1.0.1 • Published 7 years ago

lodgify-scripts v1.0.1

Weekly downloads
6
License
© 2012 - 2017 lod...
Repository
github
Last release
7 years ago

lerna

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 lerna

Then 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 --hoist

lerna boostrap will:

  1. Install all external dependencies of each package (either using npm i or yarn install depending on the client chosen - yarn by default in lerna.json).
  2. Symlink together all Lerna packages that are dependencies of each other.
  3. npm run prepublish in all bootstrapped packages.
  4. npm run prepare in 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-lockfile

2. Start

General commands which open the Interactive Command Line UI :

$ npm start

Website Renderer commands:

$ npm start renderer
$ npm run build renderer
$ npm run lint renderer
$ npm test renderer

Templates 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_NAME

Most important Lerna options

For all the available options, please check Lerna's repo.

Publishing new package version

lerna publish

Publish 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-git

When run with this flag, publish will publish to npm without running any of the git commands.

--skip-npm

$ lerna publish --skip-npm

Clean

$ lerna clean

Remove 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 watch

Run 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 test

exec

$ lerna exec -- <command> [..args] # runs the command in all packages
$ lerna exec -- rm -rf ./node_modules
$ lerna exec -- protractor conf.js

Run 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 -la

To spawn long-running processes, pass the --parallel flag:

# transpile all modules as they change in every package
$ lerna exec --parallel -- babel src -d lib -w

You may also get the name of the current package through the environment variable LERNA_PACKAGE_NAME:

$ lerna exec -- npm view \$LERNA_PACKAGE_NAME

You 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 -la