Skip to content

Commit e6afcf1

Browse files
devversionatscott
authored andcommitted
build: split dev-infra configuration into individual files (angular#37890)
Splits the dev-infra configurations into individual files inside the `.ng-dev/` folder. This helps with clarity as there is no single configuration file that becomes extremely large and difficult to maintain. Additionally, more explicit configuration types are now used. This fixed the max-line length setting for commit message validation. This option is currently named incorrectly and a noop. PR Close angular#37890
1 parent 4b4b745 commit e6afcf1

File tree

5 files changed

+127
-112
lines changed

5 files changed

+127
-112
lines changed

.ng-dev/commit-message.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import {CommitMessageConfig} from '../dev-infra/commit-message/config';
2+
3+
/**
4+
* The configuration for `ng-dev commit-message` commands.
5+
*/
6+
export const commitMessage: CommitMessageConfig = {
7+
maxLineLength: 120,
8+
minBodyLength: 20,
9+
minBodyLengthTypeExcludes: ['docs'],
10+
types: [
11+
'build',
12+
'ci',
13+
'docs',
14+
'feat',
15+
'fix',
16+
'perf',
17+
'refactor',
18+
'release',
19+
'style',
20+
'test',
21+
],
22+
scopes: [
23+
'animations',
24+
'bazel',
25+
'benchpress',
26+
'changelog',
27+
'common',
28+
'compiler',
29+
'compiler-cli',
30+
'core',
31+
'dev-infra',
32+
'docs-infra',
33+
'elements',
34+
'forms',
35+
'http',
36+
'language-service',
37+
'localize',
38+
'migrations',
39+
'ngcc',
40+
'packaging',
41+
'platform-browser',
42+
'platform-browser-dynamic',
43+
'platform-server',
44+
'platform-webworker',
45+
'platform-webworker-dynamic',
46+
'router',
47+
'service-worker',
48+
'upgrade',
49+
've',
50+
'zone.js',
51+
]
52+
};

.ng-dev/config.ts

Lines changed: 4 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,8 @@
1-
import {MergeConfig} from '../dev-infra/pr/merge/config';
1+
import {commitMessage} from './commit-message';
2+
import {format} from './format';
3+
import {github} from './github';
4+
import {merge} from './merge';
25

3-
// The configuration for `ng-dev commit-message` commands.
4-
const commitMessage = {
5-
'maxLength': 120,
6-
'minBodyLength': 20,
7-
'minBodyLengthTypeExcludes': ['docs'],
8-
'types': [
9-
'build',
10-
'ci',
11-
'docs',
12-
'feat',
13-
'fix',
14-
'perf',
15-
'refactor',
16-
'release',
17-
'style',
18-
'test',
19-
],
20-
'scopes': [
21-
'animations',
22-
'bazel',
23-
'benchpress',
24-
'changelog',
25-
'common',
26-
'compiler',
27-
'compiler-cli',
28-
'core',
29-
'dev-infra',
30-
'docs-infra',
31-
'elements',
32-
'forms',
33-
'http',
34-
'language-service',
35-
'localize',
36-
'migrations',
37-
'ngcc',
38-
'packaging',
39-
'platform-browser',
40-
'platform-browser-dynamic',
41-
'platform-server',
42-
'platform-webworker',
43-
'platform-webworker-dynamic',
44-
'router',
45-
'service-worker',
46-
'upgrade',
47-
've',
48-
'zone.js',
49-
]
50-
};
51-
52-
// The configuration for `ng-dev format` commands.
53-
const format = {
54-
'clang-format': {
55-
'matchers': [
56-
'**/*.{js,ts}',
57-
// TODO: burn down format failures and remove aio and integration exceptions.
58-
'!aio/**',
59-
'!integration/**',
60-
// Both third_party and .yarn are directories containing copied code which should
61-
// not be modified.
62-
'!third_party/**',
63-
'!.yarn/**',
64-
// Do not format d.ts files as they are generated
65-
'!**/*.d.ts',
66-
]
67-
},
68-
'buildifier': true
69-
};
70-
71-
/** Github metadata information for `ng-dev` commands. */
72-
const github = {
73-
owner: 'angular',
74-
name: 'angular',
75-
};
76-
77-
// Configuration for the `ng-dev pr merge` command. The command can be used
78-
// for merging upstream pull requests into branches based on a PR target label.
79-
const merge = () => {
80-
// TODO: resume dynamically determining patch branch
81-
const patch = '10.0.x';
82-
const config: MergeConfig = {
83-
githubApiMerge: false,
84-
claSignedLabel: 'cla: yes',
85-
mergeReadyLabel: /^PR action: merge(-assistance)?/,
86-
caretakerNoteLabel: 'PR action: merge-assistance',
87-
commitMessageFixupLabel: 'commit message fixup',
88-
labels: [
89-
{
90-
pattern: 'PR target: master-only',
91-
branches: ['master'],
92-
},
93-
{
94-
pattern: 'PR target: patch-only',
95-
branches: [patch],
96-
},
97-
{
98-
pattern: 'PR target: master & patch',
99-
branches: ['master', patch],
100-
},
101-
],
102-
requiredBaseCommits: {
103-
// PRs that target either `master` or the patch branch, need to be rebased
104-
// on top of the latest commit message validation fix.
105-
// These SHAs are the commits that update the required license text in the header.
106-
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
107-
[patch]: '27b95ba64a5d99757f4042073fd1860e20e3ed24'
108-
},
109-
};
110-
return config;
111-
};
112-
113-
// Export function to build ng-dev configuration object.
1146
module.exports = {
1157
commitMessage,
1168
format,

.ng-dev/format.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {FormatConfig} from '../dev-infra/format/config';
2+
3+
/**
4+
* Configuration for the `ng-dev format` command.
5+
*/
6+
export const format: FormatConfig = {
7+
'clang-format': {
8+
'matchers': [
9+
'**/*.{js,ts}',
10+
// TODO: burn down format failures and remove aio and integration exceptions.
11+
'!aio/**',
12+
'!integration/**',
13+
// Both third_party and .yarn are directories containing copied code which should
14+
// not be modified.
15+
'!third_party/**',
16+
'!.yarn/**',
17+
// Do not format d.ts files as they are generated
18+
'!**/*.d.ts',
19+
]
20+
},
21+
'buildifier': true
22+
};

.ng-dev/github.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {GithubConfig} from '../dev-infra/utils/config';
2+
3+
/**
4+
* Github configuration for the `ng-dev` command. This repository is used as
5+
* remote for the merge script and other utilities like `ng-dev pr rebase`.
6+
*/
7+
8+
export const github: GithubConfig = {
9+
owner: 'angular',
10+
name: 'angular'
11+
};

.ng-dev/merge.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import {MergeConfig} from '../dev-infra/pr/merge/config';
2+
3+
/**
4+
* Configuration for the merge tool in `ng-dev`. This sets up the labels which
5+
* are respected by the merge script (e.g. the target labels).
6+
*/
7+
export const merge = (): MergeConfig => {
8+
// TODO: resume dynamically determining patch branch
9+
const patch = '10.0.x';
10+
return {
11+
githubApiMerge: false,
12+
claSignedLabel: 'cla: yes',
13+
mergeReadyLabel: /^PR action: merge(-assistance)?/,
14+
caretakerNoteLabel: 'PR action: merge-assistance',
15+
commitMessageFixupLabel: 'commit message fixup',
16+
labels: [
17+
{
18+
pattern: 'PR target: master-only',
19+
branches: ['master'],
20+
},
21+
{
22+
pattern: 'PR target: patch-only',
23+
branches: [patch],
24+
},
25+
{
26+
pattern: 'PR target: master & patch',
27+
branches: ['master', patch],
28+
},
29+
],
30+
requiredBaseCommits: {
31+
// PRs that target either `master` or the patch branch, need to be rebased
32+
// on top of the latest commit message validation fix.
33+
// These SHAs are the commits that update the required license text in the header.
34+
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
35+
[patch]: '27b95ba64a5d99757f4042073fd1860e20e3ed24'
36+
},
37+
};
38+
};

0 commit comments

Comments
 (0)