replaced npm install => npm ci (#9717)

* replaced npm install => npm ci

* Made global npm modules be executed as local npm modules (#9740)

* Made global npm modules be executed as local npm modules

* Fixed a typo and added empty index.js for lgtm analysis

* Tried to fix pre-commit CI error

* Fixed a windows build file issue

* Fixed a rpm build script issue

* Removed unnecessary index.js which were introduced just to pass LGTM analysis

* Set nodejs version to 16 for arm64 build

* Removed unnecessary nodejs install action

Co-authored-by: ChiaMineJP <admin@chiamine.jp>
This commit is contained in:
Zlatko Fedor 2022-01-20 01:52:20 +01:00 committed by GitHub
parent c780f0978c
commit c6b5feaf3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 75201 additions and 37 deletions

View File

@ -22,7 +22,7 @@ try {
Set-Location chia-blockchain-gui
$ErrorActionPreference = "SilentlyContinue"
npm install --loglevel=error
npm ci --loglevel=error
npm audit fix
npm run build
py ..\installhelper.py

View File

@ -24,9 +24,10 @@ fi
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-packager -g
npm install electron-installer-debian -g
npm install lerna -g
cd npm_linux_deb || exit
npm ci
PATH=$(npm bin):$PATH
cd .. || exit
echo "Create dist/"
rm -rf dist
@ -48,7 +49,7 @@ cd chia-blockchain-gui || exit
echo "npm build"
lerna clean -y
npm install
npm ci
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build

View File

@ -25,9 +25,11 @@ fi
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-packager -g
npm install electron-installer-redhat -g
npm install lerna -g
cd npm_linux_rpm || exit
npm ci
GLOBAL_NPM_ROOT=$(pwd)/node_modules
PATH=$(npm bin):$PATH
cd .. || exit
echo "Create dist/"
rm -rf dist
@ -49,7 +51,7 @@ cd chia-blockchain-gui || exit
echo "npm build"
lerna clean -y
npm install
npm ci
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build
@ -85,22 +87,19 @@ cd ../../../build_scripts || exit
if [ "$REDHAT_PLATFORM" = "x86_64" ]; then
echo "Create chia-blockchain-$CHIA_INSTALLER_VERSION.rpm"
# shellcheck disable=SC2046
NODE_ROOT="$(dirname $(dirname $(which node)))"
# Disables build links from the generated rpm so that we dont conflict with other packages. See https://github.com/Chia-Network/chia-blockchain/issues/3846
# shellcheck disable=SC2086
sed -i '1s/^/%define _build_id_links none\n%global _enable_debug_package 0\n%global debug_package %{nil}\n%global __os_install_post \/usr\/lib\/rpm\/brp-compress %{nil}\n/' "$NODE_ROOT/lib/node_modules/electron-installer-redhat/resources/spec.ejs"
sed -i '1s/^/%define _build_id_links none\n%global _enable_debug_package 0\n%global debug_package %{nil}\n%global __os_install_post \/usr\/lib\/rpm\/brp-compress %{nil}\n/' "$GLOBAL_NPM_ROOT/electron-installer-redhat/resources/spec.ejs"
# Use attr feature of RPM to set the chrome-sandbox permissions
# adds a %attr line after the %files line
# The location is based on the existing location inside spec.ej
sed -i '/^%files/a %attr(4755, root, root) /usr/lib/<%= name %>/chrome-sandbox' "$NODE_ROOT/lib/node_modules/electron-installer-redhat/resources/spec.ejs"
sed -i '/^%files/a %attr(4755, root, root) /usr/lib/<%= name %>/chrome-sandbox' "$GLOBAL_NPM_ROOT/electron-installer-redhat/resources/spec.ejs"
# Updates the requirements for building an RPM on Centos 7 to allow older version of rpm-build and not use the boolean dependencies
# See https://github.com/electron-userland/electron-installer-redhat/issues/157
# shellcheck disable=SC2086
sed -i "s#throw new Error('Please upgrade to RPM 4.13.*#console.warn('You are using RPM < 4.13')\n return { requires: [ 'gtk3', 'libnotify', 'nss', 'libXScrnSaver', 'libXtst', 'xdg-utils', 'at-spi2-core', 'libdrm', 'mesa-libgbm', 'libxcb' ] }#g" $NODE_ROOT/lib/node_modules/electron-installer-redhat/src/dependencies.js
sed -i "s#throw new Error('Please upgrade to RPM 4.13.*#console.warn('You are using RPM < 4.13')\n return { requires: [ 'gtk3', 'libnotify', 'nss', 'libXScrnSaver', 'libXtst', 'xdg-utils', 'at-spi2-core', 'libdrm', 'mesa-libgbm', 'libxcb' ] }#g" $GLOBAL_NPM_ROOT/electron-installer-redhat/src/dependencies.js
electron-installer-redhat --src dist/$DIR_NAME/ --dest final_installer/ \
--arch "$REDHAT_PLATFORM" --options.version $CHIA_INSTALLER_VERSION \

View File

@ -15,14 +15,10 @@ fi
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-installer-dmg -g
# Pinning electron-packager and electron-osx-sign to known working versions
# Current packager uses an old version of osx-sign, so if we install the newer sign package
# things break
npm install electron-packager@15.4.0 -g
npm install electron-osx-sign@v0.5.0 -g
npm install notarize-cli -g
npm install lerna -g
cd npm_macos || exit
npm ci
PATH=$(npm bin):$PATH
cd .. || exit
echo "Create dist/"
sudo rm -rf dist
@ -43,7 +39,7 @@ cd chia-blockchain-gui || exit
echo "npm build"
lerna clean -y
npm install
npm ci
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build

View File

@ -15,14 +15,10 @@ fi
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-installer-dmg -g
# Pinning electron-packager and electron-osx-sign to known working versions
# Current packager uses an old version of osx-sign, so if we install the newer sign package
# things break
npm install electron-packager@15.4.0 -g
npm install electron-osx-sign@v0.5.0 -g
npm install notarize-cli -g
npm install lerna -g
cd npm_macos_m1 || exit
npm ci
PATH=$(npm bin):$PATH
cd .. || exit
echo "Create dist/"
sudo rm -rf dist
@ -45,7 +41,7 @@ cd chia-blockchain-gui || exit
echo "npm build"
lerna clean -y
npm install
npm ci
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix
npm run build

View File

@ -87,6 +87,15 @@ Write-Output " ---"
Write-Output "Copy chia executables to chia-blockchain-gui\"
Write-Output " ---"
Copy-Item "dist\daemon" -Destination "..\chia-blockchain-gui\packages\gui\" -Recurse
Write-Output " ---"
Write-Output "Setup npm packager"
Write-Output " ---"
Set-Location -Path ".\npm_windows" -PassThru
npm ci
$Env:Path = $(npm bin) + ";" + $Env:Path
Set-Location -Path "..\" -PassThru
Set-Location -Path "..\chia-blockchain-gui" -PassThru
# We need the code sign cert in the gui subdirectory so we can actually sign the UI package
If ($env:HAS_SECRET) {
@ -99,11 +108,9 @@ Write-Output " ---"
Write-Output "Prepare Electron packager"
Write-Output " ---"
$Env:NODE_OPTIONS = "--max-old-space-size=3000"
npm install -g electron-packager
npm install -g lerna
lerna clean -y
npm install
npm ci
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
# npm audit fix

14371
build_scripts/npm_linux_deb/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
{
"name": "npm_linux_deb",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron-installer-debian": "^3.1.0",
"electron-packager": "^15.4.0",
"lerna": "^4.0.0"
}
}

14037
build_scripts/npm_linux_rpm/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
{
"name": "npm_linux_rpm",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron-installer-redhat": "^3.3.0",
"electron-packager": "^15.4.0",
"lerna": "^4.0.0"
}
}

16392
build_scripts/npm_macos/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
{
"name": "npm_macos",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron-installer-dmg": "^3.0.0",
"electron-osx-sign": "^0.5.0",
"electron-packager": "^15.4.0",
"lerna": "^4.0.0",
"notarize-cli": "^0.2.0"
}
}

16392
build_scripts/npm_macos_m1/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
{
"name": "npm_macos",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron-installer-dmg": "^3.0.0",
"electron-osx-sign": "^0.5.0",
"electron-packager": "^15.4.0",
"lerna": "^4.0.0",
"notarize-cli": "^0.2.0"
}
}

13885
build_scripts/npm_windows/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
{
"name": "npm_windows",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron-packager": "^15.4.0",
"lerna": "^4.0.0"
}
}

View File

@ -102,7 +102,7 @@ if [ ! "$CI" ]; then
echo ""
fi
npm install
npm ci
npm audit fix || true
npm run build
python ../installhelper.py