From f50f51436c65f1aa9a2ebff8da51592c10b0f2e1 Mon Sep 17 00:00:00 2001 From: "Jibon L. Costa" Date: Sun, 20 Nov 2022 15:03:29 +0600 Subject: [PATCH] fixed for `CommonJS` --- .DS_Store | Bin 6148 -> 6148 bytes .github/workflows/release.yml | 2 -- .npmignore | 2 ++ README.md | 2 +- examples/getActiveRoomInfo.js | 2 +- examples/getRecordings.js | 2 +- examples/quickJoin.js | 2 +- package.json | 20 +++++++++++--------- tsconfig-cjs.json | 8 ++++++++ tsconfig.json | 5 ++--- 10 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 tsconfig-cjs.json diff --git a/.DS_Store b/.DS_Store index 045000e27e789d4e4cbc42e3632d72e079e8fd3c..0bdf425d8f2b38d929964ee4164f41426749c167 100644 GIT binary patch delta 95 zcmZoMXfc=|#>CJzu~2NHp4Q|SjK-4B`mu~2NHo)%A1d2vBfPJR*t1H+Dq7ne^q5Mi0v&smQwoK%pLSzKaZ zaE+0PnT3^&or9f&nXr1w@?l^GXsk z^HPhz8ZuK-fl6Y+GxJjN%boH|^HPezdV?Vn9Go1S@d6UnuGNNymO2WC=Ek);3e}cI z2098RW+t_@oE)Oc`qn}5**Up+`CULa0|6r=gl6D{(lDxfVvqF3;{t4(**W+*fIi-M b@jLTmei2x@G diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 467698f..19eecef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,8 +16,6 @@ jobs: run: | npm install npm run build - rsync -ar package.json README.md LICENSE ./dist/ - cd dist npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN npm publish env: diff --git a/.npmignore b/.npmignore index 7ff05a9..9344953 100644 --- a/.npmignore +++ b/.npmignore @@ -1,9 +1,11 @@ tsconfig.json +tsconfig-cjs.json tslint.json .prettierrc .eslintignore .eslintrc.js .DS_Store +node_modules/ src/ examples/ docs/ diff --git a/README.md b/README.md index aece46f..e256182 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ npm install plugnmeet-sdk-js JavaScript: ```js -const plugNmeet = require('plugnmeet-sdk-js').PlugNmeet; +const plugNmeet = require('plugnmeet-sdk-js/cjs').PlugNmeet; // now const pnm = new plugNmeet( diff --git a/examples/getActiveRoomInfo.js b/examples/getActiveRoomInfo.js index f65a4b8..840a292 100644 --- a/examples/getActiveRoomInfo.js +++ b/examples/getActiveRoomInfo.js @@ -1,4 +1,4 @@ -const plugNmeet = require('../dist').PlugNmeet; +const plugNmeet = require('../dist/cjs').PlugNmeet; (async () => { const pnm = new plugNmeet( diff --git a/examples/getRecordings.js b/examples/getRecordings.js index 467c5ac..12923de 100644 --- a/examples/getRecordings.js +++ b/examples/getRecordings.js @@ -1,4 +1,4 @@ -const plugNmeet = require('../dist').PlugNmeet; +const plugNmeet = require('../dist/cjs').PlugNmeet; (async () => { const pnm = new plugNmeet( diff --git a/examples/quickJoin.js b/examples/quickJoin.js index 9987684..7cf8550 100644 --- a/examples/quickJoin.js +++ b/examples/quickJoin.js @@ -1,4 +1,4 @@ -const plugNmeet = require('../dist').PlugNmeet; +const plugNmeet = require('../dist/cjs').PlugNmeet; (async () => { const roomId = "room01"; // must be unique. diff --git a/package.json b/package.json index b36004a..9bc4188 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,23 @@ { "name": "plugnmeet-sdk-js", - "version": "1.2.0", - "type": "module", + "version": "1.2.1", "description": "plugNmeet JS SDK", "author": "Jibon L. Costa", "license": "MIT", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { - ".": "./index.js" - }, - "typesVersions": { - "*": { - "index.d.ts": ["index.d.ts"] - } + "types": "./dist/src/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/cjs/index.js" }, + "files": [ + "dist", + "src" + ], "scripts": { "start": "rm -rf ./dist && concurrently -c \"red,green\" --kill-others \"tsc --watch -p . --outDir ./dist && esw -w --ext '.ts','.js' --fix\"", - "build": "rm -rf ./dist && tsc -p . --outDir ./dist", + "build": "rm -rf ./dist && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json", "build-docs": "typedoc --sort source-order" }, "devDependencies": { diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json new file mode 100644 index 0000000..08137a2 --- /dev/null +++ b/tsconfig-cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "target": "es2015", + "outDir": "./dist/cjs" + }, +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 6455e71..c1d9464 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,7 @@ "target": "ES2020", "module": "ES2020", "outDir": "dist", - "lib": [ - "es2020", "DOM" - ], + "lib": ["ES2020"], "declaration": true, "sourceMap": true, "strict": true, @@ -15,6 +13,7 @@ "skipLibCheck": true /* Skip type checking of declaration files. */, "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ }, + "exclude": ["node_modules", "dist"], "include": ["src/**/*"], "typedocOptions": { "entryPoints": ["src/index.ts"],