Skip to content

Commit

Permalink
Publish JavaScript modules (ESM)
Browse files Browse the repository at this point in the history
ESM module are published unminified by convention.
Therefore they can simply be build by `tsc`.

We target ES6 for now to comply with the
browser level that flatpickr itself supports.
See flatpickr/flatpickr#2468
for more information.
  • Loading branch information
bnf committed Sep 11, 2023
1 parent 1606739 commit 6327f83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@
"version": "0.4.0",
"exports": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"default": "./dist/shortcut-buttons-flatpickr.js"
},
"main": "dist/shortcut-buttons-flatpickr.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"scripts": {
"build": "run-s build:pre build:dev build:prod",
"build:pre": "rm -rf dist && mkdir -p dist/themes",
"build:dev": "run-s build:ts:dev build:themes:dev",
"build:prod": "run-s build:ts:prod build:types build:themes:prod",
"build:prod": "run-s build:ts:prod build:esm build:types build:themes:prod",
"build:ts:dev": "webpack --config build/webpack.config.ts --mode development",
"build:ts:prod": "webpack --config build/webpack.config.ts --mode production",
"build:themes:dev": "webpack --config build/webpack.themes.ts --mode development",
"build:themes:prod": "webpack --config build/webpack.themes.ts --mode production",
"build:esm": "tsc -p tsconfig.esm.json",
"build:types": "tsc -p tsconfig.declarations.json",
"prepublishOnly": "run-s build test",
"start:server": "forever start -m 1 -c ts-node tests/server.ts",
Expand Down
11 changes: 11 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"module": "es6",
"outDir": "dist/esm"
},
"extends": "./tsconfig.json",
"include": [
"./src/index.ts"
]
}

0 comments on commit 6327f83

Please sign in to comment.