chore(misc): updated verdaccio config files and local registry scripts (#5703)
This commit is contained in:
parent
fe0dec1f99
commit
cbfbcd3755
@ -36,4 +36,6 @@ packages:
|
||||
|
||||
# log settings
|
||||
logs:
|
||||
- { type: stdout, format: pretty, level: http }
|
||||
type: stdout
|
||||
format: pretty
|
||||
level: http
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"check-internal-links": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/documentation/internal-link-checker.ts",
|
||||
"check-versions": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/check-versions.ts",
|
||||
"check-documentation-map": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/documentation/map-link-checker.ts",
|
||||
"e2e-start-local-registry": "ts-node -P ./scripts/tsconfig.e2e.json scripts/e2e-start-local-registry.ts",
|
||||
"e2e-start-local-registry": "node ./scripts/e2e-start-local-registry.js",
|
||||
"e2e-build-package-publish": "ts-node -P ./scripts/tsconfig.e2e.json scripts/e2e-build-package-publish.ts",
|
||||
"format": "nx format",
|
||||
"nx-release": "./scripts/nx-release.js",
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import { execSync } from 'child_process';
|
||||
import { readFileSync, removeSync, writeFileSync } from 'fs-extra';
|
||||
import { readdirSync } from 'fs';
|
||||
import { removeSync } from 'fs-extra';
|
||||
import { readFileSync, writeFileSync, readdirSync } from 'fs';
|
||||
import {
|
||||
prettierVersion,
|
||||
typescriptVersion,
|
||||
} from '../packages/workspace/src/utils/versions';
|
||||
|
||||
process.env.PUBLISHED_VERSION = `9999.0.2`;
|
||||
process.env.npm_config_registry = `http://localhost:4872`;
|
||||
@ -12,7 +16,7 @@ export function buildPackagePublishAndCleanPorts() {
|
||||
removeSync('./tmp/angular/proj-backup');
|
||||
removeSync('./tmp/local-registry');
|
||||
|
||||
build(process.env.PUBLISHED_VERSION, '3.9.3', '2.1.2');
|
||||
build(process.env.PUBLISHED_VERSION);
|
||||
try {
|
||||
updateVersionsAndPublishPackages();
|
||||
} catch (e) {
|
||||
@ -21,7 +25,7 @@ export function buildPackagePublishAndCleanPorts() {
|
||||
}
|
||||
}
|
||||
|
||||
export const getDirectories = (source) =>
|
||||
export const getDirectories = (source: string) =>
|
||||
readdirSync(source, { withFileTypes: true })
|
||||
.filter((dirent) => dirent.isDirectory())
|
||||
.map((dirent) => dirent.name);
|
||||
@ -38,13 +42,13 @@ function updateVersionsAndPublishPackages() {
|
||||
});
|
||||
}
|
||||
|
||||
function updateVersion(packagePath) {
|
||||
function updateVersion(packagePath: string) {
|
||||
return execSync(`npm version ${process.env.PUBLISHED_VERSION}`, {
|
||||
cwd: packagePath,
|
||||
});
|
||||
}
|
||||
|
||||
function publishPackage(packagePath, npmMajorVersion: number) {
|
||||
function publishPackage(packagePath: string, npmMajorVersion: number) {
|
||||
if (process.env.npm_config_registry.indexOf('http://localhost') === -1) {
|
||||
throw Error(`
|
||||
------------------
|
||||
@ -79,7 +83,7 @@ function publishPackage(packagePath, npmMajorVersion: number) {
|
||||
}
|
||||
}
|
||||
|
||||
function build(nxVersion, typescriptVersion, prettierVersion) {
|
||||
function build(nxVersion: string) {
|
||||
try {
|
||||
execSync('npx nx run-many --target=build --all', {
|
||||
stdio: ['ignore', 'ignore', 'ignore'],
|
||||
@ -133,8 +137,7 @@ function build(nxVersion, typescriptVersion, prettierVersion) {
|
||||
].map((f) => `${BUILD_DIR}/${f}`);
|
||||
|
||||
files.forEach((f) => {
|
||||
let content = readFileSync(f).toString();
|
||||
content = content
|
||||
const content = readFileSync(f, 'utf-8')
|
||||
.replace(
|
||||
/exports.nxVersion = '\*'/g,
|
||||
`exports.nxVersion = '${nxVersion}'`
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { exec } from 'child_process';
|
||||
const { exec } = require('child_process');
|
||||
|
||||
const verdacio = exec(
|
||||
`yarn verdaccio --config ./scripts/local-registry/config.yml --listen 4872`
|
||||
'yarn verdaccio --config ./scripts/local-registry/config.yml'
|
||||
);
|
||||
verdacio.unref();
|
||||
|
||||
@ -16,10 +16,6 @@ function outputHandling(data) {
|
||||
|
||||
verdacio.stdout.on('data', outputHandling);
|
||||
verdacio.stderr.on('data', outputHandling);
|
||||
verdacio.on('exit', (code) => {
|
||||
process.exit(code);
|
||||
});
|
||||
verdacio.on('exit', (code) => process.exit(code));
|
||||
|
||||
setTimeout(() => {
|
||||
process.exit(0);
|
||||
}, 2000);
|
||||
setTimeout(() => process.exit(0), 2000);
|
||||
@ -12,8 +12,8 @@ fi
|
||||
if [[ $COMMAND == "disable" ]]; then
|
||||
npm config delete registry
|
||||
yarn config delete registry
|
||||
CURRENT_NPM_REGISTRY=`npm config get registry`
|
||||
CURRENT_YARN_REGISTRY=`yarn config get registry`
|
||||
CURRENT_NPM_REGISTRY=$(npm config get registry)
|
||||
CURRENT_YARN_REGISTRY=$(yarn config get registry)
|
||||
|
||||
echo "Reverting registries"
|
||||
echo " > NPM: $CURRENT_NPM_REGISTRY"
|
||||
@ -28,5 +28,5 @@ fi
|
||||
if [[ $COMMAND == "start" ]]; then
|
||||
echo "Starting Local Registry"
|
||||
VERDACCIO_HANDLE_KILL_SIGNALS=true
|
||||
npx verdaccio --config ./.verdaccio/config.yml
|
||||
yarn verdaccio --config ./.verdaccio/config.yml
|
||||
fi
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
# path to a directory with all packages
|
||||
storage: ../../tmp/local-registry/storage
|
||||
|
||||
listen: localhost:4872
|
||||
|
||||
# a list of other known repositories we can talk to
|
||||
uplinks:
|
||||
npmjs:
|
||||
@ -24,4 +26,6 @@ packages:
|
||||
|
||||
# log settings
|
||||
logs:
|
||||
- { type: stdout, format: pretty, level: warn }
|
||||
type: stdout
|
||||
format: pretty
|
||||
level: warn
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user