lodgify-scripts v1.0.1
Lodgify scripts
Front-end code for Lodgify Templates & Website Renderer
Getting Started
1. Install dependencies
Let's start by installing Lerna globally.
$ npm i --global lerna
// or
$ yarn global add lernaThen install all the packages of the project (this also installs subpackage's dependencies)
# Using npm client
lerna bootstrap --hoist --npm-client=npm
# Using yarn client
lerna bootstrap --hoistlerna boostrap will:
- Install all external dependencies of each package (either using
npm ioryarn installdepending on the client chosen -yarnby default inlerna.json). - Symlink together all Lerna
packagesthat are dependencies of each other. npm run prepublishin all bootstrapped packages.npm run preparein all bootstrapped packages.
If you instead want to install dependencies manually, consider not to use lock files.
# In order not to commit and merge lock files, we've added a .npmrc specifying not to use them
# set the package-lock to false in your NPM global config if you consider so
# To do it, run: npm config set package-lock false
#
# To use the flag when installing, add the following (NPM)
npm i --package-lock=false
# To use the flag when installing, add the following (yarn)
yarn install --no-lockfile2. Start
General commands which open the Interactive Command Line UI :
$ npm startWebsite Renderer commands:
$ npm start renderer
$ npm run build renderer
$ npm run lint renderer
$ npm test rendererTemplates command
$ npm start template TEMPLATE_NAME
// Example
$ npm start template livingstone
$ npm run build template TEMPLATE_NAME
$ npm run lint template TEMPLATE_NAME
$ npm test template TEMPLATE_NAMEMost important Lerna options
For all the available options, please check Lerna's repo.
Publishing new package version
lerna publishPublish packages in the current Lerna project. When run, this command does the following:
Creates a new release of the packages that have been updated. Prompts for a new version. Creates a new git commit/tag in the process of publishing to npm.
--skip-git
$ lerna publish --skip-gitWhen run with this flag, publish will publish to npm without running any of the git commands.
--skip-npm
$ lerna publish --skip-npmClean
$ lerna cleanRemove the node_modules directory from all packages.
lerna clean respects the --ignore, --scope, and --yes flags.
Run
$ lerna run <script> -- [..args] # runs npm run my-script in all packages that have it
$ lerna run test
$ lerna run build
# watch all packages and transpile on change, streaming prefixed output
$ lerna run --parallel watchRun an in each package that contains that script. A double-dash (--) is necessary to pass dashed arguments to the script execution.
lerna run respects the --concurrency, --scope, --ignore, --stream, and --parallel flags).
$ lerna run --scope my-component testexec
$ lerna exec -- <command> [..args] # runs the command in all packages
$ lerna exec -- rm -rf ./node_modules
$ lerna exec -- protractor conf.jsRun an arbitrary command in each package.
A double-dash (--) is necessary to pass dashed flags to the spawned command, but is not necessary when all the arguments are positional.
lerna exec respects the --concurrency, --scope, --ignore, and --parallel flags).
$ lerna exec --scope my-component -- ls -laTo spawn long-running processes, pass the --parallel flag:
# transpile all modules as they change in every package
$ lerna exec --parallel -- babel src -d lib -wYou may also get the name of the current package through the environment variable LERNA_PACKAGE_NAME:
$ lerna exec -- npm view \$LERNA_PACKAGE_NAMEYou may also run a script located in the root dir, in a complicated dir structure through the environment variable LERNA_ROOT_PATH:
$ lerna exec -- node \$LERNA_ROOT_PATH/scripts/some-script.js$ lerna exec --concurrency 1 -- ls -la8 years ago