chore: bundle 增加版本信息
parent
f433c12d8e
commit
c7dd786e56
|
@ -50,6 +50,7 @@
|
||||||
"@typescript-eslint/parser": "^4.22.1",
|
"@typescript-eslint/parser": "^4.22.1",
|
||||||
"archiver": "^5.3.0",
|
"archiver": "^5.3.0",
|
||||||
"chalk": "^4.1.1",
|
"chalk": "^4.1.1",
|
||||||
|
"dayjs": "^1.10.5",
|
||||||
"eslint": "^7.26.0",
|
"eslint": "^7.26.0",
|
||||||
"husky": "^6.0.0",
|
"husky": "^6.0.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
|
@ -63,7 +64,7 @@
|
||||||
"typescript": "^4.2.4"
|
"typescript": "^4.2.4"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.ts": [
|
"*.(t|j)s": [
|
||||||
"yarn lint",
|
"yarn lint",
|
||||||
"yarn format",
|
"yarn format",
|
||||||
"yarn test"
|
"yarn test"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||||
import { babel } from '@rollup/plugin-babel';
|
import { babel } from '@rollup/plugin-babel';
|
||||||
import typescript from 'rollup-plugin-typescript2';
|
import typescript from 'rollup-plugin-typescript2';
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
import { DEFAULT_EXTENSIONS } from '@babel/core';
|
import { DEFAULT_EXTENSIONS } from '@babel/core';
|
||||||
|
|
||||||
import filterEmptyLines from './scripts/@rollup/plugin-filter-empty-lines';
|
import filterEmptyLines from './scripts/@rollup/plugin-filter-empty-lines';
|
||||||
|
@ -11,7 +12,6 @@ import pkg from './package.json';
|
||||||
|
|
||||||
const entryFilePath = path.resolve(__dirname, 'src/index.ts');
|
const entryFilePath = path.resolve(__dirname, 'src/index.ts');
|
||||||
const distPath = path.resolve(__dirname, 'dist');
|
const distPath = path.resolve(__dirname, 'dist');
|
||||||
const pkgName = pkg.name;
|
|
||||||
|
|
||||||
const extensions = [].concat(DEFAULT_EXTENSIONS, '.ts');
|
const extensions = [].concat(DEFAULT_EXTENSIONS, '.ts');
|
||||||
const plugins = [
|
const plugins = [
|
||||||
|
@ -31,9 +31,18 @@ const plugins = [
|
||||||
}),
|
}),
|
||||||
filterEmptyLines(),
|
filterEmptyLines(),
|
||||||
];
|
];
|
||||||
|
const banner = `/**
|
||||||
|
* @name ${pkg.name}
|
||||||
|
* @version ${pkg.version}
|
||||||
|
* @description ${pkg.description}
|
||||||
|
* @date ${dayjs().format('YYYY-MM-DD')}
|
||||||
|
* @author ${pkg.author}
|
||||||
|
* @github ${pkg.repository.url}
|
||||||
|
* @issues ${pkg.bugs.url}
|
||||||
|
*/`;
|
||||||
|
|
||||||
function resolveOutputFilePath(format) {
|
function resolveOutputFilePath(format) {
|
||||||
return path.resolve(distPath, format, `${pkgName}.js`);
|
return path.resolve(distPath, format, `${pkg.name}.js`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateConfig(format) {
|
function generateConfig(format) {
|
||||||
|
@ -42,9 +51,10 @@ function generateConfig(format) {
|
||||||
output: {
|
output: {
|
||||||
file: resolveOutputFilePath(format),
|
file: resolveOutputFilePath(format),
|
||||||
format,
|
format,
|
||||||
name: pkgName,
|
name: pkg.name,
|
||||||
exports: 'default',
|
exports: 'default',
|
||||||
indent: false,
|
indent: false,
|
||||||
|
banner,
|
||||||
},
|
},
|
||||||
plugins,
|
plugins,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2489,6 +2489,11 @@ date-fns@^1.27.2:
|
||||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
|
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
|
||||||
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
|
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
|
||||||
|
|
||||||
|
dayjs@^1.10.5:
|
||||||
|
version "1.10.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.5.tgz#5600df4548fc2453b3f163ebb2abbe965ccfb986"
|
||||||
|
integrity sha512-BUFis41ikLz+65iH6LHQCDm4YPMj5r1YFLdupPIyM4SGcXMmtiLQ7U37i+hGS8urIuqe7I/ou3IS1jVc4nbN4g==
|
||||||
|
|
||||||
debug@^2.2.0, debug@^2.3.3:
|
debug@^2.2.0, debug@^2.3.3:
|
||||||
version "2.6.9"
|
version "2.6.9"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||||
|
|
Loading…
Reference in New Issue