Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (opts.env) {
config.plugins.push(
replace({
"process.env.NODE_ENV": JSON.stringify(opts.env)
})
);
// minify on production targets
if (opts.env === "production") {
config.plugins.push(uglify({}, minify));
}
}
// output a license to builds
config.plugins.push(
license({
sourceMap: true,
banner: {
file: path.resolve("LICENSE.md")
}
})
);
Object.defineProperty(config, "_name", {
enumerable: false,
value: name
});
return config;
}
if (opts.env) {
config.plugins.push(
replace({
"process.env.NODE_ENV": JSON.stringify(opts.env)
})
);
// minify on production targets
if (opts.env === "production") {
config.plugins.push(terser());
}
}
// output a license to builds
config.plugins.push(
license({
sourcemap: true,
banner: {
content: {
file: path.resolve("LICENSE")
}
}
})
);
Object.defineProperty(config, "_name", {
enumerable: false,
value: name
});
return config;
}
baseDir: 'demo',
routes: {
'/dist/css/shepherd.css': 'dist/css/shepherd.css',
'/dist/js/shepherd.js': 'dist/js/shepherd.js',
'/demo/js/prism.js': 'demo/js/prism.js',
'/demo/js/welcome.js': 'demo/js/welcome.js',
'/demo/css/prism.css': 'demo/css/prism.css',
'/demo/css/welcome.css': 'demo/css/welcome.css',
'/demo/sheep.svg': 'demo/sheep.svg'
}
}
})
);
}
plugins.push(license({ banner }));
plugins.push(filesize());
plugins.push(visualizer());
const rollupBuilds = [
// Generate unminifed bundle
{
input: './src/js/shepherd.js',
output: [
{
file: pkg.main,
format: 'umd',
name: 'Shepherd',
sourcemap: true
},
{
export default command => {
const commonJSBuild = {
input: {
'rollup.js': 'src/node-entry.ts',
'bin/rollup': 'cli/index.ts'
},
onwarn,
plugins: [
...nodePlugins,
addSheBang(),
!command.configTest && license({ thirdParty: generateLicenseFile })
],
// acorn needs to be external as some plugins rely on a shared acorn instance
external: ['acorn', 'assert', 'crypto', 'events', 'fs', 'module', 'path', 'util'],
treeshake,
output: {
banner,
chunkFileNames: 'shared/[name].js',
dir: 'dist',
entryFileNames: '[name]',
externalLiveBindings: false,
format: 'cjs',
freeze: false,
interop: false,
sourcemap: true
}
};
warnings: false
})
);
}
config.plugins.push(filesize());
} else {
config = {
input: './src/base.ts',
output: { format: 'es' },
plugins: [dts()]
};
}
config.plugins.push(
license({
banner: `/*!
* NornJ-React${withEx ? '-' + withEx : ''} v${require('../../package.json').version}
* (c) 2016-2019 Joe_Sky
* Released under the MIT License.
*/`
})
);
export default config;
typescript({
objectHashIgnoreUnknownHack: true,
clean: true,//environment === 'production',
include: _.compact( [
"src/*.ts",
"src/**/*.ts",
environment === 'demo' ? "tutorials/.tmp/**/*.ts" : undefined,
environment === 'demo' ? "tutorials/**/*.ts" : undefined,
] ),
tsconfigOverride,
}),
replace({
'process.env.NODE_ENV': JSON.stringify( environment ),
}),
environment === 'production' ? license( {
banner: `${ pkg.name } v${ pkg.version }
License: ${ pkg.license }
Repository: ${ pkg.repository.url }
Generated on ${ moment().format( 'YYYY-MM-DD [at] HH:mm:ss' ) }.
By ${ allContributorsString }`,
} ) : undefined,
environment === 'production' ? terser({
compress: {
passes: 2,
unsafe: true,
}
}) : undefined,
environment === 'production' ? visualizer( { filename: `./stats/${ iife ? 'iife' : 'esm' }.html` } ) : undefined,
import license from "rollup-plugin-license";
import { uglify } from "rollup-plugin-uglify";
import filesize from "rollup-plugin-filesize";
import { eslint } from "rollup-plugin-eslint";
const input = "src/Headroom.js";
const output = {
format: "umd",
name: "Headroom"
};
const licensePlugin = license({
banner: {
commentStyle: "ignored",
content: `<%= pkg.name %> v<%= pkg.version %> - <%= pkg.description %>
Copyright (c) <%= moment().format('YYYY') %> <%= pkg.author %> - <%= pkg.homepage %>
License: <%= pkg.license %>`
}
});
const unminified = {
input,
output: {
...output,
file: "dist/headroom.js"
},
plugins: [
eslint(),
if (Object.keys(pkg.dependencies).find(dep => id === dep) || id.match(/(core-js).+/)) {
return true;
}
return false;
},
output: {
file: pkg.module,
format: 'es',
sourcemap: true
},
plugins: [
babel({
exclude: ['/**/node_modules/**']
}),
license(licence)
]
}
];