Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* refactor: build step * refactor: remove node v12 build step
- Loading branch information
1 parent
ccd7099
commit d796355
Showing
19 changed files
with
441 additions
and
1,768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
12 | ||
14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
module.exports = { | ||
'presets': [ | ||
presets: [ | ||
['@babel/preset-env', { | ||
modules: false | ||
}] | ||
], | ||
'plugins': [ | ||
plugins: [ | ||
'@babel/plugin-proposal-object-rest-spread' | ||
], | ||
'comments': false, | ||
comments: false, | ||
env: { | ||
test: { | ||
'presets': [ | ||
presets: [ | ||
['@babel/preset-env'] | ||
], | ||
'plugins': ['@babel/plugin-transform-runtime'] | ||
plugins: ['@babel/plugin-transform-runtime'] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const config = require('../../babel.config') | ||
module.exports = config |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { generateConfigFactory, generateOutputConfig } from '../../rollup.base.mjs' | ||
|
||
const config = generateConfigFactory({ | ||
input: 'index.js', | ||
libraryName: 'VuelidateComponents', | ||
outputConfigs: generateOutputConfig('index', { | ||
globals: { | ||
'@vuelidate/core': 'Vuelidate' | ||
} | ||
}) | ||
}) | ||
config.external = [/packages\/(vuelidate|validators)/, 'vue-demi'] | ||
|
||
export default config | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const config = require('../../babel.config') | ||
module.exports = config |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { generateConfigFactory, generateOutputConfig } from '../../rollup.base.mjs' | ||
|
||
export default [ | ||
generateConfigFactory({ | ||
libraryName: 'VuelidateValidators', | ||
outputConfigs: generateOutputConfig('index') | ||
}), | ||
generateConfigFactory({ | ||
libraryName: 'VuelidateValidators', | ||
input: 'src/raw.js', | ||
outputConfigs: generateOutputConfig('raw') | ||
}) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const config = require('../../babel.config') | ||
module.exports = config |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { generateConfigFactory, generateOutputConfig } from '../../rollup.base.mjs' | ||
|
||
export default generateConfigFactory({ | ||
libraryName: 'Vuelidate', | ||
outputConfigs: generateOutputConfig('index') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import terser from '@rollup/plugin-terser' | ||
import resolve from '@rollup/plugin-node-resolve' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
import { babel } from '@rollup/plugin-babel' | ||
|
||
export function generateOutputConfig (fileName = 'index', opts) { | ||
return { | ||
mjs: { | ||
file: `dist/${fileName}.mjs`, | ||
format: 'es', | ||
...opts, | ||
}, | ||
cjs: { | ||
file: `dist/${fileName}.cjs`, | ||
format: 'cjs', | ||
...opts, | ||
}, | ||
global: { | ||
file: `dist/${fileName}.iife.min.js`, | ||
format: 'iife', | ||
...opts, | ||
} | ||
} | ||
} | ||
|
||
function generateConfigFactory ({ libraryName, input = 'src/index.js', outputConfigs }) { | ||
/** | ||
* @type {import('rollup').RollupOptions} | ||
*/ | ||
const config = { | ||
input, | ||
external: ['vue-demi'], | ||
plugins: [resolve(), commonjs(), babel({ babelHelpers: 'bundled' })], | ||
output: [] | ||
} | ||
|
||
/** | ||
* Create config output | ||
* @param {string} name | ||
* @param {import('rollup').OutputOptions} options | ||
* @return {*} | ||
*/ | ||
function createConfig (name, options) { | ||
const opts = { ...options } | ||
opts.exports = 'named' | ||
opts.globals = { | ||
...opts.globals, | ||
'vue-demi': 'VueDemi' | ||
} | ||
|
||
const isGlobalBuild = name === 'global' | ||
const isMinified = opts.file.includes('.min.') | ||
|
||
if (isGlobalBuild) opts.name = libraryName | ||
opts.plugins = [] | ||
if (isMinified) { | ||
opts.plugins.push( | ||
terser() | ||
) | ||
} | ||
return opts | ||
} | ||
|
||
const packageBuilds = Object.keys(outputConfigs) | ||
config.output = packageBuilds.map(buildName => createConfig(buildName, outputConfigs[buildName])) | ||
|
||
return config | ||
} | ||
|
||
export { generateConfigFactory } |
Oops, something went wrong.