@stone-payments/emd-cli v1.3.0
Emerald CLI
Command-line tool for creating, developing, building and testing Emerald web components.
Directory structure
Emerald CLI assumes a monorepo folder structure.
packages/
├── package-one/
│ ├── public/
│ │ ├── index.js
│ │ └── index.html
│ └── src/
│ ├── packageOne.js
│ └── packageOne.spec.js
├── package-two/
│ ├── public/
│ │ ├── index.js
│ │ └── index.html
│ └── src/
│ ├── packageTwo.js
│ └── packageTwo.spec.jsBuild
Builds some or all packages for distribution. It creates a dist folder with compiled Javascript code and injected CSS.
The Javascript is compiled with the following variations:
- Native imports and ES6 code;
- Native imports and ES5 code;
- CommonJS imports and ES6 code;
- CommonJS imports and ES5 code.
Parameters
-ror--root– The folder where packages live. String. Defaults topackages. Use--no-rootto bypass;-sor--scope– The package to build (omit for all packages). String. Defaults to*. Use--no-scopeto bypass;-ior--input-dir– The folder where source files live. String. Defaults tosrc. Use--no-input-dirto bypass;-Dor--deploy– Whether or not the build is meant for deployment. Boolean. Defaults tofalse;-cor--concurrency– Number of packages processed at once. Number. Defaults toINFINITY.
Scope is a positional parameter and can be passed without flags after the command itself.
When deploy is set to true, the CSS is also be injected in source folder files.
Examples
emd buildemd build my-componentemd build --deploy --concurrency=5Create
Creates a new folder structure for an Emerald web component, either basic or business.
Parameters
-ror--root– The folder where packages live. String. Defaults topackages. Use--no-rootto bypass;-nor--name– The component name. String;-tor--type– The component type. Can be eitherbasicorbusiness. String. Defaults tobasic.
Name is a positional parameter and can be passed without flags after the command itself.
Examples
emd create "My Component"emd create "My Component" --type=businessStart
Starts the development server using files from the public folder.
Parameters
-ror--root– The folder where packages live. String. Defaults topackages. Use--no-rootto bypass;-sor--scope– The package to start. String;-Aor--allowGitIgnored– Whether or not to allow files ignored by git. Boolean. Defaults tofalse;-Hor--host– The server host. String. Defaults tolocalhost;-por--port– The server port. String. Defaults to8080;-lor--legacy– Wheter or not to use ES5 mode. Boolean. Defaults tofalse.
Scope is a positional parameter and can be passed without flags after the command itself.
Example
emd start my-componentStorybook
Starts Storybook.
Parameters
-ror--root– The folder where packages live. String. Defaults topackages. Use--no-rootto bypass;-cor--config– The folder where config.js file lives. String. Defaults to.storybook.-Hor--host– The server host. String. Defaults tolocalhost;-por--port– The server port. String.
Example
emd storybookTest
Run tests specified on *.spec.js files.
Parameters
-ror--root– The folder where packages live. String. Defaults topackages. Use--no-rootto bypass;-sor--scope– The package to test (omit for all packages). String. Defaults to*. Use--no-scopeto bypass;-ior--input-dir– The folder where source files live. String. Defaults tosrc. Use--no-input-dirto bypass.
Scope is a positional parameter and can be passed without flags after the command itself.
Examples
emd testemd test my-component