Skip to content

Commit b42e2e0

Browse files
josephperrottmatsko
authored andcommitted
build: create dev-infra-private npm package (#35862)
Creates the scaffolding for an @angular/dev-infra-private package which will not be published to npm but will be pushed to https://github.com/angular/dev-infra-private-builds repo for each commit to master. The contents of this npm package will then be depended on via package.json dependency for angular/angular angular/angular-cli and angular/components. PR Close #35862
1 parent c55f900 commit b42e2e0

6 files changed

Lines changed: 89 additions & 0 deletions

File tree

.pullapprove.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ groups:
928928
'.github/**',
929929
'.vscode/**',
930930
'.yarn/**',
931+
'dev-infra/**',
931932
'docs/BAZEL.md',
932933
'docs/CARETAKER.md',
933934
'docs/COMMITTER.md',

dev-infra/BUILD.bazel

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
2+
load("@npm_bazel_typescript//:index.bzl", "ts_library")
3+
4+
ts_library(
5+
name = "cli",
6+
srcs = [
7+
"cli.ts",
8+
],
9+
deps = [
10+
"@npm//@types/node",
11+
],
12+
)
13+
14+
pkg_npm(
15+
name = "npm_package",
16+
srcs = [
17+
"package.json",
18+
],
19+
visibility = ["//visibility:public"],
20+
deps = [
21+
":cli",
22+
],
23+
)

dev-infra/cli.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. 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.io/license
7+
*/
8+
const args = process.argv.slice(2);
9+
10+
// TODO(josephperrott): Set up proper cli flag/command handling
11+
switch(args[0]) {
12+
default:
13+
console.info('No commands were matched');
14+
}

dev-infra/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@angular/dev-infra-private",
3+
"version": "0.0.0",
4+
"description": "INTERNAL USE ONLY - Angular internal DevInfra tooling/scripts - INTERNAL USE ONLY",
5+
"license": "MIT",
6+
"bin": {
7+
"ng-dev": "./cli.js"
8+
}
9+
}

scripts/build/build-packages-dist.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
'use strict';
1111

1212
const {buildZoneJsPackage} = require('./zone-js-builder');
13+
const {buildDevInfraPackage} = require('./dev-infra-builder');
1314
const {buildTargetPackages} = require('./package-builder');
1415

1516

@@ -19,3 +20,6 @@ buildTargetPackages('dist/packages-dist', false, 'Production');
1920
// Build the `zone.js` npm package into `dist/zone.js-dist/`, because it might be needed by other
2021
// scripts/tests.
2122
buildZoneJsPackage();
23+
24+
// Build the `angular-dev-infra` npm package into `dist/packages-dist/@angular/dev-infra-private`
25+
buildDevInfraPackage();

scripts/build/dev-infra-builder.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. 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.io/license
7+
*/
8+
9+
'use strict';
10+
11+
const {chmod, cp, mkdir, rm} = require('shelljs');
12+
const {baseDir, bazelBin, bazelCmd, exec, scriptPath} = require('./package-builder');
13+
14+
/**
15+
* Build the `@angular/dev-infra-private` npm package and copies it to `dist/packages-dist`.
16+
*/
17+
function buildDevInfraPackage() {
18+
console.info('##############################');
19+
console.info(`${scriptPath}:`);
20+
console.info(' Building @angular/dev-infra-private npm package');
21+
console.info('##############################');
22+
exec(`${bazelCmd} build //dev-infra:npm_package`);
23+
24+
const buildOutputDir = `${bazelBin}/dev-infra/npm_package`;
25+
const distTargetDir = `${baseDir}/dist/packages-dist/dev-infra-private`;
26+
27+
console.info(`# Copy artifacts to ${distTargetDir}`);
28+
mkdir('-p', distTargetDir);
29+
rm('-rf', distTargetDir);
30+
cp('-R', buildOutputDir, distTargetDir);
31+
chmod('-R', 'u+w', distTargetDir);
32+
33+
console.info('');
34+
}
35+
36+
module.exports = {
37+
buildDevInfraPackage
38+
};

0 commit comments

Comments
 (0)