fix(testing): add a guard to not accidently publish to the registry (#2978)
This commit is contained in:
parent
0a70e46b6b
commit
c00f996bea
@ -4,7 +4,7 @@ import { getDirectories } from '../utils';
|
|||||||
|
|
||||||
const asyncExec = promisify(exec);
|
const asyncExec = promisify(exec);
|
||||||
|
|
||||||
process.env.PUBLISHED_VERSION = `9999.0.0`;
|
process.env.PUBLISHED_VERSION = `9999.0.1`;
|
||||||
|
|
||||||
async function spawnLocalRegistry() {
|
async function spawnLocalRegistry() {
|
||||||
const localRegistryProcess = spawn('npx', [
|
const localRegistryProcess = spawn('npx', [
|
||||||
@ -40,6 +40,13 @@ async function updateVersion(packagePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function publishPackage(packagePath) {
|
async function publishPackage(packagePath) {
|
||||||
|
if (process.env.npm_config_registry.indexOf('http://localhost') === -1) {
|
||||||
|
throw Error(`
|
||||||
|
------------------
|
||||||
|
💣 ERROR 💣 => $NPM_REGISTRY does not look like a local registry'
|
||||||
|
------------------
|
||||||
|
`);
|
||||||
|
}
|
||||||
await asyncExec(`npm publish`, {
|
await asyncExec(`npm publish`, {
|
||||||
cwd: packagePath,
|
cwd: packagePath,
|
||||||
env: process.env,
|
env: process.env,
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
./scripts/link.sh 9999.0.0
|
./scripts/link.sh 9999.0.1
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
mkdir -p tmp/angular
|
mkdir -p tmp/angular
|
||||||
mkdir -p tmp/nx
|
mkdir -p tmp/nx
|
||||||
|
|
||||||
PUBLISHED_VERSION=9999.0.0 NPM_CONFIG_REGISTRY=http://localhost:4872/ jest --maxWorkers=1 -c "./build/e2e/jest-config.js" ./build/e2e/commands/create-playground.test.js
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest --maxWorkers=1 -c "./build/e2e/jest-config.js" ./build/e2e/commands/create-playground.test.js
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
./scripts/link.sh 9999.0.0
|
./scripts/link.sh 9999.0.1
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
mkdir -p tmp/angular
|
mkdir -p tmp/angular
|
||||||
mkdir -p tmp/nx
|
mkdir -p tmp/nx
|
||||||
|
|
||||||
export SELECTED_CLI=$1
|
export SELECTED_CLI=$1
|
||||||
PUBLISHED_VERSION=9999.0.0 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(angular|cli|workspace|workspace-aux-commands|cypress).test.js"
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(angular|cli|workspace|workspace-aux-commands|cypress).test.js"
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
./scripts/link.sh 9999.0.0
|
./scripts/link.sh 9999.0.1
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
mkdir -p tmp/angular
|
mkdir -p tmp/angular
|
||||||
mkdir -p tmp/nx
|
mkdir -p tmp/nx
|
||||||
|
|
||||||
export SELECTED_CLI=$1
|
export SELECTED_CLI=$1
|
||||||
PUBLISHED_VERSION=9999.0.0 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(jest|karma|next|nx-plugin|downgrade-module).test.js"
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(jest|karma|next|nx-plugin|downgrade-module).test.js"
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
./scripts/link.sh 9999.0.0
|
./scripts/link.sh 9999.0.1
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
mkdir -p tmp/angular
|
mkdir -p tmp/angular
|
||||||
mkdir -p tmp/nx
|
mkdir -p tmp/nx
|
||||||
|
|
||||||
export SELECTED_CLI=$1
|
export SELECTED_CLI=$1
|
||||||
PUBLISHED_VERSION=9999.0.0 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(storybook|upgrade-module|web|angular-package|react-package|ngrx).test.js"
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(storybook|upgrade-module|web|angular-package|react-package|ngrx).test.js"
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
./scripts/link.sh 9999.0.0
|
./scripts/link.sh 9999.0.1
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
mkdir -p tmp/angular
|
mkdir -p tmp/angular
|
||||||
mkdir -p tmp/nx
|
mkdir -p tmp/nx
|
||||||
|
|
||||||
export SELECTED_CLI=$1
|
export SELECTED_CLI=$1
|
||||||
PUBLISHED_VERSION=9999.0.0 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(ng-add|node|react).test.js"
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 "./build/e2e/(ng-add|node|react).test.js"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
./scripts/link.sh 9999.0.0
|
./scripts/link.sh 9999.0.1
|
||||||
|
|
||||||
rm -rf tmp/nx/proj/node_modules/@nrwl
|
rm -rf tmp/nx/proj/node_modules/@nrwl
|
||||||
rm -rf tmp/angular/proj/node_modules/@nrwl
|
rm -rf tmp/angular/proj/node_modules/@nrwl
|
||||||
@ -8,9 +8,9 @@ cp -r node_modules/@nrwl tmp/nx/proj/node_modules/@nrwl
|
|||||||
cp -r node_modules/@nrwl tmp/angular/proj/node_modules/@nrwl
|
cp -r node_modules/@nrwl tmp/angular/proj/node_modules/@nrwl
|
||||||
|
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
PUBLISHED_VERSION=9999.0.0 NPM_CONFIG_REGISTRY=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 ./build/e2e/$1.test.js
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 ./build/e2e/$1.test.js
|
||||||
else
|
else
|
||||||
PUBLISHED_VERSION=9999.0.0 NPM_CONFIG_REGISTRY=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 ./build/e2e
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 ./build/e2e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
./scripts/link.sh 9999.0.0
|
./scripts/link.sh 9999.0.1
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
mkdir -p tmp/angular
|
mkdir -p tmp/angular
|
||||||
@ -10,10 +10,10 @@ if [ -n "$1" ]; then
|
|||||||
COMMAND_FILE="./build/e2e/commands/$1.test.js"
|
COMMAND_FILE="./build/e2e/commands/$1.test.js"
|
||||||
|
|
||||||
if [ -f "$TEST_FILE" ]; then
|
if [ -f "$TEST_FILE" ]; then
|
||||||
PUBLISHED_VERSION=9999.0.0 NPM_CONFIG_REGISTRY=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 $TEST_FILE
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 $TEST_FILE
|
||||||
else
|
else
|
||||||
PUBLISHED_VERSION=9999.0.0 NPM_CONFIG_REGISTRY=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 $COMMAND_FILE
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 $COMMAND_FILE
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PUBLISHED_VERSION=9999.0.0 NPM_CONFIG_REGISTRY=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 ./build/e2e/*.test.js
|
PUBLISHED_VERSION=9999.0.1 npm_config_registry=http://localhost:4872/ jest -c "./build/e2e/jest-config.js" --maxWorkers=1 ./build/e2e/*.test.js
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user