pack

Packs plugins to prepare for deployment.

Copy
devkit-scripts pack

Similar to npm pack but without compressing the output into a tarball, instead it creates the folder structure with the files that will be published from the plugins.

As npm does, it also relies on some configuration to determine which files will be included or not. It works exactly the same as npm.

Example of a plugin's package.json
Copy
{
  "name": "plugin-a",
  "version": "1.0.0",
  "browser": "./index.js",
  "files": ["dist", "translations"]
}

In this example, only dist and translations folders/files will be included besides the default files that are always included (e.g., package.json, CHANGELOG).

Options

Copy
--plugins <plugins>  list of the plugins to be packed, comma separated

--from <from>          relative path where the plugins to be packed are located
                       (default: "/Volumes/Projects/pos-web-devkit/plugins")

--to <to>              relative path where the output will be generated (default:
                       "/Volumes/Projects/pos-web-devkit/.packed")

--no-clean             avoids cleaning the output directory before packing

--skip-clean-metadata  avoids cleaning the plugin's metadata

-h, --help             display help for command

API usage

The script can be used programmatically too using similar options as the CLI.

Copy
const { pack } = require('@pos-web/devkit-scripts');

pack({
  from: String?,
  to: String?,
  clean: Boolean?,
  plugins: [String]?,
  skipCleanMetadata: Boolean?,
});