Skip to content

Commit

Permalink
add module.min
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed May 30, 2024
1 parent 023174b commit 5efb1f0
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 3 deletions.
145 changes: 145 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"test": "test"
},
"scripts": {
"build": "npm run build-min",
"build-normal": "rollup -c && tsc --emitDeclarationOnly --declaration",
"build-min": "npm run build-normal && google-closure-compiler --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs build/externs.js --language_in=ECMASCRIPT_2019 --language_out=ECMASCRIPT_2019 --js dist/2.x/wgpu-matrix.js --js_output_file dist/2.x/wgpu-matrix.min.js && node ./build/tools/append-banner.js dist/2.x/wgpu-matrix.min.js",
"build": "rollup -c && tsc --emitDeclarationOnly --declaration",
"build-ci": "npm run pre-push && node build/tools/prep-for-deploy.js",
"check": "npm run lint",
"check-ci": "npm run pre-push",
Expand Down Expand Up @@ -48,6 +46,7 @@
},
"homepage": "https://github.com/greggman/wgpu-matrix#readme",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@tsconfig/recommended": "^1.0.6",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand Down
33 changes: 33 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import fs from 'fs';

const pkg = JSON.parse(fs.readFileSync('package.json', {encoding: 'utf8'}));
Expand All @@ -9,6 +10,11 @@ const plugins = [
typescript({ tsconfig: './tsconfig.json' }),
];

const minPlugins = [
...plugins,
terser(),
];

export default [
{
input: 'src/wgpu-matrix.ts',
Expand Down Expand Up @@ -37,4 +43,31 @@ export default [
],
plugins,
},
{
input: 'src/wgpu-matrix.ts',
output: [
{
file: `dist/${ver}/wgpu-matrix.module.min.js`,
format: 'esm',
sourcemap: true,
banner,
freeze: false,
},
],
plugins: minPlugins,
},
{
input: 'src/wgpu-matrix.ts',
output: [
{
name: 'wgpuMatrix',
file: `dist/${ver}/wgpu-matrix.min.js`,
format: 'umd',
sourcemap: true,
banner,
freeze: false,
},
],
plugins: minPlugins,
},
];

0 comments on commit 5efb1f0

Please sign in to comment.