Merge pull request #3012 from keymanapp/feat/common/init-lerna-local

feat(common): lerna now npm-installed locally
This commit is contained in:
Joshua Horton 2020-04-23 08:18:17 +07:00 • committed by GitHub
commit 7a4504b2e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 19823 additions and 10 deletions

2
.gitignore vendored
View file

@ -258,3 +258,5 @@ resources/environment.sh
# Copy of the master VERSION.md used for Linux packaging
/common/core/desktop/VERSION.md
**/node_modules/**

View file

@ -9,7 +9,7 @@ semi-formal specification on how the Worker and the main thread communicate.
System dependencies
-------------------
You will need Bash, Node.js >= 10.0, and a globally-installed `lerna` Node package (`npm install -g lerna`).
You will need Bash and Node.js >= 10.0.
Build
-----

File diff suppressed because it is too large Load diff

View file

@ -36,6 +36,7 @@
"karma-mocha-reporter": "^2.2.5",
"karma-safari-launcher": "^1.0.0",
"karma-teamcity-reporter": "^1.1.0",
"lerna": "^3.20.2",
"mocha": "^5.2.0",
"mocha-teamcity-reporter": "^2.5.1",
"sinon": "^7.1.1",

6573
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -3,5 +3,8 @@
"private": true,
"devDependencies": {
"lerna": "^3.20.2"
},
"scripts": {
"bootstrap": "lerna bootstrap"
}
}

View file

@ -258,6 +258,22 @@ set_npm_version () {
npm --no-git-tag-version --allow-same-version version "$version" || fail "Could not set package version to $version."
}
init_lerna() {
WORKING_DIRECTORY=`pwd`
if [ "${KEYMAN_ROOT}" = "" ]; then
fail "KEYMAN_ROOT not defined; cannot bootstrap repo's dependencies"
fi
# At its base, lerna does use an npm-friendly package.json. Installing that allows the base lerna install to work.
cd "$KEYMAN_ROOT"
npm install --no-optional
# Now that it exists, we can run the following command locally. (Otherwise, npx will temporarily download everything again, each time!)
npx lerna bootstrap
cd "$WORKING_DIRECTORY"
}
# Accepts an optional parameter.
# #1 - when set to 'false', only ensures that `npm` and `node` are accessible; does not install dependencies.
verify_npm_setup () {
@ -272,11 +288,13 @@ verify_npm_setup () {
fail "Build environment setup error detected! Please ensure Node.js is installed!"
if [ $fetch_deps = true ]; then
type lerna >/dev/null ||\
fail "Build environment setup error detected! Please run \`npm install -g lerna\` to install lerna"
# Is lerna locally installed? If not, initialize it at the repo's base locally.
npm list lerna >/dev/null || init_lerna
# Use lerna to ensure repo-internal dependencies are all properly linked while also installing external dependencies
lerna bootstrap -- --no-optional
# Use lerna to ensure repo-internal dependencies are all properly linked
# while also installing external dependencies. Also propagates lerna into
# each project that can use it (once added as a dev-dependency there)
npx lerna bootstrap -- --no-optional
if [ $? -ne 0 ]; then
fail "Build environment setup error detected! Please ensure Node.js is installed!"

View file

@ -16,9 +16,6 @@ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs
```
* A globally-installed `lerna` package (`npm install -g lerna`)
* Builds will call `lerna bootstrap` to setup and manage all needed `npm link`s for within-repo dependencies.
**********************************************************************
The following folders contain the distribution for KeymanWeb:

View file

@ -28,7 +28,7 @@ fail() {
}
# Ensure the dependencies are downloaded. --no-optional should help block fsevents warnings.
verify_npm_install
verify_npm_setup
# Definition of global compile constants
COMPILED_FILE="bulk_render.js"

6542
web/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@
"karma-mocha-reporter": "^2.2.5",
"karma-safari-launcher": "^1.0.0",
"karma-teamcity-reporter": "^1.1.0",
"lerna": "^3.20.2",
"mocha": "^5.2.0",
"modernizr": "^3.7.1",
"typescript": "^3.7.2"