Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/angular/cli/lib/config/workspace-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"packageManager": {
"description": "Specify which package manager tool to use.",
"type": "string",
"enum": ["npm", "yarn", "pnpm", "bun"]
"enum": ["npm", "yarn", "pnpm", "bun", "aube"]
},
"warnings": {
"description": "Control CLI specific console warnings",
Expand Down Expand Up @@ -101,7 +101,7 @@
"packageManager": {
"description": "Specify which package manager tool to use.",
"type": "string",
"enum": ["npm", "yarn", "pnpm", "bun"]
"enum": ["npm", "yarn", "pnpm", "bun", "aube"]
},
"warnings": {
"description": "Control CLI specific console warnings",
Expand Down
8 changes: 8 additions & 0 deletions packages/angular/cli/src/package-managers/discovery_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,12 @@ describe('discover', () => {
const result = await discover(host, '/project');
expect(result).toBe('bun');
});

it('should discover the aube lockfile', async () => {
const host = new MockHost({
'/project': ['aube-lock.yaml'],
});
const result = await discover(host, '/project');
expect(result).toBe('aube');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,31 @@ export const SUPPORTED_PACKAGE_MANAGERS = {
},
isNotFound: isKnownNotFound,
},
aube: {
binary: 'aube',
lockfiles: ['aube-lock.yaml'],
addCommand: 'add',
installCommand: ['install'],
forceFlag: '--force',
saveExactFlag: '--save-exact',
saveTildeFlag: '--save-tilde',
saveDevFlag: '--save-dev',
noLockfileFlag: '', // Aube does not have a flag for this.
ignoreScriptsFlag: '--ignore-scripts',
configFiles: ['.npmrc'],
getRegistryOptions: (registry: string) => ({ args: ['--registry', registry] }),
versionCommand: ['--version'],
listDependenciesCommand: ['list', '--depth=0', '--json'],
getManifestCommand: ['view', '--json'],
viewCommandFieldArgFormatter: (fields) => [...fields],
outputParsers: {
listDependencies: parseNpmLikeDependencies,
getRegistryManifest: parseNpmLikeManifest,
getRegistryMetadata: parseNpmLikeMetadata,
getError: parseNpmLikeError,
},
isNotFound: isKnownNotFound,
},
bun: {
binary: 'bun',
lockfiles: ['bun.lockb', 'bun.lock'],
Expand Down Expand Up @@ -347,6 +372,7 @@ export const SUPPORTED_PACKAGE_MANAGERS = {
export const PACKAGE_MANAGER_PRECEDENCE: readonly PackageManagerName[] = [
'pnpm',
'yarn',
'aube',
'bun',
'npm',
];
Comment on lines 372 to 378

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since bun is a significantly more established and widely used package manager in the community compared to aube, it is safer to place bun higher in the precedence list. If a project contains both bun.lockb and aube-lock.yaml, bun is much more likely to be the intended primary package manager.

Suggested change
export const PACKAGE_MANAGER_PRECEDENCE: readonly PackageManagerName[] = [
'pnpm',
'yarn',
'aube',
'bun',
'npm',
];
export const PACKAGE_MANAGER_PRECEDENCE: readonly PackageManagerName[] = [
'pnpm',
'yarn',
'bun',
'aube',
'npm',
];

2 changes: 1 addition & 1 deletion packages/angular/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const hasPackageManagerArg = args.some((a) => a.startsWith('--package-manager'))
if (!hasPackageManagerArg) {
// Ex: yarn/1.22.18 npm/? node/v16.15.1 linux x64
const packageManager = process.env['npm_config_user_agent']?.split('/')[0];
if (packageManager && ['npm', 'pnpm', 'yarn', 'bun'].includes(packageManager)) {
if (packageManager && ['npm', 'pnpm', 'yarn', 'bun', 'aube'].includes(packageManager)) {
args.push('--package-manager', packageManager);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/ng-new/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"packageManager": {
"description": "The package manager used to install dependencies.",
"type": "string",
"enum": ["npm", "yarn", "pnpm", "bun"]
"enum": ["npm", "yarn", "pnpm", "bun", "aube"]
},
"standalone": {
"description": "Creates an application based upon the standalone API, without NgModules.",
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/workspace/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"packageManager": {
"description": "The package manager to use for installing dependencies.",
"type": "string",
"enum": ["npm", "yarn", "pnpm", "bun"],
"enum": ["npm", "yarn", "pnpm", "bun", "aube"],
"$default": {
"$source": "packageManager"
}
Expand Down
12 changes: 10 additions & 2 deletions tests/e2e/utils/packages.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { getGlobalVariable } from './env';
import { ProcessOutput, silentBun, silentNpm, silentPnpm, silentYarn } from './process';
import { ProcessOutput, silentAube, silentBun, silentNpm, silentPnpm, silentYarn } from './process';

export interface PkgInfo {
readonly name: string;
readonly version: string;
readonly path: string;
}

export function getActivePackageManager(): 'npm' | 'yarn' | 'bun' | 'pnpm' {
export function getActivePackageManager(): 'npm' | 'yarn' | 'bun' | 'pnpm' | 'aube' {
return getGlobalVariable('package-manager');
}

Expand All @@ -29,6 +29,9 @@ export async function installWorkspacePackages(options?: { force?: boolean }): P
case 'bun':
await silentBun('install');
break;
case 'aube':
await silentAube('install');
break;
}
}

Expand All @@ -43,6 +46,8 @@ export function installPackage(specifier: string, registry?: string): Promise<Pr
return silentBun('add', specifier, ...registryOption);
case 'pnpm':
return silentPnpm('add', specifier, ...registryOption);
case 'aube':
return silentAube('add', specifier, ...registryOption);
}
}

Expand All @@ -61,6 +66,9 @@ export async function uninstallPackage(name: string): Promise<void> {
case 'pnpm':
await silentPnpm('remove', name);
break;
case 'aube':
await silentAube('remove', name);
break;
}
} catch (e) {
// Yarn throws an error when trying to remove a package that is not installed.
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/utils/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ export function silentBun(...args: string[]) {
return _exec({ silent: true }, 'bun', args);
}

export function silentAube(...args: string[]) {
return _exec({ silent: true }, 'aube', args);
}

export function globalNpm(args: string[], env?: NodeJS.ProcessEnv) {
if (!process.env.LEGACY_CLI_RUNNER) {
throw new Error(
Expand Down