feat(linter): support eslint v8 (#7800)
* feat(core): support eslint v8 * fix(core): align version of eslint across all packages
This commit is contained in:
parent
8fa36ff3e8
commit
98ffe8574b
@ -197,7 +197,7 @@ jobs:
|
||||
- run:
|
||||
name: Run E2E Tests
|
||||
command: |
|
||||
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-react-native,e2e-detox --parallel --max-parallel=1
|
||||
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-react-native,e2e-detox,e2e-gatsby --parallel --max-parallel=1
|
||||
no_output_timeout: 45m
|
||||
- run:
|
||||
name: Stop All Running Agents for This CI Run
|
||||
@ -257,6 +257,10 @@ workflows:
|
||||
name: 'agent9'
|
||||
pm: 'npm'
|
||||
os: 'macos'
|
||||
- agent:
|
||||
name: 'agent10'
|
||||
pm: 'npm'
|
||||
os: 'macos'
|
||||
# - agent:
|
||||
# name: 'agent10'
|
||||
# pm: 'npm'
|
||||
|
||||
@ -1061,9 +1061,9 @@ By default javascript-style comments are allowed.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1113,9 +1113,9 @@ Reads a json file, removes all comments and parses JSON.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1139,9 +1139,9 @@ Reads a JSON file and returns the object the JSON content represents.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1346,9 +1346,9 @@ By default the JSON string is formatted with a 2 space intendation to be easy re
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1459,10 +1459,10 @@ Updates a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| `U` | extends ` object``T ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
| `U` | extends `object` = `T` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1569,9 +1569,9 @@ Writes a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1596,9 +1596,9 @@ Serializes the given data to JSON and writes it to a file.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
||||
@ -1061,9 +1061,9 @@ By default javascript-style comments are allowed.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1113,9 +1113,9 @@ Reads a json file, removes all comments and parses JSON.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1139,9 +1139,9 @@ Reads a JSON file and returns the object the JSON content represents.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1346,9 +1346,9 @@ By default the JSON string is formatted with a 2 space intendation to be easy re
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1459,10 +1459,10 @@ Updates a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| `U` | extends ` object``T ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
| `U` | extends `object` = `T` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1569,9 +1569,9 @@ Writes a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1596,9 +1596,9 @@ Serializes the given data to JSON and writes it to a file.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
||||
@ -1061,9 +1061,9 @@ By default javascript-style comments are allowed.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1113,9 +1113,9 @@ Reads a json file, removes all comments and parses JSON.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1139,9 +1139,9 @@ Reads a JSON file and returns the object the JSON content represents.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1346,9 +1346,9 @@ By default the JSON string is formatted with a 2 space intendation to be easy re
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1459,10 +1459,10 @@ Updates a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :---------------------- |
|
||||
| `T` | extends ` object``any ` |
|
||||
| `U` | extends ` object``T ` |
|
||||
| Name | Type |
|
||||
| :--- | :----------------------- |
|
||||
| `T` | extends `object` = `any` |
|
||||
| `U` | extends `object` = `T` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1569,9 +1569,9 @@ Writes a JSON value to the file system tree
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
@ -1596,9 +1596,9 @@ Serializes the given data to JSON and writes it to a file.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :--- | :------------------------- |
|
||||
| `T` | extends ` object``object ` |
|
||||
| Name | Type |
|
||||
| :--- | :-------------------------- |
|
||||
| `T` | extends `object` = `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
||||
9
nx.json
9
nx.json
@ -23,8 +23,13 @@
|
||||
"sitemap"
|
||||
],
|
||||
"useDaemonProcess": true,
|
||||
"runtimeCacheInputs": ["echo $SELECTED_CLI", "echo $E2E_CI_CACHE_KEY"],
|
||||
"cacheDirectory": "/tmp/nx-cache"
|
||||
"runtimeCacheInputs": [
|
||||
"echo $SELECTED_CLI",
|
||||
"echo $NX_E2E_CI_CACHE_KEY"
|
||||
],
|
||||
"cacheDirectory": "/tmp/nx-cache",
|
||||
"parallel": 1,
|
||||
"scan": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
28
package.json
28
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nrwl/nx-source",
|
||||
"version": "13.1.3",
|
||||
"version": "13.3.0-beta.2",
|
||||
"description": "Smart, Extensible Build Framework",
|
||||
"homepage": "https://nx.dev",
|
||||
"private": true,
|
||||
@ -61,18 +61,19 @@
|
||||
"@ngrx/schematics": "~13.0.0",
|
||||
"@ngrx/store": "~13.0.0",
|
||||
"@ngrx/store-devtools": "~13.0.0",
|
||||
"@nrwl/cli": "13.2.0-rc.4",
|
||||
"@nrwl/cypress": "13.2.0-rc.4",
|
||||
"@nrwl/eslint-plugin-nx": "13.2.0-rc.4",
|
||||
"@nrwl/jest": "13.2.0-rc.4",
|
||||
"@nrwl/linter": "13.2.0-rc.4",
|
||||
"@nrwl/next": "13.2.0-rc.4",
|
||||
"@nrwl/node": "13.2.0-rc.4",
|
||||
"@nrwl/nx-cloud": "13.0.0-beta.11",
|
||||
"@nrwl/react": "13.2.0-rc.4",
|
||||
"@nrwl/tao": "13.2.0-rc.4",
|
||||
"@nrwl/web": "13.2.0-rc.4",
|
||||
"@nrwl/workspace": "13.2.0-rc.4",
|
||||
"@nrwl/cli": "13.3.0-beta.2",
|
||||
"@nrwl/js": "13.3.0-beta.2",
|
||||
"@nrwl/workspace": "13.3.0-beta.2",
|
||||
"@nrwl/cypress": "13.3.0-beta.2",
|
||||
"@nrwl/eslint-plugin-nx": "13.3.0-beta.2",
|
||||
"@nrwl/jest": "13.3.0-beta.2",
|
||||
"@nrwl/linter": "13.3.0-beta.2",
|
||||
"@nrwl/next": "13.3.0-beta.2",
|
||||
"@nrwl/node": "13.3.0-beta.2",
|
||||
"@nrwl/nx-cloud": "13.0.0-beta.12",
|
||||
"@nrwl/react": "13.3.0-beta.2",
|
||||
"@nrwl/tao": "13.3.0-beta.2",
|
||||
"@nrwl/web": "13.3.0-beta.2",
|
||||
"@parcel/watcher": "2.0.0-alpha.11",
|
||||
"@phenomnomnominal/tsquery": "4.1.1",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
|
||||
@ -299,4 +300,3 @@
|
||||
"**/xmlhttprequest-ssl": "~1.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/angular"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/angular",
|
||||
"tsConfig": "packages/angular/tsconfig.lib.json",
|
||||
"packageJson": "packages/angular/package.json",
|
||||
"main": "packages/angular/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/angular",
|
||||
|
||||
@ -68,7 +68,7 @@ function buildAppWithCustomWebpackConfiguration(
|
||||
context: BuilderContext,
|
||||
pathToWebpackConfig: string
|
||||
) {
|
||||
return executeBrowserBuilder(options, context, {
|
||||
return executeBrowserBuilder(options, context as any, {
|
||||
webpackConfiguration: async (baseWebpackConfig) => {
|
||||
const customWebpackConfiguration = require(pathToWebpackConfig);
|
||||
// The extra Webpack configuration file can export a synchronous or asynchronous function,
|
||||
@ -127,4 +127,4 @@ function run(
|
||||
);
|
||||
}
|
||||
|
||||
export default createBuilder<JsonObject & BrowserBuilderSchema>(run);
|
||||
export default createBuilder<JsonObject & BrowserBuilderSchema>(run) as any;
|
||||
|
||||
@ -41,24 +41,28 @@ export function webpackServer(schema: Schema, context: BuilderContext) {
|
||||
);
|
||||
|
||||
if (existsSync(pathToWebpackConfig)) {
|
||||
return serveWebpackBrowser(options as DevServerBuilderOptions, context, {
|
||||
webpackConfiguration: async (baseWebpackConfig) => {
|
||||
const customWebpackConfiguration = require(pathToWebpackConfig);
|
||||
// The extra Webpack configuration file can export a synchronous or asynchronous function,
|
||||
// for instance: `module.exports = async config => { ... }`.
|
||||
if (typeof customWebpackConfiguration === 'function') {
|
||||
return customWebpackConfiguration(baseWebpackConfig);
|
||||
} else {
|
||||
return merge(
|
||||
baseWebpackConfig,
|
||||
// The extra Webpack configuration file can also export a Promise, for instance:
|
||||
// `module.exports = new Promise(...)`. If it exports a single object, but not a Promise,
|
||||
// then await will just resolve that object.
|
||||
await customWebpackConfiguration
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
return serveWebpackBrowser(
|
||||
options as DevServerBuilderOptions,
|
||||
context as any,
|
||||
{
|
||||
webpackConfiguration: async (baseWebpackConfig) => {
|
||||
const customWebpackConfiguration = require(pathToWebpackConfig);
|
||||
// The extra Webpack configuration file can export a synchronous or asynchronous function,
|
||||
// for instance: `module.exports = async config => { ... }`.
|
||||
if (typeof customWebpackConfiguration === 'function') {
|
||||
return customWebpackConfiguration(baseWebpackConfig);
|
||||
} else {
|
||||
return merge(
|
||||
baseWebpackConfig,
|
||||
// The extra Webpack configuration file can also export a Promise, for instance:
|
||||
// `module.exports = new Promise(...)`. If it exports a single object, but not a Promise,
|
||||
// then await will just resolve that object.
|
||||
await customWebpackConfiguration
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
} else {
|
||||
throw new Error(
|
||||
`Custom Webpack Config File Not Found!\nTo use a custom webpack config, please ensure the path to the custom webpack file is correct: \n${pathToWebpackConfig}`
|
||||
@ -66,7 +70,10 @@ export function webpackServer(schema: Schema, context: BuilderContext) {
|
||||
}
|
||||
}
|
||||
|
||||
return serveWebpackBrowser(options as DevServerBuilderOptions, context);
|
||||
return serveWebpackBrowser(
|
||||
options as DevServerBuilderOptions,
|
||||
context as any
|
||||
);
|
||||
}
|
||||
|
||||
export default createBuilder<JsonObject & Schema>(webpackServer);
|
||||
export default createBuilder<JsonObject & Schema>(webpackServer) as any;
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/cli"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/cli",
|
||||
"tsConfig": "packages/cli/tsconfig.lib.json",
|
||||
"packageJson": "packages/cli/package.json",
|
||||
"main": "packages/cli/bin/nx.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/cli",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/create-nx-plugin"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/create-nx-plugin",
|
||||
"tsConfig": "packages/create-nx-plugin/tsconfig.lib.json",
|
||||
"packageJson": "packages/create-nx-plugin/package.json",
|
||||
"main": "packages/create-nx-plugin/bin/create-nx-plugin.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/create-nx-plugin",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/create-nx-workspace"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/create-nx-workspace",
|
||||
"tsConfig": "packages/create-nx-workspace/tsconfig.lib.json",
|
||||
"packageJson": "packages/create-nx-workspace/package.json",
|
||||
"main": "packages/create-nx-workspace/bin/create-nx-workspace.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/create-nx-workspace",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/cypress"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/cypress",
|
||||
"tsConfig": "packages/cypress/tsconfig.lib.json",
|
||||
"packageJson": "packages/cypress/package.json",
|
||||
"main": "packages/cypress/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/cypress",
|
||||
|
||||
@ -26,13 +26,11 @@
|
||||
"outputs": ["coverage/packages/detox"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/detox",
|
||||
"tsConfig": "packages/detox/tsconfig.lib.json",
|
||||
"packageJson": "packages/detox/package.json",
|
||||
"main": "packages/detox/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/detox",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/devkit"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/devkit",
|
||||
"tsConfig": "packages/devkit/tsconfig.lib.json",
|
||||
"packageJson": "packages/devkit/package.json",
|
||||
"main": "packages/devkit/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/devkit",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/eslint-plugin-nx"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/eslint-plugin-nx",
|
||||
"tsConfig": "packages/eslint-plugin-nx/tsconfig.lib.json",
|
||||
"packageJson": "packages/eslint-plugin-nx/package.json",
|
||||
"main": "packages/eslint-plugin-nx/src/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/eslint-plugin-nx",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/express"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/express",
|
||||
"tsConfig": "packages/express/tsconfig.lib.json",
|
||||
"packageJson": "packages/express/package.json",
|
||||
"main": "packages/express/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/express",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/gatsby"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/gatsby",
|
||||
"tsConfig": "packages/gatsby/tsconfig.lib.json",
|
||||
"packageJson": "packages/gatsby/package.json",
|
||||
"main": "packages/gatsby/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/gatsby/src",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/jest"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/jest",
|
||||
"tsConfig": "packages/jest/tsconfig.lib.json",
|
||||
"packageJson": "packages/jest/package.json",
|
||||
"main": "packages/jest/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/jest",
|
||||
|
||||
@ -19,13 +19,11 @@
|
||||
}
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/js",
|
||||
"tsConfig": "packages/js/tsconfig.lib.json",
|
||||
"packageJson": "packages/js/package.json",
|
||||
"main": "packages/js/src/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/js",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/linter"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/linter",
|
||||
"tsConfig": "packages/linter/tsconfig.lib.json",
|
||||
"packageJson": "packages/linter/package.json",
|
||||
"main": "packages/linter/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/linter",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/nest"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/nest",
|
||||
"tsConfig": "packages/nest/tsconfig.lib.json",
|
||||
"packageJson": "packages/nest/package.json",
|
||||
"main": "packages/nest/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/nest",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/next"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/next",
|
||||
"tsConfig": "packages/next/tsconfig.lib.json",
|
||||
"packageJson": "packages/next/package.json",
|
||||
"main": "packages/next/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/next",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/node"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/node",
|
||||
"tsConfig": "packages/node/tsconfig.lib.json",
|
||||
"packageJson": "packages/node/package.json",
|
||||
"main": "packages/node/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/node",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/nx-plugin"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/nx-plugin",
|
||||
"tsConfig": "packages/nx-plugin/tsconfig.lib.json",
|
||||
"packageJson": "packages/nx-plugin/package.json",
|
||||
"main": "packages/nx-plugin/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/nx-plugin",
|
||||
|
||||
@ -4,13 +4,11 @@
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/nx",
|
||||
"tsConfig": "packages/nx/tsconfig.lib.json",
|
||||
"packageJson": "packages/nx/package.json",
|
||||
"main": "packages/nx/bin/nx.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/nx",
|
||||
|
||||
@ -26,13 +26,11 @@
|
||||
"outputs": ["coverage/packages/react-native"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/react-native",
|
||||
"tsConfig": "packages/react-native/tsconfig.lib.json",
|
||||
"packageJson": "packages/react-native/package.json",
|
||||
"main": "packages/react-native/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
"packages/react-native/*.md",
|
||||
{
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/react"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/react",
|
||||
"tsConfig": "packages/react/tsconfig.lib.json",
|
||||
"packageJson": "packages/react/package.json",
|
||||
"main": "packages/react/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/react",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/storybook"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/storybook",
|
||||
"tsConfig": "packages/storybook/tsconfig.lib.json",
|
||||
"packageJson": "packages/storybook/package.json",
|
||||
"main": "packages/storybook/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/storybook",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/tao"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/tao",
|
||||
"tsConfig": "packages/tao/tsconfig.lib.json",
|
||||
"packageJson": "packages/tao/package.json",
|
||||
"main": "packages/tao/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/tao",
|
||||
|
||||
@ -12,13 +12,11 @@
|
||||
"outputs": ["coverage/packages/web"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/web",
|
||||
"tsConfig": "packages/web/tsconfig.lib.json",
|
||||
"packageJson": "packages/web/package.json",
|
||||
"main": "packages/web/index.ts",
|
||||
"updateBuildableProjectDepsInPackageJson": false,
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/web",
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"outputs": ["coverage/packages/workspace"]
|
||||
},
|
||||
"build-base": {
|
||||
"executor": "@nrwl/node:package",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/workspace",
|
||||
"tsConfig": "packages/workspace/tsconfig.lib.json",
|
||||
@ -24,8 +24,7 @@
|
||||
{
|
||||
"input": "packages/workspace",
|
||||
"glob": "**/files/**",
|
||||
"output": "/",
|
||||
"dot": true
|
||||
"output": "/"
|
||||
},
|
||||
{
|
||||
"input": "packages/workspace",
|
||||
|
||||
@ -10,7 +10,6 @@ import { DefaultTasksRunnerOptions } from './default-tasks-runner';
|
||||
import { TaskStatus } from './tasks-runner';
|
||||
import {
|
||||
calculateReverseDeps,
|
||||
getCustomHasher,
|
||||
getExecutorForTask,
|
||||
getOutputs,
|
||||
removeTasksFromTaskGraph,
|
||||
@ -22,6 +21,7 @@ export class TaskOrchestrator {
|
||||
private workspace = new Workspaces(appRootPath);
|
||||
private forkedProcessTaskRunner = new ForkedProcessTaskRunner(this.options);
|
||||
private tasksSchedule = new TasksSchedule(
|
||||
this.hasher,
|
||||
this.taskGraph,
|
||||
this.workspace,
|
||||
this.options
|
||||
@ -46,7 +46,7 @@ export class TaskOrchestrator {
|
||||
|
||||
async run() {
|
||||
// initial scheduling
|
||||
this.tasksSchedule.scheduleNextTasks();
|
||||
await this.tasksSchedule.scheduleNextTasks();
|
||||
performance.mark('task-execution-begins');
|
||||
|
||||
const threads = [];
|
||||
@ -198,15 +198,6 @@ export class TaskOrchestrator {
|
||||
batch
|
||||
);
|
||||
const batchResultEntries = Object.entries(results);
|
||||
|
||||
// Hash tasks after the batch is done
|
||||
// Tasks that are not at the root might need to be updated
|
||||
await Promise.all(
|
||||
batchResultEntries.map(([taskId]) =>
|
||||
this.hashTask(this.taskGraph.tasks[taskId])
|
||||
)
|
||||
);
|
||||
|
||||
return batchResultEntries.map(([taskId, result]) => ({
|
||||
task: this.taskGraph.tasks[taskId],
|
||||
status: (result.success ? 'success' : 'failure') as TaskStatus,
|
||||
@ -288,8 +279,6 @@ export class TaskOrchestrator {
|
||||
|
||||
// region Lifecycle
|
||||
private async preRunSteps(tasks: Task[]) {
|
||||
// Hash the task before it is run
|
||||
await Promise.all(tasks.map((task) => this.hashTask(task)));
|
||||
this.options.lifeCycle.startTasks(tasks);
|
||||
}
|
||||
|
||||
@ -338,7 +327,7 @@ export class TaskOrchestrator {
|
||||
})
|
||||
);
|
||||
|
||||
this.tasksSchedule.scheduleNextTasks();
|
||||
await this.tasksSchedule.scheduleNextTasks();
|
||||
}
|
||||
|
||||
private complete(
|
||||
@ -372,15 +361,6 @@ export class TaskOrchestrator {
|
||||
|
||||
// region utils
|
||||
|
||||
private async hashTask(task: Task) {
|
||||
const customHasher = getCustomHasher(task, this.workspace);
|
||||
const { value, details } = await (customHasher
|
||||
? customHasher(task, this.taskGraph, this.hasher)
|
||||
: this.hasher.hashTaskWithDepsAndContext(task));
|
||||
task.hash = value;
|
||||
task.hashDetails = details;
|
||||
}
|
||||
|
||||
private pipeOutputCapture(task: Task) {
|
||||
try {
|
||||
return (
|
||||
|
||||
@ -82,13 +82,22 @@ describe('TasksSchedule', () => {
|
||||
},
|
||||
};
|
||||
|
||||
taskSchedule = new TasksSchedule(taskGraph, workspace as Workspaces, {
|
||||
lifeCycle: {
|
||||
startTask: jest.fn(),
|
||||
endTask: jest.fn(),
|
||||
scheduleTask: jest.fn(),
|
||||
},
|
||||
});
|
||||
const hasher = {
|
||||
hashTaskWithDepsAndContext: () => 'hash',
|
||||
} as any;
|
||||
|
||||
taskSchedule = new TasksSchedule(
|
||||
hasher,
|
||||
taskGraph,
|
||||
workspace as Workspaces,
|
||||
{
|
||||
lifeCycle: {
|
||||
startTask: jest.fn(),
|
||||
endTask: jest.fn(),
|
||||
scheduleTask: jest.fn(),
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('Without Batch Mode', () => {
|
||||
@ -107,14 +116,14 @@ describe('TasksSchedule', () => {
|
||||
expect(taskSchedule.nextTask()).toBeNull();
|
||||
});
|
||||
|
||||
it('should schedule root tasks first', () => {
|
||||
taskSchedule.scheduleNextTasks();
|
||||
it('should schedule root tasks first', async () => {
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
expect(taskSchedule.nextTask()).toEqual(lib1Build);
|
||||
expect(taskSchedule.nextTask()).toEqual(app2Build);
|
||||
});
|
||||
|
||||
it('should not schedule any tasks that still have uncompleted dependencies', () => {
|
||||
taskSchedule.scheduleNextTasks();
|
||||
it('should not schedule any tasks that still have uncompleted dependencies', async () => {
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
taskSchedule.nextTask();
|
||||
taskSchedule.nextTask();
|
||||
expect(taskSchedule.nextTask()).toBeNull();
|
||||
@ -124,18 +133,18 @@ describe('TasksSchedule', () => {
|
||||
expect(taskSchedule.nextTask()).toBeNull();
|
||||
});
|
||||
|
||||
it('should continue to schedule tasks that have completed dependencies', () => {
|
||||
taskSchedule.scheduleNextTasks();
|
||||
it('should continue to schedule tasks that have completed dependencies', async () => {
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
taskSchedule.nextTask();
|
||||
taskSchedule.nextTask();
|
||||
taskSchedule.complete([lib1Build.id]);
|
||||
|
||||
taskSchedule.scheduleNextTasks();
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
expect(taskSchedule.nextTask()).toEqual(app1Build);
|
||||
});
|
||||
|
||||
it('should run out of tasks when they are all complete', () => {
|
||||
taskSchedule.scheduleNextTasks();
|
||||
it('should run out of tasks when they are all complete', async () => {
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
taskSchedule.nextTask();
|
||||
taskSchedule.nextTask();
|
||||
taskSchedule.complete([lib1Build.id, app1Build.id, app2Build.id]);
|
||||
@ -143,8 +152,8 @@ describe('TasksSchedule', () => {
|
||||
expect(taskSchedule.hasTasks()).toEqual(false);
|
||||
});
|
||||
|
||||
it('should not schedule batches', () => {
|
||||
taskSchedule.scheduleNextTasks();
|
||||
it('should not schedule batches', async () => {
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
|
||||
expect(taskSchedule.nextTask()).not.toBeNull();
|
||||
|
||||
@ -163,8 +172,8 @@ describe('TasksSchedule', () => {
|
||||
process.env['NX_BATCH_MODE'] = original;
|
||||
});
|
||||
|
||||
it('should schedule batches of tasks by different executors', () => {
|
||||
taskSchedule.scheduleNextTasks();
|
||||
it('should schedule batches of tasks by different executors', async () => {
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
|
||||
expect(taskSchedule.nextTask()).toBeNull();
|
||||
|
||||
@ -181,8 +190,8 @@ describe('TasksSchedule', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should run out of tasks when all batches are done', () => {
|
||||
taskSchedule.scheduleNextTasks();
|
||||
it('should run out of tasks when all batches are done', async () => {
|
||||
await taskSchedule.scheduleNextTasks();
|
||||
taskSchedule.nextBatch();
|
||||
taskSchedule.nextBatch();
|
||||
taskSchedule.complete(['app1:build', 'lib1:build', 'app2:build']);
|
||||
|
||||
@ -4,11 +4,13 @@ import { Workspaces } from '@nrwl/tao/src/shared/workspace';
|
||||
|
||||
import {
|
||||
calculateReverseDeps,
|
||||
getCustomHasher,
|
||||
getExecutorForTask,
|
||||
getExecutorNameForTask,
|
||||
removeTasksFromTaskGraph,
|
||||
} from './utils';
|
||||
import { DefaultTasksRunnerOptions } from './default-tasks-runner';
|
||||
import { Hasher } from '@nrwl/workspace/src/core/hasher/hasher';
|
||||
|
||||
export interface Batch {
|
||||
executorName: string;
|
||||
@ -26,18 +28,19 @@ export class TasksSchedule {
|
||||
private completedTasks = new Set<string>();
|
||||
|
||||
constructor(
|
||||
private readonly hasher: Hasher,
|
||||
private taskGraph: TaskGraph,
|
||||
private workspace: Workspaces,
|
||||
private options: DefaultTasksRunnerOptions
|
||||
) {}
|
||||
|
||||
public scheduleNextTasks() {
|
||||
public async scheduleNextTasks() {
|
||||
if (process.env.NX_BATCH_MODE === 'true') {
|
||||
this.scheduleBatches();
|
||||
}
|
||||
for (let root of this.notScheduledTaskGraph.roots) {
|
||||
if (this.canBeScheduled(root)) {
|
||||
this.scheduleTask(root);
|
||||
await this.scheduleTask(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,8 +78,9 @@ export class TasksSchedule {
|
||||
: null;
|
||||
}
|
||||
|
||||
private scheduleTask(taskId: string) {
|
||||
private async scheduleTask(taskId: string) {
|
||||
const task = this.taskGraph.tasks[taskId];
|
||||
await this.hashTask(task);
|
||||
|
||||
this.notScheduledTaskGraph = removeTasksFromTaskGraph(
|
||||
this.notScheduledTaskGraph,
|
||||
@ -155,4 +159,13 @@ export class TasksSchedule {
|
||||
this.completedTasks.has(id)
|
||||
);
|
||||
}
|
||||
|
||||
private async hashTask(task: Task) {
|
||||
const customHasher = getCustomHasher(task, this.workspace);
|
||||
const { value, details } = await (customHasher
|
||||
? customHasher(task, this.taskGraph, this.hasher)
|
||||
: this.hasher.hashTaskWithDepsAndContext(task));
|
||||
task.hash = value;
|
||||
task.hashDetails = details;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build-base": {
|
||||
"executor": "@nrwl/workspace:tsc",
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/typedoc-theme",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user