ScandiPWA CLI
A utility for accelerating development with Scandi
Example – with one command, create a component template in src/component/HugeTitle:
scandipwa create component HugeTitleA VSC plugin for Scandi CLI is also available!
Installation
Install the npm package globally:
npm i -g scandipwa-cliUsage
The CLI must be run from the the Scandi theme directory or a subdirectory.
Global options:
--helpto get usage help--versionto print version number and exit
create component
create componentCreates a new Scandi component
Syntax:
create component [--container] [--redux] <name>Options:
--container/-ccreates a container file for the component--redux/-rconnects the component to the Redux store with theconnectHOCnameis the name of the component to be created
Examples:
scandipwa create component HugeTitle
# Output:
NOTE!
The following files have been created:
src/component/HugeTitle/HugeTitle.component.js
src/component/HugeTitle/HugeTitle.style.scss
src/component/HugeTitle/index.jsscandipwa create component --container SpecialHeader
# Output:
NOTE!
The following files have been created:
src/component/SpecialHeader/SpecialHeader.component.js
src/component/SpecialHeader/SpecialHeader.style.scss
src/component/SpecialHeader/index.js
src/component/SpecialHeader/SpecialHeader.container.jscreate route
create routeCreates a new Scandi route
Syntax:
create route [--container] [--redux] <name>Options:
--container/-ccreates a container file for the route--redux/-rconnects the route to the Redux store with theconnectHOCnameis the name of the route to be created
Example:
scandipwa create route MyLandingPage
# Output:
NOTE!
The following files have been created:
src/route/MyLandingPage/MyLandingPage.component.js
src/route/MyLandingPage/MyLandingPage.style.scss
src/route/MyLandingPage/index.jscreate store
create storeCreates a new Scandi Redux store
Syntax:
create store [--dispatcher-type=<"no"|"regular"|"query">] <name>Options:
--dispatcher-type/-ddetermines what type of dispatcher file will be created.no(default) - does not create a dispatcherregular- creates a simple helper class for dispatching actionsquery- creates a dispatcher thatextends QueryDispatcher
nameis the name of the store to be created
Example:
scandipwa create store --d=query UserPreferences
# Output:
NOTE!
The following files have been created:
src/store/UserPreferences/UserPreferences.action.js
src/store/UserPreferences/UserPreferences.dispatcher.js
src/store/UserPreferences/UserPreferences.reducer.jscreate query
create queryCreates a new Scandi query helper for querying with GraphQL
Syntax:
create query <name>name is the name of the query to be created
Example:
scandipwa create query Weather
# Output:
NOTE!
The following files have been created:
src/query/Weather.query.jsdeploy
deployDeploys your app to the cloud
Syntax:
deployExample
scandipwa deploy
yarn run v1.22.5
$ scandipwa-scripts build
Creating an optimized production build...
Build completed in 186.317s
Compiled successfully.
[...]
Done in 189.38s.
Build files compressed successfully.
Code upload result: OK. Code: 200
Build archive successfully removed.
Congrats, your code will be deployed in a few minutes! You can access it here: https://master.d16zgbgmy9fzgx.amplifyapp.com/extension install
extension installInstalls a Scandi extension
Syntax:
extension install [--no-enable] [--local] [--use=<path>] [--version=<required-version>] [--save-dev] <name>Options:
--no-enablewill install the extension without enabling it--local/-l: use a local module frompackages/<name>--use/-u: use a local module from the specified<path>--version/-vspecifies the extension version to usesave-dev/-D: install the package as a devDependencynameis the name of the extension to install
extension create
extension createCreates a new scandi extension
Syntax:
extension create [--no-enable] <name>Options:
--no-enablewill create and install the extension without enabling itnamespecifies the name of the new extension
override component
override componentOverrides a Scandi component. Will interactively ask for which parts to override.
Syntax:
override component [--styles=<"extend"|"override"|"keep">] [--source-module=<module>] [--target-module=<module>] <name>Options:
--styles/-S:Not specified (default): will prompt interactively
keep: don't override stylesextend: adjust existing stylesoverride: completely replace existing styles
--source-module/-s: Path to the module to override the component from--target-module/-t: Path to the module to generate the component innameis the name of the component to be overridden
Example:
scandipwa override component Header
? Choose things to extend in Header.component.js Header
? What would you like to do with styles? Extend
? Choose things to extend in Header.config.js
? Choose things to extend in Header.container.js
NOTE!
The following files have been created:
src/component/Header/Header.override.style.scss
src/component/Header/Header.component.jsoverride route
override routeOverrides a Scandi route
Syntax:
override route [--styles=<"extend"|"override"|"keep">] [--source-module=<module>] [--target-module=<module>] <name>Options:
--styles/-S:Not specified (default): will prompt interactively
keep: don't override stylesextend: adjust existing stylesoverride: completely replace existing styles
--source-module/-s: Path to the module to override the route from--target-module/-t: Path to the module to generate the route innameis the name of the route to be overridden
override store
override storeOverrides a Scandi Redux store
Syntax:
override store [--source-module=<module>] [--target-module=<module>] <name>Options:
--source-module/-s: Path to the module to override the store from--target-module/-t: Path to the module to generate the store innameis the name of the store to be overridden
override query
override queryOverrides a Scandi query helper
Syntax:
override query [--source-module=<module>] [--target-module=<module>] <name>Options:
--source-module/-s: Path to the module to override the query from--target-module/-t: Path to the module to generate the query innameis the name of the query to be overridden
Last updated
Was this helpful?