-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add build script for publishing
- Loading branch information
Trygve Lie
committed
Sep 16, 2024
1 parent
11cac13
commit 939222c
Showing
6 changed files
with
231 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import rollupPluginCommonjs from "@rollup/plugin-commonjs"; | ||
import rollupPluginResolve from "@rollup/plugin-node-resolve"; | ||
import rollupPluginReplace from "@rollup/plugin-replace"; | ||
import rollupPluginTerser from "@rollup/plugin-terser"; | ||
import { rollup } from "rollup"; | ||
|
||
const inputOptions = { | ||
input: ["./src/alpaca-map.js"], | ||
plugins: [ | ||
rollupPluginResolve({ | ||
preferBuiltins: true | ||
}), | ||
rollupPluginCommonjs({ | ||
include: /node_modules/ | ||
}), | ||
rollupPluginReplace({ | ||
"process.env.NODE_ENV": JSON.stringify("production"), | ||
preventAssignment: true, | ||
}), | ||
/* | ||
rollupPluginTerser({ | ||
format: { | ||
comments: false | ||
} | ||
}), | ||
*/ | ||
], | ||
}; | ||
|
||
const outputOptionsList = [ | ||
{ | ||
preserveModules: true, | ||
dir: './public/build', | ||
// file: "./public/build/alpaca-map.js", | ||
format: "es", | ||
// sourcemap: true, | ||
interop: 'esModule', | ||
}, | ||
]; | ||
|
||
let bundle = await rollup(inputOptions); | ||
|
||
for (const outputOptions of outputOptionsList) { | ||
await bundle.write(outputOptions); | ||
} | ||
|
||
if (bundle) { | ||
await bundle.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.