newspack-scripts 4.3.7 → 4.3.8-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.circleci/config.yml
CHANGED
|
@@ -2,9 +2,26 @@ version: 2
|
|
|
2
2
|
jobs:
|
|
3
3
|
build:
|
|
4
4
|
docker:
|
|
5
|
-
- image:
|
|
5
|
+
- image: "circleci/node:latest"
|
|
6
6
|
steps:
|
|
7
7
|
- checkout
|
|
8
|
+
- run:
|
|
9
|
+
name: Install nvm and use the node version defined in .nvmrc
|
|
10
|
+
command: |
|
|
11
|
+
# https://support.circleci.com/hc/en-us/articles/360051656632-Swap-node-version-on-CircleCI-convenience-image
|
|
12
|
+
set +e
|
|
13
|
+
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
|
|
14
|
+
export NVM_DIR="$HOME/.nvm"
|
|
15
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
16
|
+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
|
17
|
+
nvm install
|
|
18
|
+
nvm use
|
|
19
|
+
# https://stackoverflow.com/a/61823737/3772847
|
|
20
|
+
NODE_DIR=$(dirname $(which node))
|
|
21
|
+
echo "export PATH=$NODE_DIR:\$PATH" >> $BASH_ENV
|
|
22
|
+
- run:
|
|
23
|
+
name: Check node version (should match the version set in project's .nvmrc file)
|
|
24
|
+
command: node --version
|
|
8
25
|
- run:
|
|
9
26
|
name: install
|
|
10
27
|
command: npm install
|
package/package.json
CHANGED
package/scripts/build.js
CHANGED
|
@@ -4,29 +4,6 @@ const spawn = require("cross-spawn");
|
|
|
4
4
|
const modules = require("./utils/modules");
|
|
5
5
|
const utils = require("./utils/index.js");
|
|
6
6
|
|
|
7
|
-
if (process.env.CI) {
|
|
8
|
-
// HACK: For some reason, `@automattic/calypso-build` is erroring with a cryptic
|
|
9
|
-
// `HookWebpackError: error:0308010C:digital envelope routines::unsupported` error.
|
|
10
|
-
// Reinstalling the package in the newspack-scripts directory fixes the issue. No idea how.
|
|
11
|
-
// Downside is longer build times, but maybe this will be fixed in the future.
|
|
12
|
-
utils.log("Reinstalling @automattic/calypso-build…");
|
|
13
|
-
const calypsoReinstallResult = spawn.sync(
|
|
14
|
-
"cd node_modules/newspack-scripts && npm i @automattic/calypso-build --legacy-peer-deps",
|
|
15
|
-
[],
|
|
16
|
-
{
|
|
17
|
-
shell: true,
|
|
18
|
-
cwd: modules.rootDirectory,
|
|
19
|
-
stdio: "inherit",
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
if (calypsoReinstallResult.status === 0) {
|
|
23
|
-
utils.log("Calypso reinstall successful.");
|
|
24
|
-
} else {
|
|
25
|
-
utils.log("Calypso reinstall failed:");
|
|
26
|
-
console.log(calypsoReinstallResult);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
7
|
utils.log("Starting to build…");
|
|
31
8
|
|
|
32
9
|
const buildResult = spawn.sync(process.execPath, [modules.calypsoBuild], {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
description: >
|
|
2
|
+
Set node version to the one defined in the .nvmrc file.
|
|
3
|
+
steps:
|
|
4
|
+
- run:
|
|
5
|
+
name: Install nvm and use the node version defined in .nvmrc
|
|
6
|
+
command: |
|
|
7
|
+
# https://support.circleci.com/hc/en-us/articles/360051656632-Swap-node-version-on-CircleCI-convenience-image
|
|
8
|
+
set +e
|
|
9
|
+
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
|
|
10
|
+
export NVM_DIR="$HOME/.nvm"
|
|
11
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
12
|
+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
|
13
|
+
nvm install
|
|
14
|
+
nvm use
|
|
15
|
+
# https://stackoverflow.com/a/61823737/3772847
|
|
16
|
+
NODE_DIR=$(dirname $(which node))
|
|
17
|
+
echo "export PATH=$NODE_DIR:\$PATH" >> $BASH_ENV
|
|
18
|
+
- run:
|
|
19
|
+
name: Check node version (should match the version set in project's .nvmrc file)
|
|
20
|
+
command: node --version
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
description:
|
|
2
|
-
This is a sample executor using Docker and Node.
|
|
1
|
+
description: PHP executor
|
|
3
2
|
docker:
|
|
4
3
|
- image: "cimg/php:<<parameters.tag>>"
|
|
5
4
|
parameters:
|
|
6
5
|
tag:
|
|
7
|
-
default: 8.0-
|
|
8
|
-
description:
|
|
9
|
-
Pick a specific circleci/php image variant:
|
|
10
|
-
https://hub.docker.com/r/cimg/php/tags
|
|
6
|
+
default: 8.0-node
|
|
7
|
+
description: PHP image version
|
|
11
8
|
type: string
|
package/src/jobs/build.yml
CHANGED
|
@@ -5,15 +5,21 @@ executor: default
|
|
|
5
5
|
|
|
6
6
|
steps:
|
|
7
7
|
- checkout_with_workspace
|
|
8
|
+
- set_node_version
|
|
8
9
|
- restore_cache:
|
|
9
|
-
key: v1-npm-{{ checksum "package.json" }}-{{checksum "package-lock.json" }}
|
|
10
|
+
key: v1-npm-{{ checksum "package.json" }}-{{checksum "package-lock.json" }}-{{ checksum ".nvmrc" }}
|
|
10
11
|
# https://medium.com/@mdsky1986/caching-node-dependencies-when-using-npm-ci-89fe3f46404a
|
|
11
12
|
- run:
|
|
12
13
|
name: Install node dependencies
|
|
13
14
|
# --legacy-peer-deps flag should be removed once https://github.com/Automattic/newspack-plugin/issues/1218 is resolved
|
|
14
|
-
command:
|
|
15
|
+
command: |
|
|
16
|
+
if test -d "node_modules"; then
|
|
17
|
+
echo "package.json and package-lock.json unchanged. Using cache."
|
|
18
|
+
else
|
|
19
|
+
npm ci --legacy-peer-deps --loglevel warn --yes
|
|
20
|
+
fi
|
|
15
21
|
- save_cache:
|
|
16
|
-
key: v1-npm-{{ checksum "package.json" }}-{{checksum "package-lock.json" }}
|
|
22
|
+
key: v1-npm-{{ checksum "package.json" }}-{{checksum "package-lock.json" }}-{{ checksum ".nvmrc" }}
|
|
17
23
|
paths:
|
|
18
24
|
- node_modules
|
|
19
25
|
- persist_to_workspace:
|