chore(repo): switch publishing to use lerna (#10293)

This commit is contained in:
Jason Jean 2022-05-19 20:35:47 -04:00 committed by GitHub
parent 5671b53ac7
commit 04985be149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 1897 additions and 1381 deletions

2
.gitignore vendored
View File

@ -15,3 +15,5 @@ jest.debug.config.js
dep-graph/client/src/assets/environment.js
/nx-dev/nx-dev/public/documentation
/nx-dev/nx-dev/public/images/open-graph
# Lerna creates this
CHANGELOG.md

10
lerna.json Normal file
View File

@ -0,0 +1,10 @@
{
"packages": ["build/packages/*"],
"version": "14.1.7",
"granularPathspec": false,
"command": {
"publish": {
"graphType": "all"
}
}
}

View File

@ -1,11 +1,10 @@
{
"name": "@nrwl/nx-source",
"version": "14.1.8-beta.1",
"description": "Smart, Fast and Extensible Build System",
"homepage": "https://nx.dev",
"private": true,
"scripts": {
"build": "./scripts/package.sh --local",
"build": "nx run-many --target build --all --parallel 8 --exclude nx-dev,typedoc-theme",
"commit": "git-cz",
"check-commit": "node ./scripts/commit-lint.js",
"check-format": "nx format:check --all",
@ -17,7 +16,7 @@
"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",
"nx-release": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/nx-release",
"depcheck": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/depcheck",
"local-registry": "./scripts/local-registry.sh",
"documentation": "ts-node -P scripts/tsconfig.scripts.json ./scripts/documentation/documentation.ts && yarn check-documentation-map",
@ -174,6 +173,7 @@
"karma-jasmine-html-reporter": "^0.2.2",
"karma-webpack": "4.0.2",
"kill-port": "^1.6.1",
"lerna": "^4.0.0",
"less": "3.12.2",
"less-loader": "^10.1.0",
"license-webpack-plugin": "^4.0.2",
@ -206,7 +206,6 @@
"react-router-dom": "6.3.0",
"react-test-renderer": "18.1.0",
"regenerator-runtime": "0.13.7",
"release-it": "^14.11.3",
"rollup": "^2.56.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-peer-deps-external": "^2.2.4",

View File

@ -27,12 +27,12 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"strip-json-comments": "^3.1.1",
"ignore": "^5.0.4",
"@nrwl/workspace": "*",
"@nrwl/devkit": "*",
"nx": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/workspace": "file:../workspace",
"enquirer": "~2.3.6",
"ignore": "^5.0.4",
"nx": "file:../nx",
"strip-json-comments": "^3.1.1",
"yargs-parser": "21.0.1"
}
}

View File

@ -4,11 +4,10 @@ import * as stripJsonComments from 'strip-json-comments';
import * as path from 'path';
import * as fs from 'fs';
import * as cp from 'child_process';
import { execSync } from 'child_process';
// eslint-disable-next-line @typescript-eslint/no-var-requires
import * as enquirer from 'enquirer';
import * as yargsParser from 'yargs-parser';
import { execSync } from 'child_process';
import { output } from '@nrwl/devkit';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ignore = require('ignore');
@ -272,7 +271,7 @@ function deduceDefaultBase() {
function addDepsToPackageJson(repoRoot: string, useCloud: boolean) {
const json = readJsonFile(repoRoot, `package.json`);
if (!json.devDependencies) json.devDependencies = {};
json.devDependencies['nx'] = 'NX_VERSION';
json.devDependencies['nx'] = require('../package.json').version;
if (useCloud) {
json.devDependencies['@nrwl/nx-cloud'] = 'latest';
}

View File

@ -38,24 +38,24 @@
},
"dependencies": {
"@angular-devkit/schematics": "~13.3.0",
"@nrwl/cypress": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"@nrwl/storybook": "*",
"@nrwl/workspace": "*",
"@schematics/angular": "~13.3.0",
"@nrwl/cypress": "file:../cypress",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/linter": "file:../linter",
"@nrwl/storybook": "file:../storybook",
"@nrwl/workspace": "file:../workspace",
"@phenomnomnominal/tsquery": "4.1.1",
"@schematics/angular": "~13.3.0",
"chalk": "4.1.0",
"chokidar": "^3.5.1",
"http-server": "^14.1.0",
"ignore": "^5.0.4",
"jasmine-marbles": "~0.8.4",
"rxjs-for-await": "0.0.2",
"webpack-merge": "5.7.3",
"semver": "7.3.4",
"ts-node": "~9.1.1",
"tsconfig-paths": "^3.9.0",
"semver": "7.3.4",
"webpack": "^5.58.1",
"http-server": "^14.1.0"
"webpack-merge": "5.7.3"
}
}

View File

@ -576,8 +576,8 @@ Object {
"@angular-eslint/eslint-plugin": "~13.1.0",
"@angular-eslint/eslint-plugin-template": "~13.1.0",
"@angular-eslint/template-parser": "~13.1.0",
"@nrwl/eslint-plugin-nx": "*",
"@nrwl/linter": "*",
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"eslint": "~8.12.0",
@ -934,8 +934,8 @@ Object {
"@angular-eslint/eslint-plugin": "~13.1.0",
"@angular-eslint/eslint-plugin-template": "~13.1.0",
"@angular-eslint/template-parser": "~13.1.0",
"@nrwl/eslint-plugin-nx": "*",
"@nrwl/linter": "*",
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"eslint": "~8.12.0",

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const angularVersion = '~13.3.0';
export const angularDevkitVersion = '~13.3.0';
export const angularJsVersion = '1.7.9';

View File

@ -25,6 +25,6 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"nx": "*"
"nx": "file:../nx"
}
}

View File

@ -21,11 +21,11 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"tslib": "^2.3.0",
"@nrwl/workspace": "*",
"@nrwl/devkit": "*",
"nx": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/workspace": "file:../workspace",
"fs-extra": "^10.1.0",
"nx": "file:../nx",
"tslib": "^2.3.0",
"yargs-parser": "21.0.1"
}
}

View File

@ -20,10 +20,9 @@ import {
import enquirer = require('enquirer');
import yargsParser = require('yargs-parser');
const tsVersion = 'TYPESCRIPT_VERSION';
const cliVersion = 'NX_VERSION';
const nxVersion = 'NX_VERSION';
const prettierVersion = 'PRETTIER_VERSION';
const nxVersion = require('../package.json').version;
const tsVersion = 'TYPESCRIPT_VERSION'; // This gets replaced with the typescript version in the root package.json during build
const prettierVersion = 'PRETTIER_VERSION'; // This gets replaced with the prettier version in the root package.json during build
const parsedArgs = yargsParser(process.argv, {
string: ['pluginName', 'packageManager', 'importPath'],
@ -41,7 +40,7 @@ function createSandbox(packageManager: string) {
writeJsonFile(path.join(tmpDir, 'package.json'), {
dependencies: {
'@nrwl/workspace': nxVersion,
nx: cliVersion,
nx: nxVersion,
typescript: tsVersion,
prettier: prettierVersion,
},

View File

@ -28,10 +28,10 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"nx": "*",
"@nrwl/devkit": "*",
"@nrwl/devkit": "file:../devkit",
"enquirer": "~2.3.6",
"fs-extra": "^10.1.0",
"nx": "file:../nx",
"tmp": "~0.2.1",
"yargs-parser": "21.0.1"
}

View File

@ -64,6 +64,9 @@
},
{
"command": "node ./scripts/copy-readme.js create-nx-plugin"
},
{
"command": "node ./scripts/replace-versions.js build/packages/create-nx-plugin/bin/create-nx-plugin.js"
}
],
"parallel": false

View File

@ -112,10 +112,9 @@ const presetOptions: { name: Preset; message: string }[] = [
},
];
const tsVersion = 'TYPESCRIPT_VERSION';
const cliVersion = 'NX_VERSION';
const nxVersion = 'NX_VERSION';
const prettierVersion = 'PRETTIER_VERSION';
const nxVersion = require('../package.json').version;
const tsVersion = 'TYPESCRIPT_VERSION'; // This gets replaced with the typescript version in the root package.json during build
const prettierVersion = 'PRETTIER_VERSION'; // This gets replaced with the prettier version in the root package.json during build
export const commandsObject: yargs.Argv<Arguments> = yargs
.wrap(yargs.terminalWidth())
@ -221,7 +220,7 @@ async function main(parsedArgs: yargs.Arguments<Arguments>) {
} = parsedArgs;
output.log({
title: `Nx is creating your v${cliVersion} workspace.`,
title: `Nx is creating your v${nxVersion} workspace.`,
bodyLines: [
'To make sure the command works reliably in all environments, and that the preset is applied correctly,',
`Nx will run "${packageManager} install" several times. Please wait.`,
@ -714,7 +713,7 @@ async function createSandbox(packageManager: PackageManager) {
JSON.stringify({
dependencies: {
'@nrwl/workspace': nxVersion,
nx: cliVersion,
nx: nxVersion,
typescript: tsVersion,
prettier: prettierVersion,
},

View File

@ -28,12 +28,12 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"tmp": "~0.2.1",
"yargs": "^17.4.0",
"chalk": "4.1.0",
"enquirer": "~2.3.6",
"flat": "^5.0.2",
"chalk": "4.1.0",
"ora": "5.3.0",
"tslib": "^2.3.0"
"tmp": "~0.2.1",
"tslib": "^2.3.0",
"yargs": "^17.4.0"
}
}

View File

@ -64,6 +64,9 @@
},
{
"command": "node ./scripts/copy-readme.js create-nx-workspace"
},
{
"command": "node ./scripts/replace-versions.js build/packages/create-nx-workspace/bin/create-nx-workspace.js"
}
],
"parallel": false

View File

@ -33,19 +33,19 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/devkit": "*",
"@nrwl/linter": "*",
"@nrwl/workspace": "*",
"@cypress/webpack-preprocessor": "^5.9.1",
"@nrwl/devkit": "file:../devkit",
"@nrwl/linter": "file:../linter",
"@nrwl/workspace": "file:../workspace",
"chalk": "4.1.0",
"enhanced-resolve": "^5.8.3",
"fork-ts-checker-webpack-plugin": "6.2.10",
"rxjs": "^6.5.4",
"ts-loader": "^9.2.6",
"tsconfig-paths": "^3.9.0",
"tsconfig-paths-webpack-plugin": "3.5.2",
"webpack-node-externals": "^3.0.0",
"fork-ts-checker-webpack-plugin": "6.2.10",
"rxjs": "^6.5.4",
"tslib": "^2.3.0"
"tslib": "^2.3.0",
"webpack-node-externals": "^3.0.0"
},
"peerDependencies": {
"cypress": ">= 3 < 10"

View File

@ -4,8 +4,8 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 1`] = `
Object {
"dependencies": Object {},
"devDependencies": Object {
"@nrwl/eslint-plugin-nx": "*",
"@nrwl/linter": "*",
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"eslint": "~8.12.0",

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const cypressVersion = '^9.1.0';
export const eslintPluginCypressVersion = '^2.10.3';
export const typesNodeVersion = '16.11.7';

View File

@ -24,11 +24,11 @@
"main": "index.js",
"types": "index.d.ts",
"dependencies": {
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"@nrwl/react": "*",
"@nrwl/workspace": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/linter": "file:../linter",
"@nrwl/react": "file:../react",
"@nrwl/workspace": "file:../workspace",
"chalk": "^4.1.0"
},
"peerDependencies": {

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const detoxVersion = '19.6.9';
export const testingLibraryJestDom = '5.16.4';

View File

@ -32,8 +32,8 @@
}
},
"dependencies": {
"@nrwl/devkit": "*",
"@nrwl/workspace": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/workspace": "file:../workspace",
"@typescript-eslint/experimental-utils": "~5.18.0",
"chalk": "4.1.0",
"confusing-browser-globals": "^1.0.9"

View File

@ -29,9 +29,9 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/devkit": "*",
"@nrwl/node": "*",
"@nrwl/workspace": "*"
"@nrwl/devkit": "file:../devkit",
"@nrwl/node": "file:../node",
"@nrwl/workspace": "file:../workspace"
},
"peerDependencies": {
"express": "4.17.2"

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const expressVersion = '4.17.2';
export const expressTypingsVersion = '4.17.13';

View File

@ -33,16 +33,16 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/devkit": "*",
"identity-obj-proxy": "3.0.0",
"jest-resolve": "27.5.1",
"resolve.exports": "1.1.0",
"rxjs": "^6.5.4",
"tslib": "^2.3.0",
"@jest/reporters": "27.5.1",
"@jest/test-result": "27.5.1",
"@nrwl/devkit": "file:../devkit",
"chalk": "4.1.0",
"identity-obj-proxy": "3.0.0",
"jest-config": "27.5.1",
"jest-util": "27.5.1"
"jest-resolve": "27.5.1",
"jest-util": "27.5.1",
"resolve.exports": "1.1.0",
"rxjs": "^6.5.4",
"tslib": "^2.3.0"
}
}

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const jestVersion = '27.5.1';
export const jestTypesVersion = '27.4.1';
export const tslibVersion = '^2.3.0';

View File

@ -31,10 +31,10 @@
"executors": "./executors.json",
"builders": "./executors.json",
"dependencies": {
"@nrwl/workspace": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/linter": "file:../linter",
"@nrwl/workspace": "file:../workspace",
"@parcel/watcher": "2.0.4",
"chalk": "4.1.0",
"fast-glob": "3.2.7",

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const swcCoreVersion = '~1.2.143';
export const swcCliVersion = '~0.1.55';

View File

@ -33,9 +33,9 @@
"eslint": "^8.0.0"
},
"dependencies": {
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@phenomnomnominal/tsquery": "4.1.1",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"tmp": "~0.2.1",
"tslib": "^2.3.0"
},

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const tslintVersion = '~6.1.0';
export const tslintToEslintConfigVersion = '^2.4.0';

View File

@ -27,10 +27,10 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"@nrwl/devkit": "*",
"@nrwl/workspace": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/workspace": "file:../workspace",
"enquirer": "^2.3.6",
"nx": "*",
"nx": "file:../nx",
"semver": "7.3.4",
"tmp": "~0.2.1",
"yargs": "^17.4.0",

View File

@ -29,11 +29,11 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/devkit": "*",
"@nrwl/linter": "*",
"@nrwl/node": "*",
"@nrwl/js": "*",
"@nrwl/jest": "*",
"@nestjs/schematics": "^8.0.0"
"@nestjs/schematics": "^8.0.0",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/js": "file:../js",
"@nrwl/linter": "file:../linter",
"@nrwl/node": "file:../node"
}
}

View File

@ -4,8 +4,8 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 1`] = `
Object {
"dependencies": Object {},
"devDependencies": Object {
"@nrwl/eslint-plugin-nx": "*",
"@nrwl/linter": "*",
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"eslint": "~8.12.0",
@ -297,8 +297,8 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 1`] = `
Object {
"dependencies": Object {},
"devDependencies": Object {
"@nrwl/eslint-plugin-nx": "*",
"@nrwl/linter": "*",
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"eslint": "~8.12.0",

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const nestJsVersion7 = '^7.0.0';
export const nestJsVersion8 = '^8.0.0';

View File

@ -34,20 +34,20 @@
},
"dependencies": {
"@babel/plugin-proposal-decorators": "^7.14.5",
"@nrwl/react": "*",
"@nrwl/cypress": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"@nrwl/web": "*",
"@nrwl/workspace": "*",
"@nrwl/cypress": "file:../cypress",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/linter": "file:../linter",
"@nrwl/react": "file:../react",
"@nrwl/web": "file:../web",
"@nrwl/workspace": "file:../workspace",
"@svgr/webpack": "^6.1.2",
"chalk": "4.1.0",
"eslint-config-next": "^12.1.0",
"fs-extra": "^10.1.0",
"url-loader": "^4.1.1",
"tsconfig-paths": "^3.9.0",
"ts-node": "~9.1.1",
"tsconfig-paths": "^3.9.0",
"url-loader": "^4.1.1",
"webpack-merge": "^5.8.0"
}
}

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const nextVersion = '12.1.5';
export const eslintConfigNextVersion = '12.1.5';

View File

@ -30,11 +30,11 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/workspace": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/js": "*",
"@nrwl/linter": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/js": "file:../js",
"@nrwl/linter": "file:../linter",
"@nrwl/workspace": "file:../workspace",
"chalk": "4.1.0",
"copy-webpack-plugin": "^9.0.1",
"enhanced-resolve": "^5.8.3",
@ -43,17 +43,17 @@
"glob": "7.1.4",
"license-webpack-plugin": "^4.0.2",
"rxjs": "^6.5.4",
"rxjs-for-await": "0.0.2",
"source-map-support": "0.5.19",
"terser-webpack-plugin": "^5.3.0",
"tree-kill": "1.2.2",
"ts-loader": "^9.2.6",
"ts-node": "~9.1.1",
"tsconfig-paths": "^3.9.0",
"tsconfig-paths-webpack-plugin": "3.5.2",
"tslib": "^2.3.0",
"webpack": "^5.58.1",
"webpack-merge": "^5.8.0",
"webpack-node-externals": "^3.0.0",
"terser-webpack-plugin": "^5.3.0",
"rxjs-for-await": "0.0.2",
"ts-node": "~9.1.1"
"webpack-node-externals": "^3.0.0"
}
}

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const tslibVersion = '^2.0.0';

View File

@ -27,10 +27,10 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"@nrwl/js": "*",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/js": "file:../js",
"@nrwl/linter": "file:../linter",
"fs-extra": "^10.1.0",
"rxjs": "^6.5.4",
"tslib": "^2.3.0"

View File

@ -1 +1 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;

View File

@ -31,35 +31,35 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"@swc/core": "^1.2.173",
"@swc-node/register": "^1.4.2",
"fast-glob": "3.2.7",
"jsonc-parser": "3.0.0",
"tsconfig-paths": "^3.9.0",
"v8-compile-cache": "2.3.0",
"@parcel/watcher": "2.0.4",
"@swc-node/register": "^1.4.2",
"@swc/core": "^1.2.173",
"chalk": "4.1.0",
"chokidar": "^3.5.1",
"cli-cursor": "3.1.0",
"cli-spinners": "2.6.1",
"fs-extra": "^10.1.0",
"cliui": "^7.0.2",
"dotenv": "~10.0.0",
"enquirer": "~2.3.6",
"fast-glob": "3.2.7",
"figures": "3.2.0",
"flat": "^5.0.2",
"fs-extra": "^10.1.0",
"glob": "7.1.4",
"ignore": "^5.0.4",
"jsonc-parser": "3.0.0",
"minimatch": "3.0.4",
"npm-run-path": "^4.0.1",
"open": "^8.4.0",
"semver": "7.3.4",
"string-width": "^4.2.3",
"tar-stream": "~2.2.0",
"tmp": "~0.2.1",
"tsconfig-paths": "^3.9.0",
"tslib": "^2.3.0",
"v8-compile-cache": "2.3.0",
"yargs": "^17.4.0",
"yargs-parser": "21.0.1",
"cliui": "^7.0.2",
"string-width": "^4.2.3",
"chalk": "4.1.0",
"flat": "^5.0.2",
"minimatch": "3.0.4",
"enquirer": "~2.3.6",
"tslib": "^2.3.0"
"yargs-parser": "21.0.1"
},
"nx-migrations": {
"migrations": "./migrations.json",

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const angularCliVersion = '~13.2.0';
export const typescriptVersion = '~4.5.2';

View File

@ -24,13 +24,13 @@
"main": "index.js",
"types": "index.d.ts",
"dependencies": {
"@nrwl/detox": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"@nrwl/storybook": "*",
"@nrwl/react": "*",
"@nrwl/workspace": "*",
"@nrwl/detox": "file:../detox",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/linter": "file:../linter",
"@nrwl/react": "file:../react",
"@nrwl/storybook": "file:../storybook",
"@nrwl/workspace": "file:../workspace",
"chalk": "^4.1.0",
"enhanced-resolve": "^5.8.3",
"fs-extra": "^10.1.0",

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const reactNativeVersion = '0.68.2';
export const typesReactNativeVersion = '0.67.7';

View File

@ -32,15 +32,16 @@
"dependencies": {
"@babel/core": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@nrwl/cypress": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/js": "*",
"@nrwl/linter": "*",
"@nrwl/storybook": "*",
"@nrwl/web": "*",
"@nrwl/workspace": "*",
"@nrwl/cypress": "file:../cypress",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/js": "file:../js",
"@nrwl/linter": "file:../linter",
"@nrwl/storybook": "file:../storybook",
"@nrwl/web": "file:../web",
"@nrwl/workspace": "file:../workspace",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
"@storybook/node-logger": "6.1.20",
"@svgr/webpack": "^6.1.2",
"chalk": "4.1.0",
"eslint-plugin-import": "^2.25.2",
@ -48,10 +49,9 @@
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"react-refresh": "^0.10.0",
"semver": "7.3.4",
"url-loader": "^4.1.1",
"webpack": "^5.58.1",
"webpack-merge": "^5.8.0",
"@storybook/node-logger": "6.1.20",
"semver": "7.3.4"
"webpack-merge": "^5.8.0"
}
}

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const reactVersion = '18.1.0';
export const reactDomVersion = '18.1.0';

View File

@ -29,10 +29,10 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/cypress": "*",
"@nrwl/devkit": "*",
"@nrwl/linter": "*",
"@nrwl/workspace": "*",
"@nrwl/cypress": "file:../cypress",
"@nrwl/devkit": "file:../devkit",
"@nrwl/linter": "file:../linter",
"@nrwl/workspace": "file:../workspace",
"core-js": "^3.6.5",
"semver": "7.3.4",
"ts-loader": "^9.2.6",

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const storybookVersion = '~6.4.12';
export const babelCoreVersion = '7.12.13';
export const babelLoaderVersion = '8.1.0';

View File

@ -30,6 +30,6 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"nx": "*"
"nx": "file:../nx"
}
}

View File

@ -29,22 +29,23 @@
"migrations": "./migrations.json"
},
"dependencies": {
"@nrwl/cypress": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/js": "*",
"@nrwl/linter": "*",
"@nrwl/workspace": "*",
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5",
"@babel/plugin-transform-regenerator": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/runtime": "^7.14.8",
"@babel/preset-env": "^7.15.0",
"@babel/preset-typescript": "^7.15.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@babel/runtime": "^7.14.8",
"@nrwl/cypress": "file:../cypress",
"@nrwl/devkit": "file:../devkit",
"@nrwl/jest": "file:../jest",
"@nrwl/js": "file:../js",
"@nrwl/linter": "file:../linter",
"@nrwl/workspace": "file:../workspace",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-image": "^2.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
@ -54,14 +55,12 @@
"babel-plugin-macros": "^2.8.0",
"babel-plugin-transform-async-to-promises": "^0.8.15",
"babel-plugin-transform-typescript-metadata": "^0.3.1",
"bytes": "^3.1.0",
"browserslist": "^4.16.6",
"bytes": "^3.1.0",
"caniuse-lite": "^1.0.30001251",
"chalk": "4.1.0",
"chokidar": "^3.5.1",
"copy-webpack-plugin": "^9.0.1",
"react-refresh": "^0.10.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
"core-js": "^3.6.5",
"css-loader": "^6.4.0",
"css-minimizer-webpack-plugin": "^3.1.1",
@ -69,8 +68,9 @@
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "6.2.10",
"fs-extra": "^10.1.0",
"http-server": "^14.1.0",
"http-server": "14.1.0",
"identity-obj-proxy": "3.0.0",
"ignore": "^5.0.4",
"less": "3.12.2",
"less-loader": "^10.1.0",
"license-webpack-plugin": "^4.0.2",
@ -82,13 +82,14 @@
"postcss-import": "~14.1.0",
"postcss-loader": "^6.1.1",
"raw-loader": "^4.0.2",
"rxjs": "^6.5.4",
"rxjs-for-await": "0.0.2",
"react-refresh": "^0.10.0",
"rollup": "^2.56.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-typescript2": "^0.31.1",
"rxjs": "^6.5.4",
"rxjs-for-await": "0.0.2",
"sass": "^1.42.1",
"sass-loader": "^12.2.0",
"semver": "7.3.4",
@ -104,11 +105,9 @@
"tsconfig-paths-webpack-plugin": "3.5.2",
"tslib": "^2.3.0",
"webpack": "^5.58.1",
"webpack-dev-server": "^4.3.1",
"webpack-merge": "^5.8.0",
"webpack-sources": "^3.0.2",
"webpack-subresource-integrity": "^5.1.0",
"webpack-dev-server": "^4.3.1",
"http-server": "14.1.0",
"ignore": "^5.0.4"
"webpack-subresource-integrity": "^5.1.0"
}
}

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const swcLoaderVersion = '0.1.15';
export const typesNodeVersion = '16.11.7';

View File

@ -32,27 +32,27 @@
"requirements": {},
"migrations": "./migrations.json",
"packageGroup": {
"@nrwl/angular": "*",
"@nrwl/cypress": "*",
"@nrwl/devkit": "*",
"@nrwl/eslint-plugin-nx": "*",
"@nrwl/express": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"@nrwl/nest": "*",
"@nrwl/next": "*",
"@nrwl/node": "*",
"@nrwl/nx-plugin": "*",
"@nrwl/react": "*",
"@nrwl/storybook": "*",
"@nrwl/web": "*",
"@nrwl/js": "*",
"@nrwl/cli": "*",
"@nrwl/tao": "*",
"@nrwl/angular": "file:../angular",
"@nrwl/cypress": "file:../cypress",
"@nrwl/devkit": "file:../devkit",
"@nrwl/eslint-plugin-nx": "file:../eslint-plugin-nx",
"@nrwl/express": "file:../express",
"@nrwl/jest": "file:../jest",
"@nrwl/linter": "file:../linter",
"@nrwl/nest": "file:../nest",
"@nrwl/next": "file:../next",
"@nrwl/node": "file:../node",
"@nrwl/nx-plugin": "file:../nx-plugin",
"@nrwl/react": "file:../react",
"@nrwl/storybook": "file:../storybook",
"@nrwl/web": "file:../web",
"@nrwl/js": "file:../js",
"@nrwl/cli": "file:../cli",
"@nrwl/tao": "file:../tao",
"@nrwl/nx-cloud": "latest",
"@nrwl/react-native": "*",
"@nrwl/detox": "*",
"nx": "*"
"@nrwl/react-native": "file:../react-native",
"@nrwl/detox": "file:../detox",
"nx": "file:../nx"
}
},
"peerDependencies": {
@ -64,27 +64,27 @@
}
},
"dependencies": {
"@nrwl/devkit": "file:../devkit",
"@parcel/watcher": "2.0.4",
"@nrwl/devkit": "*",
"chalk": "4.1.0",
"chokidar": "^3.5.1",
"cli-cursor": "3.1.0",
"cli-spinners": "2.6.1",
"fs-extra": "^10.1.0",
"dotenv": "~10.0.0",
"enquirer": "~2.3.6",
"figures": "3.2.0",
"flat": "^5.0.2",
"fs-extra": "^10.1.0",
"glob": "7.1.4",
"ignore": "^5.0.4",
"minimatch": "3.0.4",
"npm-run-path": "^4.0.1",
"open": "^8.4.0",
"rxjs": "^6.5.4",
"semver": "7.3.4",
"tmp": "~0.2.1",
"tslib": "^2.3.0",
"yargs": "^17.4.0",
"yargs-parser": "21.0.1",
"chalk": "4.1.0",
"flat": "^5.0.2",
"minimatch": "3.0.4",
"enquirer": "~2.3.6",
"tslib": "^2.3.0"
"yargs-parser": "21.0.1"
}
}

View File

@ -3,12 +3,12 @@
exports[`new --preset angular should generate necessary npm dependencies 1`] = `
Object {
"dependencies": Object {
"@nrwl/angular": "*",
"@nrwl/angular": "0.0.1",
},
"devDependencies": Object {
"@nrwl/cli": "*",
"@nrwl/workspace": "*",
"nx": "*",
"@nrwl/cli": "0.0.1",
"@nrwl/workspace": "0.0.1",
"nx": "0.0.1",
"prettier": "^2.5.1",
"typescript": "~4.6.2",
},
@ -28,9 +28,9 @@ exports[`new --preset empty should generate necessary npm dependencies 1`] = `
Object {
"dependencies": Object {},
"devDependencies": Object {
"@nrwl/cli": "*",
"@nrwl/workspace": "*",
"nx": "*",
"@nrwl/cli": "0.0.1",
"@nrwl/workspace": "0.0.1",
"nx": "0.0.1",
"prettier": "^2.5.1",
"typescript": "~4.6.2",
},
@ -50,10 +50,10 @@ exports[`new --preset react should generate necessary npm dependencies 1`] = `
Object {
"dependencies": Object {},
"devDependencies": Object {
"@nrwl/cli": "*",
"@nrwl/react": "*",
"@nrwl/workspace": "*",
"nx": "*",
"@nrwl/cli": "0.0.1",
"@nrwl/react": "0.0.1",
"@nrwl/workspace": "0.0.1",
"nx": "0.0.1",
"prettier": "^2.5.1",
"typescript": "~4.6.2",
},

View File

@ -1,4 +1,4 @@
export const nxVersion = '*';
export const nxVersion = require('../../package.json').version;
export const angularCliVersion = '~13.3.0';
export const typescriptVersion = '~4.6.2';

View File

@ -1,10 +1,6 @@
import { execSync } from 'child_process';
import { readFileSync, writeFileSync, remove } from 'fs-extra';
import { existsSync, readdirSync } from 'fs';
import {
prettierVersion,
typescriptVersion,
} from '../packages/workspace/src/utils/versions';
import { remove } from 'fs-extra';
import { existsSync } from 'fs';
import { stripIndent } from 'nx/src/utils/logger';
process.env.PUBLISHED_VERSION = process.env.PUBLISHED_VERSION || `9999.0.2`;
@ -35,7 +31,6 @@ async function buildPackagePublishAndCleanPorts() {
]);
}
if (!process.env.NX_E2E_SKIP_BUILD_CLEANUP || !existsSync('./build')) {
build(process.env.PUBLISHED_VERSION);
try {
await updateVersionsAndPublishPackages();
} catch (e) {
@ -47,181 +42,12 @@ async function buildPackagePublishAndCleanPorts() {
}
}
const getDirectories = (source: string) =>
readdirSync(source, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
async function updateVersionsAndPublishPackages() {
const npmMajorVersion = execSync(`npm --version`)
.toString('utf-8')
.trim()
.split('.')[0];
const directories = getDirectories('./build/packages');
await Promise.all(
directories.map(async (pkg) => {
updateVersion(`./build/packages/${pkg}`);
publishPackage(`./build/packages/${pkg}`, +npmMajorVersion);
})
);
}
function updateVersion(packagePath: string) {
return execSync(`npm version ${process.env.PUBLISHED_VERSION}`, {
cwd: packagePath,
execSync(`yarn nx-release ${process.env.PUBLISHED_VERSION} --local`, {
stdio: 'inherit',
});
}
async function publishPackage(packagePath: string, npmMajorVersion: number) {
if (process.env.npm_config_registry.indexOf('http://localhost') === -1) {
throw Error(`
------------------
💣 ERROR 💣 => $NPM_REGISTRY does not look like a local registry'
------------------
`);
}
try {
console.log(` 📦 ${packagePath}`);
// NPM@7 requires a token to publish, thus, is just a matter of fake a token to bypass npm.
// See: https://twitter.com/verdaccio_npm/status/1357798427283910660
if (npmMajorVersion >= 7) {
writeFileSync(
`${packagePath}/.npmrc`,
`registry=${
process.env.npm_config_registry
}\n${process.env.npm_config_registry.replace(
'http:',
''
)}/:_authToken=fake`
);
}
execSync(`npm publish`, {
cwd: packagePath,
env: process.env,
stdio: ['ignore', 'ignore', 'ignore'],
});
} catch (e) {
console.log(e);
process.exit(1);
}
}
function build(nxVersion: string) {
try {
const b = new Date();
const projectsToExclude = [
'docs',
'nx-dev-data-access-documents',
'nx-dev-e2e',
'nx-dev',
'nx-dev-feature-analytics',
'nx-dev-feature-conf',
'nx-dev-feature-doc-viewer',
'nx-dev-feature-search',
'nx-dev-feature-storage',
'nx-dev-feature-versions-and-flavors',
'nx-dev-ui-commands',
'nx-dev-ui-common',
'nx-dev-ui-home',
'nx-dev-ui-member-card',
'nx-dev-ui-sponsor-card',
'typedoc-theme',
].join(',');
execSync(
`npx nx run-many --target=build --all --parallel=8 --exclude=${projectsToExclude}`,
{
stdio: ['pipe', 'pipe', 'pipe'],
}
);
const a = new Date();
console.log(
`\n> Packages built successfully in ${
(a.getTime() - b.getTime()) / 1000
}s\n`
);
} catch (e) {
console.log(e.output.toString());
console.log('Build failed. See error above.');
process.exit(1);
}
const BUILD_DIR = 'build/packages';
const files = [
...[
'react',
'next',
'web',
'jest',
'node',
'express',
'nest',
'cypress',
'storybook',
'angular',
'workspace',
'react-native',
'detox',
'js',
'nx',
].map((f) => `${f}/src/utils/versions.js`),
...[
'add-nx-to-monorepo',
'angular',
'cli',
'cra-to-nx',
'create-nx-plugin',
'create-nx-workspace',
'cypress',
'detox',
'devkit',
'eslint-plugin-nx',
'express',
'jest',
'js',
'linter',
'make-angular-cli-faster',
'nest',
'next',
'node',
'nx-plugin',
'react-native',
'react',
'storybook',
'tao',
'web',
'workspace',
].map((f) => `${f}/package.json`),
'create-nx-workspace/bin/create-nx-workspace.js',
'create-nx-plugin/bin/create-nx-plugin.js',
'add-nx-to-monorepo/src/add-nx-to-monorepo.js',
].map((f) => `${BUILD_DIR}/${f}`);
files.forEach((f) => {
const content = readFileSync(f, 'utf-8')
.replace(
/exports.nxVersion = '\*'/g,
`exports.nxVersion = '${nxVersion}'`
)
.replace(/NX_VERSION/g, nxVersion)
.replace(/TYPESCRIPT_VERSION/g, typescriptVersion)
.replace(/PRETTIER_VERSION/g, prettierVersion);
writeFileSync(f, content);
});
// patch devkit's nx limit
const content = readFileSync(
`${BUILD_DIR}/devkit/package.json`,
'utf-8'
).replace(/"nx": ">= 13\.10 <= (\d+)"/, `"nx": ">= 13.10 <= ${nxVersion}"`);
writeFileSync(`${BUILD_DIR}/devkit/package.json`, content);
}
(async () => {
await buildPackagePublishAndCleanPorts();
})();

View File

@ -1,245 +0,0 @@
#!/usr/bin/env node
const yargsParser = require('yargs-parser');
const releaseIt = require('release-it');
const childProcess = require('child_process');
const fs = require('fs');
const path = require('path');
const parsedArgs = yargsParser(process.argv, {
boolean: ['dry-run', 'local'],
alias: {
d: 'dry-run',
h: 'help',
l: 'local',
},
});
console.log('parsedArgs', parsedArgs);
if (!parsedArgs.local && !process.env.GITHUB_TOKEN_RELEASE_IT_NX) {
console.error('process.env.GITHUB_TOKEN_RELEASE_IT_NX is not set');
process.exit(1);
}
if (parsedArgs.help) {
console.log(`
Usage: yarn nx-release <version> [options]
Example: "yarn nx-release 1.0.0-beta.1"
The acceptable format for the version number is:
{number}.{number}.{number}[-{alpha|beta|rc}.{number}]
The subsection of the version number in []s is optional, and, if used, will be used to
mark the release as "prerelease" on GitHub, and tag it with "next" on npm.
Options:
--dry-run Do not touch or write anything, but show the commands
--help Show this message
--local Publish to local npm registry (IMPORTANT: install & run Verdaccio first & set registry in .npmrc)
`);
process.exit(0);
}
if (!parsedArgs.local) {
console.log('> git fetch --all');
childProcess.execSync('git fetch --all', {
stdio: [0, 1, 2],
});
}
function updatePackageJsonFiles(parsedVersion, isLocal) {
let pkgFiles = [
'package.json',
'build/npm/add-nx-to-monorepo/package.json',
'build/npm/cra-to-nx/package.json',
'build/npm/create-nx-workspace/package.json',
'build/npm/create-nx-plugin/package.json',
'build/npm/jest/package.json',
'build/npm/cypress/package.json',
'build/npm/storybook/package.json',
'build/npm/angular/package.json',
'build/npm/react/package.json',
'build/npm/next/package.json',
'build/npm/web/package.json',
'build/npm/node/package.json',
'build/npm/express/package.json',
'build/npm/nest/package.json',
'build/npm/workspace/package.json',
'build/npm/cli/package.json',
'build/npm/tao/package.json',
'build/npm/devkit/package.json',
'build/npm/eslint-plugin-nx/package.json',
'build/npm/linter/package.json',
'build/npm/make-angular-cli-faster/package.json',
'build/npm/nx-plugin/package.json',
'build/npm/nx/package.json',
'build/npm/react-native/package.json',
'build/npm/detox/package.json',
'build/npm/js/package.json',
];
if (isLocal) {
pkgFiles = pkgFiles.filter((f) => f !== 'package.json');
}
for (const pkgFile of pkgFiles) {
const pkgDir = path.dirname(pkgFile);
const licensePath = path.join(pkgDir, 'LICENSE');
if (!fs.existsSync(licensePath)) {
throw new Error('Missing License: ' + licensePath);
}
}
pkgFiles.forEach((p) => {
const content = JSON.parse(fs.readFileSync(p).toString());
content.version = parsedVersion.version;
fs.writeFileSync(p, JSON.stringify(content, null, 2));
});
}
function parseVersion(version) {
if (!version || !version.length) {
return {
version,
isValid: false,
isPrerelease: false,
};
}
const sections = version.split('-');
if (sections.length === 1) {
/**
* Not a prerelease version, validate matches exactly the
* standard {number}.{number}.{number} format
*/
return {
version,
isValid: !!sections[0].match(/\d+\.\d+\.\d+$/),
isPrerelease: false,
};
}
/**
* Is a prerelease version, validate each section
* 1. {number}.{number}.{number} format
* 2. {alpha|beta|rc}.{number}
*/
return {
version,
isValid: !!(
sections[0].match(/\d+\.\d+\.\d+$/) &&
sections[1].match(/(alpha|beta|rc)\.\d+$/)
),
isPrerelease: true,
};
}
const parsedVersion = parseVersion(parsedArgs._[2]);
if (!parsedVersion.isValid) {
console.error(
`\nError:\nThe specified version is not valid. You specified: "${parsedVersion.version}"`
);
console.error(
`Please run "yarn nx-release --help" for details on the acceptable version format.\n`
);
process.exit(1);
} else {
console.log('parsed version: ', JSON.stringify(parsedVersion));
}
const { devDependencies } = JSON.parse(
fs.readFileSync(path.join(__dirname, '../package.json'))
);
const cliVersion = devDependencies['@angular/cli'];
const typescriptVersion = devDependencies['typescript'];
const prettierVersion = devDependencies['prettier'];
console.log('Executing build script:');
const buildCommand = `./scripts/package.sh ${parsedVersion.version} ${cliVersion} ${typescriptVersion} ${prettierVersion}`;
console.log(`> ${buildCommand}`);
childProcess.execSync(buildCommand, {
stdio: [0, 1, 2],
});
/**
* Create working directory and copy over built packages
*/
childProcess.execSync('rm -rf build/npm && mkdir -p build/npm', {
stdio: [0, 1, 2],
});
childProcess.execSync('cp -R build/packages/* build/npm', {
stdio: [0, 1, 2],
});
/**
* Get rid of tarballs at top of copied directory (made with npm pack)
*/
childProcess.execSync(`find build/npm -maxdepth 1 -name "*.tgz" -delete`, {
stdio: [0, 1, 2],
});
/**
* Setting this to true can be useful for development/testing purposes.
* No git commands, nor npm publish commands will be run when this is
* true.
*/
const DRY_RUN = !!parsedArgs['dry-run'];
process.env.GITHUB_TOKEN = !parsedArgs.local
? process.env.GITHUB_TOKEN_RELEASE_IT_NX
: 'dummy-gh-token';
/**
* Set the static options for release-it
*/
const options = {
'dry-run': DRY_RUN,
/**
* Needed so that we can leverage conventional-changelog to generate
* the changelog
*/
safeBump: false,
increment: parsedVersion.version,
requireUpstream: false,
github: {
preRelease: parsedVersion.isPrerelease,
release: true,
},
npm: false,
git: {
requireCleanWorkingDir: false,
changelog: 'conventional-changelog -p angular | tail -n +3',
},
};
updatePackageJsonFiles(parsedVersion, parsedArgs.local);
if (parsedArgs.local) {
childProcess.execSync(
`./scripts/publish.sh ${parsedVersion.version} latest --local`,
{
stdio: [0, 1, 2],
}
);
process.exit(0);
} else {
releaseIt(options)
.then((output) => {
if (DRY_RUN) {
console.warn(
'WARNING: In DRY_RUN mode - not running publishing script'
);
process.exit(0);
return;
}
const npmTag = parsedVersion.isPrerelease ? 'next' : 'latest';
const npmPublishCommand = `./scripts/publish.sh ${output.version} ${npmTag}`;
console.log('Executing publishing script for all packages:');
console.log(`> ${npmPublishCommand}`);
console.log(
`Note: You will need to authenticate with your NPM credentials`
);
childProcess.execSync(npmPublishCommand, {
stdio: [0, 1, 2],
});
process.exit(0);
})
.catch((err) => {
console.error(err.message);
process.exit(1);
});
}

216
scripts/nx-release.ts Executable file
View File

@ -0,0 +1,216 @@
#!/usr/bin/env node
import * as yargs from 'yargs';
import { execSync } from 'child_process';
import { readFileSync, writeFileSync } from 'fs';
import { URL } from 'url';
import { join } from 'path';
import * as version from '@lerna/version/index';
import * as publish from '@lerna/publish/index';
(async () => {
const options = parseArgs();
if (!options.local && !options.force) {
console.log('Authenticating to NPM');
execSync('npm adduser', {
stdio: [0, 1, 2],
});
}
if (options.clearLocalRegistry) {
execSync('yarn local-registry clear');
}
const buildCommand = 'yarn build';
console.log(`> ${buildCommand}`);
execSync(buildCommand, {
stdio: [0, 1, 2],
});
const versionOptions = {
bump: options.version ? options.version : undefined,
conventionalCommits: true,
conventionalPrerelease: options.tag === 'next',
preid: options.preid,
forcePublish: true,
createRelease: options.tag !== 'next' ? 'github' : undefined,
noChangelog: options.tag === 'next',
tagVersionPrefix: '',
exact: true,
gitRemote: options.gitRemote,
gitTagVersion: options.tag !== 'next',
message: 'chore(misc): publish %v',
loglevel: options.loglevel ?? 'info',
yes: false,
ignoreScripts: true,
};
if (options.local) {
versionOptions.conventionalCommits = false;
delete versionOptions.createRelease;
versionOptions.gitTagVersion = false;
versionOptions.loglevel = options.loglevel ?? 'error';
versionOptions.yes = true;
versionOptions.bump = options.version ? options.version : 'minor';
}
const lernaJsonPath = join(__dirname, '../lerna.json');
let originalLernaJson: Buffer;
let uncommittedFiles: string[];
try {
if (options.local || options.tag === 'next') {
originalLernaJson = readFileSync(lernaJsonPath);
}
if (options.local) {
/**
* Hide changes from Lerna
*/
uncommittedFiles = execSync('git diff --name-only --relative HEAD .')
.toString()
.split('\n')
.filter((i) => i.length > 0);
execSync(
`git update-index --assume-unchanged ${uncommittedFiles.join(' ')}`
);
}
const publishOptions = {
gitReset: false,
distTag: options.tag,
};
if (!options.skipPublish) {
await publish({ ...versionOptions, ...publishOptions });
} else {
await version(versionOptions);
console.warn('Not Publishing because --dryRun was passed');
}
if (options.local || options.tag === 'next') {
writeFileSync(lernaJsonPath, originalLernaJson);
}
} finally {
if (options.local) {
/**
* Unhide changes from Lerna
*/
execSync(
`git update-index --no-assume-unchanged ${uncommittedFiles.join(' ')}`
);
}
}
})();
function parseArgs() {
const parsedArgs = yargs
.scriptName('yarn nx-release')
.wrap(144)
.strictOptions()
.version(false)
.command(
'$0 [version]',
'This script is for publishing Nx both locally and publically'
)
.option('skipPublish', {
type: 'boolean',
description: 'Skips the actual publishing for testing out versioning',
})
.option('clearLocalRegistry', {
type: 'boolean',
description:
'Clear existing versions in the local registry so that you can republish the same version',
default: true,
})
.option('local', {
type: 'boolean',
description: 'Publish Nx locally, not to actual NPM',
alias: 'l',
default: true,
})
.option('force', {
type: 'boolean',
description: "Don't use this unless you really know what it does",
hidden: true,
})
.positional('version', {
type: 'string',
description:
'The version to publish. This does not need to be passed and can be inferred.',
})
.option('gitRemote', {
type: 'string',
description:
'Alternate git remote name to publish tags to (useful for testing changelog)',
default: 'origin',
})
.option('tag', {
type: 'string',
description: 'NPM Tag',
choices: ['next', 'latest', 'previous'],
})
.option('preid', {
type: 'string',
description: 'The kind of prerelease tag. (1.0.0-[preid].0)',
choices: ['alpha', 'beta', 'rc'],
default: 'beta',
})
.option('loglevel', {
type: 'string',
description: 'Log Level',
choices: ['error', 'info', 'debug'],
})
.example(
'$0',
`By default, this will locally publish a minor version bump as latest. Great for local development. Most developers should only need this.`
)
.example(
'$0 --local false',
`This will really publish a new beta version to npm as next. The version is inferred by the changes.`
)
.example(
'$0 --local false --tag latest',
`This will really publish a new stable version to npm as latest, tag, commit, push, and create a release on GitHub.`
)
.example(
'$0 --local false --preid rc',
`This will really publish a new rc version to npm as next.`
)
.group(
['local', 'clearLocalRegistry'],
'Local Publishing Options for most developers'
)
.group(
['preid', 'tag', 'gitRemote', 'force'],
'Real Publishing Options for actually publishing to NPM'
)
.check((args) => {
const registry = getRegistry();
const registryIsLocalhost = registry.hostname === 'localhost';
if (!args.local) {
if (!process.env.GH_TOKEN) {
throw new Error('process.env.GH_TOKEN is not set');
}
if (!args.force && registryIsLocalhost) {
throw new Error(
'Registry is still set to localhost! Run "yarn local-registry disable" or pass --force'
);
}
} else {
if (!args.force && !registryIsLocalhost) {
throw new Error('--local was passed and registry is not localhost');
}
}
return true;
})
.parseSync();
parsedArgs.tag ??= parsedArgs.local ? 'latest' : 'next';
return parsedArgs;
}
function getRegistry() {
return new URL(execSync('npm config get registry').toString().trim());
}

View File

@ -1,53 +0,0 @@
#!/usr/bin/env bash
##################################################
# This shell script is executed by nx-release.js #
##################################################
NX_VERSION=$1
ANGULAR_CLI_VERSION=$2
TYPESCRIPT_VERSION=$3
PRETTIER_VERSION=$4
if [[ $NX_VERSION == "--local" ]]; then
NX_VERSION="*"
fi
rm -rf build
npx nx run-many --target=build --all --parallel || { echo 'Build failed' ; exit 1; }
cd build/packages
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" {nx,react,next,web,jest,node,linter,express,nest,cypress,storybook,angular,workspace,nx-plugin,react-native,detox,js}/src/utils/versions.js
sed -i "" "s|\*|$NX_VERSION|g" {nx,react,next,web,jest,node,express,nest,cypress,storybook,angular,workspace,cli,linter,tao,devkit,eslint-plugin-nx,create-nx-workspace,create-nx-plugin,nx-plugin,react-native,detox,js,add-nx-to-monorepo,cra-to-nx,make-angular-cli-faster}/package.json
sed -i "" "s|NX_VERSION|$NX_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "" "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "" "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "" "s|PRETTIER_VERSION|$PRETTIER_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "" "s|NX_VERSION|$NX_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "" "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "" "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "" "s|PRETTIER_VERSION|$PRETTIER_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "" "s|NX_VERSION|$NX_VERSION|g" add-nx-to-monorepo/src/add-nx-to-monorepo.js
else
sed -i "s|exports.nxVersion = '\*';|exports.nxVersion = '$NX_VERSION';|g" {nx,react,next,web,jest,node,linter,express,nest,cypress,storybook,angular,workspace,nx-plugin,react-native,detox,js}/src/utils/versions.js
sed -i "s|\*|$NX_VERSION|g" {nx,react,next,web,jest,node,express,nest,cypress,storybook,angular,workspace,cli,linter,tao,devkit,eslint-plugin-nx,create-nx-workspace,create-nx-plugin,nx-plugin,react-native,detox,js,add-nx-to-monorepo,cra-to-nx,make-angular-cli-faster}/package.json
sed -i "s|NX_VERSION|$NX_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "s|PRETTIER_VERSION|$PRETTIER_VERSION|g" create-nx-workspace/bin/create-nx-workspace.js
sed -i "s|NX_VERSION|$NX_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "s|ANGULAR_CLI_VERSION|$ANGULAR_CLI_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "s|TYPESCRIPT_VERSION|$TYPESCRIPT_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "s|PRETTIER_VERSION|$PRETTIER_VERSION|g" create-nx-plugin/bin/create-nx-plugin.js
sed -i "s|NX_VERSION|$NX_VERSION|g" add-nx-to-monorepo/src/add-nx-to-monorepo.js
fi
if [[ $NX_VERSION == "*" ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -E -i "" "s|\"@nrwl\/([^\"]+)\": \"\\*\"|\"@nrwl\/\1\": \"file:$PWD\/\1\"|" {nx,jest,web,react,next,node,express,nest,cypress,storybook,angular,workspace,linter,cli,tao,devkit,eslint-plugin-nx,create-nx-workspace,create-nx-plugin,nx-plugin,react-native,detox,cra-to-nx,make-angular-cli-faster,create-nx-workspace}/package.json
else
echo $PWD
sed -E -i "s|\"@nrwl\/([^\"]+)\": \"\\*\"|\"@nrwl\/\1\": \"file:$PWD\/\1\"|" {nx,jest,web,react,next,node,express,nest,cypress,storybook,angular,workspace,linter,cli,tao,devkit,eslint-plugin-nx,create-nx-workspace,create-nx-plugin,nx-plugin,react-native,detox,cra-to-nx,make-angular-cli-faster,create-nx-workspace}/package.json
fi
fi

View File

@ -1,56 +0,0 @@
#!/usr/bin/env bash
##################################################
# This shell script is executed by nx-release.js #
##################################################
VERSION=$1
TAG=$2
LOCALBUILD=$3
PACKAGE_SOURCE=build/packages
NPM_DEST=build/npm
ORIG_DIRECTORY=`pwd`
NPM_REGISTRY=`npm config get registry` # for local releases
if [ "$LOCALBUILD" = "--local" ]; then
echo
echo "Publishing to npm registry $NPM_REGISTRY"
if [[ ! $NPM_REGISTRY == http://localhost* ]]; then
echo "------------------"
echo "💣 WARNING 💣 => $NPM_REGISTRY does not look like a local registry!"
echo "You may want to set registry with 'npm config set registry ...'"
echo "------------------"
fi
read -p "Continue? (y/n)" -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
else
echo "Publishing to public npm"
# We are running inside of a child_process, so we need to reauth
npm adduser
fi
for package in $NPM_DEST/*/
do
PACKAGE_DIR="$(basename ${package})"
cd $NPM_DEST/$PACKAGE_DIR
PACKAGE_NAME=`node -e "console.log(require('./package.json').name)"`
echo "Publishing ${PACKAGE_NAME}@${VERSION} --tag ${TAG}"
if [ "$LOCALBUILD" = "--local" ]; then
npm publish --tag $TAG --access public --registry=$NPM_REGISTRY
else
npm publish --tag $TAG --access public
fi
cd $ORIG_DIRECTORY
done
echo "Publishing complete"

View File

@ -0,0 +1,19 @@
const { readFileSync, writeFileSync } = require('fs');
const { join } = require('path');
const [file] = process.argv.slice(2);
const originalContents = readFileSync(file).toString();
const packageJson = require(join(__dirname, '../package.json'));
const typescriptVersion = packageJson.devDependencies.typescript;
const prettierVersion = packageJson.devDependencies.prettier;
writeFileSync(
file,
originalContents
.replace(/TYPESCRIPT_VERSION/g, typescriptVersion)
.replace(/PRETTIER_VERSION/g, prettierVersion)
// .replace(/TYPESCRIPT_VERSION/g, typescriptVersion)
);

2038
yarn.lock

File diff suppressed because it is too large Load Diff