Skip to content

Commit fe7aab5

Browse files
authored
Make ./scripts a package, make scripts typecheck, remove old stuff, workflow updates (DefinitelyTyped#67128)
1 parent 6db928c commit fe7aab5

20 files changed

+165
-211
lines changed

.github/workflows/CI.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,22 @@ jobs:
7676
TOKEN='ghp_i5wtj1l2AbpFv3OU96w6R'
7777
TOKEN+='On3bHOkcV2AmVY6'
7878
DANGER_GITHUB_API_TOKEN=$TOKEN pnpm danger ci || $( exit 0 )
79+
80+
scripts:
81+
runs-on: ubuntu-latest
82+
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'
83+
84+
steps:
85+
- uses: actions/checkout@v4
86+
- uses: actions/setup-node@v3
87+
with:
88+
node-version: '16'
89+
90+
- uses: pnpm/action-setup@v2
91+
name: Install pnpm
92+
with:
93+
version: latest
94+
run_install: |
95+
- args: [--filter, ., --filter, '{./scripts}...']
96+
97+
- run: pnpm tsc -p ./scripts

.github/workflows/UpdateCodeowners.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@ jobs:
3131
with:
3232
version: latest
3333
run_install: |
34-
- args: [--filter, .]
34+
- args: [--filter, ., --filter, '{./scripts}...']
3535
3636
- run: git config --global user.email "[email protected]"
3737
- run: git config --global user.name "TypeScript Bot"
3838

3939
- run: pnpm run update-codeowners
40-
env:
41-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
40+
41+
- uses: stefanzweifel/[email protected]
42+
with:
43+
commit_author: 'TypeScript Bot <[email protected]>'
44+
commit_message: '🤖 Update CODEOWNERS'
45+
commit_user_email: '[email protected]'
46+
commit_user_name: 'TypeScript Bot'

.github/workflows/format-and-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
version: latest
2727
run_install: |
28-
- args: [--filter, .]
28+
- args: [--filter, ., --filter, '{./scripts}...']
2929
3030
- name: Get date
3131
id: date

.github/workflows/ghostbuster.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v3
27-
with:
28-
fetch-depth: 0
2927

3028
- uses: actions/setup-node@v4
3129

@@ -34,7 +32,7 @@ jobs:
3432
with:
3533
version: latest
3634
run_install: |
37-
- args: [--filter, .]
35+
- args: [--filter, ., --filter, '{./scripts}...']
3836
3937
- run: node ./scripts/ghostbuster.js
4038
env:

.github/workflows/lint-md.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ jobs:
1717
with:
1818
version: latest
1919
run_install: |
20-
- args: [--filter, .]
20+
- args: [--filter, ., --filter, '{./scripts}...']
2121
- run: pnpm remark --frail . .github

.github/workflows/support-window.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
with:
3232
version: latest
3333
run_install: |
34-
- args: [--filter, .]
34+
- args: [--filter, ., --filter, '{./scripts}...']
3535
- name: Fetch TypeScript versions and release dates from npm
3636
run: |
3737
npm view --json typescript time |

package.json

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,30 @@
2020
"preinstall": "npx only-allow pnpm",
2121
"not-needed": "node scripts/not-needed.js",
2222
"update-codeowners": "node scripts/update-codeowners.js",
23-
"test-all": "node --require source-map-support/register node_modules/@definitelytyped/dtslint-runner/ --path .",
23+
"test-all": "node --enable-source-maps node_modules/@definitelytyped/dtslint-runner/ --path .",
2424
"clean": "node scripts/remove-empty.js",
2525
"clean-node-modules": "node scripts/clean-node-modules.js",
26-
"test": "node --require source-map-support/register node_modules/@definitelytyped/dtslint/ types",
27-
"lint": "node --require source-map-support/register node_modules/@definitelytyped/dtslint/ types",
26+
"test": "node --enable-source-maps node_modules/@definitelytyped/dtslint/ types",
27+
"lint": "node --enable-source-maps node_modules/@definitelytyped/dtslint/ types",
2828
"prettier": "prettier"
2929
},
3030
"devDependencies": {
3131
"@definitelytyped/definitions-parser": "latest",
32+
"@definitelytyped/dts-critic": "latest",
3233
"@definitelytyped/dtslint": "latest",
3334
"@definitelytyped/dtslint-runner": "latest",
3435
"@definitelytyped/eslint-plugin": "latest",
3536
"@definitelytyped/header-parser": "latest",
3637
"@definitelytyped/typescript-versions": "latest",
3738
"@definitelytyped/utils": "latest",
38-
"@octokit/core": "^3.5.1",
39-
"@octokit/rest": "^16.0.0",
40-
"comment-json": "^4.2.3",
41-
"d3-array": "^3.0.2",
42-
"d3-axis": "^3.0.0",
43-
"d3-scale": "^4.0.0",
44-
"d3-selection": "^3.0.0",
45-
"d3-time": "^3.0.0",
46-
"d3-time-format": "^4.0.0",
4739
"danger": "^11.2.3",
4840
"dprint": "^0.42.3",
4941
"eslint-plugin-jsdoc": "^44.2.7",
50-
"jsdom": "^17.0.0",
5142
"remark-cli": "^11.0.0",
5243
"remark-gfm": "^3.0.0",
5344
"remark-validate-links": "^12.0.0",
54-
"shelljs": "^0.8.5",
55-
"source-map-support": "^0.5.21",
56-
"typescript": "next",
57-
"w3c-xmlserializer": "^2.0.0",
58-
"yargs": "^17.1.1"
45+
"tslint": "latest",
46+
"typescript": "next"
5947
},
6048
"type": "module",
6149
"husky": {

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
packages:
2+
- 'scripts'
23
- 'types/**'

scripts/clean-node-modules.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const __filename = url.fileURLToPath(new URL(import.meta.url));
66
const __dirname = path.dirname(__filename);
77
const repoRoot = path.resolve(__dirname, "..");
88

9+
/**
10+
* @param {string} p
11+
* @returns {Iterable<string>}
12+
*/
913
function* iterateNodeModules(p) {
1014
const dirents = fs.readdirSync(p, { withFileTypes: true });
1115
for (const dirent of dirents) {
@@ -20,6 +24,9 @@ function* iterateNodeModules(p) {
2024
}
2125
}
2226

27+
/**
28+
* @param {string} p
29+
*/
2330
function rimraf(p) {
2431
// The rimraf package uses maxRetries=10 on Windows, but Node's fs.rm does not have that special case.
2532
return fs.rmSync(p, { recursive: true, force: true, maxRetries: process.platform === "win32" ? 10 : 0 });

scripts/close-old-issues.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)