@daybrush/builder
Advanced tools
Comparing version 0.0.5 to 0.0.6
48
index.js
@@ -0,7 +1,19 @@ | ||
const fs = require("fs"); | ||
const pkg = require(process.cwd() + "/package.json"); | ||
let copyright = `Copyright (c) ${pkg.author ? pkg.author.name || pkg.author : ""}`; | ||
try { | ||
const licenseFile = fs.readFileSync(process.cwd() + "/LICENSE", { encoding: "utf8" }); | ||
const result = licenseFile.match(/^copy.*$/img); | ||
if (result && result[0]) { | ||
copyright = result[0]; | ||
} | ||
} catch (e) { } | ||
const defaultBanner = `/* | ||
Copyright (c) 2019 ${pkg.author} | ||
${copyright} | ||
name: ${pkg.name} | ||
license: ${pkg.license} | ||
author: ${pkg.author} | ||
author: ${pkg.author ? pkg.author.name || pkg.author : ""} | ||
repository: ${pkg.repository.url} | ||
@@ -11,10 +23,3 @@ version: ${pkg.version} | ||
const commonjsPlugin = require("rollup-plugin-commonjs")(); | ||
const typescriptPlugin = require("rollup-plugin-typescript")({ | ||
"module": "es2015", | ||
"target": "es3", | ||
"lib": ["es2015", "dom"], | ||
"exclude": "node_modules/**", | ||
"sourceMap": true, | ||
}); | ||
const typescriptPlugin = require("rollup-plugin-typescript"); | ||
const replacePlugin = require("rollup-plugin-replace")({ | ||
@@ -44,5 +49,7 @@ "#__VERSION__#": pkg.version, | ||
output, // string | string[] | ||
tsconfig = "tsconfig.json", | ||
format = "umd", // "umd", "cjs", "es" | ||
exports = "default", // "default", "named" | ||
sourcemap = true, // boolean, | ||
plugins = [], | ||
name, // string, | ||
@@ -58,6 +65,13 @@ uglify, // boolean or except string | ||
} = options; | ||
const plugins = [typescriptPlugin, minifyPlugin, replacePlugin]; | ||
const nextPlugins = plugins.concat([ | ||
typescriptPlugin({ | ||
tsconfig, | ||
"sourceMap": true, | ||
}), | ||
minifyPlugin, | ||
replacePlugin | ||
]); | ||
commonjs && plugins.push(commonjsPlugin); | ||
resolve && plugins.push(resolvePlugin); | ||
commonjs && nextPlugins.push(commonjsPlugin); | ||
resolve && nextPlugins.push(resolvePlugin); | ||
if (uglify) { | ||
@@ -75,3 +89,3 @@ const condition = typeof uglify === "string" ? uglify : `name:(\\s*)${pkg.name.replace(/\//g, "\\/")}`; | ||
})();`); | ||
plugins.push(uglifyPlugin({ | ||
nextPlugins.push(uglifyPlugin({ | ||
sourcemap: true, | ||
@@ -83,7 +97,7 @@ output: { | ||
} | ||
visualizer && plugins.push(visualizerPlugin({ | ||
visualizer && nextPlugins.push(visualizerPlugin({ | ||
sourcemap: true, | ||
filename: './statistics/index.html', | ||
title: '', | ||
...visualizer , | ||
...visualizer, | ||
})); | ||
@@ -93,3 +107,3 @@ | ||
input, | ||
plugins, | ||
plugins: nextPlugins, | ||
external: Object.keys(external || {}), | ||
@@ -96,0 +110,0 @@ ...inputOptions, |
{ | ||
"name": "@daybrush/builder", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6675
213
2