Skip to content

Commit

Permalink
chore: add package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Oct 17, 2023
1 parent 9542669 commit 6c2845f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"main": "src/index.ts",
"scripts": {
"prepare": "husky install",
"build": "NODE_ENV=production webpack",
"build": "NODE_ENV=production webpack && pnpm create-package",
"create-package": "node scripts/build-finished.ts",
"watch": "webpack --watch --mode=development",
"test": "vitest --coverage",
"test:watch": "vitest --ui",
Expand Down
17 changes: 17 additions & 0 deletions scripts/build-finished.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require("fs");
const path = require("path");

const pkg = require("../package.json");

const distDir = "dist";

const packageData = {
name: "agora-rtc-sdk-ng-fake",
version: "1.0.0",
description: "Fake Agora Web RTC for testing",
main: `${pkg.name}_${pkg.version}.js`,
};

const packagePath = path.join(distDir, "package.json");

fs.writeFileSync(packagePath, JSON.stringify(packageData, null, 2));
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let config = {
type: "umd",
umdNamedDefine: true,
},
filename: `iris-web-rtc-fake_${pkg.version}.js`,
filename: `${pkg.name}_${pkg.version}.js`,
globalObject: "this",
environment: {
arrowFunction: false,
Expand Down

0 comments on commit 6c2845f

Please sign in to comment.