Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try replacing tsc with tsup as build tool #1727

Merged
merged 148 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
c81485d
dsafa
Janpot Feb 1, 2023
58b3edd
alpha 3
Janpot Feb 1, 2023
398eb18
number formatter
Janpot Feb 2, 2023
93511b6
fix preview
Janpot Feb 2, 2023
e6b5c23
wip
Janpot Feb 2, 2023
9fb3450
add note
Janpot Feb 2, 2023
64883a2
Merge branch 'master' into pubs
Janpot Feb 2, 2023
e5573bd
Update NOTES.md
Janpot Feb 2, 2023
e5ffa2a
Merge branch 'master' into pubs
Janpot Feb 7, 2023
94f3261
Forbid writing in start mode
Janpot Feb 7, 2023
dcde747
forbid creating new app
Janpot Feb 7, 2023
24aadb1
dsefrw
Janpot Feb 7, 2023
9a291cc
upgrade
Janpot Feb 7, 2023
a79d329
Merge branch 'master' into pubs
Janpot Feb 8, 2023
c5a445c
Add path
Janpot Feb 8, 2023
3e6a65a
dewd
Janpot Feb 8, 2023
4ec5d26
Merge branch 'master' into pubs
Janpot Feb 8, 2023
175fede
env
Janpot Feb 8, 2023
92ef860
dewfrewr
Janpot Feb 8, 2023
bbd7182
fix empty components folder
Janpot Feb 8, 2023
2cd5cc0
fdsfds
Janpot Feb 8, 2023
e850d20
maybe env
Janpot Feb 8, 2023
386d727
dfewfw
Janpot Feb 8, 2023
59afbe2
keep env
Janpot Feb 9, 2023
490f6bd
dffew
Janpot Feb 9, 2023
e241ccd
Merge branch 'master' into pubs
Janpot Feb 9, 2023
5807af4
dwefewr
Janpot Feb 9, 2023
68f0366
local workflow
Janpot Feb 10, 2023
7c96e16
Update index.tsx
Janpot Feb 10, 2023
bec7d54
componnet by name
Janpot Feb 10, 2023
4fc48fc
Revert "componnet by name"
Janpot Feb 10, 2023
b9bc55a
dedwffdsf
Janpot Feb 10, 2023
732686b
fwf
Janpot Feb 10, 2023
ad18c30
codecomponents by name
Janpot Feb 13, 2023
aaba8cc
exit process when child process fails
Janpot Feb 14, 2023
f0b5a7e
fix migration
Janpot Feb 14, 2023
3629c2e
Add error
Janpot Feb 14, 2023
58e5f31
Merge branch 'master' into direction-13
Janpot Feb 15, 2023
186a7d3
quick dirty
Janpot Feb 15, 2023
85556c4
new instructions
Janpot Feb 15, 2023
edf9bea
clean up
Janpot Feb 15, 2023
1b5739e
punctuation
Janpot Feb 15, 2023
8df3a9e
Add fetch
Janpot Feb 15, 2023
a6166ce
refactor
Janpot Feb 15, 2023
9fb106d
file query resolvers
Janpot Feb 15, 2023
3c1c0ca
stability
Janpot Feb 15, 2023
397baac
dewf
Janpot Feb 15, 2023
915b8dc
Merge branch 'master' into direction-13
Janpot Feb 15, 2023
72e47e9
Remove sentry
Janpot Feb 15, 2023
545e22b
Update handleDataRequest.ts
Janpot Feb 15, 2023
2d7607b
werwe
Janpot Feb 15, 2023
d4acf75
Merge branch 'master' into direction-13
Janpot Feb 15, 2023
49b2580
Merge branch 'master' into direction-13
Janpot Feb 16, 2023
c12f50a
sentry leftovers
Janpot Feb 16, 2023
cc9da67
experiment
Janpot Feb 17, 2023
734c349
custom server
Janpot Feb 17, 2023
ed292da
refine
Janpot Feb 17, 2023
99af7b2
bring back queries
Janpot Feb 17, 2023
8b1d8eb
wefwr
Janpot Feb 17, 2023
02ee20e
Merge branch 'master' into direction-13
Janpot Feb 17, 2023
2be7ca6
add components in the mix
Janpot Feb 17, 2023
282d4b8
Update package.json
Janpot Feb 18, 2023
f42a726
Merge branch 'master' into direction-13
Janpot Feb 18, 2023
0e87ecc
bring back fetch
Janpot Feb 18, 2023
adf3086
lkdnaf
Janpot Feb 18, 2023
b890998
dfsf
Janpot Feb 18, 2023
3b9e4b7
Use lib to open files
Janpot Feb 20, 2023
24b7644
Merge branch 'master' into direction-13
Janpot Feb 20, 2023
fe1ae16
verified this
Janpot Feb 20, 2023
47c82ac
lints
Janpot Feb 20, 2023
00b0b4b
move cli over to toolpad-app
Janpot Feb 20, 2023
517515a
fskjfh
Janpot Feb 20, 2023
5c66ba7
exit on error
Janpot Feb 20, 2023
98088a5
kjdashkhjdf
Janpot Feb 20, 2023
1e8e3f5
Merge branch 'master' into direction-13
Janpot Feb 20, 2023
d431cf3
jhdfs
Janpot Feb 20, 2023
182b847
Add instruction
Janpot Feb 20, 2023
d7ee059
small note
Janpot Feb 20, 2023
d713afd
Merge branch 'master' into direction-13
Janpot Feb 20, 2023
e75493e
lint
Janpot Feb 21, 2023
ac189ad
write code component only once
Janpot Feb 21, 2023
ca9f26b
lint md
Janpot Feb 21, 2023
3433fc2
naming issues
Janpot Feb 21, 2023
f5f0bf0
oops
Janpot Feb 21, 2023
7e4b644
Merge branch 'master' into direction-13
Janpot Feb 21, 2023
d8f228c
Merge branch 'master' into direction-13
Janpot Feb 21, 2023
19ba2f8
Open code editor after creating a code component (#1693)
Janpot Feb 21, 2023
e617a55
Merge branch 'master' into direction-13
Janpot Feb 22, 2023
8bd1613
exit process
Janpot Feb 22, 2023
7570bfc
Create projects directories as needed (#1706)
Janpot Feb 23, 2023
4256f17
Merge branch 'master' into direction-13
Janpot Feb 23, 2023
5ebdc86
New create component flow (#1709)
Janpot Feb 23, 2023
93e5f90
Make Toolpad work offline (#1710)
Janpot Feb 24, 2023
549d5cc
Merge branch 'master' into direction-13
Janpot Feb 28, 2023
4efa517
Improve createQuery types (#1716)
apedroferreira Feb 28, 2023
ddb0ce3
Merge branch 'master' into direction-13
Janpot Mar 1, 2023
ed9e421
Merge branch 'master' into direction-13
Janpot Mar 1, 2023
8b16c74
release
Janpot Mar 1, 2023
9d70739
Open browser to app as part of of `dev` script (#1707)
bharatkashyap Mar 2, 2023
f35a258
Merge branch 'master' into direction-13
Janpot Mar 2, 2023
b440de9
Fix config file being deleted (#1725)
Janpot Mar 2, 2023
10b25c0
release
Janpot Mar 2, 2023
9ebe75f
release
Janpot Mar 2, 2023
3a37268
Updates to `toolpad-app/cli` (#1726)
bharatkashyap Mar 3, 2023
64a9277
Try out tsup as build tool
Janpot Mar 3, 2023
bc95f1d
more
Janpot Mar 3, 2023
83bda20
fixes
Janpot Mar 4, 2023
425ab76
Update jest.config.ts
Janpot Mar 4, 2023
337eebb
fsdf
Janpot Mar 4, 2023
cfef66a
fix
Janpot Mar 4, 2023
124ffee
Allow direction13 embedding in iframes (#1735)
Janpot Mar 6, 2023
62dd717
add release note
Janpot Mar 6, 2023
1fac418
new version
Janpot Mar 6, 2023
4ccb9ea
note tweaks
Janpot Mar 9, 2023
d9b2fb1
remove list
Janpot Mar 13, 2023
035964a
pin next
Janpot Mar 14, 2023
974d801
fix next version
Janpot Mar 14, 2023
8ad1f91
Update RELEASE.md
Janpot Mar 14, 2023
a05de4d
Merge branch 'master' into direction-13
Janpot Mar 15, 2023
e30a602
Soft deprecate pagemodules
Janpot Mar 15, 2023
0f99c2a
screenshot
Janpot Mar 16, 2023
8506b7f
update readme
Janpot Mar 16, 2023
cd4e3a3
fdsff
Janpot Mar 16, 2023
abcfe3b
frst
Janpot Mar 16, 2023
1327be8
Add a lock on Toolpad config file read/write (#1759)
Janpot Mar 17, 2023
129c75e
Fix toolpad process output disappearing (#1757)
Janpot Mar 17, 2023
56c01de
Merge branch 'master' into direction-13
Janpot Mar 19, 2023
d4c6b92
Merge branch 'direction-13' into try-tsup
Janpot Mar 23, 2023
05d0f32
Merge branch 'master' into try-tsup
Janpot Mar 23, 2023
601b9ad
dfdaf
Janpot Mar 23, 2023
c1687ea
fix
Janpot Mar 23, 2023
2753601
remove lock
Janpot Mar 23, 2023
a65eb3d
Merge branch 'master' into try-tsup
Janpot Mar 24, 2023
c9bae2f
Merge branch 'master' into try-tsup
Janpot Mar 28, 2023
ccfe593
lock
Janpot Mar 28, 2023
9cac9f5
react-devtools
Janpot Mar 28, 2023
8850199
defwr
Janpot Mar 28, 2023
e844815
Merge branch 'master' into try-tsup
Janpot Mar 29, 2023
f97d530
dwkejh
Janpot Mar 29, 2023
08c8d81
fsg
Janpot Mar 29, 2023
a1f285c
update
Janpot Mar 29, 2023
ef39bdc
Merge branch 'master' into try-tsup
Janpot Mar 29, 2023
19ea7cd
Merge branch 'master' into try-tsup
Janpot Mar 29, 2023
36b06c0
Merge branch 'master' into try-tsup
Janpot Mar 29, 2023
1513805
Merge branch 'master' into try-tsup
Janpot Mar 30, 2023
f455fd8
Merge branch 'master' into try-tsup
Janpot Mar 31, 2023
16f7d0a
Merge branch 'master' into try-tsup
Janpot Apr 5, 2023
be16b99
Update yarn.lock
Janpot Apr 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

/examples/*/toolpad.yml

/test/integration/**/toolpad.yml
/test/integration/**/toolpad.yml
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"dotenv-cli": "^7.1.0",
"inquirer": "^9.1.5",
"semver": "^7.3.8",
"tsup": "^6.7.0",
"yargs": "^17.7.1"
},
"engines": {
Expand Down
5 changes: 3 additions & 2 deletions packages/create-toolpad-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
],
"scripts": {
"prebuild": "rimraf ./dist",
"build": "tsc -p ./tsconfig.json",
"dev": "tsc -p ./tsconfig.json --watch"
"build": "tsup",
"dev": "tsup --watch",
"check-types": "tsc --noEmit"
},
"engines": {
"node": ">=16.17"
Expand Down
2 changes: 1 addition & 1 deletion packages/create-toolpad-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es2020",
"module": "commonjs",
"moduleResolution": "node16",
"isolatedModules": true,
Expand Down
11 changes: 11 additions & 0 deletions packages/create-toolpad-app/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['./src/index.ts'],
silent: true,
noExternal: ['chalk', 'execa'],
async onSuccess() {
// eslint-disable-next-line no-console
console.log('cli: build successful');
},
});
8 changes: 5 additions & 3 deletions packages/toolpad-app/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { Config } from '@jest/types';
import nextJest from 'next/jest';

const createJestConfig = nextJest();
const createJestConfig = nextJest({
dir: __dirname,
});

async function jestConfig(): Promise<Config.InitialOptions> {
const baseConfig: Config.InitialOptions = {
Expand All @@ -10,8 +12,8 @@ async function jestConfig(): Promise<Config.InitialOptions> {
const nextJestConfig: Config.InitialOptions = await createJestConfig(baseConfig)();

// Workaround, see https://github.com/vercel/next.js/issues/35634#issuecomment-1115250297
nextJestConfig.transformIgnorePatterns = nextJestConfig.transformIgnorePatterns ?? [];
nextJestConfig.transformIgnorePatterns[0] = '/node_modules/(?!lodash-es)/';
nextJestConfig.transformIgnorePatterns ??= [];
nextJestConfig.transformIgnorePatterns[0] = '/node_modules/(?!(lodash-es))/';

return nextJestConfig;
}
Expand Down
6 changes: 2 additions & 4 deletions packages/toolpad-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
"cli": "./cli.js",
"lint": "next lint && prettier --check .",
"fix": "next lint --fix && prettier --write .",
"build:cli": "tsc -p tsconfig.cli.json",
"build:cli": "tsup",
"build:next": "NODE_OPTIONS=--max-old-space-size=8192 next build",
"build:react-devtools": "rimraf ./public/reactDevtools && esbuild ./reactDevtools/bootstrap.ts --target=es6 --bundle --format=iife --outdir=./public/reactDevtools",
"build:typings": "ts-node --esm ./scripts/typings.mts",
"dev:cli": "yarn build:cli --watch",
"dev:react-devtools": "yarn build:react-devtools --watch",
"dev:cli": "tsup --watch",
"dev:typings": "yarn build:typings",
"waitForApp": "ts-node --esm ./scripts/waitForApp.mts",
"check-types": "tsc --noEmit"
Expand Down
2 changes: 1 addition & 1 deletion packages/toolpad-app/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class MyDocument extends Document<ToolpadDocumentProps> {
// Add the data-toolpad-canvas attribute to the canvas iframe element
if (window.frameElement?.dataset.toolpadCanvas){
var script = document.createElement('script');
script.src = '/reactDevtools/bootstrap.js';
script.src = '/reactDevtools/bootstrap.global.js';
document.write(script.outerHTML);
}
`,
Expand Down
2 changes: 1 addition & 1 deletion packages/toolpad-app/pages/api/runtime/[[...path]].ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const routes = new Map<RegExp, NextApiHandler<string>>([
// Add the data-toolpad-canvas attribute to the canvas iframe element
if (window.frameElement?.dataset.toolpadCanvas){
var script = document.createElement('script');
script.src = '/reactDevtools/bootstrap.js';
script.src = '/reactDevtools/bootstrap.global.js';
document.write(script.outerHTML);
}

Expand Down
18 changes: 9 additions & 9 deletions packages/toolpad-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"compilerOptions": {
"paths": {
// TODO: remove when typescript module resolution supports package exports. (v5.0 with moduleResolution: 'bundler')
"@mui/toolpad-core": ["../toolpad-core/dist/esm"],
"@mui/toolpad-core/runtime": ["../toolpad-core/dist/esm/runtime"],
"@mui/toolpad-core/jsRuntime": ["../toolpad-core/dist/esm/jsRuntime"],
"@mui/toolpad-core/jsBrowserRuntime": ["../toolpad-core/dist/esm/jsBrowserRuntime"],
"@mui/toolpad-core/jsServerRuntime": ["../toolpad-core/dist/esm/jsServerRuntime"],
"@mui/toolpad-core/objectKey": ["../toolpad-core/dist/esm/objectKey"],
"@mui/toolpad-core/utils/*": ["../toolpad-core/dist/esm/utils/*"]
"@mui/toolpad-core": ["../toolpad-core/dist"],
"@mui/toolpad-core/runtime": ["../toolpad-core/dist/runtime"],
"@mui/toolpad-core/jsRuntime": ["../toolpad-core/dist/jsRuntime"],
"@mui/toolpad-core/jsBrowserRuntime": ["../toolpad-core/dist/jsBrowserRuntime"],
"@mui/toolpad-core/jsServerRuntime": ["../toolpad-core/dist/jsServerRuntime"],
"@mui/toolpad-core/objectKey": ["../toolpad-core/dist/objectKey"],
"@mui/toolpad-core/utils/*": ["../toolpad-core/dist/utils/*"]
},
"target": "es5",
"lib": ["dom", "dom.iterable", "es2022"],
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
Expand Down
29 changes: 29 additions & 0 deletions packages/toolpad-app/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { defineConfig } from 'tsup';

export default defineConfig([
{
entry: {
'cli/index': './cli/index.ts',
'cli/server': './cli/server.ts',
},
silent: true,
noExternal: ['open-editor', 'execa', 'fractional-indexing'],
async onSuccess() {
// eslint-disable-next-line no-console
console.log('cli: build successful');
},
},
{
entry: ['./reactDevtools/bootstrap.ts'],
silent: true,
outDir: './public/reactDevtools',
bundle: true,
target: 'es6',
format: 'iife',
replaceNodeEnv: true,
async onSuccess() {
// eslint-disable-next-line no-console
console.log('reactDevtools: build successful');
},
},
]);
26 changes: 19 additions & 7 deletions packages/toolpad-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@
"author": "MUI Toolpad team",
"homepage": "https://github.com/mui/mui-toolpad#readme",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"exports": {
".": "./dist/index.js",
"./package.json": "./package.json"
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./*": {
"types": "./dist/*.d.ts",
"import": "./dist/*.js",
"require": "./dist/*.cjs"
}
},
"files": [
"dist"
Expand All @@ -21,21 +31,23 @@
},
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc",
"dev": "tsc --watch",
"build": "tsup",
"dev": "tsup --watch",
"test": "echo \"Error: run tests from root\" && exit 1",
"check-types": "tsc"
},
"bugs": {
"url": "https://github.com/mui/mui-toolpad/issues"
},
"dependencies": {
"@mui/lab": "^5.0.0-alpha.121",
"@mui/material": "^5.11.16",
"@mui/toolpad-core": "^0.1.2",
"@mui/x-data-grid-pro": "^6.0.4",
"@mui/x-date-pickers": "^6.0.4",
"dayjs": "^1.11.7",
"markdown-to-jsx": "^7.2.0"
"markdown-to-jsx": "^7.2.0",
"react-error-boundary": "^3.1.4"
},
"devDependencies": {
"react": "^18.2.0"
Expand Down
17 changes: 11 additions & 6 deletions packages/toolpad-components/src/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import { createComponent } from '@mui/toolpad-core';
import dayjs from 'dayjs';
import { SX_PROP_HELPER_TEXT } from './constants.js';

const LOCALE_LOADERS = new Map([
['en', () => import('dayjs/locale/en')],
['nl', () => import('dayjs/locale/nl')],
['fr', () => import('dayjs/locale/fr')],
// TODO...
]);
const LOCALE_LOADERS = new Map(
// jest is choking on this dynamic import
process.env.NODE_ENV === 'test'
? []
: [
['en', () => import('dayjs/locale/en')],
['nl', () => import('dayjs/locale/nl')],
['fr', () => import('dayjs/locale/fr')],
// TODO...
],
);

interface LoadableLocale {
locale: string;
Expand Down
14 changes: 14 additions & 0 deletions packages/toolpad-components/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { spawnSync } from 'child_process';
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/*.ts', 'src/*.tsx'],
format: ['esm', 'cjs'],
dts: false,
silent: true,
async onSuccess() {
// eslint-disable-next-line no-console
console.log('build successful');
spawnSync('tsc', ['--emitDeclarationOnly', '--declaration']);
},
});
4 changes: 2 additions & 2 deletions packages/toolpad-core/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": "../dist/cjs/browser.js",
"types": "../dist/cjs/browser.d.ts",
"main": "../dist/browser.cjs",
"types": "../dist/browser.d.ts",
"type": "commonjs"
}
33 changes: 14 additions & 19 deletions packages/toolpad-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
"author": "MUI Toolpad team",
"homepage": "https://github.com/mui/mui-toolpad#readme",
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/esm/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./*": {
"types": "./dist/esm/*.d.ts",
"import": "./dist/esm/*.js",
"require": "./dist/cjs/*.js"
"types": "./dist/*.d.ts",
"import": "./dist/*.js",
"require": "./dist/*.cjs"
},
"./utils/*": {
"types": "./dist/esm/utils/*.d.ts",
"import": "./dist/esm/utils/*.js",
"require": "./dist/cjs/utils/*.js"
"types": "./dist/utils/*.d.ts",
"import": "./dist/utils/*.js",
"require": "./dist/utils/*.cjs"
}
},
"files": [
Expand All @@ -38,13 +38,8 @@
},
"scripts": {
"prebuild": "rimraf dist",
"cjsify": "mkdir -p ./dist/cjs && echo \"{ \\\"type\\\":\\\"commonjs\\\" }\" > ./dist/cjs/package.json",
"build": "concurrently \"yarn:build:*\" && yarn cjsify",
"build:esm": "tsc --outDir dist/esm --module esnext",
"build:cjs": "tsc --outDir dist/cjs --module commonjs",
"dev": "concurrently \"yarn:dev:*\" yarn:cjsify",
"dev:esm": "yarn build:esm --watch",
"dev:cjs": "yarn build:cjs --watch",
"build": "tsup",
"dev": "tsup --watch",
"test": "echo \"Error: run tests from root\" && exit 1",
"check-types": "yarn build"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/toolpad-core/server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": "../dist/cjs/server.js",
"types": "../dist/cjs/server.d.ts",
"main": "../dist/server.cjs",
"types": "../dist/server.d.ts",
"type": "commonjs"
}
2 changes: 0 additions & 2 deletions packages/toolpad-core/src/server.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/toolpad-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"pretty": true,
"preserveWatchOutput": true
},
"include": ["**/*.ts", "**/*.tsx"]
"include": ["src/**/*.ts", "src/**/*.tsx"]
}
14 changes: 14 additions & 0 deletions packages/toolpad-core/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { spawnSync } from 'child_process';
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/*.ts', 'src/*.tsx', 'src/utils/*.ts', 'src/utils/*.tsx'],
format: ['esm', 'cjs'],
dts: false,
silent: true,
async onSuccess() {
// eslint-disable-next-line no-console
console.log('build successful');
spawnSync('tsc', ['--emitDeclarationOnly', '--declaration']);
},
});
4 changes: 2 additions & 2 deletions packages/toolpad/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "commonjs",
"main": "../dist/cjs/browser.js",
"types": "../dist/esm/browser.d.ts"
"main": "../dist/browser.cjs",
"types": "../dist/browser.d.ts"
}
23 changes: 10 additions & 13 deletions packages/toolpad/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,22 @@
"version": "0.1.2",
"license": "MIT",
"scripts": {
"cjsify": "mkdir -p ./dist/cjs && echo \"{ \\\"type\\\":\\\"commonjs\\\" }\" > ./dist/cjs/package.json",
"build": "concurrently \"yarn:build:*\" && yarn cjsify",
"build:esm": "tsc",
"build:cjs": "tsc -p tsconfig.cjs.json",
"dev": "concurrently \"yarn:dev:*\" yarn:cjsify",
"dev:esm": "yarn build:esm --watch",
"dev:cjs": "yarn build:cjs --watch"
"prebuild": "rimraf dist",
"build": "tsup",
"dev": "tsup --watch",
"check-types": "tsc"
},
"exports": {
"./package.json": "./package.json",
"./server": {
"types": "./dist/esm/server.d.ts",
"import": "./dist/esm/server.js",
"require": "./dist/cjs/server.js"
"types": "./dist/server.d.ts",
"import": "./dist/server.mjs",
"require": "./dist/server.js"
},
"./browser": {
"types": "./dist/esm/browser.d.ts",
"import": "./dist/esm/browser.js",
"require": "./dist/cjs/browser.js"
"types": "./dist/browser.d.ts",
"import": "./dist/browser.mjs",
"require": "./dist/browser.js"
}
},
"files": [
Expand Down
4 changes: 2 additions & 2 deletions packages/toolpad/server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "commonjs",
"main": "../dist/cjs/server.js",
"types": "../dist/esm/server.d.ts"
"main": "../dist/server.cjs",
"types": "../dist/server.d.ts"
}
Loading