From 4db6f258decba0caa998d0ce7918a20498805b12 Mon Sep 17 00:00:00 2001 From: mayinrain <624899618@qq.com> Date: Mon, 1 Apr 2024 16:39:32 +0800 Subject: [PATCH 1/2] upd: add script to build esm-browser --- package.json | 5 +++-- scripts/build-browser.mjs | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 scripts/build-browser.mjs diff --git a/package.json b/package.json index 631ce4d..605be10 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,14 @@ "prepare": "husky install", "commit": "git-cz", "build:esm": "node scripts/build-esm.js", + "build:esm-browser": "node scripts/build-browser.mjs", "build:umd": "node scripts/build-umd.js", "build:type": "node scripts/build-types.js", "build:style": "node scripts/build-style.js", - "build.unix": "rm -rf packages/traction-widget/dist packages/traction-widget/es && npm run build:esm && npm run build:type && npm run build:style && npm run build:umd", + "build.unix": "rm -rf packages/traction-widget/dist packages/traction-widget/es && npm run build:esm && npm run build:type && npm run build:style && npm run build:umd && npm run build:esm-browser", "release": "npm run build && node scripts/release.js", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "build.win": "npm run build:esm && npm run build:type && npm run build:style && npm run build:umd", + "build.win": "npm run build:esm && npm run build:type && npm run build:style && npm run build:umd && npm run build:esm-browser", "build": "node scripts/build.js" }, "files": [ diff --git a/scripts/build-browser.mjs b/scripts/build-browser.mjs new file mode 100644 index 0000000..6bb54c9 --- /dev/null +++ b/scripts/build-browser.mjs @@ -0,0 +1,18 @@ +import path from 'path'; +import fse from 'fs-extra'; +import { rollup } from 'rollup'; + +import { getRollupConfig, OUTPUT_DIR } from './build-shard.js'; + +fse.mkdirsSync(OUTPUT_DIR); + +async function compiler() { + const bundle = await rollup(getRollupConfig()); + const outputFilePath = path.join(OUTPUT_DIR, 'traction-widget.esm-browser.js'); + await bundle.write({ + file: outputFilePath, + format: 'esm', + }); +} + +compiler(); From 8d4b6617262c6b7a279a2ec9685ca046620f4a92 Mon Sep 17 00:00:00 2001 From: mayinrain <624899618@qq.com> Date: Mon, 1 Apr 2024 16:43:44 +0800 Subject: [PATCH 2/2] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 605be10..77f2ec1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/traction-widget", - "version": "1.8.10", + "version": "1.8.11", "description": "集合大型中台项目使用到的通用组件和工具函数", "scripts": { "docs:dev": "npm run build && vitepress dev docs",