weiran-zsd / dts-cli Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jaredpalmer/tsdx
Zero-config CLI for TypeScript package development
License: MIT License
This project forked from jaredpalmer/tsdx
Zero-config CLI for TypeScript package development
License: MIT License
❯ npx dts-cli create bld
____ _____ ____
| _ \ |_ _| / ___|
| | | | | | \___ \
| |_| | | | ___) |
|____/ |_| |____/
✔ Choose a template · basic
✔ Created bld
✖ Failed to install dependencies
Error: Command failed with exit code 1: yarn add @size-limit/preset-small-lib @tsconfig/recommended dts-cli husky size-limit tslib typescript --dev
warning dts-cli > rollup-plugin-sourcemaps > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.15.5"
error Found incompatible module.
yarn add v1.22.17
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
No error
Probably copy from tsdx some configurations.
npx: installed 1 in 1.234s
System:
OS: macOS 11.5.2
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 399.97 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.5 - ~/.nvm/versions/node/v14.15.5/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.15.5/bin/yarn
npm: 6.14.16 - ~/.nvm/versions/node/v14.15.5/bin/npm
Browsers:
Brave Browser: 86.1.16.75
Chrome: 100.0.4896.88
Chrome Canary: 103.0.5006.0
Firefox: 97.0.1
Safari: 14.1.2
I'm trying to run some code at the top of a file, before anything else runs, before imports even. But the problem is that the generated files always hoist imports up, which causes a problem for me.
What I want to do, is check if a dependency exist before trying to import it, so that I can let the user install first it.
Imports shouldn't be hoisted based on my little knowledge.
There should be a way to inject some code in the cli index before the require statement.
System:
OS: Linux 5.4 Ubuntu 18.04.6 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz
Memory: 1.06 GB / 11.60 GB
Container: Yes
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm
Browsers:
Chrome: 101.0.4951.41
Firefox: 99.0
npmPackages:
dts-cli: ^1.1.5 => 1.5.1
typescript: ^4.5.4 => 4.6.4
Hello. Thank for the awesome library.
I am currently using paths
in my tsconfig as I have a very complex structure folder. The project itself compiles perfectly but when it's bundled I get imports error (I am using the example
folder to test the project).
Error: The following dependencies are imported but could not be resolved:
store (imported by /Users/michelecocuccio/Documents/Michele/Projects/Simple React Lightbox/NEW/srl/simple-react-lightbox/dist/simple-react-lightbox.esm.js)
store/reducers/srlSlice (imported by /Users/michelecocuccio/Documents/Michele/Projects/Simple React Lightbox/NEW/srl/simple-react-lightbox/dist/simple-react-lightbox.esm.js)
utils (imported by /Users/michelecocuccio/Documents/Michele/Projects/Simple React Lightbox/NEW/srl/simple-react-lightbox/dist/simple-react-lightbox.esm.js)
hooks (imported by /Users/michelecocuccio/Documents/Michele/Projects/Simple React Lightbox/NEW/srl/simple-react-lightbox/dist/simple-react-lightbox.esm.js)
styledComponents/SRLLightboxSC (imported by /Users/michelecocuccio/Documents/Michele/Projects/Simple React Lightbox/NEW/srl/simple-react-lightbox/dist/simple-react-lightbox.esm.js)
SRLComponents/SRLContainer (imported by /Users/michelecocuccio/Documents/Michele/Projects/Simple React Lightbox/NEW/srl/simple-react-lightbox/dist/simple-react-lightbox.esm.js)
Is there a way to make sure the paths are compiled correctly when the project is bundled?
System:
OS: macOS 12.0.1
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 39.71 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - /usr/local/bin/node
Yarn: 1.22.15 - ~/.yarn/bin/yarn
npm: 8.1.0 - /usr/local/bin/npm
Browsers:
Chrome: 97.0.4692.71
Firefox: 95.0.2
Safari: 15.1
npmPackages:
dts-cli: ^1.1.5 => 1.1.5
typescript: ^4.5.4 => 4.5.4
First let me thank you for your amazing work on this fork.
It would be nice that all of this effort gets more recognition. It's actually not that straightforward to land on this repository.
Have you considered publishing this package under a new name?
Regards,
TypeScript compiler outputs all type definitions into the dist
folder regardless of whether they are relevant to the components exported from the library. Even dead code that doesn't make its way into the final .js rollup still produces type definitions in the dist
folder. Unless you take some extra steps, all those .d.ts files end up in your npm package.
Let's assume the following project structure:
src
foo
foo.tsx
bar
bar.tsx
ComponentA.tsx
ComponentB.tsx
index.tsx
dts-cli build
produces the following dist
output:
dist
foo
foo.d.ts
bar
bar.d.ts
ComponentA.d.ts
ComponentB.d.ts
foo-bar.cjs.development.js
foo-bar.cjs.production.min.js
foo-bar.esm.js
index.d.ts
index.js
index.d.ts
so that the final output looks like the one below:
dist
foo-bar.cjs.development.js
foo-bar.cjs.production.min.js
foo-bar.esm.js
index.d.ts
index.js
I achieved the desired goal with rollup-plugin-dts, but I didn't find an elegant way to plug into the build pipeline to execute a separate rollup build after all rollups are done. I ended up with the following patch package:
diff --git a/node_modules/dts-cli/dist/index.js b/node_modules/dts-cli/dist/index.js
index d5d2644..6285cd8 100755
--- a/node_modules/dts-cli/dist/index.js
+++ b/node_modules/dts-cli/dist/index.js
@@ -34,6 +34,8 @@ const utils_2 = require("./templates/utils");
const deprecated = (0, tslib_1.__importStar)(require("./deprecated"));
const sort_package_json_1 = (0, tslib_1.__importDefault)(require("sort-package-json"));
const pkg = require('../package.json');
+const dts = require('rollup-plugin-dts').default;
+const del = require('rollup-plugin-delete');
const prog = (0, sade_1.default)('dts');
let appPackageJson;
try {
@@ -60,6 +62,18 @@ async function jsOrTs(filename) {
: '.js';
return (0, utils_1.resolveApp)(`${filename}${extension}`);
}
+const rollupTypesConfig = {
+ input: "dist/types/index.d.ts",
+ output: { file: "dist/index.d.ts", format: "es" },
+ plugins: [
+ dts(),
+ del({ hook: "buildEnd", targets: "dist/types" })
+ ]
+ };
+async function rollupTypes() {
+ const bundle = await (0, rollup_1.rollup)(rollupTypesConfig);
+ await bundle.write(rollupTypesConfig.output);
+}
async function getInputs(entries, source) {
return (0, jpjs_1.concatAllArray)([]
.concat(entries && entries.length
@@ -261,6 +275,7 @@ prog
`);
try {
await deprecated.moveTypes();
+ await rollupTypes();
if (firstTime && opts.onFirstSuccess) {
firstTime = false;
run(opts.onFirstSuccess);
@@ -314,6 +329,9 @@ prog
})
.then(async () => {
await deprecated.moveTypes();
+ })
+ .then(async () => {
+ await rollupTypes();
});
logger(promise, 'Building modules');
await promise;
I'm curious if there is a more straightforward approach that I simply overlooked. If not, would you be interested in adding this as a feature to dts-cli
behind a feature flag? I'll be happy to contribute a more generic solution.
I'm assuming this can be useful for most developers working on TypeScript libraries that roll up all their code into a single file without preserving the directory structure.
There are some alternative options (i.e. api-extractor
) that I haven't explored closely since rollup-plugin-dts
option appears to fit more naturally into dts-api
pipeline.
Currently rollup-plugin-typescript2 is used
typanion and clipanion recently moved to @rollup/plugin-typescript arcanis/typanion#8
as it is maintained by rollup community directly has better chance of long term maintenance.
Update dependency to @rollup/plugin-typescript
Switching to better maintained dependencies is always a big win for long term
It'd help in reducing maintenance in debian, we already have @rollup/plugin-typescript and it'd be nice if we can avoid maintaining rollup-plugin-typescript2 as well.
Error loading `tslib` helper library.
/Users/weiran/repo/dian/tsdx/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25177
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/weiran/repo/dian/tsdx/node_modules/rollup-plugin-typescript2/node_modules/tslib/package.json
System:
OS: macOS 12.0
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 703.07 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.0.0 - /usr/local/bin/node
Yarn: 1.22.10 - ~/.npm-global/bin/yarn
npm: 8.1.0 - ~/.npm-global/bin/npm
Watchman: 20200920.192359.0 - /usr/local/bin/watchman
Browsers:
Brave Browser: 83.1.10.93
Chrome: 94.0.4606.81
Edge: 94.0.992.50
Safari: 15.1
npmGlobalPackages:
dts-cli: 0.19.2
typescript: 4.4.2
Running the npx dts-cli create mylib
command to create a new library fails because tsconfig.json contains module options incompatible with Rollup.
npx dts-cli create mylib
____ _____ ____
| _ \ |_ _| / ___|
| | | | | | \___ \
| |_| | | | ___) |
|____/ |_| |____/
✔ Choose a template · basic
✔ Created mylib
✖ Failed to install dependencies
Error: Command failed with exit code 1: yarn add @size-limit/preset-small-lib @tsconfig/recommended dts-cli husky size-limit tslib typescript --dev
warning dts-cli > [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
Error: Incompatible tsconfig option. Module resolves to 'CommonJS'. This is incompatible with rollup, please use 'module: "ES2015"' or 'module: "ESNext"'.
at checkTsConfig (/home/user/example/mylib/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25125:15)
at parseTsConfig (/home/user/example/mylib/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25156:5)
at Object.options (/home/user/example/mylib/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:30033:73)
at /home/user/example/mylib/node_modules/rollup/dist/shared/rollup.js:23384:43
at async /home/user/example/mylib/node_modules/rollup/dist/shared/rollup.js:23384:99
at async getInputOptions (/home/user/example/mylib/node_modules/rollup/dist/shared/rollup.js:23377:61)
at async rollupInternal (/home/user/example/mylib/node_modules/rollup/dist/shared/rollup.js:23324:72)
at async /home/user/example/mylib/node_modules/dts-cli/dist/index.js:300:26
at async Promise.all (index 2)
error Command failed with exit code 1.
yarn add v1.22.15
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
success Saved 564 new dependencies.
info Direct dependencies
├─ @size-limit/[email protected]
├─ @tsconfig/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @bcoe/[email protected]
├─ @eslint/[email protected]
├─ @humanwhocodes/[email protected]
├─ @humanwhocodes/[email protected]
├─ @istanbuljs/[email protected]
├─ @jest/[email protected]
├─ @jest/[email protected]
├─ @jest/[email protected]
├─ @nodelib/[email protected]
├─ @nodelib/[email protected]
├─ @nodelib/[email protected]
├─ @rollup/[email protected]
├─ @rollup/[email protected]
├─ @rollup/[email protected]
├─ @rollup/[email protected]
├─ @rollup/[email protected]
├─ @rollup/[email protected]
├─ @sinonjs/[email protected]
├─ @sinonjs/[email protected]
├─ @size-limit/[email protected]
├─ @size-limit/[email protected]
├─ @size-limit/[email protected]
├─ @statoscope/[email protected]
├─ @statoscope/[email protected]
├─ @statoscope/[email protected]
├─ @statoscope/[email protected]
├─ @statoscope/[email protected]
├─ @statoscope/[email protected]
├─ @tootallnate/[email protected]
├─ @trysound/[email protected]
├─ @tsconfig/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @typescript-eslint/[email protected]
├─ @typescript-eslint/[email protected]
├─ @typescript-eslint/[email protected]
├─ @webassemblyjs/[email protected]
├─ @webassemblyjs/[email protected]
├─ @webassemblyjs/[email protected]
├─ @webassemblyjs/[email protected]
├─ @webassemblyjs/[email protected]
├─ @webassemblyjs/[email protected]
├─ @xtuc/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
$ dts build
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
at makeError (/home/user/.npm/_npx/9780/lib/node_modules/dts-cli/node_modules/execa/lib/error.js:59:11)
at handlePromise (/home/user/.npm/_npx/9780/lib/node_modules/dts-cli/node_modules/execa/index.js:114:26)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async /home/user/.npm/_npx/9780/lib/node_modules/dts-cli/dist/index.js:169:9
The command finishes the setup successfully.
System:
OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Memory: 6.99 GB / 15.54 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 14.18.0 - /tmp/fnm_multishells/2688_1634980799404/bin/node
Yarn: 1.22.15 - /tmp/fnm_multishells/2688_1634980799404/bin/yarn
npm: 6.14.15 - /tmp/fnm_multishells/2688_1634980799404/bin/npm
Browsers:
Chrome: 94.0.4606.81
Firefox: 93.0
npmPackages:
dts-cli: ^0.19.3 => 0.19.3
typescript: ^4.4.4 => 4.4.4
npmGlobalPackages:
dts-cli: 0.19.3
When running
dts build -i src/components/core/Badge/index.ts -i src/components/core/CssBaseline/index.ts
the second entry is ignored.
The dist/
folder only contains the bundle containing the Badge component in this case.
I would expect having bundle files for CssBaseline too.
I don't have a clue 😂
I just want to have one file for each component of a library of React components
System:
OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i7-7560U CPU @ 2.40GHz
Memory: 3.67 GB / 15.37 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.5/bin/yarn
npm: 7.21.0 - ~/.nvm/versions/node/v14.17.5/bin/npm
Browsers:
Brave Browser: 93.1.29.81
Chrome: 93.0.4577.82
Firefox: 92.0
npmPackages:
dts-cli: ^0.17.1 => 0.17.1
typescript: ^4.4.3 => 4.4.3
I'm not sure it's a bug or miscofig.
npm run test
will run all the tests in the test folder as expect.
In the following cases, the sub folder test from other folder will be executed, and of cuz failed
due to the environment setup differences.
steps to create the issues:
npx dts-cli create mylib
Go into the mylib
, run CRA command to create a sub folder my-app
, which will includes the default testing suites and a test case.
npx create-react-app my-app --template typescript
then run in root folder
npm run test
the test in test
folder by dts-cli will pass but the test inside the my-app
will run also and failed.
Those tests should be ignored?
{
"version": "0.1.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"dist",
"src"
],
"engines": {
"node": ">=10"
},
"scripts": {
"start": "dts watch",
"build": "dts build",
"test": "dts test",
"lint": "dts lint",
"prepare": "dts build",
"size": "size-limit",
"analyze": "size-limit --why"
},
"peerDependencies": {},
"husky": {
"hooks": {
"pre-commit": "dts lint"
}
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
},
"jest": {
"testEnvironment": "node"
},
"name": "mylib",
"author": "weiran",
"module": "dist/mylib.esm.js",
"size-limit": [
{
"path": "dist/mylib.cjs.production.min.js",
"limit": "10 KB"
},
{
"path": "dist/mylib.esm.js",
"limit": "10 KB"
}
],
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.3",
"@tsconfig/recommended": "^1.0.1",
"dts-cli": "^0.19.6",
"husky": "^7.0.4",
"size-limit": "^7.0.3",
"tslib": "^2.3.1",
"typescript": "^4.5.2"
}
}
a well-sorted package.json, using something like sort-package-json
no typescript declaration files (.d.ts) are output in the build
declaration files should be included in build output
Not sure what the problem is
I have a tsdx component library and I swapped it out with dts-cli but the build is missing declaration files. I didn't change anything except the scripts, package.json, and renamed tsdx.config.json
to dts.config.json
System:
OS: macOS 11.6
CPU: (8) x64 Apple M1
Memory: 26.42 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.2 - ~/n/bin/node
Yarn: 1.22.17 - ~/n/bin/yarn
npm: 8.1.2 - ~/n/bin/npm
Browsers:
Chrome: 97.0.4692.71
Firefox: 95.0.2
Safari: 15.0
npmPackages:
typescript: ^4.5.4 => 4.5.4
npmGlobalPackages:
typescript: 4.3.5
tsdx has been around for quite some time. It does appear to me that the current (however undeniably awesome!) approach lost its momentum and there are other, newer tools (like mentioned in the title 'esbuild') we could wrap dts-cli around. Would love to hear your feedback
Probably most users
Related: jaredpalmer#716
I added absolute import aliases configuration in tsconfig.json
{
"extends": "@tsconfig/create-react-app/tsconfig.json",
"include": ["src", "types", "stories"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@Components": ["src/Components"],
"@Components/*": ["src/Components/*"]
}
}
}
and using that aliases import in one of my interfaces file
but when running dts build
which will bundle the component. the import still not updated to relative import and cause the types not detected and the component will lose the ability of the types since it's refer to the incorrect path.
Expected behavior is that when build the app it will resolve all aliases import into relative import so that it refers to the correct path
None at the moment,
My temporary workaround is just to update all import to relative import. but it will be a mess if in the future i have deeper nested folder with ../../../
import
Since this lib based on tsdx
. I have tried many things from the github issue on tsdx
library but nothing seems to work
jaredpalmer#91
What i have tried
System:
OS: Windows 10 10.0.22000
CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
Memory: 6.51 GB / 13.86 GB
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (98.0.1108.56)
Internet Explorer: 11.0.22000.120
npmPackages:
dts-cli: ^1.4.0 => 1.4.0
typescript: ^4.5.5 => 4.5.5
I am using type module in my package json for my code which breaks the require function that pulls in the config file
Should pull in .cjs config file
Just needs to be able to support .cjs file import as an option instead of just .js and .ts
System:
OS: macOS 12.5
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 164.73 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - /usr/local/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 8.3.1 - /usr/local/bin/npm
Browsers:
Chrome: 104.0.5112.79
Safari: 15.6
(node:97280) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/weiran/.npm-global/lib/node_modules/dts-cli/node_modules/rollup-plugin-typescript2/node_modules/tslib/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
System:
OS: macOS 12.0
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 551.53 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.10.0 - /usr/local/bin/node
Yarn: 3.0.0-rc.2.git.20210523.hash-664cc40d - ~/.npm-global/bin/yarn
npm: 7.24.1 - ~/.npm-global/bin/npm
Watchman: 20200920.192359.0 - /usr/local/bin/watchman
Browsers:
Brave Browser: 83.1.10.93
Chrome: 94.0.4606.81
Edge: 94.0.992.38
Safari: 15.0
npmGlobalPackages:
dts-cli: 0.18.0
typescript: 4.4.2
The import cost is very expensive, and the size is still the same as the amount of components imported reduced
The import cost only takes on what component is being used
I have tried few things such as reducing reexporting components, but it doesn't work
N / A
System:
OS: Windows 10 10.0.22000
CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
Memory: 2.47 GB / 13.86 GB
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Managers:
Cargo: 1.61.0 - ~\.cargo\bin\cargo.EXE
Utilities:
Git: 2.34.1. - /mingw64/bin/git
IDEs:
VSCode: 1.68.1 - C:\Users\bryan\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Languages:
Bash: 4.4.23 - C:\Program Files\Git\usr\bin\bash.EXE
Perl: 5.34.0 - C:\Program Files\Git\usr\bin\perl.EXE
Rust: 1.61.0 - /c/Users/bryan/.cargo/bin/rustc
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (102.0.1245.44)
Internet Explorer: 11.0.22000.120
After creating a new react library using dts-cli, the ESLint Plugin of VSCode won't work out-of-the-box.
ESLint Plugin of VSCode should work without any additional tinkering
Not sure how one could fix it, but it seems like the extension cant find the right config to pick.
[Info - 11:19:28 AM] ESLint server is starting
[Info - 11:19:28 AM] ESLint server running in node v16.13.0
[Info - 11:19:28 AM] ESLint server is running.
[Info - 11:19:29 AM] ESLint library loaded from: /Users/dummy/react-libs/dts-test/node_modules/eslint/lib/api.js
[Warn - 11:19:29 AM]
No ESLint configuration (e.g .eslintrc) found for file: /Users/dummy/react-libs/dts-test/src/index.tsx
File will not be validated. Consider running 'eslint --init' in the workspace folder dts-test
Alternatively you can disable ESLint by executing the 'Disable ESLint' command.
System:
OS: macOS 12.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 701.05 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.19.1 - ~/.yarn/bin/yarn
npm: 8.5.0 - /usr/local/bin/npm
Browsers:
Brave Browser: 98.1.35.100
Chrome: 100.0.4896.127
Firefox: 98.0.2
Safari: 15.2
npmPackages:
dts-cli: ^1.5.0 => 1.5.0
typescript: ^4.6.3 => 4.6.3
The watch command features a noClean option which does not clean the build folder. The build command does not.
We'd like to run multiple build commands (for multiple entries until #55 is supported) and would like to retain the dist folder between those.
Add the same noClean option to the build command too.
Some advanced usages / edge cases.
Named exports from a barrel file.
Ive just converted over from TSDX and the first issue im getting is when i run dts test i get this issue, have you come across this issue before.
Sorry to keep bombarding with issues, but i seem to have got an issue as where the aliases that work normally don't seem to work when running the built files.
https://github.com/The-Code-Monkey/Components/runs/4141119026?check_suite_focus=true
The weird part is that inside the devDependencies
, parcel
is ^1.12.3
,
but when I run npm i
and npm outdated
, parcel is always installed as 1.12.4
due to some dep
dependency requirement.
The current project will always fail in /example
project due to the Parcel
bug.
It's been discussed for a while but it seems like this forks does not address this critical issue.
So I had to do hard roll back to 1,12.3
by npm i [email protected]
, which creates some questionable warnings.
Though it's just a example playground that has nothing to do with the true package, the developer experience is quite unpleasing.
Run npm run start
without problems
windows
It would be nice if there was a code-mod or a doc to say how to convert between the two.
No bug/issue, just wanted to say thanks to y'all at weiran-zsd for picking up the slack on tsdx.
import "./error.less";
// global.d.ts
declare module '*.less' {
const content: { [key: string]: any }
export default content
}
'react-photo-view/dist/index.css' is imported by dist/types/components/image-upload/index.d.ts, but could not be resolved Error: Could not resolve './error.less' from dist/types/components/error/index.d.ts
it was introduced in 26a6950. the error was like Swatinem/rollup-plugin-dts#184.
I think it's fine to make the rollup-plugin-dts behind the option, as seems not well compat with css/json modules.
System:
OS: macOS 12.2
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 3.68 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.2.0 - /usr/local/bin/node
Yarn: 1.22.17 - ~/.npm-global/bin/yarn
npm: 8.2.0 - ~/.npm-global/bin/npm
Watchman: 20200920.192359.0 - /usr/local/bin/watchman
Browsers:
Brave Browser: 83.1.10.93
Chrome: 96.0.4664.110
Edge: 96.0.1054.62
Safari: 15.3
npmPackages:
dts-cli: ^1.1.1 => 1.1.1
npmGlobalPackages:
dts-cli: 0.20.0
typescript: 4.5.2
Jest is on v27 and eslint is on v7
Jest and Eslint have bump major versions to v29 and v8 respectively
Updated package.json
with the new versions... note Jest 29 requires you to import a new library
All users who want the latest technologies
Switching to a new bundler
If I have an existing project folder or repository, I first run npx dtx create foo
, then copy the contents of foo
to the root of my project.
First cd into an existing project folder, then run npx dtx create .
This should then setup all files and folders in the root of the project folder.
I suggest using a similar implementation as npx create-next-app .
or npx create-react-app .
After creating a new dts-cli project, choosing the react-storybook template, running yarn lint
will fail due to not being able to load eslint-plugin-prettier correctly.
yarn lint
works without any problems
Installing eslint-plugin-prettier
helps get rid of the error message, but it does not seem to be the intended way, since for the react
template it works out of the box (and there it is also missing in the package.json)
It apparently only fails in the react-storybook
template.
yarn run v1.19.1
$ dts lint
Defaulting to "dts lint src test"
You can override this in the package.json scripts, like "lint": "dts lint src otherDir"
Error: Failed to load plugin 'prettier' declared in 'BaseConfig': Cannot find module 'eslint-plugin-prettier'
Require stack:
- /Users/dummy/react-libs/dts-test-storybook/__placeholder__.js
Referenced from: BaseConfig
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at Object.resolve (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2325:46)
at ConfigArrayFactory._loadPlugin (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3376:33)
at ConfigArrayFactory._loadExtendedPluginConfig (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3196:29)
at ConfigArrayFactory._loadExtends (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3117:29)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3058:25)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (/Users/dummy/react-libs/dts-test-storybook/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3003:20)
at _normalizeObjectConfigData.next (<anonymous>) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/dummy/react-libs/dts-test-storybook/__placeholder__.js'
],
messageTemplate: 'plugin-missing',
messageData: {
pluginName: 'eslint-plugin-prettier',
resolvePluginsRelativeTo: '/Users/dummy/react-libs/dts-test-storybook',
importerName: 'BaseConfig'
}
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
System:
OS: macOS 12.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 701.05 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.19.1 - ~/.yarn/bin/yarn
npm: 8.5.0 - /usr/local/bin/npm
Browsers:
Brave Browser: 98.1.35.100
Chrome: 100.0.4896.127
Firefox: 98.0.2
Safari: 15.2
npmPackages:
dts-cli: ^1.5.0 => 1.5.0
typescript: ^4.6.3 => 4.6.3
Currently it is pulled in as an indirect dependency even though it is directly required in src/templates/react-with-storybook.ts
Any modules directly used in src/* should be explicitly mentioned in package.json
Just add types-fest as a direct devDependency, this will also gives flexibility with which exact version is pulled in.
When type-fest 0.18.0 is used build fails with this error,
src/templates/basic.ts(47,5): error TS2322: Type '{ version: string; license: string; main: string; typings: string; files: string[]; engines: { node: string; }; scripts: { start: string; build: string; test: string; lint: string; prepare: string; size: string; analyze: string; }; peerDependencies: {}; husky: { ...; }; prettier: { ...; }; }' is not assignable to type 'PackageJson'.
Object literal may only specify known properties, and 'husky' does not exist in type 'PackageJson'.
I'm trying to build tsdx as a native debian package.
If I remove the import of React, build fails with message:
'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
the import of React it's not necessary.
I wish there was a way we could run export like you can for create-react-app where it will unpack all the config files that it uses as well as install any packages it's using under the hood. So that we could update and tweak everything
Without making any changes besides adding a useState to the component <Thing />
in the src file I'm getting this error:
TypeError: Cannot read properties of null (reading 'useState')
I'm not getting any errors in the DTS app console or my app console, it is compiling without errors or warnings. The error is showing when the component tries to mount. If I remove the useState my app is working fine.
This is how the code of the component looks like:
And this is the error I'm getting:
dts lint --write-file
produces the following .eslintrc.js
in v1.1.3:
module.exports = {
extends: [
"/Users/user/my-project/node_modules/dts-cli/conf/eslint-config-react-app/index.js",
"prettier",
"plugin:prettier/recommended",
],
settings: {
react: {
version: "detect",
},
},
};
dts lint --write-file
should not be including absolute paths in the .eslintrc.js
Output path relative to the project root.
it won't happen soon, just want to list all the possible things:
when init project with dts-cli, it installs husky, which breaks the hooks of git when in monorepo.
no husky installed, or there is options in the cli
add a question to decide if husky needed.
Local commits fail unless doctoc is installed in global scope.
.husky/pre-commit: line 7: doctoc: command not found
husky - pre-commit hook exited with code 127 (error)
This is happening due to pre-commit hook:
yarn pretty-quick --staged --pattern '!test/tests/lint/**'
yarn lint
yarn deduplicate:check
doctoc README.md <----- this line is breaking commit
I should be able to commit changes without installing doctoc globally.
doctoc
script in package.jsonyarn doctoc
in husky pre-commit hooklint-staged is not installed
As we already include husky
, I think it would be nice if dts-cli
would include lint-staged
as well.
Include lint-staged
as part of the setup
All users
When I run yarn build
command, packge.json dependencies
are not added to the bundle.
package.json dependencies
should be included to the bundle.
I'm building a NodeJS package and it can be found here.
System:
OS: Linux 5.15 Ubuntu 22.04 LTS 22.04 LTS (Jammy Jellyfish)
CPU: (4) x64 Intel(R) Core(TM) i3-1005G1 CPU @ 1.20GHz
Memory: 6.12 GB / 11.44 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.15.1/bin/yarn
npm: 8.15.1 - ~/.nvm/versions/node/v16.15.1/bin/npm
Browsers:
Brave Browser: 103.1.41.100
Chrome: 103.0.5060.134
npmPackages:
dts-cli: ^1.5.2 => 1.5.2
typescript: ^4.7.4 => 4.7.4
npmGlobalPackages:
typescript: 4.7.4
When creating a project, husky
is installed, but as there is no git repo, husky isn't initialized.
npx dts-cli create my-project
pre-commit
hooks should be initialized.
Run git init
before installing node modules
System:
OS: macOS 12.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 120.61 MB / 32.00 GB
Shell: 3.3.1 - /opt/homebrew/bin/fish
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
Browsers:
Chrome: 102.0.5005.61
Firefox: 99.0.1
Safari: 15.4
npmPackages:
dts-cli: ^1.5.1 => 1.5.1
typescript: ^4.7.3 => 4.7.3
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@babel/core
, @babel/eslint-parser
, @babel/helper-module-imports
, @babel/parser
, @babel/preset-env
, @babel/traverse
, @rollup/plugin-replace
, @rushstack/eslint-patch
, @types/eslint
, @types/lodash
, @types/node
, @types/react
, @types/react-dom
, babel-plugin-polyfill-regenerator
, eslint-plugin-react
, eslint-plugin-react-hooks
, lint-staged
, semver
, ts-jest
, tslib
)@commitlint/cli
, @commitlint/config-conventional
)fs-extra
, @types/fs-extra
).github/workflows/nodejs.yml
actions/checkout v4
actions/setup-node v4
actions/checkout v4
actions/setup-node v4
templates/basic/.github/workflows/main.yml
actions/checkout v4
actions/setup-node v4
templates/basic/.github/workflows/size.yml
actions/checkout v4
andresz1/size-limit-action v1
templates/react-with-storybook/.github/workflows/main.yml
actions/checkout v4
actions/setup-node v4
templates/react-with-storybook/.github/workflows/size.yml
actions/checkout v4
andresz1/size-limit-action v1
templates/react/.github/workflows/main.yml
actions/checkout v4
actions/setup-node v4
templates/react/.github/workflows/size.yml
actions/checkout v4
andresz1/size-limit-action v1
conf/eslint-config-react-app/package.json
@babel/core ^7.24.3
@babel/eslint-parser ^7.24.1
@rushstack/eslint-patch ^1.10.1
@typescript-eslint/eslint-plugin ^5.62.0
@typescript-eslint/parser ^5.62.0
babel-preset-react-app ^10.0.1
confusing-browser-globals ^1.0.11
eslint-plugin-flowtype ^8.0.3
eslint-plugin-import ^2.29.1
eslint-plugin-jest ^26.9.0
eslint-plugin-jsx-a11y ^6.8.0
eslint-plugin-react ^7.34.1
eslint-plugin-react-hooks ^4.6.0
eslint-plugin-testing-library ^5.11.1
package.json
@babel/core ^7.24.3
@babel/helper-module-imports ^7.24.3
@babel/parser ^7.24.1
@babel/plugin-proposal-class-properties ^7.18.6
@babel/preset-env ^7.24.3
@babel/traverse ^7.24.1
@rollup/plugin-babel ^6.0.4
@rollup/plugin-commonjs ^24.1.0
@rollup/plugin-json ^6.1.0
@rollup/plugin-node-resolve ^15.2.3
@rollup/plugin-replace ^5.0.5
@rollup/plugin-terser ^0.4.4
@types/jest ^29.5.12
@typescript-eslint/eslint-plugin ^5.62.0
@typescript-eslint/parser ^5.62.0
asyncro ^3.0.0
babel-jest ^29.7.0
babel-plugin-annotate-pure-calls ^0.4.0
babel-plugin-dev-expression ^0.2.3
babel-plugin-macros ^3.1.0
babel-plugin-polyfill-regenerator ^0.6.1
babel-plugin-transform-rename-import ^2.3.0
camelcase ^6.3.0
chalk ^4.1.2
confusing-browser-globals ^1.0.11
enquirer ^2.4.1
eslint-config-prettier ^8.10.0
eslint-plugin-flowtype ^8.0.3
eslint-plugin-import ^2.29.1
eslint-plugin-jest ^27.9.0
eslint-plugin-jsx-a11y ^6.8.0
eslint-plugin-prettier ^4.2.1
eslint-plugin-react ^7.34.1
eslint-plugin-react-hooks ^4.6.0
eslint-plugin-testing-library ^5.11.1
execa ^4.1.0
figlet ^1.7.0
fs-extra ^10.1.0
jest-environment-jsdom ^29.7.0
jest-watch-typeahead ^2.2.2
jpjs ^1.2.1
lodash.merge ^4.6.2
pascal-case ^3.1.2
postcss ^8.4.38
progress-estimator ^0.3.1
regenerator-runtime ^0.14.1
rollup-plugin-delete ^2.0.0
rollup-plugin-dts ^5.3.1
rollup-plugin-typescript2 ^0.36.0
sade ^1.8.1
semver ^7.6.0
shelljs ^0.8.5
sort-package-json ^1.57.0
tiny-glob ^0.2.9
ts-jest ^29.1.2
ts-node ^10.9.2
tslib ^2.6.2
type-fest ^2.19.0
@commitlint/cli ^16.3.0
@commitlint/config-conventional ^16.2.4
@release-it/conventional-changelog ^5.1.1
@types/cssnano ^5.1.0
@types/eslint ^8.56.7
@types/figlet ^1.5.8
@types/fs-extra ^9.0.13
@types/lodash ^4.17.0
@types/node ^16.18.94
@types/react ^18.2.74
@types/rollup-plugin-json ^3.0.7
@types/semver ^7.5.8
@types/shelljs ^0.8.15
@types/styled-components ^5.1.34
auto-changelog ^2.4.0
autoprefixer ^10.4.19
babel-plugin-replace-identifiers ^0.1.1
cssnano ^5.1.15
doctoc ^2.2.1
husky ^8.0.3
lint-staged ^15.2.2
release-it ^15.11.0
rollup-plugin-postcss ^4.0.2
styled-components ^5.3.11
tiny-invariant ^1.3.3
tiny-warning ^1.0.3
templates/react-with-storybook/example/package.json
react-app-polyfill ^3.0.0
@types/react ^18.2.74
@types/react-dom ^18.2.23
templates/react/example/package.json
react-app-polyfill ^3.0.0
@types/react ^18.2.74
@types/react-dom ^18.2.23
test/e2e/fixtures/build-default/package.json
test/e2e/fixtures/build-invalid/package.json
test/e2e/fixtures/build-multipleEntries/package.json
test/e2e/fixtures/build-withTsconfig/package.json
test/e2e/fixtures/build-withTypesRollup/package.json
test/integration/fixtures/build-options/package.json
test/integration/fixtures/build-withBabel/package.json
test/integration/fixtures/build-withConfig-defineConfig/package.json
test/integration/fixtures/build-withConfig/package.json
test/integration/fixtures/build-withConfigTs-defineConfig/package.json
test/integration/fixtures/build-withConfigTs-noRollup/package.json
test/integration/fixtures/build-withConfigTs/package.json
If I don't call
npm i dts-cli -D
and directly call
npx dts-cli create mylib
to install everything.
The example
folder inside mylib
is still using the old parcel
one instead of vite
one, which is problematic.
dts-cli
currently creates minified builds by default. This is problematic because it makes auditing the produced libraries (as a third party) much more difficult, even though there's not really any purpose to building minified libraries - anybody using a module system is very likely to already have their own minification tooling set up, since they will need it for their own application code anyway.
Only producing unminified builds by default, including for production builds.
Disabling minified builds by default, clearly documenting this, and allowing the user to re-enable minified builds (for which there is already a configuration option).
I've written a more detailed article here about the issues with minified builds in packages, and why it's better to not include them, also addressing some common concerns. If you have a concern that isn't covered there, I'd be happy to address it, of course :)
Especially because dts-cli
isn't just a single library but rather a tool used to produce libraries, the default setting makes a lot of difference in how easy it is for people to audit their dependency trees - people tend to stick with defaults most of the time, and so whether a tool like this enables them by default or not can have a big overnight impact on many different packages.
(I'll also be filing a similar issue on tsdx
, if it turns out to enable minification by default as well)
N/A
First let me thank you for your amazing work on this fork.
For documentation reasons, it would be nice to have the tsdx website available on https://weiran.github.io/dts-cli/ .
Thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.