JSPM

  • Created
  • Published
  • Downloads 2463
  • Score
    100M100P100Q133917F
  • License Apache 2.0

The needed infrastructure for building Headlamp plugins.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@kinvolk/headlamp-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @kinvolk/headlamp-plugin

    The needed infrastructure for building Headlamp plugins. Headlamp plugins depend on this package.

    See the Headlamp plugins documentation on the web

    This package is published to the npm package index separately from Headlamp.

    Commands

    headlamp-plugin --help
    headlamp-plugin create <name>       Create a new plugin folder with base code
    headlamp-plugin build <package>     Build the plugin, or folder of
                                        plugins. <package> defaults to
                                        current working directory.
    headlamp-plugin start               Watch for changes and build the plugin
    headlamp-plugin upgrade <package>   Upgrade the plugin to latest headlamp-plugin.
                                        Audits, formats, lints and type checks.
                                        <package> defaults to current working
                                        directory. Can also be a folder of packages.
    headlamp-plugin extract             Copies folders of packages from plug
    <pluginPackages> <outputPlugins>    inPackages/packageName/dist/main.js
                                        to outputPlugins/packageName/main.js
    headlamp-plugin storybook [package] Start storybook. <package> defaults
                                        to current working directory.

    Development notes

    Generate types

    @kinvolk/headlamp-plugin ships type declarations from the frontend module. To generate the declarations, run npm run build.

    How to test local changes to headlamp-plugin

    Developing headlamp-plugin itself? Want to test your changes?

    Integration tests

    See test-headlamp-plugin.js for some basic integration tests.

    See test-headlamp-plugin-published.js for testing published packages.

    linking to use local version of headlamp-plugin

    Use your changes inside a plugin with an npm feature called linking:

    1. Run npm link within the src/plugins/headlamp-plugins folder.
    2. Create the plugin with link: npx --yes @kinvolk/headlamp-plugin create myplugin --link
    3. Develop your plugin using your local headlamp-plugin changes.

    This internally does a npm link @kinvolk/headlamp-plugin, so the development version is linked rather than using a released version from npm.

    Why is this needed? Whilst npx uses linked packages by default, npm install requires that you first use npm link packageName. See the npm link docs for more info on npm link.

    Testing "headlamp-plugin create" changes

    For the "create" command npx and linking doesn't work. Instead, for this one command, you can call the script directly.

    cd plugins/headlamp-plugin
    node ./bin/headlamp-plugin.js create myplugin --link

    Keep the dependencies in sync with the frontend/

    Run npm run update-dependencies so the packages are kept up to date with there.

    A lot of the packages are shared between the two, but some are not. See bin/update-dependencies.js for lists of dependencies which are shared/not-shared. You may need to update these lists when adding/removing packages.