@nx/js 16.4.0-beta.1 → 16.4.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/executors.json +1 -0
- package/generators.json +12 -0
- package/package.json +6 -5
- package/plugins/jest/local-registry.d.ts +1 -0
- package/plugins/jest/local-registry.js +4 -0
- package/src/executors/node/node.impl.js +57 -7
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.d.ts +4 -0
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.js +54 -0
- package/src/executors/tsc/lib/batch/generate-temp-tsconfig.d.ts +3 -0
- package/src/executors/tsc/lib/batch/generate-temp-tsconfig.js +52 -0
- package/src/executors/tsc/lib/batch/get-task-options.d.ts +3 -0
- package/src/executors/tsc/lib/batch/get-task-options.js +24 -0
- package/src/executors/tsc/lib/batch/index.d.ts +8 -0
- package/src/executors/tsc/lib/batch/index.js +11 -0
- package/src/executors/tsc/lib/batch/normalize-tasks-options.d.ts +3 -0
- package/src/executors/tsc/lib/batch/normalize-tasks-options.js +14 -0
- package/src/executors/tsc/lib/batch/types.d.ts +12 -0
- package/src/executors/tsc/lib/batch/types.js +2 -0
- package/src/executors/tsc/lib/batch/typescript-compilation.d.ts +7 -0
- package/src/executors/tsc/lib/batch/typescript-compilation.js +195 -0
- package/src/executors/tsc/lib/batch/typescript-diagnostic-reporters.d.ts +4 -0
- package/src/executors/tsc/lib/batch/typescript-diagnostic-reporters.js +44 -0
- package/src/executors/tsc/lib/batch/watch.d.ts +3 -0
- package/src/executors/tsc/lib/batch/watch.js +63 -0
- package/src/executors/tsc/lib/get-custom-transformers-factory.d.ts +3 -0
- package/src/executors/tsc/lib/get-custom-transformers-factory.js +13 -0
- package/src/executors/tsc/lib/index.d.ts +2 -0
- package/src/executors/tsc/lib/index.js +5 -0
- package/src/executors/tsc/lib/normalize-options.d.ts +2 -0
- package/src/executors/tsc/lib/normalize-options.js +32 -0
- package/src/executors/tsc/tsc.batch-impl.d.ts +4 -0
- package/src/executors/tsc/tsc.batch-impl.js +47 -0
- package/src/executors/tsc/tsc.impl.d.ts +0 -1
- package/src/executors/tsc/tsc.impl.js +4 -39
- package/src/executors/verdaccio/verdaccio.impl.d.ts +1 -0
- package/src/executors/verdaccio/verdaccio.impl.js +25 -22
- package/src/generators/library/library.js +2 -10
- package/src/generators/library/schema.json +7 -6
- package/src/generators/setup-build/generator.d.ts +5 -0
- package/src/generators/setup-build/generator.js +133 -0
- package/src/generators/setup-build/schema.d.ts +7 -0
- package/src/generators/setup-build/schema.json +42 -0
- package/src/generators/setup-verdaccio/files/config.yml +1 -1
- package/src/generators/setup-verdaccio/generator.js +5 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/plugins/jest/start-local-registry.d.ts +12 -0
- package/src/plugins/jest/start-local-registry.js +61 -0
- package/src/utils/add-babel-inputs.d.ts +1 -0
- package/src/utils/add-babel-inputs.js +2 -0
- package/src/utils/add-local-registry-scripts.d.ts +5 -0
- package/src/utils/add-local-registry-scripts.js +57 -0
- package/src/utils/assets/copy-assets-handler.d.ts +5 -1
- package/src/utils/assets/copy-assets-handler.js +34 -23
- package/src/utils/inline.d.ts +1 -1
- package/src/utils/inline.js +3 -3
- package/src/utils/minimal-publish-script.js +2 -5
- package/src/utils/schema.d.ts +3 -2
- package/src/utils/swc/add-swc-config.d.ts +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SetupBuild",
|
|
4
|
+
"title": "Setup Build",
|
|
5
|
+
"description": "Sets up build target for a project.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"project": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Project to add the build target to.",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
},
|
|
15
|
+
"x-prompt": "Which project do you want to add build to?",
|
|
16
|
+
"x-dropdown": "projects",
|
|
17
|
+
"x-priority": "important"
|
|
18
|
+
},
|
|
19
|
+
"bundler": {
|
|
20
|
+
"description": "The bundler to use to build the project.",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"enum": ["tsc", "swc", "rollup", "vite", "esbuild"],
|
|
23
|
+
"default": "tsc",
|
|
24
|
+
"x-prompt": "Which bundler would you like to use to build the project?",
|
|
25
|
+
"x-priority": "important"
|
|
26
|
+
},
|
|
27
|
+
"main": {
|
|
28
|
+
"description": "The path to the main entry file, relative to workspace root. Defaults to <project>/src/index.ts or <project>/src/main.ts.",
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"tsConfig": {
|
|
32
|
+
"description": "The path to the tsConfig file, relative to workspace root. Defaults to <project>/tsconfig.lib.json or <project>/tsconfig.app.json depending on project type.",
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"buildTarget": {
|
|
36
|
+
"description": "The build target to add.",
|
|
37
|
+
"type": "string",
|
|
38
|
+
"default": "build"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"required": ["project", "bundler"]
|
|
42
|
+
}
|
|
@@ -5,10 +5,14 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const versions_1 = require("../../utils/versions");
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
8
9
|
function setupVerdaccio(tree, options) {
|
|
10
|
+
var _a, _b, _c;
|
|
9
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
12
|
if (!tree.exists('.verdaccio/config.yml')) {
|
|
11
|
-
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), '.verdaccio', {
|
|
13
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), '.verdaccio', {
|
|
14
|
+
npmUplinkRegistry: (_c = (_b = (_a = (0, child_process_1.execSync)('npm config get registry')) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : 'https://registry.npmjs.org',
|
|
15
|
+
});
|
|
12
16
|
}
|
|
13
17
|
const verdaccioTarget = {
|
|
14
18
|
executor: '@nx/js:verdaccio',
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPackageJson = exports.getLockFileName = exports.createLockFile = exports.initGenerator = exports.libraryGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./utils/typescript/add-tslib-dependencies"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./utils/typescript/load-ts-transformers"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./utils/typescript/print-diagnostics"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./utils/typescript/run-type-check"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function is used to start a local registry for testing purposes.
|
|
3
|
+
* @param localRegistryTarget the target to run to start the local registry e.g. workspace:local-registry
|
|
4
|
+
* @param storage the storage location for the local registry
|
|
5
|
+
* @param verbose whether to log verbose output
|
|
6
|
+
*/
|
|
7
|
+
export declare function startLocalRegistry({ localRegistryTarget, storage, verbose, }: {
|
|
8
|
+
localRegistryTarget: string;
|
|
9
|
+
storage?: string;
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
}): Promise<() => void>;
|
|
12
|
+
export default startLocalRegistry;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startLocalRegistry = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
/**
|
|
6
|
+
* This function is used to start a local registry for testing purposes.
|
|
7
|
+
* @param localRegistryTarget the target to run to start the local registry e.g. workspace:local-registry
|
|
8
|
+
* @param storage the storage location for the local registry
|
|
9
|
+
* @param verbose whether to log verbose output
|
|
10
|
+
*/
|
|
11
|
+
function startLocalRegistry({ localRegistryTarget, storage, verbose, }) {
|
|
12
|
+
if (!localRegistryTarget) {
|
|
13
|
+
throw new Error(`localRegistryTarget is required`);
|
|
14
|
+
}
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const childProcess = (0, child_process_1.fork)(require.resolve('nx'), [
|
|
18
|
+
...`run ${localRegistryTarget} --location none --clear true`.split(' '),
|
|
19
|
+
...(storage ? [`--storage`, storage] : []),
|
|
20
|
+
], { stdio: 'pipe' });
|
|
21
|
+
const listener = (data) => {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
if (verbose) {
|
|
24
|
+
process.stdout.write(data);
|
|
25
|
+
}
|
|
26
|
+
if (data.toString().includes('http://localhost:')) {
|
|
27
|
+
const port = parseInt((_b = (_a = data.toString().match(/localhost:(?<port>\d+)/)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.port);
|
|
28
|
+
console.log('Local registry started on port ' + port);
|
|
29
|
+
const registry = `http://localhost:${port}`;
|
|
30
|
+
process.env.npm_config_registry = registry;
|
|
31
|
+
process.env.YARN_REGISTRY = registry;
|
|
32
|
+
(0, child_process_1.execSync)(`npm config set //localhost:${port}/:_authToken "secretVerdaccioToken"`);
|
|
33
|
+
console.log('Set npm and yarn config registry to ' + registry);
|
|
34
|
+
resolve(() => {
|
|
35
|
+
childProcess.kill();
|
|
36
|
+
(0, child_process_1.execSync)(`npm config delete //localhost:${port}/:_authToken`);
|
|
37
|
+
});
|
|
38
|
+
(_c = childProcess === null || childProcess === void 0 ? void 0 : childProcess.stdout) === null || _c === void 0 ? void 0 : _c.off('data', listener);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
(_a = childProcess === null || childProcess === void 0 ? void 0 : childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', listener);
|
|
42
|
+
(_b = childProcess === null || childProcess === void 0 ? void 0 : childProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
|
|
43
|
+
process.stderr.write(data);
|
|
44
|
+
});
|
|
45
|
+
childProcess.on('error', (err) => {
|
|
46
|
+
console.log('local registry error', err);
|
|
47
|
+
reject(err);
|
|
48
|
+
});
|
|
49
|
+
childProcess.on('exit', (code) => {
|
|
50
|
+
console.log('local registry exit', code);
|
|
51
|
+
if (code !== 0) {
|
|
52
|
+
reject(code);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
resolve(() => { });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
exports.startLocalRegistry = startLocalRegistry;
|
|
61
|
+
exports.default = startLocalRegistry;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addBabelInputs = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
/** @deprecated Do not use this function as the root babel.config.json file is no longer needed */
|
|
6
|
+
// TODO(jack): Remove This in Nx 17 once we don't need to support Nx 15 anymore. Currently this function is used in v15 migrations.
|
|
5
7
|
function addBabelInputs(tree) {
|
|
6
8
|
var _a;
|
|
7
9
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addLocalRegistryScripts = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const startLocalRegistryScript = (localRegistryTarget) => `
|
|
6
|
+
/**
|
|
7
|
+
* This script starts a local registry for e2e testing purposes.
|
|
8
|
+
* It is meant to be called in jest's globalSetup.
|
|
9
|
+
*/
|
|
10
|
+
import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry';
|
|
11
|
+
import { execFileSync } from 'child_process';
|
|
12
|
+
|
|
13
|
+
export default async () => {
|
|
14
|
+
// local registry target to run
|
|
15
|
+
const localRegistryTarget = '${localRegistryTarget}';
|
|
16
|
+
// storage folder for the local registry
|
|
17
|
+
const storage = './tmp/local-registry/storage';
|
|
18
|
+
|
|
19
|
+
global.stopLocalRegistry = await startLocalRegistry({
|
|
20
|
+
localRegistryTarget,
|
|
21
|
+
storage,
|
|
22
|
+
verbose: false,
|
|
23
|
+
});
|
|
24
|
+
const nx = require.resolve('nx');
|
|
25
|
+
execFileSync(
|
|
26
|
+
nx,
|
|
27
|
+
['run-many', '--targets', 'publish', '--ver', '1.0.0', '--tag', 'e2e'],
|
|
28
|
+
{ env: process.env, stdio: 'inherit' }
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
`;
|
|
32
|
+
const stopLocalRegistryScript = `
|
|
33
|
+
/**
|
|
34
|
+
* This script stops the local registry for e2e testing purposes.
|
|
35
|
+
* It is meant to be called in jest's globalTeardown.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export default () => {
|
|
39
|
+
if (global.stopLocalRegistry) {
|
|
40
|
+
global.stopLocalRegistry();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
`;
|
|
44
|
+
function addLocalRegistryScripts(tree) {
|
|
45
|
+
const startLocalRegistryPath = 'tools/scripts/start-local-registry.ts';
|
|
46
|
+
const stopLocalRegistryPath = 'tools/scripts/stop-local-registry.ts';
|
|
47
|
+
const projectConfiguration = (0, devkit_1.readJson)(tree, 'project.json');
|
|
48
|
+
const localRegistryTarget = `${projectConfiguration.name}:local-registry`;
|
|
49
|
+
if (!tree.exists(startLocalRegistryPath)) {
|
|
50
|
+
tree.write(startLocalRegistryPath, startLocalRegistryScript(localRegistryTarget));
|
|
51
|
+
}
|
|
52
|
+
if (!tree.exists(stopLocalRegistryPath)) {
|
|
53
|
+
tree.write(stopLocalRegistryPath, stopLocalRegistryScript);
|
|
54
|
+
}
|
|
55
|
+
return { startLocalRegistryPath, stopLocalRegistryPath };
|
|
56
|
+
}
|
|
57
|
+
exports.addLocalRegistryScripts = addLocalRegistryScripts;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AssetGlob } from './assets';
|
|
2
|
+
import { ChangedFile } from 'nx/src/daemon/client/client';
|
|
2
3
|
export type FileEventType = 'create' | 'update' | 'delete';
|
|
3
4
|
export interface FileEvent {
|
|
4
5
|
type: FileEventType;
|
|
@@ -22,7 +23,10 @@ export declare class CopyAssetsHandler {
|
|
|
22
23
|
private readonly callback;
|
|
23
24
|
constructor(opts: CopyAssetHandlerOptions);
|
|
24
25
|
processAllAssetsOnce(): Promise<void>;
|
|
26
|
+
processAllAssetsOnceSync(): void;
|
|
25
27
|
watchAndProcessOnAssetChange(): Promise<() => void>;
|
|
26
|
-
|
|
28
|
+
processWatchEvents(events: ChangedFile[]): Promise<void>;
|
|
29
|
+
private filesToEvent;
|
|
30
|
+
private normalizeAssetPattern;
|
|
27
31
|
}
|
|
28
32
|
export {};
|
|
@@ -74,35 +74,27 @@ class CopyAssetsHandler {
|
|
|
74
74
|
processAllAssetsOnce() {
|
|
75
75
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
76
|
yield Promise.all(this.assetGlobs.map((ag) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
|
|
78
|
-
if (typeof ag === 'string') {
|
|
79
|
-
pattern = ag;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
pattern = ag.pattern;
|
|
83
|
-
}
|
|
77
|
+
const pattern = this.normalizeAssetPattern(ag);
|
|
84
78
|
// fast-glob only supports Unix paths
|
|
85
79
|
const files = yield fg(pattern.replace(/\\/g, '/'), {
|
|
86
80
|
cwd: this.rootDir,
|
|
87
81
|
dot: true, // enable hidden files
|
|
88
82
|
});
|
|
89
|
-
this.callback(
|
|
90
|
-
var _a;
|
|
91
|
-
if (!((_a = ag.ignore) === null || _a === void 0 ? void 0 : _a.some((ig) => minimatch(src, ig))) &&
|
|
92
|
-
!this.ignore.ignores(src)) {
|
|
93
|
-
const relPath = path.relative(ag.input, src);
|
|
94
|
-
const dest = relPath.startsWith('..') ? src : relPath;
|
|
95
|
-
acc.push({
|
|
96
|
-
type: 'create',
|
|
97
|
-
src: path.join(this.rootDir, src),
|
|
98
|
-
dest: path.join(this.rootDir, ag.output, dest),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return acc;
|
|
102
|
-
}, []));
|
|
83
|
+
this.callback(this.filesToEvent(files, ag));
|
|
103
84
|
})));
|
|
104
85
|
});
|
|
105
86
|
}
|
|
87
|
+
processAllAssetsOnceSync() {
|
|
88
|
+
this.assetGlobs.forEach((ag) => {
|
|
89
|
+
const pattern = this.normalizeAssetPattern(ag);
|
|
90
|
+
// fast-glob only supports Unix paths
|
|
91
|
+
const files = fg.sync(pattern.replace(/\\/g, '/'), {
|
|
92
|
+
cwd: this.rootDir,
|
|
93
|
+
dot: true, // enable hidden files
|
|
94
|
+
});
|
|
95
|
+
this.callback(this.filesToEvent(files, ag));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
106
98
|
watchAndProcessOnAssetChange() {
|
|
107
99
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
100
|
const unregisterFileWatcher = yield client_1.daemonClient.registerFileWatcher({
|
|
@@ -118,13 +110,13 @@ class CopyAssetsHandler {
|
|
|
118
110
|
devkit_1.logger.error(`Watch error: ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : 'Unknown'}`);
|
|
119
111
|
}
|
|
120
112
|
else {
|
|
121
|
-
this.
|
|
113
|
+
this.processWatchEvents(data.changedFiles);
|
|
122
114
|
}
|
|
123
115
|
});
|
|
124
116
|
return () => unregisterFileWatcher();
|
|
125
117
|
});
|
|
126
118
|
}
|
|
127
|
-
|
|
119
|
+
processWatchEvents(events) {
|
|
128
120
|
var _a;
|
|
129
121
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
130
122
|
const fileEvents = [];
|
|
@@ -150,5 +142,24 @@ class CopyAssetsHandler {
|
|
|
150
142
|
this.callback(fileEvents);
|
|
151
143
|
});
|
|
152
144
|
}
|
|
145
|
+
filesToEvent(files, assetGlob) {
|
|
146
|
+
return files.reduce((acc, src) => {
|
|
147
|
+
var _a;
|
|
148
|
+
if (!((_a = assetGlob.ignore) === null || _a === void 0 ? void 0 : _a.some((ig) => minimatch(src, ig))) &&
|
|
149
|
+
!this.ignore.ignores(src)) {
|
|
150
|
+
const relPath = path.relative(assetGlob.input, src);
|
|
151
|
+
const dest = relPath.startsWith('..') ? src : relPath;
|
|
152
|
+
acc.push({
|
|
153
|
+
type: 'create',
|
|
154
|
+
src: path.join(this.rootDir, src),
|
|
155
|
+
dest: path.join(this.rootDir, assetGlob.output, dest),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return acc;
|
|
159
|
+
}, []);
|
|
160
|
+
}
|
|
161
|
+
normalizeAssetPattern(assetEntry) {
|
|
162
|
+
return typeof assetEntry === 'string' ? assetEntry : assetEntry.pattern;
|
|
163
|
+
}
|
|
153
164
|
}
|
|
154
165
|
exports.CopyAssetsHandler = CopyAssetsHandler;
|
package/src/utils/inline.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface InlineProjectGraph {
|
|
|
13
13
|
dependencies: Record<string, string[]>;
|
|
14
14
|
}
|
|
15
15
|
export declare function isInlineGraphEmpty(inlineGraph: InlineProjectGraph): boolean;
|
|
16
|
-
export declare function handleInliningBuild(context: ExecutorContext, options: NormalizedExecutorOptions, tsConfigPath: string): InlineProjectGraph;
|
|
16
|
+
export declare function handleInliningBuild(context: ExecutorContext, options: NormalizedExecutorOptions, tsConfigPath: string, projectName?: string): InlineProjectGraph;
|
|
17
17
|
export declare function postProcessInlinedDependencies(outputPath: string, parentOutputPath: string, inlineGraph: InlineProjectGraph): void;
|
|
18
18
|
export declare function getRootTsConfigPath(context: ExecutorContext): string | null;
|
|
19
19
|
export {};
|
package/src/utils/inline.js
CHANGED
|
@@ -9,11 +9,11 @@ function isInlineGraphEmpty(inlineGraph) {
|
|
|
9
9
|
return Object.keys(inlineGraph.nodes).length === 0;
|
|
10
10
|
}
|
|
11
11
|
exports.isInlineGraphEmpty = isInlineGraphEmpty;
|
|
12
|
-
function handleInliningBuild(context, options, tsConfigPath) {
|
|
12
|
+
function handleInliningBuild(context, options, tsConfigPath, projectName = context.projectName) {
|
|
13
13
|
var _a;
|
|
14
14
|
const tsConfigJson = (0, devkit_1.readJsonFile)(tsConfigPath);
|
|
15
15
|
const pathAliases = ((_a = tsConfigJson['compilerOptions']) === null || _a === void 0 ? void 0 : _a['paths']) || readBasePathAliases(context);
|
|
16
|
-
const inlineGraph = createInlineGraph(context, options, pathAliases);
|
|
16
|
+
const inlineGraph = createInlineGraph(context, options, pathAliases, projectName);
|
|
17
17
|
if (isInlineGraphEmpty(inlineGraph)) {
|
|
18
18
|
return inlineGraph;
|
|
19
19
|
}
|
|
@@ -81,7 +81,7 @@ function projectNodeToInlineProjectNode(projectNode, pathAlias = '', buildOutput
|
|
|
81
81
|
buildOutputPath,
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function createInlineGraph(context, options, pathAliases, projectName
|
|
84
|
+
function createInlineGraph(context, options, pathAliases, projectName, inlineGraph = emptyInlineGraph()) {
|
|
85
85
|
var _a;
|
|
86
86
|
var _b;
|
|
87
87
|
if (options.external == null)
|
|
@@ -13,14 +13,13 @@ const publishScriptContent = `
|
|
|
13
13
|
|
|
14
14
|
import { execSync } from 'child_process';
|
|
15
15
|
import { readFileSync, writeFileSync } from 'fs';
|
|
16
|
-
import chalk from 'chalk';
|
|
17
16
|
|
|
18
17
|
import devkit from '@nx/devkit';
|
|
19
18
|
const { readCachedProjectGraph } = devkit;
|
|
20
19
|
|
|
21
20
|
function invariant(condition, message) {
|
|
22
21
|
if (!condition) {
|
|
23
|
-
console.error(
|
|
22
|
+
console.error(message);
|
|
24
23
|
process.exit(1);
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -59,9 +58,7 @@ try {
|
|
|
59
58
|
json.version = version;
|
|
60
59
|
writeFileSync(\`package.json\`, JSON.stringify(json, null, 2));
|
|
61
60
|
} catch (e) {
|
|
62
|
-
console.error(
|
|
63
|
-
chalk.bold.red(\`Error reading package.json file from library build output.\`)
|
|
64
|
-
);
|
|
61
|
+
console.error(\`Error reading package.json file from library build output.\`);
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
// Execute "npm publish" to publish
|
package/src/utils/schema.d.ts
CHANGED
|
@@ -50,11 +50,12 @@ export interface ExecutorOptions {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface NormalizedExecutorOptions extends ExecutorOptions {
|
|
53
|
-
|
|
54
|
-
sourceRoot?: string;
|
|
53
|
+
rootDir: string;
|
|
55
54
|
projectRoot: string;
|
|
56
55
|
mainOutputPath: string;
|
|
57
56
|
files: Array<FileInputOutput>;
|
|
57
|
+
root?: string;
|
|
58
|
+
sourceRoot?: string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export interface SwcExecutorOptions extends ExecutorOptions {
|