Skip to content

Commit aa1a426

Browse files
authored
feat: rewrite to make it more extensible (#81)
* feat: rewrite to make it more extensible BREAKING CHANGE: bin scripts are now `template-oss-apply` and `template-oss-check` BREAKING CHANGE: renamed apply props `rootRepo`, `rootModule`, `workspaceRepo`, `workspaceModule`
1 parent f80526a commit aa1a426

File tree

100 files changed

+5221
-2066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+5221
-2066
lines changed

.commitlintrc.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
// This file is automatically added by @npmcli/template-oss. Do not edit.
1+
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
22

33
module.exports = {
44
extends: ['@commitlint/config-conventional'],
5-
// If you change rules be sure to also update release-please.yml
65
rules: {
7-
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'chore', 'deps']],
6+
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']],
87
'header-max-length': [2, 'always', 80],
98
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
109
},

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is automatically added by @npmcli/template-oss. Do not edit.
1+
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
22

33
const { readdirSync: readdir } = require('fs')
44

.github/CODEOWNERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
* @npm/cli-team
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
* @npm/cli-team

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,52 @@
33
name: Bug
44
description: File a bug/issue
55
title: "[BUG] <title>"
6-
labels: [Bug, Needs Triage]
6+
labels: [ Bug, Needs Triage ]
7+
78
body:
8-
- type: checkboxes
9-
attributes:
10-
label: Is there an existing issue for this?
11-
description: Please [search here](./issues) to see if an issue already exists for your problem.
12-
options:
13-
- label: I have searched the existing issues
14-
required: true
15-
- type: textarea
16-
attributes:
17-
label: Current Behavior
18-
description: A clear & concise description of what you're experiencing.
19-
validations:
20-
required: false
21-
- type: textarea
22-
attributes:
23-
label: Expected Behavior
24-
description: A clear & concise description of what you expected to happen.
25-
validations:
26-
required: false
27-
- type: textarea
28-
attributes:
29-
label: Steps To Reproduce
30-
description: Steps to reproduce the behavior.
31-
value: |
32-
1. In this environment...
33-
2. With this config...
34-
3. Run '...'
35-
4. See error...
36-
validations:
37-
required: false
38-
- type: textarea
39-
attributes:
40-
label: Environment
41-
description: |
42-
examples:
43-
- **npm**: 7.6.3
44-
- **Node**: 13.14.0
45-
- **OS**: Ubuntu 20.04
46-
- **platform**: Macbook Pro
47-
value: |
9+
- type: checkboxes
10+
attributes:
11+
label: Is there an existing issue for this?
12+
description: Please [search here](./issues) to see if an issue already exists for your problem.
13+
options:
14+
- label: I have searched the existing issues
15+
required: true
16+
- type: textarea
17+
attributes:
18+
label: Current Behavior
19+
description: A clear & concise description of what you're experiencing.
20+
validations:
21+
required: false
22+
- type: textarea
23+
attributes:
24+
label: Expected Behavior
25+
description: A clear & concise description of what you expected to happen.
26+
validations:
27+
required: false
28+
- type: textarea
29+
attributes:
30+
label: Steps To Reproduce
31+
description: Steps to reproduce the behavior.
32+
value: |
33+
1. In this environment...
34+
2. With this config...
35+
3. Run '...'
36+
4. See error...
37+
validations:
38+
required: false
39+
- type: textarea
40+
attributes:
41+
label: Environment
42+
description: |
43+
examples:
44+
- **npm**: 7.6.3
45+
- **Node**: 13.14.0
46+
- **OS**: Ubuntu 20.04
47+
- **platform**: Macbook Pro
48+
value: |
4849
- npm:
4950
- Node:
5051
- OS:
5152
- platform:
52-
validations:
53-
required: false
54-
53+
validations:
54+
required: false

.github/dependabot.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# This file is automatically added by @npmcli/template-oss. Do not edit.
22

33
version: 2
4+
45
updates:
5-
- package-ecosystem: npm
6-
directory: "/"
7-
schedule:
8-
interval: daily
9-
allow:
10-
- dependency-type: direct
11-
versioning-strategy: increase
12-
commit-message:
13-
prefix: deps
14-
prefix-development: chore
15-
labels:
16-
- "Dependencies"
6+
- package-ecosystem: npm
7+
directory: "/"
8+
schedule:
9+
interval: daily
10+
allow:
11+
- dependency-type: direct
12+
versioning-strategy: increase
13+
commit-message:
14+
prefix: deps
15+
prefix-development: chore
16+
labels:
17+
- "Dependencies"

.github/workflows/audit.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,40 @@
33
name: Audit
44

55
on:
6+
workflow_dispatch: null
67
schedule:
78
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
89
- cron: "0 1 * * 1"
9-
workflow_dispatch:
1010

1111
jobs:
1212
audit:
13-
name: npm audit
1413
runs-on: ubuntu-latest
1514
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v2
15+
- uses: actions/checkout@v3
16+
- name: Setup git user
17+
run: |
18+
git config --global user.email "[email protected]"
19+
git config --global user.name "npm cli ops bot"
20+
- uses: actions/setup-node@v3
1821
with:
19-
node-version: '16'
20-
- name: Install deps
21-
run: npm i --package-lock
22-
- name: Audit
23-
run: npm audit
22+
node-version: 16.x
23+
- name: Update to workable npm (windows)
24+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
25+
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
26+
run: |
27+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
28+
tar xf npm-7.5.4.tgz
29+
cd package
30+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
31+
cd ..
32+
rmdir /s /q package
33+
- name: Update npm to 7
34+
# If we do test on npm 10 it needs npm7
35+
if: matrix.node-version <= 10
36+
run: npm i --prefer-online --no-fund --no-audit -g npm@7
37+
- name: Update npm to latest
38+
if: matrix.node-version > 10
39+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
40+
- run: npm -v
41+
- run: npm i --package-lock
42+
- run: npm audit

.github/workflows/ci.yml

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
name: CI
44

55
on:
6+
workflow_dispatch: null
67
pull_request:
8+
branches:
9+
- '*'
710
push:
811
branches:
912
- main
@@ -16,37 +19,68 @@ jobs:
1619
lint:
1720
runs-on: ubuntu-latest
1821
steps:
19-
- uses: actions/checkout@v2
20-
- uses: actions/setup-node@v2
22+
- uses: actions/checkout@v3
23+
- name: Setup git user
24+
run: |
25+
git config --global user.email "[email protected]"
26+
git config --global user.name "npm cli ops bot"
27+
- uses: actions/setup-node@v3
2128
with:
22-
node-version: '16'
23-
- run: npm i --prefer-online -g npm@latest
29+
node-version: 16.x
30+
- name: Update to workable npm (windows)
31+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
32+
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
33+
run: |
34+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
35+
tar xf npm-7.5.4.tgz
36+
cd package
37+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
38+
cd ..
39+
rmdir /s /q package
40+
- name: Update npm to 7
41+
# If we do test on npm 10 it needs npm7
42+
if: matrix.node-version <= 10
43+
run: npm i --prefer-online --no-fund --no-audit -g npm@7
44+
- name: Update npm to latest
45+
if: matrix.node-version > 10
46+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
47+
- run: npm -v
2448
- run: npm i
2549
- run: npm run lint
2650

2751
test:
2852
strategy:
2953
fail-fast: false
3054
matrix:
31-
node-version: [12.13.0, 12.x, 14.15.0, 14.x, 16.13.0, 16.x]
55+
node-version:
56+
- 12.13.0
57+
- 12.x
58+
- 14.15.0
59+
- 14.x
60+
- 16.0.0
61+
- 16.x
3262
platform:
33-
- os: ubuntu-latest
34-
shell: bash
35-
- os: macos-latest
36-
shell: bash
37-
- os: windows-latest
38-
shell: cmd
63+
- os: ubuntu-latest
64+
shell: bash
65+
- os: macos-latest
66+
shell: bash
67+
- os: windows-latest
68+
shell: cmd
3969
runs-on: ${{ matrix.platform.os }}
4070
defaults:
4171
run:
4272
shell: ${{ matrix.platform.shell }}
4373
steps:
44-
- uses: actions/checkout@v2
45-
- uses: actions/setup-node@v2
74+
- uses: actions/checkout@v3
75+
- name: Setup git user
76+
run: |
77+
git config --global user.email "[email protected]"
78+
git config --global user.name "npm cli ops bot"
79+
- uses: actions/setup-node@v3
4680
with:
47-
node-version: ${{ matrix.node-version }}
48-
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
81+
node-version: 16.x
4982
- name: Update to workable npm (windows)
83+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
5084
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
5185
run: |
5286
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
@@ -55,7 +89,12 @@ jobs:
5589
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
5690
cd ..
5791
rmdir /s /q package
58-
- name: Update npm
92+
- name: Update npm to 7
93+
# If we do test on npm 10 it needs npm7
94+
if: matrix.node-version <= 10
95+
run: npm i --prefer-online --no-fund --no-audit -g npm@7
96+
- name: Update npm to latest
97+
if: matrix.node-version > 10
5998
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
6099
- run: npm -v
61100
- run: npm i

.github/workflows/codeql-analysis.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ name: "CodeQL"
44

55
on:
66
push:
7-
branches: [ main ]
7+
branches:
8+
- main
9+
- latest
810
pull_request:
911
# The branches below must be a subset of the branches above
10-
branches: [ main ]
12+
branches:
13+
- main
14+
- latest
1115
schedule:
1216
# "At 03:00 on Monday" https://crontab.guru/#0_3_*_*_1
1317
- cron: "0 3 * * 1"
@@ -24,15 +28,17 @@ jobs:
2428
strategy:
2529
fail-fast: false
2630
matrix:
27-
language: [ 'javascript' ]
31+
language: [ javascript ]
2832

2933
steps:
30-
- name: Checkout repository
31-
uses: actions/checkout@v2
32-
33-
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@v1
35-
with:
36-
languages: ${{ matrix.language }}
37-
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@v1
34+
- uses: actions/checkout@v3
35+
- name: Setup git user
36+
run: |
37+
git config --global user.email "[email protected]"
38+
git config --global user.name "npm cli ops bot"
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v1
41+
with:
42+
languages: ${{ matrix.language }}
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v1

0 commit comments

Comments
 (0)