Skip to content

Commit 02f5581

Browse files
chore: Migrate scripts to ESM (#5486)
1 parent 92545cc commit 02f5581

File tree

7 files changed

+153
-213
lines changed

7 files changed

+153
-213
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"dev": "pnpm run watch",
2121
"prettier": "prettier --plugin-search-dir . \"{packages,examples}/**/src/**/*.{md,js,jsx,cjs,ts,tsx,json,vue,svelte}\"",
2222
"prettier:write": "pnpm run prettier --write",
23-
"cipublish": "ts-node scripts/publish.ts",
24-
"validatePackages": "ts-node scripts/validate-packages.ts"
23+
"cipublish": "node scripts/publish.mjs",
24+
"validatePackages": "node scripts/validate-packages.mjs"
2525
},
2626
"nx": {
2727
"includedScripts": [
@@ -87,7 +87,7 @@
8787
"semver": "^7.5.1",
8888
"solid-js": "^1.6.13",
8989
"stream-to-array": "^2.3.0",
90-
"ts-node": "^10.9.1",
90+
"type-fest": "^3.11.0",
9191
"typescript": "^5.0.4",
9292
"vitest": "^0.27.1",
9393
"vue": "^3.2.47"

pnpm-lock.yaml

+20-104
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/config.ts renamed to scripts/config.mjs

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import path from 'path'
2-
import type { BranchConfig, Package } from './types'
1+
// @ts-check
32

4-
// TODO: List your npm packages here. The first package will be used as the versioner.
5-
export const packages: Package[] = [
3+
import { resolve } from 'node:path'
4+
import { fileURLToPath } from "node:url";
5+
6+
/**
7+
* List your npm packages here. The first package will be used as the versioner.
8+
* @type {import('./types').Package[]}
9+
*/
10+
export const packages = [
611
{
712
name: '@tanstack/query-core',
813
packageDir: 'query-core',
@@ -91,7 +96,8 @@ export const packages: Package[] = [
9196

9297
export const latestBranch = 'main'
9398

94-
export const branchConfigs: Record<string, BranchConfig> = {
99+
/** @type {Record<string, import('./types').BranchConfig>} */
100+
export const branchConfigs = {
95101
main: {
96102
prerelease: false,
97103
ghRelease: true,
@@ -110,4 +116,5 @@ export const branchConfigs: Record<string, BranchConfig> = {
110116
},
111117
}
112118

113-
export const rootDir = path.resolve(__dirname, '..')
119+
const __dirname = fileURLToPath(new URL(".", import.meta.url));
120+
export const rootDir = resolve(__dirname, '..')

0 commit comments

Comments
 (0)