Skip to content

Commit

Permalink
fix: packages exports types
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Dec 20, 2024
1 parent bcef624 commit 65a0927
Show file tree
Hide file tree
Showing 8 changed files with 498 additions and 133 deletions.
22 changes: 19 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,17 @@
},
"./*": "./*"
},
"typesVersions": {
"*": {
"three": [
"./dist/three.d.ts"
],
"pmndrs": [
"./dist/pmndrs.d.ts"
]
}
},
"files": [
"*.d.ts",
"dist"
],
"publishConfig": {
Expand All @@ -51,7 +60,8 @@
"lint:fix": "eslint . --fix",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
"docs:preview": "vitepress preview docs",
"test:attw": "attw --pack --ignore-rules cjs-resolves-to-esm"
},
"peerDependencies": {
"@tresjs/core": ">=4.0",
Expand All @@ -63,6 +73,7 @@
"postprocessing": "^6.36.4"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.2",
"@release-it/conventional-changelog": "^9.0.3",
"@tresjs/core": "^4.3.1",
"@tresjs/eslint-config": "^1.4.0",
Expand All @@ -77,7 +88,7 @@
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-visualizer": "^5.12.0",
"three": "^0.170.0",
"typescript": "^5.7.2",
"typescript": "5.4.2",
"unocss": "^0.64.1",
"vite": "^6.0.0",
"vite-plugin-banner": "^0.8.0",
Expand All @@ -86,5 +97,10 @@
"vitepress": "1.5.0",
"vue": "^3.5.13",
"vue-tsc": "^2.1.10"
},
"pnpm": {
"patchedDependencies": {
"@arethetypeswrong/[email protected]": "patches/@[email protected]"
}
}
}
36 changes: 36 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/dist/index.js b/dist/index.js
index 0504e767daf256ff705961e1d9052763fa910f41..793dfdc0971ebb6d71e66cb0a1a2f9ab959fd335 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -34,7 +34,7 @@ program
.description(`${chalk.bold.blue("Are the Types Wrong?")} attempts to analyze npm package contents for issues with their TypeScript types,
particularly ESM-related module resolution issues.`)
.argument("[file-directory-or-package-spec]", "the packed .tgz, or directory containing package.json with --pack, or package spec with --from-npm")
- .option("-P, --pack", "Run `npm pack` in the specified directory and delete the resulting .tgz file afterwards")
+ .option("-P, --pack", "Run `pnpm pack` in the specified directory and delete the resulting .tgz file afterwards")
.option("-p, --from-npm", "Read from the npm registry instead of a local file")
.addOption(new Option("--definitely-typed [version]", "Specify the version range of @types to use").default(true))
.option("--no-definitely-typed", "Don't include @types")
@@ -126,11 +126,11 @@ particularly ESM-related module resolution issues.`)
}
if (!opts.pack) {
if (!process.stdout.isTTY) {
- program.error("Specifying a directory requires the --pack option to confirm that running `npm pack` is ok.");
+ program.error("Specifying a directory requires the --pack option to confirm that running `pnpm pack` is ok.");
}
const rl = readline.createInterface(process.stdin, process.stdout);
const answer = await new Promise((resolve) => {
- rl.question(`Run \`npm pack\`? (Pass -P/--pack to skip) (Y/n) `, resolve);
+ rl.question(`Run \`pnpm pack\`? (Pass -P/--pack to skip) (Y/n) `, resolve);
});
rl.close();
if (answer.trim() && !answer.trim().toLowerCase().startsWith("y")) {
@@ -141,7 +141,7 @@ particularly ESM-related module resolution issues.`)
fileName = deleteTgz = path.join(fileOrDirectory,
// https://github.com/npm/cli/blob/f875caa86900122819311dd77cde01c700fd1817/lib/utils/tar.js#L123-L125
`${manifest.name.replace("@", "").replace("/", "-")}-${manifest.version}.tgz`);
- execSync("npm pack", { cwd: fileOrDirectory, encoding: "utf8", stdio: "ignore" });
+ execSync("pnpm pack", { cwd: fileOrDirectory, encoding: "utf8", stdio: "ignore" });
}
const file = await readFile(fileName);
const data = new Uint8Array(file);
10 changes: 10 additions & 0 deletions playground-nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ export default defineNuxtConfig({
modules: [
'@tresjs/nuxt',
],
typescript: {
tsConfig: {
compilerOptions: {
paths: {
'@tresjs/post-processing/pmndrs': ['../../src/core/pmndrs'],
'@tresjs/post-processing/three': ['../../src/core/three'],
},
},
},
},
vite: {
resolve: {
alias: {
Expand Down
2 changes: 1 addition & 1 deletion playground-nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@tresjs/cientos": "^4.0.3",
"@tresjs/nuxt": "^3.0.7",
"@tresjs/post-processing": "^0.7.1",
"@tresjs/post-processing": "workspace:^",
"@types/three": "^0.169.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"module": "ESNext",
"moduleResolution": "bundler",
"paths": {
"@tresjs/post-processing": ["../dist/"]
"@tresjs/post-processing/pmndrs": ["../dist/pmndrs"],
"@tresjs/post-processing/three": ["../dist/three"]
},
"resolveJsonModule": true,
"strict": true,
Expand Down
Loading

0 comments on commit 65a0927

Please sign in to comment.