musescore-downloader/rollup.config.js

53 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-11-03 19:13:06 +00:00
import typescript from "rollup-plugin-typescript"
import resolve from "rollup-plugin-node-resolve"
import commonjs from "rollup-plugin-commonjs"
import builtins from "rollup-plugin-node-builtins"
import nodeGlobals from "rollup-plugin-node-globals"
import json from "@rollup/plugin-json"
2019-11-03 19:13:06 +00:00
import fs from "fs"
2019-11-03 20:01:29 +00:00
const getBannerText = () => {
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"))
const { version } = packageJson
let bannerText = fs.readFileSync("./src/meta.js", "utf-8")
bannerText = bannerText.replace("%VERSION%", version)
return bannerText
}
2019-11-03 19:13:06 +00:00
export default {
input: "src/main.ts",
output: {
file: "dist/main.js",
format: "iife",
2019-11-03 19:27:47 +00:00
sourcemap: false,
2019-11-03 20:01:29 +00:00
banner: getBannerText,
// intro: "const global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof commonjsGlobal === 'object' && commonjsGlobal.global === commonjsGlobal ? commonjsGlobal : void 0"
2019-11-03 19:13:06 +00:00
},
plugins: [
typescript({
target: "ES6",
2019-11-03 19:27:47 +00:00
sourceMap: false,
allowJs: true,
2019-11-03 19:13:06 +00:00
lib: [
"ES6",
"dom"
],
2019-11-03 20:01:29 +00:00
}),
resolve({
preferBuiltins: true,
jsnext: true,
extensions: [".js", ".ts"]
}),
commonjs({
extensions: [".js", ".ts"]
}),
json(),
builtins(),
nodeGlobals({
dirname: false,
filename: false,
baseDir: false,
})
2019-11-03 19:13:06 +00:00
]
}