Skip to content

Commit

Permalink
refactor(solid): remove preset and simplify tsup configuration (#373)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Abdelrahman Ashraf <[email protected]>
  • Loading branch information
moonlitgrace and theashraf authored Dec 2, 2024
1 parent 9f8973d commit 7c8dfe3
Show file tree
Hide file tree
Showing 5 changed files with 435 additions and 242 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-trains-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/dotlottie-solid': patch
---

refactor(solid): remove preset and simplify tsup configuration
11 changes: 2 additions & 9 deletions packages/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.js",
"exports": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"browser": {},
"types": "./dist/index.d.ts",
"typesVersions": {},
"files": [
"dist"
],
Expand Down Expand Up @@ -53,10 +45,11 @@
"@lottiefiles/dotlottie-web": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.7.6",
"cross-env": "7.0.3",
"esbuild-plugin-solid": "^0.6.0",
"solid-js": "^1.8.17",
"tsup": "^8.0.2",
"tsup-preset-solid": "^2.2.0",
"typescript": "^5.4.5"
},
"publishConfig": {
Expand Down
10 changes: 10 additions & 0 deletions packages/solid/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.build.json",
"compilerOptions": {
"outDir": "./dist",
"jsx": "preserve",
"jsxImportSource": "solid-js",
"exactOptionalPropertyTypes": false
},
"include": ["./src"]
}
38 changes: 10 additions & 28 deletions packages/solid/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
import { solidPlugin } from 'esbuild-plugin-solid';
import { defineConfig } from 'tsup';
// eslint-disable-next-line import/no-namespace
import * as preset from 'tsup-preset-solid';

const presetOptions: preset.PresetOptions = {
entries: [
{
entry: 'src/index.ts',
},
],
// Set to `true` to remove all `console.*` calls and `debugger` statements in prod builds
// eslint-disable-next-line @typescript-eslint/naming-convention
drop_console: false,
// Set to `true` to generate a CommonJS build alongside ESM
// cjs: true,
};

export default defineConfig((config) => {
const watching = Boolean(config.watch);

const parsedOptions = preset.parsePresetOptions(presetOptions, watching);

if (!watching) {
const packageFields = preset.generatePackageExports(parsedOptions);

// will update ./package.json with the correct export fields
preset.writePackageJson(packageFields);
}

return preset.generateTsupOptions(parsedOptions);
export default defineConfig({
entry: ['src/index.ts'],
clean: true,
dts: true,
sourcemap: true,
format: ['esm'],
tsconfig: 'tsconfig.build.json',
external: ['solid-js'],
esbuildPlugins: [solidPlugin()],
});
Loading

0 comments on commit 7c8dfe3

Please sign in to comment.