Skip to content

Commit

Permalink
chore(deps): migrate from ts-node to tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Jan 8, 2025
1 parent 777be51 commit eb5a4fe
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/add-push-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
node-version-file: ".nvmrc"
cache: npm
- run: npm ci
- run: node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts features.json
- run: node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/diff-features.ts --no-github --format=json > features.diff.json
- run: npx tsx --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts features.json
- run: npx tsx --no-warnings=ExperimentalWarning ./scripts/diff-features.ts --no-github --format=json > features.diff.json
- uses: actions/upload-artifact@v4
with:
name: enumerate-features
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-browser-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
node-version-file: ".nvmrc"
cache: npm
- run: npm install -D typescript
- run: npm install -D ts-node
- run: npm install -D tsx
- name: Run update-browser-releases script
id: ubr
run: |
Expand Down
1 change: 0 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"loader": "ts-node/esm",
"extensions": ["ts", "tsx"]
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@
},
"scripts": {
"postinstall": "(git rev-parse --is-inside-work-tree && npm run save-git-history) || echo 'not in Git worktree; skipping save-git-history'",
"save-git-history": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/save-git-history.ts",
"save-git-history": "tsx --no-warnings=ExperimentalWarning scripts/save-git-history.ts",
"prepare": "(husky || true) && npm run gentypes && npm run build",
"diff": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/diff.ts",
"unittest": "NODE_ENV=test c8 mocha index.test.ts --recursive \"{,!(node_modules)/**}/*.test.ts\"",
"diff": "tsx --no-warnings=ExperimentalWarning scripts/diff.ts",
"unittest": "NODE_ENV=test c8 mocha index.test.ts --require tsx --recursive \"{,!(node_modules)/**}/*.test.ts\"",
"coverage": "c8 report -r lcov && open-cli coverage/lcov-report/index.html",
"format": "eslint . && prettier --check . && tsc --noEmit",
"format:fix": "eslint --quiet --fix . && prettier --write .",
"lint": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning lint/lint.ts",
"lint:fix": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning lint/fix.ts",
"lint": "tsx --no-warnings=ExperimentalWarning lint/lint.ts",
"lint:fix": "tsx --no-warnings=ExperimentalWarning lint/fix.ts",
"fix": "npm run format:fix && npm run lint:fix",
"stats": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/statistics.ts",
"build": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/build/index.ts",
"gentypes": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/generate-types.ts",
"release": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/release/index.ts",
"remove-redundant-flags": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/remove-redundant-flags.ts",
"stats": "tsx --no-warnings=ExperimentalWarning scripts/statistics.ts",
"build": "tsx --no-warnings=ExperimentalWarning scripts/build/index.ts",
"gentypes": "tsx --no-warnings=ExperimentalWarning scripts/generate-types.ts",
"release": "tsx --no-warnings=ExperimentalWarning scripts/release/index.ts",
"remove-redundant-flags": "tsx --no-warnings=ExperimentalWarning scripts/remove-redundant-flags.ts",
"show-errors": "npm test 1> /dev/null",
"test": "npm run format && npm run lint && npm run unittest",
"traverse": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/traverse.ts",
"update-browser-releases": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/update-browser-releases/index.ts",
"bcd": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/bulk-editor/index.ts"
"traverse": "tsx --no-warnings=ExperimentalWarning scripts/traverse.ts",
"update-browser-releases": "tsx --no-warnings=ExperimentalWarning scripts/update-browser-releases/index.ts",
"bcd": "tsx --no-warnings=ExperimentalWarning scripts/bulk-editor/index.ts"
}
}
12 changes: 9 additions & 3 deletions scripts/diff-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,15 @@ const enumerateFeatures = (ref = 'HEAD', quiet = false): string[] => {
// If the clean install fails, proceed anyways
}

execSync(
`node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts --data-from=${worktree}`,
);
try {
execSync(
`npx tsx --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts --data-from=${worktree}`,
);
} catch (e) {
execSync(
`node --loader=ts-node/esm --no-warnings=ExperimentalWarning ./scripts/enumerate-features.ts --data-from=${worktree}`,
);
}

return JSON.parse(fs.readFileSync('.features.json', { encoding: 'utf-8' }));
} finally {
Expand Down
7 changes: 1 addition & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,5 @@
"skipLibCheck": true
},
"exclude": ["build", "**/*.test.ts"],
"typeRoots": ["./node_modules/@types", "./types"],
"ts-node": {
"esm": true,
"files": true,
"swc": true
}
"typeRoots": ["./node_modules/@types", "./types"]
}

0 comments on commit eb5a4fe

Please sign in to comment.