|
2 | 2 | "name": "dexie-cloud-addon",
|
3 | 3 | "version": "1.0.0-alpha.7",
|
4 | 4 | "description": "Dexie addon that syncs with to Dexie Cloud",
|
5 |
| - "main": "dist/dexie-cloud.js", |
6 |
| - "module": "dist/dexie-cloud.mjs", |
7 |
| - "esnext": "esnext/dexie-cloud.js", |
8 |
| - "typings": "dist/dexie-cloud.d.ts", |
| 5 | + "main": "dist/umd/dexie-cloud-addon.min.js", |
| 6 | + "module": "dist/module-es5/dexie-cloud-addon.min.js", |
| 7 | + "exports": { |
| 8 | + ".": "./dist/modern/dexie-cloud-addon.min.js", |
| 9 | + "./service-worker": "./dist/modern/service-worker.min.js" |
| 10 | + }, |
| 11 | + "types": "dist/types/dexie-cloud-client.d.ts", |
9 | 12 | "engines": {
|
10 | 13 | "node": ">=14"
|
11 | 14 | },
|
|
16 | 19 | "scripts": {
|
17 | 20 | "test": "just-build test && npm run test-unit",
|
18 | 21 | "test-unit": "karma start test/unit/karma.conf.js --single-run",
|
19 |
| - "build": "just-build", |
| 22 | + "build": "just-build && bash ./copydts.sh", |
20 | 23 | "watch": "just-build --watch",
|
21 |
| - "clean": "rm -rf tools/tmp dist esnext test/unit/bundle.*" |
| 24 | + "clean": "rm -rf tools/tmp dist test/unit/bundle.*", |
| 25 | + "copydts": "bash ./copydts.sh" |
22 | 26 | },
|
23 | 27 | "just-build": {
|
24 | 28 | "default": [
|
|
27 | 31 | "release": [
|
28 | 32 | "# Build outputs",
|
29 | 33 | "just-build src",
|
| 34 | + "just-build dexie-cloud service-worker", |
30 | 35 | "# Minify the default ES5 UMD module",
|
31 |
| - "cd dist", |
32 |
| - "uglifyjs dexie-cloud.js -m -c negate_iife=0 -o dexie-cloud.min.js --source-map", |
33 |
| - "cd ..", |
34 |
| - "terser --compress --mangle --source-map -o esnext/dexie-cloud.min.js -- esnext/dexie-cloud.js", |
35 |
| - "terser --compress --mangle --source-map -o dist/dexie-cloud.min.js -- dist/dexie-cloud.mjs" |
| 36 | + "cd dist/umd", |
| 37 | + "# Minify ES5 UMD bundle", |
| 38 | + "uglifyjs dexie-cloud-addon.js -m -c negate_iife=0 -o dexie-cloud-addon.min.js --source-map", |
| 39 | + "cd ../..", |
| 40 | + "#dts-bundle-generator --external-imports=dexie --project src/tsconfig.json -o dist/dexie-cloud-addon.d.ts tools/tmp/modern/dexie-cloud-client.d.ts", |
| 41 | + "# Minify modern bundle", |
| 42 | + "terser --comments false --compress --mangle --source-map -o dist/modern/dexie-cloud-addon.min.js -- dist/modern/dexie-cloud-addon.js", |
| 43 | + "# Minify module bundle", |
| 44 | + "terser --comments false --compress --mangle --source-map -o dist/module-es5/dexie-cloud-addon.min.js -- dist/module-es5/dexie-cloud-addon.js", |
| 45 | + "# Minify modern service-worker", |
| 46 | + "terser --comments false --compress --mangle --source-map -o dist/modern/service-worker.min.js -- dist/modern/service-worker.js", |
| 47 | + "# Minify umd service-worker", |
| 48 | + "terser --comments false --compress --mangle --source-map -o dist/umd/service-worker.min.js -- dist/umd/service-worker.js" |
36 | 49 | ],
|
37 | 50 | "src": [
|
38 |
| - "tsc -p src -t esnext --outDir tools/tmp/esnext [--watch 'Compilation complete.']", |
39 |
| - "rollup -c tools/build-configs/rollup.esnext.config.js", |
40 |
| - "tsc --allowJs -m es2015 -t es5 --sourceMap --outDir tools/tmp/es5 esnext/dexie-cloud.js", |
| 51 | + "# Build the entire typescript source into modern JS", |
| 52 | + "tsc -p src -t esnext --outDir tools/tmp/modern [--watch 'Compilation complete.']" |
| 53 | + ], |
| 54 | + "dexie-cloud": [ |
| 55 | + "# Create a modern bundle in dist/modern", |
| 56 | + "rollup -c tools/build-configs/rollup.modern.config.js", |
| 57 | + "# Transpile the modern dexie-cloud bundle into ES5 JS", |
| 58 | + "tsc --allowJs -m es2015 -t es5 --sourceMap --outDir tools/tmp/es5 dist/modern/dexie-cloud-addon.js", |
| 59 | + "# Create ES5 bundles: One UMD and one MJS", |
41 | 60 | "rollup -c tools/build-configs/rollup.es5.config.js",
|
42 | 61 | "# Copy dexie-cloud-client.d.ts to dist",
|
43 |
| - "node -e \"fs.writeFileSync('dist/dexie-cloud.d.ts', fs.readFileSync('tools/tmp/esnext/dexie-cloud-client.d.ts'))\"", |
| 62 | + "#node -e \"fs.writeFileSync('dist/dexie-cloud-addon.d.ts', fs.readFileSync('tools/tmp/modern/dexie-cloud-client.d.ts'))\"", |
| 63 | + "# Replace {version} and {date} in output files", |
| 64 | + "node tools/replaceVersionAndDate.js dist/umd/dexie-cloud-addon.js dist/module-es5/dexie-cloud-addon.js dist/modern/dexie-cloud-addon.js" |
| 65 | + ], |
| 66 | + "service-worker": [ |
| 67 | + "# Create a modern bundle in dist/modern", |
| 68 | + "rollup -c tools/build-configs/rollup.sw.modern.config.js", |
44 | 69 | "# Replace {version} and {date} in output files",
|
45 |
| - "node tools/replaceVersionAndDate.js dist/dexie-cloud.d.ts dist/dexie-cloud.js dist/dexie-cloud.mjs esnext/dexie-cloud.js" |
| 70 | + "node tools/replaceVersionAndDate.js dist/umd/service-worker.js dist/modern/service-worker.js" |
46 | 71 | ],
|
47 | 72 | "test": [
|
48 | 73 | "just-build test-unit"
|
|
0 commit comments