Skip to content

Commit bf5787f

Browse files
build: refactored setup scripts to src/ .ts files (#469)
## PR Checklist - [x] Addresses an existing open issue: fixes #468 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Applies two general refactors: * Migrates `script/setup.js` contents to a `src/setup/` folder with `.ts` files * Moves out all the core logic (input parsing, repository fetching, etc.) from that one file into other files
1 parent 9fb12c9 commit bf5787f

30 files changed

+1087
-718
lines changed

.eslintrc.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ module.exports = {
5959
rules: {
6060
// These off-by-default rules work well for this repo and we like them on.
6161
"deprecation/deprecation": "error",
62+
63+
// These more-strict-by-default rules don't work well for this repo and we like them less strict.
64+
"@typescript-eslint/no-unnecessary-condition": [
65+
"error",
66+
{
67+
allowConstantLoopConditions: true,
68+
},
69+
],
6270
},
6371
},
6472
{
@@ -124,6 +132,7 @@ module.exports = {
124132

125133
// These on-by-default rules don't work well for this repo and we like them off.
126134
"no-constant-condition": "off",
135+
"no-case-declarations": "off",
127136
"no-inner-declarations": "off",
128137

129138
// Stylistic concerns that don't interfere with Prettier

cspell.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"lib",
88
"node_modules",
99
"pnpm-lock.yaml",
10-
"script/*.json"
10+
"src/setup/*.json"
1111
],
1212
"words": [
1313
"Codecov",

knip.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"entry": [
44
"src/index.ts!",
55
"src/hydrate/index.ts",
6-
"script/*e2e.js",
7-
"script/setup*.js"
6+
"src/setup/index.ts",
7+
"script/*e2e.js"
88
],
99
"ignoreBinaries": ["dedupe", "gh"],
1010
"project": ["src/**/*.ts!", "script/**/*.js"]

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"lint:packages": "pnpm dedupe --check",
3030
"lint:spelling": "cspell \"**\" \".github/**/*\"",
3131
"prepare": "husky install",
32-
"setup": "node script/setup.js",
32+
"setup": "tsx src/setup/index.ts",
3333
"setup:test": "node script/setup-test-e2e.js",
3434
"should-semantic-release": "should-semantic-release --verbose",
3535
"test": "vitest"
@@ -44,6 +44,7 @@
4444
},
4545
"devDependencies": {
4646
"@clack/prompts": "^0.6.3",
47+
"@octokit/request-error": "^3.0.3",
4748
"@types/eslint": "^8.37.0",
4849
"@types/js-yaml": "^4.0.5",
4950
"@types/prettier": "^2.7.2",
@@ -85,6 +86,7 @@
8586
"sentences-per-line": "^0.2.1",
8687
"should-semantic-release": "^0.1.1",
8788
"title-case": "^3.0.3",
89+
"tsx": "^3.12.7",
8890
"typescript": "^5.0.4",
8991
"vitest": "^0.31.0",
9092
"yaml-eslint-parser": "^1.2.2"

pnpm-lock.yaml

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)