Use `yarn` instead of `npm` for package management. Lock dependencies.

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
Igor Mandrigin 2018-11-28 19:02:20 +01:00
parent 91e5ac3ccd
commit 37ef82b04d
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
18 changed files with 17583 additions and 25935 deletions

View File

@ -45,7 +45,7 @@ setup: ##@prepare Install all the requirements for status-react
prepare-desktop: ##@prepare Install desktop platform dependencies and prepare workspace
scripts/prepare-for-platform.sh desktop
npm install
yarn install --frozen-lockfile
$(STATUS_GO_IOS_ARCH):
curl --fail --silent --location \
@ -78,7 +78,7 @@ $(STATUS_GO_DRO_ARCH):
prepare-ios: $(STATUS_GO_IOS_ARCH) ##@prepare Install and prepare iOS-specific dependencies
scripts/prepare-for-platform.sh ios
npm install
yarn install --frozen-lockfile
unzip -q -o "$(STATUS_GO_IOS_ARCH)" -d "$(RCTSTATUS_DIR)"
ifeq ($(OS),Darwin)
cd ios && pod install
@ -86,7 +86,7 @@ endif
prepare-android: $(STATUS_GO_DRO_ARCH) ##@prepare Install and prepare Android-specific dependencies
scripts/prepare-for-platform.sh android
npm install
yarn install --frozen-lockfile
cd android && ./gradlew react-native-android:installArchives
prepare-mobile: prepare-android prepare-ios ##@prepare Install and prepare mobile platform specific dependencies

View File

@ -17,7 +17,7 @@ pipeline {
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 25, unit: 'MINUTES')
timeout(time: 35, unit: 'MINUTES')
/* Limit builds retained */
buildDiscarder(logRotator(
numToKeepStr: '60',

View File

@ -57,7 +57,7 @@ def installJSDeps(platform) {
sh "scripts/prepare-for-platform.sh ${platform}"
while (!installed && attempt <= maxAttempts) {
println("#${attempt} attempt to install npm deps")
sh 'npm install'
sh 'yarn install --frozen-lockfile'
installed = fileExists('node_modules/web3/index.js')
attemp = attempt + 1
}

View File

@ -55,7 +55,7 @@ RUN apt-get update && apt-get -q -y --no-install-recommends install curl softwar
libx11-xcb1 libxss1 libasound2 libgl-dev libsm6 libxrandr2 python-dev \
libjasper-dev libegl1-mesa libxcomposite-dev libxcursor-dev && \
locale-gen en_US.UTF-8 && \
npm install -g npm@5.5.1 && \
npm install -g yarn@1.12.3 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man
RUN cd /tmp && wget -q https://cmake.org/files/v3.12/cmake-3.12.2-Linux-x86_64.tar.gz && \

View File

@ -25,7 +25,7 @@ RUN apt-get update && apt-get -q -y --no-install-recommends install curl softwar
libx11-xcb1 libxss1 libasound2 libgl-dev libsm6 libxrandr2 python-dev \
libjasper-dev libegl1-mesa libxcomposite-dev libxcursor-dev && \
locale-gen en_US.UTF-8 && \
npm install -g npm@5.5.1 && \
npm install -g yarn@1.12.3 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man && \
python3 -m pip install --upgrade pip && \
pip3 install conan==1.9.0

File diff suppressed because it is too large Load Diff

9893
desktop_files/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -69,6 +69,8 @@ RUN mkdir -p $LEIN_INSTALL \
# Install React-Native
RUN npm install -g react-native-cli
# Install Yarn
RUN npm install -g yarn@1.12.3
# Add files needed for installing dependencies
# Use directory /build for that purpose
@ -80,7 +82,7 @@ ADD ./project.clj ./
ADD ./package.json package-lock.json ./
RUN npm install
RUN yarn install --frozen-lockfile
ADD . ./

File diff suppressed because it is too large Load Diff

7644
mobile_files/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -155,7 +155,7 @@ function buildClojureScript() {
# Add path to javascript bundle to package.json
jsBundleLine="\"desktopJSBundlePath\": \"$WORKFOLDER/Status.jsbundle\""
jsPackagePath=$(joinExistingPath "$STATUSREACTPATH" 'desktop_files/package.json')
jsPackagePath=$(joinExistingPath "$STATUSREACTPATH" 'desktop_files/package.json.orig')
if grep -Fq "$jsBundleLine" "$jsPackagePath"; then
echo -e "${GREEN}Found line in package.json.${NC}"
else

View File

@ -210,20 +210,33 @@ function install_react_native_cli() {
fi
}
function install_yarn() {
if ! program_exists "node"; then
npm install -g yarn@1.12.3 # Install the latest yarn
else
cecho "+ yarn already installed... skipping."
fi
local yarn_version=$(yarn -v)
if [[ $yarn_version != "1.12.3" ]]; then
cecho "@b@red[[+ yarn version $yarn_version is installed. yarn version 1.12.3 is recommended.]]"
fi
}
function install_node_via_nvm() {
local nvmrc="$(repo_path)/.nvmrc"
cd "$(repo_path)"
if [ ! -e "$nvmrc" ]; then
cecho "@b@blue[[+ Installing Node 8 (Node 10 is not supported by Realm and Node 9 doesn't support npm 5.5.1)]]"
cecho "@b@blue[[+ Installing Node 9 (Node 10 is not supported by Realm)]]"
nvm install 8.9.4
nvm alias status-im 8.9.4
nvm install 9.3.0
nvm alias status-im 9.3.0
echo status-im > "$nvmrc"
nvm use status-im
npm install -g npm@5.5.1 # Explicitly downgrade to v5.5.1 of npm, since Status Desktop builds require it (npm install hangs with version higher than 5.5.1). We could maintain two versions of npm (5.5.1 for Desktop and a more recent on for mobile) but that can be confusing and lead to inconsistent environments
else
local version_alias=$(cat "$nvmrc")
nvm use $version_alias
@ -232,10 +245,6 @@ function install_node_via_nvm() {
cecho "+ Node already installed ($version_alias $version via NVM)... skipping."
fi
local npm_version=$(npm -v)
if [[ $npm_version != "5.5.1" ]]; then
cecho "@b@red[[+ npm version $npm_version is installed. npm version 5.5.1 is recommended.]]"
fi
}
function install_node_via_package_manager() {

View File

@ -29,11 +29,11 @@ fi
scripts/run-pre-build-check.sh $1
echo "Creating link: package.json -> ${PLATFORM_FOLDER}/package.json "
ln -sf ${PLATFORM_FOLDER}/package.json package.json
echo "Creating link: package.json -> ${PLATFORM_FOLDER}/package.json.orig "
ln -sf ${PLATFORM_FOLDER}/package.json.orig package.json
echo "Creating link: package-lock.json -> ${PLATFORM_FOLDER}/package-lock.json"
ln -sf ${PLATFORM_FOLDER}/package-lock.json package-lock.json
echo "Creating link: yarn.lock -> ${PLATFORM_FOLDER}/yarn.lock"
ln -sf ${PLATFORM_FOLDER}/yarn.lock yarn.lock
echo "Creating link: VERSION -> ${PLATFORM_FOLDER}/VERSION"
ln -sf ${PLATFORM_FOLDER}/VERSION VERSION

View File

@ -61,7 +61,7 @@ open -a /Applications/Genymotion.app/Contents/MacOS/player.app --args --vm-name
fi
# Install deps
npm install
yarn install --frozen-lockfile
cd android && ./gradlew react-native-android:installArchives && cd ../

View File

@ -6,6 +6,9 @@ YELLOW='\033[1;33m'
NC='\033[0m'
PLATFORM=""
EXPECTED_NODE_VERSION="v9.3.0" # note the 'v' in front, that is how node does versioning
EXPECTED_YARN_VERSION="1.12.3" # note the lack of 'v' in front. inconsistent. :(
#if no arguments passed, inform user about possible ones
if [ $# -eq 0 ]; then
@ -15,9 +18,15 @@ else
PLATFORM=$1
fi
npm_version=$(npm -v)
if [[ $npm_version != "5.5.1" ]]; then
echo -e "${YELLOW}+ npm version $npm_version is installed. npm version 5.5.1 is recommended.${NC}"
node_version=$(node -v)
if [[ $node_version != $EXPECTED_NODE_VERSION ]]; then
echo -e "${YELLOW}+ node version $node_version is installed. node version $EXPECTED_NODE_VERSION is recommended.${NC}"
fi
yarn_version=$(yarn -v)
if [[ $yarn_version != $EXPECTED_YARN_VERSION ]]; then
echo -e "${YELLOW}+ yarn version $yarn_version is installed. yarn version $EXPECTED_YARN_VERSION is recommended.${NC}"
fi
if [[ $PLATFORM == 'android' ]]; then

View File

@ -30,6 +30,7 @@ install_clojure_cli
install_leiningen
install_nsis
install_node
install_yarn
install_watchman
install_react_native_cli
install_android_sdk