Skip to content

Commit

Permalink
adjust version injector plugin location
Browse files Browse the repository at this point in the history
  • Loading branch information
patinthehat authored and Patrick committed Feb 6, 2021
1 parent 974b90d commit 16965fd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
45 changes: 26 additions & 19 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,33 @@ import { terser } from 'rollup-plugin-terser';
import typescript from '@rollup/plugin-typescript';
import versionInjector from 'rollup-plugin-version-injector';

const sourceMapsEnabled = false;
const versionInject = versionInjector({
//injectInComments: {
// fileRegexp: /\.(cjs|mjs|js)$/,
// tag: 'Version: {version} - {date}',
// dateFormat: 'mmmm d, yyyy HH:MM:ss'
//},
injectInTags: {
fileRegexp: /\.(cjs|mjs|js)$/,
tagId: 'VI',
dateFormat: 'mmmm d, yyyy HH:MM:ss'
}
});

const sourceMapsEnabled = true;

const outputMinified = [
{
file: 'dist/index.min.cjs',
format: 'cjs',
plugins: [terser()],
plugins: [versionInject, terser()],
sourcemap: sourceMapsEnabled,
exports: 'auto',
},
{
file: 'dist/index.min.mjs',
format: 'esm',
plugins: [terser()],
plugins: [versionInject, terser()],
sourcemap: sourceMapsEnabled,
},
];
Expand All @@ -26,32 +39,26 @@ const outputUnminified = [
{
file: 'dist/index.cjs',
format: 'cjs',
sourcemap: sourceMapsEnabled,
sourcemap: false,
exports: 'auto',
plugins: [versionInject]
},
{
file: 'dist/index.mjs',
format: 'esm',
sourcemap: sourceMapsEnabled,
sourcemap: false,
plugins: [versionInject]
},
];

const versionInject = versionInjector({
//injectInComments: {
// fileRegexp: /\.(cjs|mjs|js)$/,
// tag: 'Version: {version} - {date}',
// dateFormat: 'mmmm d, yyyy HH:MM:ss'
//},
injectInTags: {
fileRegexp: /\.(cjs|mjs|js)$/,
tagId: 'VI',
dateFormat: 'mmmm d, yyyy HH:MM:ss'
}
});


export default {
input: 'src/Ray.ts',
output: [...outputUnminified],
plugins: [nodeResolve(), commonjs(), versionInject, typescript()],
output: [
...outputUnminified,
...outputMinified,
],
plugins: [nodeResolve(), commonjs(), typescript()],
external: ['axios', 'find-up', 'md5', 'pretty-format', 'stacktrace-js', 'xml-formatter', 'uuid'],
};
5 changes: 3 additions & 2 deletions rollup.standalone-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const outputMinified = [
{
file: 'dist/standalone.min.js',
format: 'umd',
plugins: [terser()],
plugins: [versionInjector(), terser()],
sourcemap: sourceMapsEnabled,
exports: 'auto',
name: 'Ray',
Expand All @@ -23,6 +23,7 @@ const outputUnminified = [
{
file: 'dist/standalone.js',
format: 'umd',
plugins: [versionInjector()],
sourcemap: sourceMapsEnabled,
exports: 'auto',
name: 'Ray',
Expand All @@ -34,6 +35,6 @@ export default {
output: [
...outputUnminified,
],
plugins: [nodeResolve(), json(), commonjs(), typescript(), versionInjector()],
plugins: [nodeResolve(), json(), commonjs(), typescript()],
external: [], //'axios', 'find-up', 'md5', 'pretty-format', 'stacktrace-js', 'xml-formatter', 'uuid'
};

0 comments on commit 16965fd

Please sign in to comment.