diff --git a/package.json b/package.json index a5348a6e..82b976a9 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "url": "https://ko-fi.com/ghiscoding" }, "scripts": { - "clean": "rimraf --glob **/dist */tsconfig.tsbuildinfo", + "clean": "rimraf --glob **/dist **/tsconfig.tsbuildinfo", "prebuild": "pnpm clean && pnpm biome:lint:write && pnpm biome:format:write", "build": "pnpm -r --stream build", "build:demo": "pnpm -r --stream --filter=\"{packages/demo/**}\" build", diff --git a/packages/multiple-select-vanilla/build-prod.mjs b/packages/multiple-select-vanilla/build-prod.mjs index c6ac4b1d..a39c4ad2 100644 --- a/packages/multiple-select-vanilla/build-prod.mjs +++ b/packages/multiple-select-vanilla/build-prod.mjs @@ -10,7 +10,7 @@ for (const format of buildFormats) { // multiple-select.js runBuild({ format, - outfile: `dist/${format}/multiple-select.${extension}`, + outfile: `dist/multiple-select.${extension}`, }); // build all locales diff --git a/packages/multiple-select-vanilla/build-watch.mjs b/packages/multiple-select-vanilla/build-watch.mjs index 0fbb06ec..e6ab951e 100644 --- a/packages/multiple-select-vanilla/build-watch.mjs +++ b/packages/multiple-select-vanilla/build-watch.mjs @@ -23,7 +23,7 @@ function runBuild(options) { sourcemap: true, logLevel: 'error', // outfile: env === 'production' ? './dist/multiple-select.min.js' : './dist/multiple-select.js', - outfile: 'dist/esm/multiple-select.js', + outfile: 'dist/multiple-select.js', }, ...options, }; @@ -32,7 +32,7 @@ function runBuild(options) { console.info(`⚡️ Built in ${endTime - startTime}ms`); } -function runLocaleBuild() { +function runMergedLocaleBuild() { // merge all Locales into a single file "multiple-select-all-locales.js" runBuild({ entryPoints: ['./src/locales/all-locales-index.ts'], @@ -56,7 +56,16 @@ async function runCompilation(changedFiles) { tsLogged = true; } if (changedFile.includes('locales')) { - runLocaleBuild(); + // rebuild changed locale and also merged locale into a single locale + const [_, locale] = changedFile.match(/locales[\\\/]multiple-select-(.*)\.ts$/) || []; + if (locale?.length === 5) { + runBuild({ + entryPoints: [`src/locales/multiple-select-${locale}.ts`], + format: 'esm', + outfile: `dist/locales/multiple-select-${locale}.js`, + }); + } + runMergedLocaleBuild(); } else { runBuild(); } diff --git a/packages/multiple-select-vanilla/package.json b/packages/multiple-select-vanilla/package.json index a39dde89..d90ea8f3 100644 --- a/packages/multiple-select-vanilla/package.json +++ b/packages/multiple-select-vanilla/package.json @@ -1,22 +1,15 @@ { "name": "multiple-select-vanilla", "version": "1.2.5", - "main": "./dist/cjs/multiple-select.cjs", - "module": "./dist/esm/multiple-select.js", - "types": "index.d.ts", - "typesVersions": { - ">=4.2": { - "*": [ - "dist/types/*" - ] - } - }, + "main": "./dist/multiple-select.cjs", + "module": "./dist/multiple-select.js", + "types": "dist/index.d.ts", "exports": { ".": { - "types": "./dist/types/index.d.ts", - "node": "./dist/cjs/multiple-select.cjs", - "require": "./dist/cjs/multiple-select.cjs", - "default": "./dist/esm/multiple-select.js" + "types": "./dist/index.d.ts", + "node": "./dist/multiple-select.cjs", + "require": "./dist/multiple-select.cjs", + "default": "./dist/multiple-select.js" }, "./dist/browser/*": "./dist/browser/*", "./dist/locales/*": "./dist/locales/*", @@ -59,8 +52,8 @@ "build:watch": "cross-env NODE_ENV='development' node build-watch.mjs", "build:locales": "esbuild src/locales/all-locales-index.ts --bundle --minify --format=iife --target=es2021 --sourcemap --outfile=dist/locales/multiple-select-all-locales.js", "build:esm": "esbuild src/index.ts --bundle --minify --format=esm --target=es2021 --sourcemap --outfile=dist/esm/multiple-select.js", - "build:types": "tsc --emitDeclarationOnly --incremental --declarationMap false --outDir dist/types", - "build:types:prod": "tsc --emitDeclarationOnly --incremental --declarationMap --outDir dist/types", + "build:types": "tsc --emitDeclarationOnly --incremental --declarationMap false --outDir dist", + "build:types:prod": "tsc --emitDeclarationOnly --incremental --declarationMap --outDir dist", "sass:build": "sass src/styles:dist/styles/css --style=compressed --quiet-deps --no-source-map", "postsass:build": "postcss dist/styles/css/**/* --dir dist/styles/css --base dist/styles/css --no-map --use cssnano --use autoprefixer --style=compressed", "sass:watch": "sass src/styles:dist/styles/css --watch --style=compressed --quiet-deps --no-source-map", diff --git a/packages/multiple-select-vanilla/tsconfig.json b/packages/multiple-select-vanilla/tsconfig.json index 3b6db37f..b8162e72 100644 --- a/packages/multiple-select-vanilla/tsconfig.json +++ b/packages/multiple-select-vanilla/tsconfig.json @@ -4,7 +4,7 @@ "declaration": true, "declarationMap": true, "rootDir": "src", - "outDir": "dist/esm", + "outDir": "dist", "target": "ES2021", "useDefineForClassFields": true, "module": "ESNext",