diff options
author | Matthew Miller <matthew@millerti.me> | 2021-04-06 08:59:51 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2021-04-06 08:59:51 -0700 |
commit | 8232af6c88c427ace96cc612c02754cb8c69b3a5 (patch) | |
tree | 11705a69945f1c92bf9cc12d4354937dae859058 /packages/browser/rollup.config.js | |
parent | 4f40d3cbd5fcc0d74e78a1541871addea4fe8669 (diff) |
De-duplicate versionInjector config
Diffstat (limited to 'packages/browser/rollup.config.js')
-rw-r--r-- | packages/browser/rollup.config.js | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/packages/browser/rollup.config.js b/packages/browser/rollup.config.js index 6d2914f..0f275e2 100644 --- a/packages/browser/rollup.config.js +++ b/packages/browser/rollup.config.js @@ -32,8 +32,20 @@ const cleanTslibCommentInUMDBundleTargetingES5 = () => { }; }; +const swanVersionInjector = versionInjector({ + injectInComments: { + fileRegexp: /\.(js)$/, + // [@simplewebauthn/browser] Version: 2.1.0 - Saturday, February 6th, 2021, 4:10:31 PM + tag: '[@simplewebauthn/browser] Version: {version} - {date}', + dateFormat: 'dddd, mmmm dS, yyyy, h:MM:ss TT', + }, +}); + /** - * Rollup configuration to generate all bundles in ES2018, ES5 and types + * Rollup configuration to generate the following: + * - ES2018 bundle + * - ES5 bundle + * - Type declarations */ export default [ { @@ -53,18 +65,7 @@ export default [ plugins: [terser()], }, ], - plugins: [ - typescript({ tsconfig: './tsconfig.json' }), - nodeResolve(), - versionInjector({ - injectInComments: { - fileRegexp: /\.(js)$/, - // [@simplewebauthn/browser] Version: 2.1.0 - Saturday, February 6th, 2021, 4:10:31 PM - tag: '[@simplewebauthn/browser] Version: {version} - {date}', - dateFormat: 'dddd, mmmm dS, yyyy, h:MM:ss TT', - }, - }), - ], + plugins: [typescript({ tsconfig: './tsconfig.json' }), nodeResolve(), swanVersionInjector], }, { input: 'src/index.ts', @@ -78,14 +79,7 @@ export default [ typescript({ tsconfig: './tsconfig.es5.json' }), commonjs({ extensions: ['.ts'] }), nodeResolve(), - versionInjector({ - injectInComments: { - fileRegexp: /\.(js)$/, - // [@simplewebauthn/browser] Version: 2.1.0 - Saturday, February 6th, 2021, 4:10:31 PM - tag: '[@simplewebauthn/browser] Version: {version} - {date}', - dateFormat: 'dddd, mmmm dS, yyyy, h:MM:ss TT', - }, - }), + swanVersionInjector, ], external: ['tslib'], }, @@ -102,14 +96,7 @@ export default [ typescript({ tsconfig: './tsconfig.es5.json' }), commonjs({ extensions: ['.ts'] }), nodeResolve(), - versionInjector({ - injectInComments: { - fileRegexp: /\.(js)$/, - // [@simplewebauthn/browser] Version: 2.1.0 - Saturday, February 6th, 2021, 4:10:31 PM - tag: '[@simplewebauthn/browser] Version: {version} - {date}', - dateFormat: 'dddd, mmmm dS, yyyy, h:MM:ss TT', - }, - }), + swanVersionInjector, ], }, ]; |