Skip to content

Commit 978c9d4

Browse files
committed
Do the dual build with TypeScript instead
1 parent fa79d04 commit 978c9d4

File tree

7 files changed

+16
-78
lines changed

7 files changed

+16
-78
lines changed

pnpm-lock.yaml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: changed
3+
4+
Build CJS and ESM versions with TypeScript

projects/js-packages/number-formatters/changelog/build-with-rollup

Lines changed: 0 additions & 4 deletions
This file was deleted.

projects/js-packages/number-formatters/package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,28 @@
2222
"@babel/core": "7.26.10",
2323
"@babel/preset-react": "7.26.3",
2424
"@jest/globals": "29.4.3",
25-
"@rollup/plugin-typescript": "12.1.0",
2625
"@types/jest": "29.5.14",
2726
"jest": "29.7.0",
2827
"jest-environment-jsdom": "29.7.0",
29-
"rollup": "3.29.5",
30-
"rollup-plugin-dts": "6.1.1",
3128
"typescript": "5.8.2"
3229
},
3330
"type": "module",
3431
"main": "./dist/cjs/index.js",
3532
"module": "./dist/mjs/index.js",
36-
"types": "./dist/index.d.ts",
33+
"types": "./dist/types/index.d.ts",
3734
"exports": {
3835
".": {
3936
"jetpack:src": "./src/index.ts",
37+
"types": "./dist/types/index.d.ts",
4038
"import": "./dist/mjs/index.js",
41-
"require": "./dist/cjs/index.js",
42-
"types": "./dist/index.d.ts"
39+
"require": "./dist/cjs/index.js"
4340
}
4441
},
4542
"scripts": {
46-
"build": "pnpm run clean && pnpm run build:prod",
47-
"build:prod": "pnpm run clean && rollup -c --environment NODE_ENV:production",
48-
"clean": "rm -rf dist/",
43+
"build": "pnpm run clean && pnpm run build:esm && pnpm run build:cjs",
44+
"build:esm": "tsc --declarationDir dist/types --outDir dist/mjs",
45+
"build:cjs": "tsc --module CommonJS --moduleResolution node10 --declaration false --outDir dist/cjs",
46+
"clean": "rm -rf dist",
4947
"compile-ts": "tsc --pretty",
5048
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
5149
"test-coverage": "pnpm run test --coverage",

projects/js-packages/number-formatters/rollup.config.mjs

Lines changed: 0 additions & 51 deletions
This file was deleted.

projects/js-packages/number-formatters/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const {
1313

1414
export { createNumberFormatters };
1515

16-
export * from './types.ts';
16+
export type * from './types.ts';
1717

1818
// We can optionally export the formatters individually if we want to use them in a more granular way.
1919
// export { numberFormat, numberFormatCompact, numberFormatCurrency, getCurrencyObject };

projects/js-packages/number-formatters/tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"extends": "jetpack-js-tools/tsconfig.tsc.json",
33
"compilerOptions": {
44
"typeRoots": [ "./node_modules/@types/", "src/*" ],
5-
"target": "ES2024"
5+
"target": "ES2024",
6+
"importHelpers": true, // Import helpers from `tslib` instead of inlining them
7+
"customConditions": null // CommonJS build fails when customConditions are defined and this package doesn't need them anyway
68
},
7-
// List all sources and source-containing subdirs.
8-
"include": [ "./src" ],
9-
"exclude": [ "node_modules", "dist", "**/stories/**" ]
9+
"include": [ "./src/index.ts" ]
1010
}

0 commit comments

Comments
 (0)