@nx/js 21.4.0-beta.0 → 21.4.0-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "21.4.0-beta.0",
3
+ "version": "21.4.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "@babel/preset-env": "^7.23.2",
40
40
  "@babel/preset-typescript": "^7.22.5",
41
41
  "@babel/runtime": "^7.22.6",
42
- "@nx/devkit": "21.4.0-beta.0",
43
- "@nx/workspace": "21.4.0-beta.0",
42
+ "@nx/devkit": "21.4.0-beta.2",
43
+ "@nx/workspace": "21.4.0-beta.2",
44
44
  "@zkochan/js-yaml": "0.0.7",
45
45
  "babel-plugin-const-enum": "^1.0.1",
46
46
  "babel-plugin-macros": "^3.1.0",
@@ -63,7 +63,7 @@
63
63
  "tslib": "^2.3.0"
64
64
  },
65
65
  "devDependencies": {
66
- "nx": "21.4.0-beta.0"
66
+ "nx": "21.4.0-beta.2"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "verdaccio": "^6.0.5"
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-sync.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/typescript-sync/typescript-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AA0CtC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAyM5E;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"typescript-sync.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/typescript-sync/typescript-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AAuCtC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgO5E;AAED,eAAe,aAAa,CAAC"}
@@ -22,7 +22,6 @@ async function syncGenerator(tree) {
22
22
  composite: new Map(),
23
23
  content: new Map(),
24
24
  exists: new Map(),
25
- isFile: new Map(),
26
25
  };
27
26
  // Root tsconfig containing project references for the whole workspace
28
27
  const rootTsconfigPath = 'tsconfig.json';
@@ -63,18 +62,18 @@ async function syncGenerator(tree) {
63
62
  // made by this generator to know if the TS config is out of sync with the
64
63
  // project graph. Therefore, we don't format the files if there were no changes
65
64
  // to avoid potential format-only changes that can lead to false positives.
66
- let hasChanges = false;
65
+ const changedFiles = new Map();
67
66
  if (tsconfigProjectNodeValues.length > 0) {
68
67
  const referencesSet = new Set();
69
68
  for (const ref of rootTsconfig.references ?? []) {
70
69
  // reference path is relative to the tsconfig file
71
- const resolvedRefPath = getTsConfigPathFromReferencePath(tree, rootTsconfigPath, ref.path, tsconfigInfoCaches);
70
+ const resolvedRefPath = getTsConfigPathFromReferencePath(rootTsconfigPath, ref.path);
72
71
  if (tsconfigExists(tree, tsconfigInfoCaches, resolvedRefPath)) {
73
72
  // we only keep the references that still exist
74
73
  referencesSet.add(normalizeReferencePath(ref.path));
75
74
  }
76
75
  else {
77
- hasChanges = true;
76
+ addChangedFile(changedFiles, rootTsconfigPath, resolvedRefPath, 'stale');
78
77
  }
79
78
  }
80
79
  for (const node of tsconfigProjectNodeValues) {
@@ -82,10 +81,10 @@ async function syncGenerator(tree) {
82
81
  // Skip the root tsconfig itself
83
82
  if (node.data.root !== '.' && !referencesSet.has(normalizedPath)) {
84
83
  referencesSet.add(normalizedPath);
85
- hasChanges = true;
84
+ addChangedFile(changedFiles, rootTsconfigPath, toFullProjectReferencePath(node.data.root), 'missing');
86
85
  }
87
86
  }
88
- if (hasChanges) {
87
+ if (changedFiles.size > 0) {
89
88
  const updatedReferences = Array.from(referencesSet)
90
89
  // Check composite is true in the internal reference before proceeding
91
90
  .filter((ref) => hasCompositeEnabled(tsSysFromTree, tsconfigInfoCaches, (0, devkit_1.joinPathFragments)(ref, 'tsconfig.json')))
@@ -101,7 +100,7 @@ async function syncGenerator(tree) {
101
100
  COMMON_RUNTIME_TS_CONFIG_FILE_NAMES,
102
101
  };
103
102
  const collectedDependencies = new Map();
104
- for (const [projectName, data] of Object.entries(projectGraph.dependencies)) {
103
+ for (const projectName of Object.keys(projectGraph.dependencies)) {
105
104
  if (!projectGraph.nodes[projectName] ||
106
105
  projectGraph.nodes[projectName].data.root === '.') {
107
106
  continue;
@@ -124,17 +123,26 @@ async function syncGenerator(tree) {
124
123
  continue;
125
124
  }
126
125
  // Update project references for the runtime tsconfig
127
- hasChanges =
128
- updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, runtimeTsConfigPath, dependencies, sourceProjectNode.data.root, projectRoots, runtimeTsConfigFileName, runtimeTsConfigFileNames) || hasChanges;
126
+ updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, runtimeTsConfigPath, dependencies, sourceProjectNode.data.root, projectRoots, changedFiles, runtimeTsConfigFileName, runtimeTsConfigFileNames);
129
127
  }
130
128
  // Update project references for the tsconfig.json file
131
- hasChanges =
132
- updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, sourceProjectTsconfigPath, dependencies, sourceProjectNode.data.root, projectRoots) || hasChanges;
129
+ updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, sourceProjectTsconfigPath, dependencies, sourceProjectNode.data.root, projectRoots, changedFiles);
133
130
  }
134
- if (hasChanges) {
131
+ if (changedFiles.size > 0) {
135
132
  await (0, devkit_1.formatFiles)(tree);
133
+ const outOfSyncDetails = [];
134
+ for (const [filePath, details] of changedFiles) {
135
+ outOfSyncDetails.push(`${filePath}:`);
136
+ if (details.missing.size > 0) {
137
+ outOfSyncDetails.push(` - Missing references: ${Array.from(details.missing).join(', ')}`);
138
+ }
139
+ if (details.stale.size > 0) {
140
+ outOfSyncDetails.push(` - Stale references: ${Array.from(details.stale).join(', ')}`);
141
+ }
142
+ }
136
143
  return {
137
- outOfSyncMessage: 'Some TypeScript configuration files are missing project references to the projects they depend on or contain outdated project references.',
144
+ outOfSyncMessage: 'Some TypeScript configuration files are missing project references to the projects they depend on or contain stale project references.',
145
+ outOfSyncDetails,
138
146
  };
139
147
  }
140
148
  }
@@ -159,7 +167,7 @@ function tsconfigExists(tree, tsconfigInfoCaches, tsconfigPath) {
159
167
  }
160
168
  return tsconfigInfoCaches.exists.get(tsconfigPath);
161
169
  }
162
- function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsConfigPath, dependencies, projectRoot, projectRoots, runtimeTsConfigFileName, possibleRuntimeTsConfigFileNames) {
170
+ function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsConfigPath, dependencies, projectRoot, projectRoots, changedFiles, runtimeTsConfigFileName, possibleRuntimeTsConfigFileNames) {
163
171
  const stringifiedJsonContents = readRawTsconfigContents(tree, tsconfigInfoCaches, tsConfigPath);
164
172
  const tsConfig = (0, devkit_1.parseJson)(stringifiedJsonContents);
165
173
  const ignoredReferences = new Set(tsConfig.nx?.sync?.ignoredReferences ?? []);
@@ -177,13 +185,16 @@ function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsCon
177
185
  continue;
178
186
  }
179
187
  // reference path is relative to the tsconfig file
180
- const resolvedRefPath = getTsConfigPathFromReferencePath(tree, tsConfigPath, ref.path, tsconfigInfoCaches);
181
- if (isProjectReferenceWithinNxProject(tree, tsconfigInfoCaches, resolvedRefPath, projectRoot, projectRoots) ||
188
+ const resolvedRefPath = getTsConfigPathFromReferencePath(tsConfigPath, ref.path);
189
+ if (isProjectReferenceWithinNxProject(resolvedRefPath, projectRoot, projectRoots) ||
182
190
  isProjectReferenceIgnored(tree, resolvedRefPath)) {
183
191
  // we keep all references within the current Nx project or that are ignored
184
192
  references.push(ref);
185
193
  newReferencesSet.add(normalizedPath);
186
194
  }
195
+ if (!newReferencesSet.has(normalizedPath)) {
196
+ addChangedFile(changedFiles, tsConfigPath, resolvedRefPath, 'stale');
197
+ }
187
198
  }
188
199
  let hasChanges = false;
189
200
  for (const dep of dependencies) {
@@ -238,13 +249,13 @@ function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsCon
238
249
  }
239
250
  if (!originalReferencesSet.has(relativePathToTargetRoot)) {
240
251
  hasChanges = true;
252
+ addChangedFile(changedFiles, tsConfigPath, toFullProjectReferencePath(referencePath), 'missing');
241
253
  }
242
254
  }
243
255
  hasChanges ||= newReferencesSet.size !== originalReferencesSet.size;
244
256
  if (hasChanges) {
245
257
  patchTsconfigJsonReferences(tree, tsconfigInfoCaches, tsConfigPath, references);
246
258
  }
247
- return hasChanges;
248
259
  }
249
260
  // TODO(leo): follow up with the TypeScript team to confirm if we really need
250
261
  // to reference transitive dependencies.
@@ -288,8 +299,14 @@ function normalizeReferencePath(path) {
288
299
  .replace(/\/tsconfig.json$/, '')
289
300
  .replace(/^\.\//, '');
290
301
  }
291
- function isProjectReferenceWithinNxProject(tree, tsconfigInfoCaches, refTsConfigPath, projectRoot, projectRoots) {
292
- let currentPath = getTsConfigDirName(tree, tsconfigInfoCaches, refTsConfigPath);
302
+ function toFullProjectReferencePath(path) {
303
+ const normalizedPath = normalizeReferencePath(path);
304
+ return normalizedPath.endsWith('.json')
305
+ ? normalizedPath
306
+ : (0, devkit_1.joinPathFragments)(normalizedPath, 'tsconfig.json');
307
+ }
308
+ function isProjectReferenceWithinNxProject(refTsConfigPath, projectRoot, projectRoots) {
309
+ let currentPath = getTsConfigDirName(refTsConfigPath);
293
310
  if ((0, posix_1.relative)(projectRoot, currentPath).startsWith('..')) {
294
311
  // it's outside of the project root, so it's an external project reference
295
312
  return false;
@@ -315,14 +332,14 @@ function isProjectReferenceIgnored(tree, refTsConfigPath) {
315
332
  }
316
333
  return ig.ignores(refTsConfigPath);
317
334
  }
318
- function getTsConfigDirName(tree, tsconfigInfoCaches, tsConfigPath) {
319
- return tsconfigIsFile(tree, tsconfigInfoCaches, tsConfigPath)
335
+ function getTsConfigDirName(tsConfigPath) {
336
+ return tsConfigPath.endsWith('.json')
320
337
  ? (0, posix_1.dirname)(tsConfigPath)
321
338
  : (0, posix_1.normalize)(tsConfigPath);
322
339
  }
323
- function getTsConfigPathFromReferencePath(tree, ownerTsConfigPath, referencePath, tsconfigInfoCaches) {
340
+ function getTsConfigPathFromReferencePath(ownerTsConfigPath, referencePath) {
324
341
  const resolvedRefPath = (0, devkit_1.joinPathFragments)((0, posix_1.dirname)(ownerTsConfigPath), referencePath);
325
- return tsconfigIsFile(tree, tsconfigInfoCaches, resolvedRefPath)
342
+ return resolvedRefPath.endsWith('.json')
326
343
  ? resolvedRefPath
327
344
  : (0, devkit_1.joinPathFragments)(resolvedRefPath, 'tsconfig.json');
328
345
  }
@@ -344,15 +361,9 @@ function hasCompositeEnabled(tsSysFromTree, tsconfigInfoCaches, tsconfigPath) {
344
361
  }
345
362
  return tsconfigInfoCaches.composite.get(tsconfigPath);
346
363
  }
347
- function tsconfigIsFile(tree, tsconfigInfoCaches, tsconfigPath) {
348
- if (tsconfigInfoCaches.isFile.has(tsconfigPath)) {
349
- return tsconfigInfoCaches.isFile.get(tsconfigPath);
350
- }
351
- if (tsconfigInfoCaches.content.has(tsconfigPath)) {
352
- // if it has content, it's a file
353
- tsconfigInfoCaches.isFile.set(tsconfigPath, true);
354
- return true;
364
+ function addChangedFile(changedFiles, filePath, referencePath, type) {
365
+ if (!changedFiles.has(filePath)) {
366
+ changedFiles.set(filePath, { missing: new Set(), stale: new Set() });
355
367
  }
356
- tsconfigInfoCaches.isFile.set(tsconfigPath, tree.isFile(tsconfigPath));
357
- return tsconfigInfoCaches.isFile.get(tsconfigPath);
368
+ changedFiles.get(filePath)[type].add(referencePath);
358
369
  }
@@ -1 +1 @@
1
- {"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AAGxE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;CAC1C;AAUD,eAAO,MAAM,uBAAuB,GAAI,QAAQ,SAAS,EAAE,SAiB1D,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;gBAE7C,IAAI,EAAE,uBAAuB;IAoDnC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB3C,wBAAwB,IAAI,IAAI;IAe1B,4BAA4B,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;IAqBnD,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA4B9D,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,qBAAqB;CAG9B"}
1
+ {"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AAGxE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;CAC1C;AAUD,eAAO,MAAM,uBAAuB,GAAI,QAAQ,SAAS,EAAE,SAiB1D,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;gBAE7C,IAAI,EAAE,uBAAuB;IAuDnC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB3C,wBAAwB,IAAI,IAAI;IAgB1B,4BAA4B,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;IAqBnD,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC9D,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,qBAAqB;CAG9B"}
@@ -41,10 +41,12 @@ class CopyAssetsHandler {
41
41
  this.ignore = (0, ignore_1.default)();
42
42
  const gitignore = pathPosix.join(opts.rootDir, '.gitignore');
43
43
  const nxignore = pathPosix.join(opts.rootDir, '.nxignore');
44
- if ((0, node_fs_1.existsSync)(gitignore))
44
+ if ((0, node_fs_1.existsSync)(gitignore)) {
45
45
  this.ignore.add((0, node_fs_1.readFileSync)(gitignore).toString());
46
- if ((0, node_fs_1.existsSync)(nxignore))
46
+ }
47
+ if ((0, node_fs_1.existsSync)(nxignore)) {
47
48
  this.ignore.add((0, node_fs_1.readFileSync)(nxignore).toString());
49
+ }
48
50
  this.assetGlobs = opts.assets.map((f) => {
49
51
  let isGlob = false;
50
52
  let pattern;
@@ -85,6 +87,8 @@ class CopyAssetsHandler {
85
87
  cwd: this.rootDir,
86
88
  dot: true, // enable hidden files
87
89
  expandDirectories: false,
90
+ // Ignore common directories that should not be copied or processed
91
+ ignore: ['**/node_modules/**', '**/.git/**'],
88
92
  });
89
93
  this.callback(this.filesToEvent(files, ag));
90
94
  }));
@@ -97,6 +101,7 @@ class CopyAssetsHandler {
97
101
  cwd: this.rootDir,
98
102
  dot: true, // enable hidden files
99
103
  expandDirectories: false,
104
+ ignore: ['**/node_modules/**', '**/.git/**'],
100
105
  });
101
106
  this.callback(this.filesToEvent(files, ag));
102
107
  });
@@ -120,6 +125,8 @@ class CopyAssetsHandler {
120
125
  return () => unregisterFileWatcher();
121
126
  }
122
127
  async processWatchEvents(events) {
128
+ if (events.length === 0)
129
+ return;
123
130
  const fileEvents = [];
124
131
  for (const event of events) {
125
132
  const pathFromRoot = event.path.startsWith(this.rootDir)
@@ -1 +1 @@
1
- {"version":3,"file":"ts-solution-setup.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/ts-solution-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EAGzB,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAWpB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAU3D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,CAO3D;AA4CD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,IAAI,CAsBN;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,IAAI,GACV,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,uBAAuB,EAAE,MAAM,EAC/B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC,EAC5D,OAAO,GAAE,MAAM,EAAO,EACtB,OAAO,SAAQ,QAoFhB;AAED,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,iBAqDnB;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,SAAS,GAAG,aAAa,GACtC,SAAS,GAAG,aAAa,CAa3B;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,oBAAoB,EAC7B,IAAI,CAAC,EAAE,IAAI,GACV,MAAM,CAgBR"}
1
+ {"version":3,"file":"ts-solution-setup.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/ts-solution-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EAGzB,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAWpB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAU3D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,CAO3D;AA4CD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,IAAI,CAsBN;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,IAAI,GACV,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,uBAAuB,EAAE,MAAM,EAC/B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC,EAC5D,OAAO,GAAE,MAAM,EAAO,EACtB,OAAO,SAAQ,QAoFhB;AAED,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,iBAqDnB;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,SAAS,GAAG,aAAa,GACtC,SAAS,GAAG,aAAa,CAoB3B;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,oBAAoB,EAC7B,IAAI,CAAC,EAAE,IAAI,GACV,MAAM,CAgBR"}
@@ -198,13 +198,17 @@ function getProjectType(tree, projectRoot, projectType) {
198
198
  return 'library';
199
199
  if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.app.json')))
200
200
  return 'application';
201
- // If there are no exports, assume it is an application since both buildable and non-buildable libraries have exports.
201
+ // If it doesn't have any common library entry points, assume it is an application
202
202
  const packageJsonPath = (0, devkit_1.joinPathFragments)(projectRoot, 'package.json');
203
203
  const packageJson = tree.exists(packageJsonPath)
204
204
  ? (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'))
205
205
  : null;
206
- if (!packageJson?.exports)
206
+ if (!packageJson?.exports &&
207
+ !packageJson?.main &&
208
+ !packageJson?.module &&
209
+ !packageJson?.bin) {
207
210
  return 'application';
211
+ }
208
212
  return 'library';
209
213
  }
210
214
  function getProjectSourceRoot(project, tree) {