npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@movable/studio-framework-package-blueprint

v2.18.1

Published

Movable CLI blueprint for creating a Studio Package

Downloads

86

Readme

Studio Package Blueprint

This MDK blueprint will create a working Studio Package.

Usage

  1. Get the MDK: yarn global add @movable/cli
  2. Create a new package: movable new my-package -b @movable/studio-framework-package-blueprint

How can I use this?

The blueprint will create a functioning package that you can learn from and modify for your own use-case. It contains:

  • 2 cold state examples (multiple-canvases has 2 canvases & default has 1 canvas)
  • Properties examples
  • A Tool example
  • A utils folder
  • Starter tests
  • A package manifest
  • A package.json
  • A rollup build file

Coldstates

  • This JSON object contains the tag structure a user will see when they load an App that contains your package, provided that you've specified that the App should use your package coldstate. This is defined in the App's manifest.yml file and will look something like:

    cold_state:
      packageName: '@movable-internal/my-amazing-package'
      name: 'default'

    or:

    cold_state:
      packageName: '@movable-internal/my-amazing-package'
      name: 'multiple-canvases'

In general, the default coldstate should be the coldstate most commonly used. There is no limit to the amount of coldstates your package can have.

Properties

  • Properties represent data.
  • In other words, you will write code, that takes inputs that results in a value once your App is rendered.
  • The inputs that you'll use can come from an API, a user in Studio, a CSV etc.
  • The resulting value could be a string, a URL for an image etc...
  • The resulting value will be accessed by the property path that you define. For example: fakeData.formattedCaption.
  • The inputs required by users in Studio will have to be defined in package-manifest.yml.

Tools

  • Tools represent a UI element. Just like properties, tools will probably need to access data from the User in Studio. Tools will have to be defined in package-manfest.yml in order to be visible in Studio. The return value of a tool is written with JSX.

Utils

  • Depending on the logic of your package, you may find it useful to extract helper files into their own folder. This is just a suggestion, not a requirment.

Package Manifest

  • The package-manifest.yml is one of the most important files in your package and probably the one that is the easiest to break, get wrong, update with typos etc... You will probably have to try, try again, again, then again.
  • This file is written in YML. YML is notoriously picky. If your indentation is wrong, your YML is wrong. It's wise to find a YML validation tool online to pre-validate your YML.
  • This is the file where you specify what data your package needs from a user. In other words, this YML will communicate to Studio the fields that should be displayed to the user and and how the user's selections get used.
  • For example, the Diamond tool in this package needs a color for its border, and a name for its greeting. Look at the package-manifest.yml to see how that's done.
  • In general, the package-manifest.yml defines the following:
    • What fields can the user specify?
    • What are the fields called?
    • What are the field types? (select, color etc...)
    • What are the field descriptions? ("Image from fakeData based on index number 1 - 3.")
    • Where does field data come from? Is it a field like a color picket? Is it a dynamic property that could consist of static values? query params?
    • What is a fields name. ie. HOW DOES YOUR CODE ACCESS THE FIELDS VALUES?
      - name: fakeData.image
            label: Fake Data Image
            type: image
            options_description: Image from fakeData based on index number 1 - 3.
            context_options:
              - name: postNumber
                type: select
                description: Index of your image
                options:
                  - value: 0
                    label: Image 1
                  - value: 1
                    label: Image 2
                  - value: 2
                    label: Image 3
    • Based on the example above, your code can access the fakeData.image like:
      getProperty('fakeData.image');

Package JSON

  • The package.json file created by this blueprint will contain values that you need to change.

    1. What is the name of your package? (name attribute)
    2. What libraries will your package use? (peerDependencies, dependencies and devDependencies attributes)
    3. What does your package do? (description attribute)

Rollup

  • The rollup.config.js simply imports the rollup configuration that's been set up to work for all packages. It's possible (but not likely) that you would deviate from that standard setup.

Tests

  • You will be tempted to skip tests and go directly to User Acceptance Testing... thinking that this will save you precious time. Debugging by UAT will an incredibly tedious and painful process. Debugging via tests is significantly easier.

User Acceptance Testing

My code is tested (and amazing) - how to I use it?

  • All packages get built into an App. That build process is fascilitated 2 ways:

    1. Publish a canary version of your package. **
    2. If you want to test your coldstate, create an App that uses your package and deploy it to staging.
    3. If you simply want to test your logic in an existing App, install your package in Studio.

    **Don't publish a package until you have the tests to prove that it works.

License

Copyright 2018 Movable, Inc. All rights reserved.