@angular/cli 18.1.0-next.2 → 18.1.0-rc.0

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.
@@ -6,14 +6,39 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
9
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
10
+ var useValue = arguments.length > 2;
11
+ for (var i = 0; i < initializers.length; i++) {
12
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13
+ }
14
+ return useValue ? value : void 0;
14
15
  };
15
- var __metadata = (this && this.__metadata) || function (k, v) {
16
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
16
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
17
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
18
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
19
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
20
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
21
+ var _, done = false;
22
+ for (var i = decorators.length - 1; i >= 0; i--) {
23
+ var context = {};
24
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
25
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
26
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
27
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
28
+ if (kind === "accessor") {
29
+ if (result === void 0) continue;
30
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
31
+ if (_ = accept(result.get)) descriptor.get = _;
32
+ if (_ = accept(result.set)) descriptor.set = _;
33
+ if (_ = accept(result.init)) initializers.unshift(_);
34
+ }
35
+ else if (_ = accept(result)) {
36
+ if (kind === "field") initializers.unshift(_);
37
+ else descriptor[key] = _;
38
+ }
39
+ }
40
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
41
+ done = true;
17
42
  };
18
43
  Object.defineProperty(exports, "__esModule", { value: true });
19
44
  exports.PackageManagerUtils = void 0;
@@ -25,263 +50,258 @@ const path_1 = require("path");
25
50
  const workspace_schema_1 = require("../../lib/config/workspace-schema");
26
51
  const config_1 = require("./config");
27
52
  const memoize_1 = require("./memoize");
28
- const spinner_1 = require("./spinner");
29
- class PackageManagerUtils {
30
- context;
31
- constructor(context) {
32
- this.context = context;
33
- }
34
- /** Get the package manager name. */
35
- get name() {
36
- return this.getName();
37
- }
38
- /** Get the package manager version. */
39
- get version() {
40
- return this.getVersion(this.name);
41
- }
42
- /** Install a single package. */
43
- async install(packageName, save = true, extraArgs = [], cwd) {
44
- const packageManagerArgs = this.getArguments();
45
- const installArgs = [packageManagerArgs.install, packageName];
46
- if (save === 'devDependencies') {
47
- installArgs.push(packageManagerArgs.saveDev);
53
+ let PackageManagerUtils = (() => {
54
+ let _instanceExtraInitializers = [];
55
+ let _getVersion_decorators;
56
+ let _getName_decorators;
57
+ return class PackageManagerUtils {
58
+ static {
59
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
60
+ _getVersion_decorators = [memoize_1.memoize];
61
+ _getName_decorators = [memoize_1.memoize];
62
+ __esDecorate(this, null, _getVersion_decorators, { kind: "method", name: "getVersion", static: false, private: false, access: { has: obj => "getVersion" in obj, get: obj => obj.getVersion }, metadata: _metadata }, null, _instanceExtraInitializers);
63
+ __esDecorate(this, null, _getName_decorators, { kind: "method", name: "getName", static: false, private: false, access: { has: obj => "getName" in obj, get: obj => obj.getName }, metadata: _metadata }, null, _instanceExtraInitializers);
64
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
48
65
  }
49
- return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
50
- }
51
- /** Install all packages. */
52
- async installAll(extraArgs = [], cwd) {
53
- const packageManagerArgs = this.getArguments();
54
- const installArgs = [];
55
- if (packageManagerArgs.installAll) {
56
- installArgs.push(packageManagerArgs.installAll);
66
+ context = __runInitializers(this, _instanceExtraInitializers);
67
+ constructor(context) {
68
+ this.context = context;
57
69
  }
58
- return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
59
- }
60
- /** Install a single package temporary. */
61
- async installTemp(packageName, extraArgs) {
62
- const tempPath = await fs_1.promises.mkdtemp((0, path_1.join)((0, fs_1.realpathSync)((0, os_1.tmpdir)()), 'angular-cli-packages-'));
63
- // clean up temp directory on process exit
64
- process.on('exit', () => {
65
- try {
66
- (0, fs_1.rmSync)(tempPath, { recursive: true, maxRetries: 3 });
70
+ /** Get the package manager name. */
71
+ get name() {
72
+ return this.getName();
73
+ }
74
+ /** Get the package manager version. */
75
+ get version() {
76
+ return this.getVersion(this.name);
77
+ }
78
+ /** Install a single package. */
79
+ async install(packageName, save = true, extraArgs = [], cwd) {
80
+ const packageManagerArgs = this.getArguments();
81
+ const installArgs = [packageManagerArgs.install, packageName];
82
+ if (save === 'devDependencies') {
83
+ installArgs.push(packageManagerArgs.saveDev);
67
84
  }
68
- catch { }
69
- });
70
- // NPM will warn when a `package.json` is not found in the install directory
71
- // Example:
72
- // npm WARN enoent ENOENT: no such file or directory, open '/tmp/.ng-temp-packages-84Qi7y/package.json'
73
- // npm WARN .ng-temp-packages-84Qi7y No description
74
- // npm WARN .ng-temp-packages-84Qi7y No repository field.
75
- // npm WARN .ng-temp-packages-84Qi7y No license field.
76
- // While we can use `npm init -y` we will end up needing to update the 'package.json' anyways
77
- // because of missing fields.
78
- await fs_1.promises.writeFile((0, path_1.join)(tempPath, 'package.json'), JSON.stringify({
79
- name: 'temp-cli-install',
80
- description: 'temp-cli-install',
81
- repository: 'temp-cli-install',
82
- license: 'MIT',
83
- }));
84
- // setup prefix/global modules path
85
- const packageManagerArgs = this.getArguments();
86
- const tempNodeModules = (0, path_1.join)(tempPath, 'node_modules');
87
- // Yarn will not append 'node_modules' to the path
88
- const prefixPath = this.name === workspace_schema_1.PackageManager.Yarn ? tempNodeModules : tempPath;
89
- const installArgs = [
90
- ...(extraArgs ?? []),
91
- `${packageManagerArgs.prefix}="${prefixPath}"`,
92
- packageManagerArgs.noLockfile,
93
- ];
94
- return {
95
- success: await this.install(packageName, true, installArgs, tempPath),
96
- tempNodeModules,
97
- };
98
- }
99
- getArguments() {
100
- switch (this.name) {
101
- case workspace_schema_1.PackageManager.Yarn:
102
- return {
103
- saveDev: '--dev',
104
- install: 'add',
105
- prefix: '--modules-folder',
106
- noLockfile: '--no-lockfile',
107
- };
108
- case workspace_schema_1.PackageManager.Pnpm:
109
- return {
110
- saveDev: '--save-dev',
111
- install: 'add',
112
- installAll: 'install',
113
- prefix: '--prefix',
114
- noLockfile: '--no-lockfile',
115
- };
116
- case workspace_schema_1.PackageManager.Bun:
117
- return {
118
- saveDev: '--development',
119
- install: 'add',
120
- installAll: 'install',
121
- prefix: '--cwd',
122
- noLockfile: '',
123
- };
124
- default:
125
- return {
126
- saveDev: '--save-dev',
127
- install: 'install',
128
- installAll: 'install',
129
- prefix: '--prefix',
130
- noLockfile: '--no-package-lock',
131
- };
85
+ return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
132
86
  }
133
- }
134
- async run(args, options = {}) {
135
- const { cwd = process.cwd(), silent = false } = options;
136
- const spinner = new spinner_1.Spinner();
137
- spinner.start('Installing packages...');
138
- return new Promise((resolve) => {
139
- const bufferedOutput = [];
140
- const childProcess = (0, child_process_1.spawn)(this.name, args, {
141
- // Always pipe stderr to allow for failures to be reported
142
- stdio: silent ? ['ignore', 'ignore', 'pipe'] : 'pipe',
143
- shell: true,
144
- cwd,
145
- }).on('close', (code) => {
146
- if (code === 0) {
147
- spinner.succeed('Packages successfully installed.');
148
- resolve(true);
149
- }
150
- else {
151
- spinner.stop();
152
- bufferedOutput.forEach(({ stream, data }) => stream.write(data));
153
- spinner.fail('Packages installation failed, see above.');
154
- resolve(false);
87
+ /** Install all packages. */
88
+ async installAll(extraArgs = [], cwd) {
89
+ const packageManagerArgs = this.getArguments();
90
+ const installArgs = [];
91
+ if (packageManagerArgs.installAll) {
92
+ installArgs.push(packageManagerArgs.installAll);
93
+ }
94
+ return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
95
+ }
96
+ /** Install a single package temporary. */
97
+ async installTemp(packageName, extraArgs) {
98
+ const tempPath = await fs_1.promises.mkdtemp((0, path_1.join)((0, fs_1.realpathSync)((0, os_1.tmpdir)()), 'angular-cli-packages-'));
99
+ // clean up temp directory on process exit
100
+ process.on('exit', () => {
101
+ try {
102
+ (0, fs_1.rmSync)(tempPath, { recursive: true, maxRetries: 3 });
155
103
  }
104
+ catch { }
156
105
  });
157
- childProcess.stdout?.on('data', (data) => bufferedOutput.push({ stream: process.stdout, data: data }));
158
- childProcess.stderr?.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data }));
159
- });
160
- }
161
- getVersion(name) {
162
- try {
163
- return (0, child_process_1.execSync)(`${name} --version`, {
164
- encoding: 'utf8',
165
- stdio: ['ignore', 'pipe', 'ignore'],
166
- env: {
167
- ...process.env,
168
- // NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.
169
- NO_UPDATE_NOTIFIER: '1',
170
- NPM_CONFIG_UPDATE_NOTIFIER: 'false',
171
- },
172
- }).trim();
106
+ // NPM will warn when a `package.json` is not found in the install directory
107
+ // Example:
108
+ // npm WARN enoent ENOENT: no such file or directory, open '/tmp/.ng-temp-packages-84Qi7y/package.json'
109
+ // npm WARN .ng-temp-packages-84Qi7y No description
110
+ // npm WARN .ng-temp-packages-84Qi7y No repository field.
111
+ // npm WARN .ng-temp-packages-84Qi7y No license field.
112
+ // While we can use `npm init -y` we will end up needing to update the 'package.json' anyways
113
+ // because of missing fields.
114
+ await fs_1.promises.writeFile((0, path_1.join)(tempPath, 'package.json'), JSON.stringify({
115
+ name: 'temp-cli-install',
116
+ description: 'temp-cli-install',
117
+ repository: 'temp-cli-install',
118
+ license: 'MIT',
119
+ }));
120
+ // setup prefix/global modules path
121
+ const packageManagerArgs = this.getArguments();
122
+ const tempNodeModules = (0, path_1.join)(tempPath, 'node_modules');
123
+ // Yarn will not append 'node_modules' to the path
124
+ const prefixPath = this.name === workspace_schema_1.PackageManager.Yarn ? tempNodeModules : tempPath;
125
+ const installArgs = [
126
+ ...(extraArgs ?? []),
127
+ `${packageManagerArgs.prefix}="${prefixPath}"`,
128
+ packageManagerArgs.noLockfile,
129
+ ];
130
+ return {
131
+ success: await this.install(packageName, true, installArgs, tempPath),
132
+ tempNodeModules,
133
+ };
173
134
  }
174
- catch {
175
- return undefined;
176
- }
177
- }
178
- getName() {
179
- const packageManager = this.getConfiguredPackageManager();
180
- if (packageManager) {
181
- return packageManager;
182
- }
183
- const hasNpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Npm);
184
- const hasYarnLock = this.hasLockfile(workspace_schema_1.PackageManager.Yarn);
185
- const hasPnpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Pnpm);
186
- const hasBunLock = this.hasLockfile(workspace_schema_1.PackageManager.Bun);
187
- // PERF NOTE: `this.getVersion` spawns the package a the child_process which can take around ~300ms at times.
188
- // Therefore, we should only call this method when needed. IE: don't call `this.getVersion(PackageManager.Pnpm)` unless truly needed.
189
- // The result of this method is not stored in a variable because it's memoized.
190
- if (hasNpmLock) {
191
- // Has NPM lock file.
192
- if (!hasYarnLock && !hasPnpmLock && !hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Npm)) {
193
- // Only NPM lock file and NPM binary is available.
194
- return workspace_schema_1.PackageManager.Npm;
135
+ getArguments() {
136
+ switch (this.name) {
137
+ case workspace_schema_1.PackageManager.Yarn:
138
+ return {
139
+ saveDev: '--dev',
140
+ install: 'add',
141
+ prefix: '--modules-folder',
142
+ noLockfile: '--no-lockfile',
143
+ };
144
+ case workspace_schema_1.PackageManager.Pnpm:
145
+ return {
146
+ saveDev: '--save-dev',
147
+ install: 'add',
148
+ installAll: 'install',
149
+ prefix: '--prefix',
150
+ noLockfile: '--no-lockfile',
151
+ };
152
+ case workspace_schema_1.PackageManager.Bun:
153
+ return {
154
+ saveDev: '--development',
155
+ install: 'add',
156
+ installAll: 'install',
157
+ prefix: '--cwd',
158
+ noLockfile: '',
159
+ };
160
+ default:
161
+ return {
162
+ saveDev: '--save-dev',
163
+ install: 'install',
164
+ installAll: 'install',
165
+ prefix: '--prefix',
166
+ noLockfile: '--no-package-lock',
167
+ };
195
168
  }
196
169
  }
197
- else {
198
- // No NPM lock file.
199
- if (hasYarnLock && this.getVersion(workspace_schema_1.PackageManager.Yarn)) {
200
- // Yarn lock file and Yarn binary is available.
201
- return workspace_schema_1.PackageManager.Yarn;
202
- }
203
- else if (hasPnpmLock && this.getVersion(workspace_schema_1.PackageManager.Pnpm)) {
204
- // PNPM lock file and PNPM binary is available.
205
- return workspace_schema_1.PackageManager.Pnpm;
170
+ async run(args, options = {}) {
171
+ const { cwd = process.cwd(), silent = false } = options;
172
+ return new Promise((resolve) => {
173
+ const bufferedOutput = [];
174
+ const childProcess = (0, child_process_1.spawn)(this.name, args, {
175
+ // Always pipe stderr to allow for failures to be reported
176
+ stdio: silent ? ['ignore', 'ignore', 'pipe'] : 'pipe',
177
+ shell: true,
178
+ cwd,
179
+ }).on('close', (code) => {
180
+ if (code === 0) {
181
+ resolve(true);
182
+ }
183
+ else {
184
+ bufferedOutput.forEach(({ stream, data }) => stream.write(data));
185
+ resolve(false);
186
+ }
187
+ });
188
+ childProcess.stdout?.on('data', (data) => bufferedOutput.push({ stream: process.stdout, data: data }));
189
+ childProcess.stderr?.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data }));
190
+ });
191
+ }
192
+ getVersion(name) {
193
+ try {
194
+ return (0, child_process_1.execSync)(`${name} --version`, {
195
+ encoding: 'utf8',
196
+ stdio: ['ignore', 'pipe', 'ignore'],
197
+ env: {
198
+ ...process.env,
199
+ // NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.
200
+ NO_UPDATE_NOTIFIER: '1',
201
+ NPM_CONFIG_UPDATE_NOTIFIER: 'false',
202
+ },
203
+ }).trim();
206
204
  }
207
- else if (hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Bun)) {
208
- // Bun lock file and Bun binary is available.
209
- return workspace_schema_1.PackageManager.Bun;
205
+ catch {
206
+ return undefined;
210
207
  }
211
208
  }
212
- if (!this.getVersion(workspace_schema_1.PackageManager.Npm)) {
213
- // Doesn't have NPM installed.
214
- const hasYarn = !!this.getVersion(workspace_schema_1.PackageManager.Yarn);
215
- const hasPnpm = !!this.getVersion(workspace_schema_1.PackageManager.Pnpm);
216
- const hasBun = !!this.getVersion(workspace_schema_1.PackageManager.Bun);
217
- if (hasYarn && !hasPnpm && !hasBun) {
218
- return workspace_schema_1.PackageManager.Yarn;
209
+ getName() {
210
+ const packageManager = this.getConfiguredPackageManager();
211
+ if (packageManager) {
212
+ return packageManager;
219
213
  }
220
- else if (hasPnpm && !hasYarn && !hasBun) {
221
- return workspace_schema_1.PackageManager.Pnpm;
214
+ const hasNpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Npm);
215
+ const hasYarnLock = this.hasLockfile(workspace_schema_1.PackageManager.Yarn);
216
+ const hasPnpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Pnpm);
217
+ const hasBunLock = this.hasLockfile(workspace_schema_1.PackageManager.Bun);
218
+ // PERF NOTE: `this.getVersion` spawns the package a the child_process which can take around ~300ms at times.
219
+ // Therefore, we should only call this method when needed. IE: don't call `this.getVersion(PackageManager.Pnpm)` unless truly needed.
220
+ // The result of this method is not stored in a variable because it's memoized.
221
+ if (hasNpmLock) {
222
+ // Has NPM lock file.
223
+ if (!hasYarnLock && !hasPnpmLock && !hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Npm)) {
224
+ // Only NPM lock file and NPM binary is available.
225
+ return workspace_schema_1.PackageManager.Npm;
226
+ }
222
227
  }
223
- else if (hasBun && !hasYarn && !hasPnpm) {
224
- return workspace_schema_1.PackageManager.Bun;
228
+ else {
229
+ // No NPM lock file.
230
+ if (hasYarnLock && this.getVersion(workspace_schema_1.PackageManager.Yarn)) {
231
+ // Yarn lock file and Yarn binary is available.
232
+ return workspace_schema_1.PackageManager.Yarn;
233
+ }
234
+ else if (hasPnpmLock && this.getVersion(workspace_schema_1.PackageManager.Pnpm)) {
235
+ // PNPM lock file and PNPM binary is available.
236
+ return workspace_schema_1.PackageManager.Pnpm;
237
+ }
238
+ else if (hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Bun)) {
239
+ // Bun lock file and Bun binary is available.
240
+ return workspace_schema_1.PackageManager.Bun;
241
+ }
225
242
  }
243
+ if (!this.getVersion(workspace_schema_1.PackageManager.Npm)) {
244
+ // Doesn't have NPM installed.
245
+ const hasYarn = !!this.getVersion(workspace_schema_1.PackageManager.Yarn);
246
+ const hasPnpm = !!this.getVersion(workspace_schema_1.PackageManager.Pnpm);
247
+ const hasBun = !!this.getVersion(workspace_schema_1.PackageManager.Bun);
248
+ if (hasYarn && !hasPnpm && !hasBun) {
249
+ return workspace_schema_1.PackageManager.Yarn;
250
+ }
251
+ else if (hasPnpm && !hasYarn && !hasBun) {
252
+ return workspace_schema_1.PackageManager.Pnpm;
253
+ }
254
+ else if (hasBun && !hasYarn && !hasPnpm) {
255
+ return workspace_schema_1.PackageManager.Bun;
256
+ }
257
+ }
258
+ // TODO: This should eventually inform the user of ambiguous package manager usage.
259
+ // Potentially with a prompt to choose and optionally set as the default.
260
+ return workspace_schema_1.PackageManager.Npm;
226
261
  }
227
- // TODO: This should eventually inform the user of ambiguous package manager usage.
228
- // Potentially with a prompt to choose and optionally set as the default.
229
- return workspace_schema_1.PackageManager.Npm;
230
- }
231
- hasLockfile(packageManager) {
232
- let lockfileName;
233
- switch (packageManager) {
234
- case workspace_schema_1.PackageManager.Yarn:
235
- lockfileName = 'yarn.lock';
236
- break;
237
- case workspace_schema_1.PackageManager.Pnpm:
238
- lockfileName = 'pnpm-lock.yaml';
239
- break;
240
- case workspace_schema_1.PackageManager.Bun:
241
- lockfileName = 'bun.lockb';
242
- break;
243
- case workspace_schema_1.PackageManager.Npm:
244
- default:
245
- lockfileName = 'package-lock.json';
246
- break;
262
+ hasLockfile(packageManager) {
263
+ let lockfileName;
264
+ switch (packageManager) {
265
+ case workspace_schema_1.PackageManager.Yarn:
266
+ lockfileName = 'yarn.lock';
267
+ break;
268
+ case workspace_schema_1.PackageManager.Pnpm:
269
+ lockfileName = 'pnpm-lock.yaml';
270
+ break;
271
+ case workspace_schema_1.PackageManager.Bun:
272
+ lockfileName = 'bun.lockb';
273
+ break;
274
+ case workspace_schema_1.PackageManager.Npm:
275
+ default:
276
+ lockfileName = 'package-lock.json';
277
+ break;
278
+ }
279
+ return (0, fs_1.existsSync)((0, path_1.join)(this.context.root, lockfileName));
247
280
  }
248
- return (0, fs_1.existsSync)((0, path_1.join)(this.context.root, lockfileName));
249
- }
250
- getConfiguredPackageManager() {
251
- const getPackageManager = (source) => {
252
- if (source && (0, core_1.isJsonObject)(source)) {
253
- const value = source['packageManager'];
254
- if (typeof value === 'string') {
255
- return value;
281
+ getConfiguredPackageManager() {
282
+ const getPackageManager = (source) => {
283
+ if (source && (0, core_1.isJsonObject)(source)) {
284
+ const value = source['packageManager'];
285
+ if (typeof value === 'string') {
286
+ return value;
287
+ }
288
+ }
289
+ return undefined;
290
+ };
291
+ let result;
292
+ const { workspace: localWorkspace, globalConfiguration: globalWorkspace } = this.context;
293
+ if (localWorkspace) {
294
+ const project = (0, config_1.getProjectByCwd)(localWorkspace);
295
+ if (project) {
296
+ result = getPackageManager(localWorkspace.projects.get(project)?.extensions['cli']);
256
297
  }
298
+ result ??= getPackageManager(localWorkspace.extensions['cli']);
257
299
  }
258
- return undefined;
259
- };
260
- let result;
261
- const { workspace: localWorkspace, globalConfiguration: globalWorkspace } = this.context;
262
- if (localWorkspace) {
263
- const project = (0, config_1.getProjectByCwd)(localWorkspace);
264
- if (project) {
265
- result = getPackageManager(localWorkspace.projects.get(project)?.extensions['cli']);
300
+ if (!result) {
301
+ result = getPackageManager(globalWorkspace.extensions['cli']);
266
302
  }
267
- result ??= getPackageManager(localWorkspace.extensions['cli']);
303
+ return result;
268
304
  }
269
- if (!result) {
270
- result = getPackageManager(globalWorkspace.extensions['cli']);
271
- }
272
- return result;
273
- }
274
- }
305
+ };
306
+ })();
275
307
  exports.PackageManagerUtils = PackageManagerUtils;
276
- __decorate([
277
- memoize_1.memoize,
278
- __metadata("design:type", Function),
279
- __metadata("design:paramtypes", [String]),
280
- __metadata("design:returntype", Object)
281
- ], PackageManagerUtils.prototype, "getVersion", null);
282
- __decorate([
283
- memoize_1.memoize,
284
- __metadata("design:type", Function),
285
- __metadata("design:paramtypes", []),
286
- __metadata("design:returntype", String)
287
- ], PackageManagerUtils.prototype, "getName", null);
@@ -5,4 +5,4 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- export declare function isTTY(): boolean;
8
+ export declare function isTTY(stream?: NodeJS.WriteStream): boolean;
@@ -12,11 +12,11 @@ function _isTruthy(value) {
12
12
  // Returns true if value is a string that is anything but 0 or false.
13
13
  return value !== undefined && value !== '0' && value.toUpperCase() !== 'FALSE';
14
14
  }
15
- function isTTY() {
15
+ function isTTY(stream = process.stdout) {
16
16
  // If we force TTY, we always return true.
17
17
  const force = process.env['NG_FORCE_TTY'];
18
18
  if (force !== undefined) {
19
19
  return _isTruthy(force);
20
20
  }
21
- return !!process.stdout.isTTY && !_isTruthy(process.env['CI']);
21
+ return !!stream.isTTY && !_isTruthy(process.env['CI']);
22
22
  }
@@ -25,5 +25,5 @@ class Version {
25
25
  }
26
26
  }
27
27
  // TODO(bazel): Convert this to use build-time version stamping after flipping the build script to use bazel
28
- // export const VERSION = new Version('18.1.0-next.2');
28
+ // export const VERSION = new Version('18.1.0-rc.0');
29
29
  exports.VERSION = new Version(JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../package.json'), 'utf-8')).version);
@@ -1,20 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- export declare class Spinner {
9
- private readonly spinner;
10
- /** When false, only fail messages will be displayed. */
11
- enabled: boolean;
12
- constructor(text?: string);
13
- set text(text: string);
14
- succeed(text?: string): void;
15
- info(text?: string): void;
16
- fail(text?: string): void;
17
- warn(text?: string): void;
18
- stop(): void;
19
- start(text?: string): void;
20
- }