Skip to content

Commit 21713a7

Browse files
authored
fix: remove tsup, replace with esbuild + dts with tsc (#307)
* fix: remove tsup, replace with esbuild + dts with tsc
1 parent 52c15ba commit 21713a7

File tree

9 files changed

+17
-592
lines changed

9 files changed

+17
-592
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ jobs:
7373
- name: Build Library
7474
run: pnpm build:lib
7575

76+
- name: validate "Are the Types Wrong"
77+
run: pnpm are-types-wrong
78+
7679
- name: Build Website (GitHub demo site)
7780
run: pnpm build:demo
7881

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"url": "https://ko-fi.com/ghiscoding"
2727
},
2828
"scripts": {
29+
"are-types-wrong": "pnpm -r --stream --filter=\"{packages/multiple-select-vanilla/**}\" are-types-wrong",
2930
"clean": "rimraf --glob **/dist **/tsconfig.tsbuildinfo",
3031
"prebuild": "pnpm clean && pnpm biome:lint:write && pnpm biome:format:write",
3132
"build": "pnpm -r --stream build",

packages/multiple-select-vanilla/build-prod.mjs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ const localeEntryPoints = [];
88
for (const format of buildFormats) {
99
const extension = format === 'cjs' ? 'cjs' : 'js';
1010

11-
// - let's use TSUP to get valid hybrid (CJS/ESM) approach with are-the-types-wrong, however keep the rest of the build
12-
/*
1311
runBuild({
1412
format,
1513
outfile: `dist/index.${extension}`,
1614
});
17-
*/
1815

1916
// build all locales
2017
for (const localeFile of localeFiles) {
@@ -37,16 +34,13 @@ for (const format of buildFormats) {
3734
outfile: `dist/locales/multiple-select-all-locales.${extension}`,
3835
});
3936

40-
// - let's use TSUP to get valid hybrid (CJS/ESM) approach with are-the-types-wrong, however keep the rest of the build
4137
// finally, create a regular bundle as a standalone which will be accessible as MultipleSelect from the global window object
4238
// this file is basically a legacy alternative to import via a <script> tag
43-
/*
4439
runBuild({
4540
format,
4641
globalName: 'MultipleSelect',
4742
outfile: `dist/browser/multiple-select.${extension}`,
4843
});
49-
*/
5044
}
5145

5246
function runBuild(options) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { readFileSync, writeFileSync } from 'node:fs';
2+
3+
writeFileSync('dist/index.d.cts', readFileSync('dist/index.d.ts'));

packages/multiple-select-vanilla/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export type {};
1+
import type { MultipleSelectLocale } from './src/models/locale.interface.js';
2+
import type { MultipleSelectInstance } from './src/MultipleSelectInstance.js';
3+
import type { MultipleSelectOption } from './src/models/multipleSelectOption.interface.js';
24

35
declare global {
46
interface Window {

packages/multiple-select-vanilla/package.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222
"license": "MIT",
2323
"type": "module",
2424
"main": "./dist/index.cjs",
25-
"module": "./dist/index.mjs",
2625
"types": "./dist/index.d.ts",
2726
"exports": {
2827
".": {
2928
"import": {
3029
"types": "./dist/index.d.ts",
31-
"default": "./dist/index.mjs"
30+
"default": "./dist/index.js"
3231
},
3332
"require": {
3433
"types": "./dist/index.d.cts",
@@ -56,19 +55,18 @@
5655
"url": "https://ko-fi.com/ghiscoding"
5756
},
5857
"scripts": {
59-
"are-type-wrong": "attw --pack .",
58+
"are-types-wrong": "attw --pack .",
6059
"clean": "rimraf dist",
61-
"esbuild:prod": "node build-prod.mjs",
62-
"build": "pnpm clean && node build-prod.mjs && pnpm build:types:prod && tsup && pnpm sass:build && pnpm sass:copy",
63-
"build:esbuild": "pnpm build:all && pnpm build:types:prod",
64-
"postbuild:esbuild": "pnpm sass:build && pnpm sass:copy",
60+
"build": "pnpm build:all && pnpm build:types:prod && pnpm clone:dts",
61+
"postbuild": "pnpm sass:build && pnpm sass:copy",
6562
"dev:init": "pnpm sass:build && pnpm sass:copy && pnpm build:all",
66-
"build:all": "node build-prod.mjs && pnpm build:types:prod",
63+
"build:all": "node build-prod.mjs",
6764
"build:watch": "cross-env NODE_ENV='development' node build-watch.mjs",
6865
"build:locales": "esbuild src/locales/all-locales-index.ts --bundle --minify --format=iife --target=es2021 --sourcemap --outfile=dist/locales/multiple-select-all-locales.js",
6966
"build:esm": "esbuild src/index.ts --bundle --minify --format=esm --target=es2021 --sourcemap --outfile=dist/multiple-select.js",
7067
"build:types": "tsc --emitDeclarationOnly --incremental --declarationMap false --outDir dist",
71-
"build:types:prod": "tsc --emitDeclarationOnly --declarationMap --outDir dist",
68+
"build:types:prod": "tsc --emitDeclarationOnly --incremental --declarationMap --outDir dist",
69+
"clone:dts": "node clone-dts.mjs",
7270
"sass:build": "sass src/styles:dist/styles/css --style=compressed --quiet-deps --no-source-map",
7371
"postsass:build": "postcss dist/styles/css/**/* --dir dist/styles/css --base dist/styles/css --no-map --use cssnano --use autoprefixer --style=compressed",
7472
"sass:watch": "sass src/styles:dist/styles/css --watch --style=compressed --quiet-deps --no-source-map",
@@ -84,13 +82,11 @@
8482
"cross-env": "^7.0.3",
8583
"cssnano": "^7.0.6",
8684
"esbuild": "^0.24.0",
87-
"esbuild-plugin-d.ts": "^1.3.0",
8885
"fs-extra": "^11.2.0",
8986
"postcss": "^8.4.47",
9087
"postcss-cli": "^11.0.0",
9188
"sass": "^1.79.5",
9289
"tinyglobby": "^0.2.9",
93-
"tsup": "^8.3.0",
9490
"typescript": "5.6.3"
9591
}
9692
}

packages/multiple-select-vanilla/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"noUnusedLocals": true,
2020
"noUnusedParameters": true,
2121
"noImplicitReturns": true,
22-
"skipLibCheck": true,
2322
"sourceMap": true
2423
},
2524
"exclude": ["node_modules", "**/*.spec.ts"],

packages/multiple-select-vanilla/tsup.config.ts

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

0 commit comments

Comments
 (0)