chore: unify migrated packages (#32819)

* add readme note in root

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher

* use declarations instead of src root and ship it with package. also use tsconfig.json instead of tsconfig.base as it has better IDE support. Also add a watcher
This commit is contained in:
Bill Glesias
2025-10-27 20:07:46 -04:00
committed by GitHub
parent 4ea36d4d8d
commit d5cc26de3d
37 changed files with 48 additions and 39 deletions

View File

@@ -18,7 +18,8 @@
"test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0", "test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0",
"test-unit": "vitest run", "test-unit": "vitest run",
"test:clean": "find ./test/__fixtures__ -depth -name 'output.*' -type f -exec rm {} \\;", "test:clean": "find ./test/__fixtures__ -depth -name 'output.*' -type f -exec rm {} \\;",
"tslint": "tslint --config ../ts/tslint.json --project ." "tslint": "tslint --config ../ts/tslint.json --project .",
"watch": "yarn build:cjs --watch & yarn build:esm --watch"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.28.0", "@babel/core": "^7.28.0",
@@ -53,7 +54,7 @@
"cjs/*", "cjs/*",
"esm/*" "esm/*"
], ],
"types": "src/index.ts", "types": "cjs/index.d.ts",
"module": "esm/index.js", "module": "esm/index.js",
"nx": {} "nx": {}
} }

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./cjs", "outDir": "./cjs",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./esm", "outDir": "./esm",

View File

@@ -14,6 +14,7 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"types": [ "types": [
"node" "node"
] ],
"declaration": true
} }
} }

View File

@@ -9,7 +9,7 @@
"cjs/*", "cjs/*",
"esm/*" "esm/*"
], ],
"types": "src/index.ts", "types": "cjs/index.d.ts",
"scripts": { "scripts": {
"build": "yarn build:esm && yarn build:cjs", "build": "yarn build:esm && yarn build:cjs",
"build-prod": "yarn build", "build-prod": "yarn build",
@@ -21,7 +21,9 @@
"test": "yarn test-unit", "test": "yarn test-unit",
"test-unit": "vitest run", "test-unit": "vitest run",
"test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0", "test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0",
"tslint": "tslint --config ../ts/tslint.json --project ." "tslint": "tslint --config ../ts/tslint.json --project .",
"watch": "yarn build:cjs --watch & yarn build:esm --watch"
}, },
"dependencies": { "dependencies": {
"ansi_up": "5.0.0", "ansi_up": "5.0.0",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./cjs", "outDir": "./cjs",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./esm", "outDir": "./esm",

View File

@@ -9,6 +9,7 @@
"noUncheckedIndexedAccess": true, "noUncheckedIndexedAccess": true,
"skipLibCheck": true, "skipLibCheck": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"esModuleInterop": true "esModuleInterop": true,
"declaration": true
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"include": [ "include": [
"index.ts" "index.ts"
], ],

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"include": [ "include": [
"index.mts" "index.mts"
], ],

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./lib", "rootDir": "./lib",
"outDir": "./cjs", "outDir": "./cjs",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./lib", "rootDir": "./lib",
"outDir": "./esm", "outDir": "./esm",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./lib", "rootDir": "./lib",
"outDir": "./cjs", "outDir": "./cjs",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./lib", "rootDir": "./lib",
"outDir": "./esm", "outDir": "./esm",

View File

@@ -1,6 +1,5 @@
import path from 'path' import path from 'path'
import fs from 'fs-extra'
let fs: typeof import('fs-extra')
export type RunnerPkg = 'app' | 'runner' export type RunnerPkg = 'app' | 'runner'
@@ -11,8 +10,6 @@ export const resolveFromPackages = (...args: string[]) => {
} }
const getRunnerContents = (filename: string) => { const getRunnerContents = (filename: string) => {
fs ??= require('fs-extra') as typeof import('fs-extra')
return fs.readFile(getPathToDist('runner', filename)) return fs.readFile(getPathToDist('runner', filename))
} }

View File

@@ -23,7 +23,7 @@
"cjs/*", "cjs/*",
"esm/*" "esm/*"
], ],
"types": "./lib/index.ts", "types": "./cjs/index.d.ts",
"module": "esm/index.js", "module": "esm/index.js",
"nx": {} "nx": {}
} }

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./lib", "rootDir": "./lib",
"outDir": "./cjs", "outDir": "./cjs",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./lib", "rootDir": "./lib",
"outDir": "./esm", "outDir": "./esm",

View File

@@ -5,6 +5,7 @@
"compilerOptions": { "compilerOptions": {
"allowJs": false, "allowJs": false,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true "skipLibCheck": true,
"declaration": true
} }
} }

View File

@@ -2,4 +2,6 @@
Bundles the monorepo root `package.json` as an installable package, allowing `@packages/root` to be installed in any context without having an absolute reference to the root `package.json` Bundles the monorepo root `package.json` as an installable package, allowing `@packages/root` to be installed in any context without having an absolute reference to the root `package.json`
In order to accomplish this, `rollup` is used to bundle the `package.json`, as packages may be interpreted in place or be installed inside the `node_modules` directory. This package builds an `index.mjs` file for packages using `vite`/ ES Modules and an `index.js` file for any CommonJS entry points. In order to accomplish this, `rollup` is used to bundle the `package.json`, as packages may be interpreted in place or be installed inside the `node_modules` directory. This package builds an `index.mjs` file for packages using `vite`/ ES Modules and an `index.js` file for any CommonJS entry points.
We currently don't use a watcher for this package because it is so small, so if any changes happen to the `package.json` in the root you will need to manually retrigger the build of this package.

View File

@@ -15,7 +15,8 @@
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, .", "lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, .",
"test": "vitest run", "test": "vitest run",
"test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0", "test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0",
"tslint": "tslint --config ../ts/tslint.json --project ." "tslint": "tslint --config ../ts/tslint.json --project .",
"watch": "yarn build:cjs --watch & yarn build:esm --watch"
}, },
"dependencies": { "dependencies": {
"compare-versions": "4.1.3", "compare-versions": "4.1.3",
@@ -38,7 +39,7 @@
"cjs/*", "cjs/*",
"esm/*" "esm/*"
], ],
"types": "src/index.ts", "types": "cjs/index.d.ts",
"module": "esm/index.js", "module": "esm/index.js",
"nx": {} "nx": {}
} }

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"include": [ "include": [
"src/dependencies.ts" "src/dependencies.ts"
], ],

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./cjs", "outDir": "./cjs",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./esm", "outDir": "./esm",

View File

@@ -15,6 +15,7 @@
"noUncheckedIndexedAccess": true, "noUncheckedIndexedAccess": true,
"esModuleInterop": true, "esModuleInterop": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true "skipLibCheck": true,
"declaration": true
} }
} }

View File

@@ -17,7 +17,7 @@
"test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0", "test-debug": "vitest --inspect-brk --no-file-parallelism --test-timeout=0",
"test-unit": "vitest run", "test-unit": "vitest run",
"tslint": "tslint --config ../ts/tslint.json --project .", "tslint": "tslint --config ../ts/tslint.json --project .",
"watch": "tsc --watch" "watch": "yarn build:cjs --watch & yarn build:esm --watch & yarn build:browser -w"
}, },
"dependencies": { "dependencies": {
"@opentelemetry/api": "1.4.1", "@opentelemetry/api": "1.4.1",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"include": [ "include": [
"src/client.ts" "src/client.ts"
], ],

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"include": [ "include": [
"src/**/*.ts" "src/**/*.ts"
], ],

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"include": [ "include": [
"src/**/*.ts" "src/**/*.ts"
], ],

View File

@@ -12,7 +12,8 @@
"check-ts": "tsc -p tsconfig.cjs.json --noEmit", "check-ts": "tsc -p tsconfig.cjs.json --noEmit",
"clean": "rimraf cjs esm", "clean": "rimraf cjs esm",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, .", "lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, .",
"test": "vitest run" "test": "vitest run",
"watch": "yarn build:cjs --watch & yarn build:esm --watch"
}, },
"dependencies": { "dependencies": {
"semver": "^7.7.1" "semver": "^7.7.1"
@@ -33,7 +34,7 @@
"cjs/*", "cjs/*",
"esm/*" "esm/*"
], ],
"types": "src/index.ts", "types": "cjs/index.d.ts",
"module": "esm/index.js", "module": "esm/index.js",
"workspaces": { "workspaces": {
"nohoist": [ "nohoist": [

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./cjs", "outDir": "./cjs",

View File

@@ -1,5 +1,5 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src", "rootDir": "./src",
"outDir": "./esm", "outDir": "./esm",

View File

@@ -14,6 +14,7 @@
"ignoreDeprecations": "5.0", "ignoreDeprecations": "5.0",
"importsNotUsedAsValues": "error", "importsNotUsedAsValues": "error",
"skipLibCheck": true, "skipLibCheck": true,
"declaration": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"types": [ "types": [
"mocha", "mocha",