-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
2,434 additions
and
4,212 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
File renamed without changes.
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,14 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<link rel="shortcut icon" href="<%= webpackConfig.output.publicPath %>favicon.ico"> | ||
<title>Vue Color Picker</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<!-- built files will be auto injected --> | ||
<script type="module" src="./src/main.js"></script> | ||
</body> | ||
</html> |
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
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,28 +1,70 @@ | ||
const vue = require('@vitejs/plugin-vue'); | ||
const fse = require('fs-extra'); | ||
const { log, logWithSpinner, stopSpinner, clearConsole, done, chalk, error } = require('@vue/cli-shared-utils'); | ||
const path = require('path'); | ||
const { build } = require('vite'); | ||
const chalk = require('chalk'); | ||
const readline = require('readline'); | ||
|
||
const { printStats } = require('./print-stats'); | ||
const { bundle } = require('./roll'); | ||
|
||
const fileNameBase = 'vue-color-picker'; | ||
|
||
const getBuildConfig = ({ formats, minify }) => { | ||
return { | ||
define: { | ||
// @workaround vite replaces process.env.NODE_ENV with 'production' during build | ||
// after dead code elimination is applied the whole if branch is removed | ||
// what we want instead is to remove it only in UMD builds | ||
__DEV__: formats.includes('umd') ? false : 'process.env.NODE_ENV === "development"', | ||
}, | ||
logLevel: 'silent', | ||
configFile: false, | ||
plugins: [vue()], | ||
build: { | ||
emptyOutDir: false, | ||
minify, | ||
brotliSize: false, | ||
sourcemap: !!minify, | ||
lib: { | ||
entry: path.resolve(__dirname, '../src/wrapper.js'), | ||
name: 'VueColorPicker', | ||
formats, | ||
}, | ||
rollupOptions: { | ||
external: ['vue'], | ||
output: { | ||
globals: { | ||
vue: 'Vue', | ||
}, | ||
entryFileNames: `${fileNameBase}.[format].${!!minify ? 'min.js' : 'js'}`, | ||
assetFileNames: `${fileNameBase}.${!!minify ? 'min.[ext]' : '[ext]'}`, | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
(async () => { | ||
try { | ||
const start = Date.now(); | ||
if (process.stdout.isTTY) { | ||
console.log('\n'.repeat(process.stdout.rows)); | ||
|
||
await fse.remove('dist'); | ||
readline.cursorTo(process.stdout, 0, 0); | ||
readline.clearScreenDown(process.stdout); | ||
} | ||
|
||
log(); | ||
logWithSpinner('Building for production as library (commonjs, esm, umd, umd-min)...'); | ||
await fse.remove('dist'); | ||
|
||
await bundle(); | ||
console.log('Building for production as library (commonjs, es, umd, umd-min)...'); | ||
|
||
stopSpinner(); | ||
clearConsole(); | ||
await build(getBuildConfig({ formats: ['es', 'cjs'] })); | ||
await build(getBuildConfig({ formats: ['umd'], minify: false })); | ||
await build(getBuildConfig({ formats: ['umd'], minify: true })); | ||
|
||
done(chalk.green(`Compiled successfully in ${Date.now() - start}ms`)); | ||
printStats(); | ||
} catch (err) { | ||
stopSpinner(); | ||
error(err); | ||
console.error('\n' + chalk.red(err.message)); | ||
console.error(err.stack); | ||
process.exit(1); | ||
} | ||
})(); |
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 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
Oops, something went wrong.