Skip to content

Commit 4f446a1

Browse files
committed
refactor(@angular-devkit/architect): consolidate architect cli into core package
Moves the `architect` CLI implementation from `@angular-devkit/architect-cli` into the `@angular-devkit/architect` package itself. This change aims to make the `@angular-devkit/architect` package more self-contained by hosting its own CLI entry point. The `@angular-devkit/architect-cli` package now serves as a lightweight wrapper, importing the `architect` binary directly from the core package.
1 parent 7d3e0ad commit 4f446a1

File tree

11 files changed

+96
-23
lines changed

11 files changed

+96
-23
lines changed

packages/angular_devkit/architect/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ npm_package(
110110
"README.md",
111111
":architect",
112112
":license",
113+
"//packages/angular_devkit/architect/bin",
114+
"//packages/angular_devkit/architect/bin:cli.js",
113115
"//packages/angular_devkit/architect/node",
114116
"//packages/angular_devkit/architect/testing",
115117
],
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright Google Inc. All Rights Reserved.
2+
#
3+
# Use of this source code is governed by an MIT-style license that can be
4+
# found in the LICENSE file at https://angular.dev/license
5+
6+
load("//tools:defaults.bzl", "ts_project")
7+
8+
licenses(["notice"])
9+
10+
package(default_visibility = ["//visibility:public"])
11+
12+
exports_files([
13+
"cli.js",
14+
])
15+
16+
ts_project(
17+
name = "bin",
18+
srcs = glob(
19+
include = ["**/*.ts"],
20+
exclude = ["**/*_spec.ts"],
21+
),
22+
deps = [
23+
"//:node_modules/@types/node",
24+
"//packages/angular_devkit/architect",
25+
"//packages/angular_devkit/architect:node_modules/@angular-devkit/core",
26+
"//packages/angular_devkit/architect/node",
27+
],
28+
)

packages/angular_devkit/architect_cli/bin/architect.ts renamed to packages/angular_devkit/architect/bin/architect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
* found in the LICENSE file at https://angular.dev/license
88
*/
99

10-
import { Architect } from '@angular-devkit/architect';
11-
import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
1210
import { JsonValue, json, logging, schema, strings, tags, workspaces } from '@angular-devkit/core';
1311
import { NodeJsSyncHost, createConsoleLogger } from '@angular-devkit/core/node';
1412
import { existsSync } from 'node:fs';
1513
import * as path from 'node:path';
1614
import { parseArgs, styleText } from 'node:util';
15+
import { Architect } from '../index';
16+
import { WorkspaceNodeModulesArchitectHost } from '../node/index';
1717

1818
function findUp(names: string | string[], from: string) {
1919
if (!Array.isArray(names)) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env node
2+
/**
3+
* @license
4+
* Copyright Google LLC All Rights Reserved.
5+
*
6+
* Use of this source code is governed by an MIT-style license that can be
7+
* found in the LICENSE file at https://angular.dev/license
8+
*/
9+
10+
require('./architect');

packages/angular_devkit/architect/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "0.0.0-EXPERIMENTAL-PLACEHOLDER",
44
"description": "Angular Build Facade",
55
"experimental": true,
6+
"bin": {
7+
"architect": "./bin/cli.js"
8+
},
69
"main": "src/index.js",
710
"typings": "src/index.d.ts",
811
"dependencies": {
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@npm//:defs.bzl", "npm_link_all_packages")
2-
load("//tools:defaults.bzl", "npm_package", "ts_project")
2+
load("//tools:defaults.bzl", "npm_package")
33

44
# Copyright Google Inc. All Rights Reserved.
55
#
@@ -11,18 +11,6 @@ package(default_visibility = ["//visibility:public"])
1111

1212
npm_link_all_packages()
1313

14-
ts_project(
15-
name = "architect_cli",
16-
srcs = [
17-
"bin/architect.ts",
18-
],
19-
deps = [
20-
":node_modules/@angular-devkit/architect",
21-
":node_modules/@angular-devkit/core",
22-
"//:node_modules/@types/node",
23-
],
24-
)
25-
2614
genrule(
2715
name = "license",
2816
srcs = ["//:LICENSE"],
@@ -34,12 +22,11 @@ npm_package(
3422
name = "pkg",
3523
pkg_deps = [
3624
"//packages/angular_devkit/architect:package.json",
37-
"//packages/angular_devkit/core:package.json",
3825
],
3926
tags = ["release-package"],
4027
deps = [
4128
":README.md",
42-
":architect_cli",
29+
":bin/cli.js",
4330
":license",
4431
],
4532
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env node
2+
/**
3+
* @license
4+
* Copyright Google LLC All Rights Reserved.
5+
*
6+
* Use of this source code is governed by an MIT-style license that can be
7+
* found in the LICENSE file at https://angular.dev/license
8+
*/
9+
10+
import '@angular-devkit/architect/bin/architect.js';
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "@angular-devkit/architect-cli",
33
"version": "0.0.0-EXPERIMENTAL-PLACEHOLDER",
4+
"type": "module",
45
"description": "Angular Architect CLI",
56
"homepage": "https://github.com/angular/angular-cli",
67
"experimental": true,
78
"bin": {
8-
"architect": "./bin/architect.js"
9+
"architect": "./bin/cli.js"
910
},
1011
"keywords": [
1112
"build system",
@@ -14,7 +15,6 @@
1415
"tooling"
1516
],
1617
"dependencies": {
17-
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
18-
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER"
18+
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER"
1919
}
2020
}

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as assert from 'node:assert/strict';
2+
import { exec } from '../../utils/process';
3+
import { join } from 'node:path';
4+
5+
export default async function () {
6+
// Run help command
7+
const binPath = join('node_modules', '.bin', 'architect');
8+
const { stdout } = await exec(binPath, '--help');
9+
10+
assert.ok(
11+
stdout.includes('architect [project][:target][:configuration] [options, ...]'),
12+
'Expected stdout to contain usage information.',
13+
);
14+
}

0 commit comments

Comments
 (0)