diff --git a/dist.zip b/dist.zip index 4ac6304..18772d9 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/package.json b/package.json index b11b967..8a86c3b 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "@typescript-eslint/parser": "^4.22.1", "archiver": "^5.3.0", "chalk": "^4.1.1", + "dayjs": "^1.10.5", "eslint": "^7.26.0", "husky": "^6.0.0", "jest": "^26.6.3", @@ -63,7 +64,7 @@ "typescript": "^4.2.4" }, "lint-staged": { - "*.ts": [ + "*.(t|j)s": [ "yarn lint", "yarn format", "yarn test" diff --git a/rollup.config.js b/rollup.config.js index d94598c..038b098 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,6 +4,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve'; import { babel } from '@rollup/plugin-babel'; import typescript from 'rollup-plugin-typescript2'; import commonjs from '@rollup/plugin-commonjs'; +import dayjs from 'dayjs'; import { DEFAULT_EXTENSIONS } from '@babel/core'; 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 distPath = path.resolve(__dirname, 'dist'); -const pkgName = pkg.name; const extensions = [].concat(DEFAULT_EXTENSIONS, '.ts'); const plugins = [ @@ -31,9 +31,18 @@ const plugins = [ }), 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) { - return path.resolve(distPath, format, `${pkgName}.js`); + return path.resolve(distPath, format, `${pkg.name}.js`); } function generateConfig(format) { @@ -42,9 +51,10 @@ function generateConfig(format) { output: { file: resolveOutputFilePath(format), format, - name: pkgName, + name: pkg.name, exports: 'default', indent: false, + banner, }, plugins, }; diff --git a/yarn.lock b/yarn.lock index 9ac0399..6feecb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2489,6 +2489,11 @@ date-fns@^1.27.2: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" 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: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"