Skip to content

Commit

Permalink
do not bundle or minify, generate declaration map
Browse files Browse the repository at this point in the history
Using tsup only to transpile ts files. Disabled bundling, minifying and declaration generation.
Using tsup onSuccess to use tsc to emit declaration and declaration sourcemap
  • Loading branch information
otaviosoares committed Nov 20, 2023
1 parent a5bf5f2 commit 77dd897
Show file tree
Hide file tree
Showing 35 changed files with 77 additions and 67 deletions.
2 changes: 1 addition & 1 deletion examples/data-generator/package.json
Expand Up @@ -9,7 +9,7 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"watch": "yarn tsup --watch"
},
"dependencies": {
"date-fns": "^2.19.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-core/package.json
Expand Up @@ -27,8 +27,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"devDependencies": {
"@hookform/resolvers": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-data-fakerest/package.json
Expand Up @@ -38,8 +38,8 @@
},
"homepage": "https://github.com/marmelab/react-admin#readme",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"fakerest": "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-data-fakerest/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-data-graphql-simple/package.json
Expand Up @@ -34,8 +34,8 @@
],
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"@apollo/client": "^3.3.19",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-data-graphql-simple/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-data-graphql/package.json
Expand Up @@ -34,8 +34,8 @@
],
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"@apollo/client": "^3.3.19",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-data-graphql/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-data-json-server/package.json
Expand Up @@ -26,8 +26,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"query-string": "^7.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-data-json-server/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-data-localforage/package.json
Expand Up @@ -41,8 +41,8 @@
},
"homepage": "https://github.com/marmelab/react-admin#readme",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"localforage": "^1.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-data-localforage/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"declaration": true,
"declarationMap": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-data-localstorage/package.json
Expand Up @@ -38,8 +38,8 @@
},
"homepage": "https://github.com/marmelab/react-admin#readme",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"lodash": "~4.17.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-data-localstorage/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-data-simple-rest/package.json
Expand Up @@ -26,8 +26,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"query-string": "^7.1.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-data-simple-rest/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-i18n-i18next/package.json
Expand Up @@ -26,8 +26,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"i18next": "^23.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-i18n-i18next/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-i18n-polyglot/package.json
Expand Up @@ -26,8 +26,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"node-polyglot": "^2.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-i18n-polyglot/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-input-rich-text/package.json
Expand Up @@ -24,8 +24,8 @@
},
"sideEffects": false,
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"@tiptap/core": "^2.0.3",
Expand Down
16 changes: 8 additions & 8 deletions packages/ra-input-rich-text/tsconfig.json
@@ -1,10 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"allowJs": false
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"],
"include": ["src"]
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"],
"include": ["src"]
}
4 changes: 2 additions & 2 deletions packages/ra-language-english/package.json
Expand Up @@ -22,8 +22,8 @@
}
},
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"ra-core": "^4.15.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-language-english/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-language-french/package.json
Expand Up @@ -22,8 +22,8 @@
}
},
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"dependencies": {
"ra-core": "^4.15.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-language-french/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-no-code/package.json
Expand Up @@ -26,8 +26,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"devDependencies": {
"@testing-library/react": "^11.2.3",
Expand Down
7 changes: 2 additions & 5 deletions packages/ra-no-code/tsconfig.json
@@ -1,13 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false,
"types": [
"jest",
"@types/node"
]
"types": ["jest", "@types/node"]
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"],
"include": ["src"]
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-ui-materialui/package.json
Expand Up @@ -28,8 +28,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"devDependencies": {
"@mui/icons-material": "^5.0.1",
Expand Down
11 changes: 8 additions & 3 deletions packages/ra-ui-materialui/tsconfig.json
@@ -1,9 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"outDir": "dist",
"rootDir": "src"
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js", "**/*.stories.tsx"],
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.spec.js",
"**/*.stories.tsx"
],
"include": ["src"]
}
4 changes: 2 additions & 2 deletions packages/react-admin/package.json
Expand Up @@ -28,8 +28,8 @@
"bugs": "https://github.com/marmelab/react-admin/issues",
"license": "MIT",
"scripts": {
"build": "yarn tsup",
"watch": "tsc --outDir dist/esm --module es2015 --watch"
"build": "yarn tsup --onSuccess tsc",
"watch": "yarn tsup --watch"
},
"devDependencies": {
"cross-env": "^5.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-admin/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"outDir": "dist",
"rootDir": "src",
"allowJs": false
},
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -12,13 +12,14 @@
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
"emitDeclarationOnly": true,
"sourceMap": true /* Generates corresponding '.map' file. */,
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./lib", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "removeComments": true, /* Do not emit comments to output. */
"noEmit": true /* Do not emit outputs. */,
// "noEmit": true /* Do not emit outputs. */,
"allowArbitraryExtensions": true,
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
Expand Down
15 changes: 11 additions & 4 deletions tsup.config.ts
@@ -1,12 +1,19 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts'],
entry: [
'src/**/*.{ts,tsx}',
'!src/**/*.spec.{ts,tsx}',
'!src/**/*.stories.{ts,tsx}',
'!src/**/*.d.{ts,tsx}',
],
outDir: 'dist',
splitting: false,
sourcemap: false,
bundle: false,
minify: false,
sourcemap: true,
clean: true,
dts: true,
dts: false,
format: ['esm', 'cjs'],
target: 'es2015',
silent: true,
});

0 comments on commit 77dd897

Please sign in to comment.