mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 19:03:46 +02:00
Add build step
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
build/* linguist-generated
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import * as esbuild from 'esbuild';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
|
const baseConfig = {
|
||||||
|
entryPoints: ['src/index.ts'],
|
||||||
|
bundle: true,
|
||||||
|
logLevel: 'info'
|
||||||
|
};
|
||||||
|
|
||||||
|
const umdConfig = {
|
||||||
|
...baseConfig,
|
||||||
|
format: 'iife',
|
||||||
|
|
||||||
|
// The following are hacks to basically make this an UMD module. No native support for that in esbuild as of today
|
||||||
|
globalName: 'Metamuxer',
|
||||||
|
|
||||||
|
footer: {
|
||||||
|
js:
|
||||||
|
`if (typeof module === "object" && typeof module.exports === "object") Object.assign(module.exports, Metamuxer)`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const esmConfig = {
|
||||||
|
...baseConfig,
|
||||||
|
format: 'esm'
|
||||||
|
};
|
||||||
|
|
||||||
|
let ctxUmd = await esbuild.context({
|
||||||
|
...umdConfig,
|
||||||
|
outfile: 'dist/metamuxer.js'
|
||||||
|
});
|
||||||
|
let ctxEsm = await esbuild.context({
|
||||||
|
...esmConfig,
|
||||||
|
outfile: 'dist/metamuxer.mjs'
|
||||||
|
});
|
||||||
|
let ctxUmdMinified = await esbuild.context({
|
||||||
|
...umdConfig,
|
||||||
|
outfile: 'dist/metamuxer.min.js',
|
||||||
|
minify: true
|
||||||
|
});
|
||||||
|
let ctxEsmMinified = await esbuild.context({
|
||||||
|
...esmConfig,
|
||||||
|
outfile: 'dist/metamuxer.min.mjs',
|
||||||
|
minify: true
|
||||||
|
});
|
||||||
|
|
||||||
|
if (process.argv[2] === '--watch') {
|
||||||
|
await Promise.all([
|
||||||
|
ctxUmd.watch(),
|
||||||
|
ctxEsm.watch(),
|
||||||
|
ctxUmdMinified.watch(),
|
||||||
|
ctxEsmMinified.watch(),
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
ctxUmd.rebuild();
|
||||||
|
ctxEsm.rebuild();
|
||||||
|
ctxUmdMinified.rebuild();
|
||||||
|
ctxEsmMinified.rebuild();
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
ctxUmd.dispose(),
|
||||||
|
ctxEsm.dispose(),
|
||||||
|
ctxUmdMinified.dispose(),
|
||||||
|
ctxEsmMinified.dispose(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
"use strict";
|
||||||
|
var Metamuxer = (() => {
|
||||||
|
// src/index.ts
|
||||||
|
console.log("hi");
|
||||||
|
})();
|
||||||
|
if (typeof module === "object" && typeof module.exports === "object") Object.assign(module.exports, Metamuxer)
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
"use strict";var Metamuxer=(()=>{console.log("hi");})();
|
||||||
|
if (typeof module === "object" && typeof module.exports === "object") Object.assign(module.exports, Metamuxer)
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
console.log("hi");
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
// src/index.ts
|
||||||
|
console.log("hi");
|
||||||
+2
-1
@@ -4,7 +4,8 @@
|
|||||||
"description": "TODO",
|
"description": "TODO",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"build": "node build.mjs",
|
||||||
|
"watch": "node build.mjs --watch"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
Reference in New Issue
Block a user