diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index b310ced9fae..c82a5e2cb8b 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -78,7 +78,7 @@ jobs: # Bump alpha package versions - name: Bump alpha package versions - run: node common/release/node_modules/beachball/bin/beachball canary --canary-name alpha+${{ steps.datetime.outputs.datetime }} --tag dev --no-publish + run: node common/config/node_modules/beachball/bin/beachball canary --canary-name alpha+${{ steps.datetime.outputs.datetime }} --tag dev --no-publish # Build packages - name: Build @azure/communication-ui package diff --git a/.github/workflows/npm-release-bump.yml b/.github/workflows/npm-release-bump.yml index 44aba95b13b..1af075cd2e3 100644 --- a/.github/workflows/npm-release-bump.yml +++ b/.github/workflows/npm-release-bump.yml @@ -43,7 +43,7 @@ jobs: # Bump package versions - name: Bump package versions - run: node common/release/node_modules/beachball/bin/beachball bump + run: node common/config/node_modules/beachball/bin/beachball bump # Get datetime for release branch name - name: Create datetime diff --git a/.github/workflows/npm-release-publish.yml b/.github/workflows/npm-release-publish.yml index 80e19049195..70b529789af 100644 --- a/.github/workflows/npm-release-publish.yml +++ b/.github/workflows/npm-release-publish.yml @@ -39,7 +39,7 @@ jobs: # Perform changelog check - name: Guard check - ensure no new changes were introduced - run: node common/release/node_modules/beachball/bin/beachball check + run: node common/config/node_modules/beachball/bin/beachball check # Builds - name: Build Packages and Samples diff --git a/.github/workflows/private-preview-release.yaml b/.github/workflows/private-preview-release.yaml index 1c23063b970..e25f79cd277 100644 --- a/.github/workflows/private-preview-release.yaml +++ b/.github/workflows/private-preview-release.yaml @@ -26,14 +26,30 @@ jobs: run: rush install - name: Build Packages and Samples - run: rush build -t "@azure/communication-ui" + run: | + rush build -t "@azure/communication-ui" + rush build -t "@azure/acs-chat-declarative" + rush build -t "@azure/acs-chat-selector" + rush build -t "@azure/acs-calling-declarative" - - name: Package Private-Preview Artifact + - name: Package @communication-ui run: npm pack working-directory: ./packages/communication-ui/ - - name: Archive builds - run: 7z a private-preview.zip ./packages/communication-ui/private-preview/* + - name: Package @azure/acs-chat-declarative + run: npm pack + working-directory: ./packages/acs-chat-declarative/ + + - name: Package @azure/acs-chat-selector + run: npm pack + working-directory: ./packages/acs-chat-selector/ + + - name: Package @azure/acs-calling-declarative + run: npm pack + working-directory: ./packages/acs-calling-declarative/ + + - name: Compile private preview zip + run: 7z a private-preview.zip ./packages/**/private-preview/* # Get datetime to name and tag the releases with. - name: Get Release names diff --git a/.gitignore b/.gitignore index 2c384a871e8..3c193a5e3f2 100644 --- a/.gitignore +++ b/.gitignore @@ -87,4 +87,6 @@ junit.xml dist/ build/ temp/ -docGen/ \ No newline at end of file +docGen/ +private-preview/ +private-preview.zip diff --git a/beachball.config.js b/beachball.config.js index cbdeafd440a..ceb375c4113 100644 --- a/beachball.config.js +++ b/beachball.config.js @@ -1,2 +1,2 @@ -require('./common/release/ts-node-register'); -module.exports = require('./common/release/changelog-config').config; +require('./common/config/beachball/ts-node-register'); +module.exports = require('./common/config/beachball/changelog-config').config; diff --git a/change/@azure-acs-calling-declarative-22ca4d19-d325-4f39-90f2-a8eadc37e076.json b/change/@azure-acs-calling-declarative-22ca4d19-d325-4f39-90f2-a8eadc37e076.json new file mode 100644 index 00000000000..e826744e780 --- /dev/null +++ b/change/@azure-acs-calling-declarative-22ca4d19-d325-4f39-90f2-a8eadc37e076.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Add commonjs support", + "packageName": "@azure/acs-calling-declarative", + "email": "mail@jamesburnside.com", + "dependentChangeType": "patch" +} diff --git a/change/@azure-acs-chat-declarative-072bb5d6-4431-4e8d-a490-14cda824ebed.json b/change/@azure-acs-chat-declarative-072bb5d6-4431-4e8d-a490-14cda824ebed.json new file mode 100644 index 00000000000..074f66bd176 --- /dev/null +++ b/change/@azure-acs-chat-declarative-072bb5d6-4431-4e8d-a490-14cda824ebed.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Add commonjs support", + "packageName": "@azure/acs-chat-declarative", + "email": "mail@jamesburnside.com", + "dependentChangeType": "patch" +} diff --git a/change/@azure-acs-chat-selector-dbce2042-9d62-49e3-8325-fa943a401637.json b/change/@azure-acs-chat-selector-dbce2042-9d62-49e3-8325-fa943a401637.json new file mode 100644 index 00000000000..8136c9fb44e --- /dev/null +++ b/change/@azure-acs-chat-selector-dbce2042-9d62-49e3-8325-fa943a401637.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Add commonjs support", + "packageName": "@azure/acs-chat-selector", + "email": "mail@jamesburnside.com", + "dependentChangeType": "patch" +} diff --git a/change/@azure-communication-ui-e064c0a3-de37-4293-bc3d-0d3e0d7a765a.json b/change/@azure-communication-ui-e064c0a3-de37-4293-bc3d-0d3e0d7a765a.json new file mode 100644 index 00000000000..019fd1fa6d0 --- /dev/null +++ b/change/@azure-communication-ui-e064c0a3-de37-4293-bc3d-0d3e0d7a765a.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Exclude config files from npm pack", + "packageName": "@azure/communication-ui", + "email": "mail@jamesburnside.com", + "dependentChangeType": "none" +} diff --git a/common/api-extractor/api-extractor.json b/common/config/api-extractor/api-extractor.json similarity index 100% rename from common/api-extractor/api-extractor.json rename to common/config/api-extractor/api-extractor.json diff --git a/common/release/changelog-config.ts b/common/config/beachball/changelog-config.ts similarity index 100% rename from common/release/changelog-config.ts rename to common/config/beachball/changelog-config.ts diff --git a/common/release/changelog-custom-renders.ts b/common/config/beachball/changelog-custom-renders.ts similarity index 100% rename from common/release/changelog-custom-renders.ts rename to common/config/beachball/changelog-custom-renders.ts diff --git a/common/release/github-functions/constants.ts b/common/config/beachball/github-functions/constants.ts similarity index 100% rename from common/release/github-functions/constants.ts rename to common/config/beachball/github-functions/constants.ts diff --git a/common/release/github-functions/github-instance.ts b/common/config/beachball/github-functions/github-instance.ts similarity index 100% rename from common/release/github-functions/github-instance.ts rename to common/config/beachball/github-functions/github-instance.ts diff --git a/common/release/github-functions/index.ts b/common/config/beachball/github-functions/index.ts similarity index 100% rename from common/release/github-functions/index.ts rename to common/config/beachball/github-functions/index.ts diff --git a/common/release/github-functions/pull-request.ts b/common/config/beachball/github-functions/pull-request.ts similarity index 100% rename from common/release/github-functions/pull-request.ts rename to common/config/beachball/github-functions/pull-request.ts diff --git a/common/release/github-functions/types.ts b/common/config/beachball/github-functions/types.ts similarity index 100% rename from common/release/github-functions/types.ts rename to common/config/beachball/github-functions/types.ts diff --git a/common/release/ts-node-register.js b/common/config/beachball/ts-node-register.js similarity index 100% rename from common/release/ts-node-register.js rename to common/config/beachball/ts-node-register.js diff --git a/common/release/package.json b/common/config/package.json similarity index 64% rename from common/release/package.json rename to common/config/package.json index f599f5a6a36..9195bb8a748 100644 --- a/common/release/package.json +++ b/common/config/package.json @@ -1,5 +1,5 @@ { - "name": "release-tools", + "name": "build-tools", "version": "1.0.0", "private": true, "scripts": { @@ -11,8 +11,12 @@ }, "devDependencies": { "@octokit/rest": "~18.0.6", + "@rollup/plugin-commonjs": "~17.1.0", "@types/node": "^14.14.10", "beachball": "~1.53.2", + "rollup": "~2.42.4", + "rollup-plugin-sourcemaps": "~0.6.3", + "rollup-plugin-svg": "~2.0.0", "ts-node": "^9.1.1" } } diff --git a/common/config/rollup/rollup.config.js b/common/config/rollup/rollup.config.js new file mode 100644 index 00000000000..12cac17101a --- /dev/null +++ b/common/config/rollup/rollup.config.js @@ -0,0 +1,20 @@ +// © Microsoft Corporation. All rights reserved. + +import commonjs from '@rollup/plugin-commonjs'; +import sourcemaps from 'rollup-plugin-sourcemaps'; +import svg from 'rollup-plugin-svg'; + +export default (packageJson) => ({ + context: 'window', + external: [ + ...(packageJson.dependencies ? Object.keys(packageJson.dependencies) : []), + ...(packageJson.peerDependencies ? Object.keys(packageJson.peerDependencies) : []) + ], + input: './dist/dist-esm/index.js', + output: { + file: './dist/dist-cjs/index.js', + format: 'cjs', + sourcemap: true + }, + plugins: [commonjs(), sourcemaps(), svg()] +}); diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 80e48eb74f0..b653f9be0e9 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -13,14 +13,14 @@ "commandKind": "global", "name": "changelog", "summary": "Runs beachball change", - "shellCommand": "node common/release/node_modules/beachball/bin/beachball", + "shellCommand": "node common/config/node_modules/beachball/bin/beachball", "safeForSimultaneousRushProcesses": true }, { "commandKind": "global", "name": "changelog:check", "summary": "Checks change files have been generated", - "shellCommand": "node common/release/node_modules/beachball/bin/beachball check", + "shellCommand": "node common/config/node_modules/beachball/bin/beachball check", "safeForSimultaneousRushProcesses": true }, { diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 060613b024e..f0e5f74d9c6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -19,11 +19,11 @@ dependencies: '@rush-temp/acs-calling-declarative': file:projects/acs-calling-declarative.tgz_prettier@2.0.5+ts-node@9.1.1 '@rush-temp/acs-chat-declarative': file:projects/acs-chat-declarative.tgz_prettier@2.0.5+ts-node@9.1.1 '@rush-temp/acs-chat-selector': file:projects/acs-chat-selector.tgz_prettier@2.0.5 + '@rush-temp/build-tools': file:projects/build-tools.tgz_typescript@4.1.5 '@rush-temp/calling': file:projects/calling.tgz_570bf42e92a70fb216c5cd4d5ed668ef '@rush-temp/chat': file:projects/chat.tgz_40b0c9f7a7a0fac66e4b6fcf06de2a42 '@rush-temp/communication-ui': file:projects/communication-ui.tgz_webpack-cli@4.5.0 '@rush-temp/one-to-one-call': file:projects/one-to-one-call.tgz_570bf42e92a70fb216c5cd4d5ed668ef - '@rush-temp/release-tools': file:projects/release-tools.tgz_typescript@4.1.5 '@rush-temp/server': file:projects/server.tgz '@rush-temp/storybook': file:projects/storybook.tgz_webpack-cli@4.5.0 '@storybook/addon-actions': 6.1.21_30bc4764d4ba778218056aab0be8023f @@ -86,6 +86,7 @@ dependencies: eslint-plugin-prettier: 3.3.1_cdac37046eab2e8d6fb794f34ed825c2 eslint-plugin-react: 7.22.0_eslint@7.22.0 eslint-plugin-react-hooks: 4.2.0_eslint@7.22.0 + events: 3.3.0 express: 4.16.4 http-errors: 1.6.3 husky: 4.3.8 @@ -20203,9 +20204,11 @@ packages: eslint-plugin-header: 3.1.1_eslint@7.22.0 eslint-plugin-import: 2.22.1_eslint@7.22.0 eslint-plugin-prettier: 3.3.1_cdac37046eab2e8d6fb794f34ed825c2 + events: 3.3.0 immer: 8.0.1 jest: 26.6.0_ts-node@9.1.1 nanoid: 3.1.22 + rollup: 2.42.4 ts-jest: 26.5.3_jest@26.6.0+typescript@4.1.5 typescript: 4.1.5 dev: false @@ -20215,7 +20218,7 @@ packages: prettier: '*' ts-node: '*' resolution: - integrity: sha512-27XkTAtdMHzfP28mzzTk9lQbSTO88/bWqBTcw5NDTHatpi6gWVmtKt7TLmIT/LoCFZLWJh2xk6wAqq+KKqtbpQ== + integrity: sha512-Dvfet7uEYruGSHOgIksbZNzgzhkatwbwdMO0MS8PMbLeyiL/qS45bqnBPZ0h3r+SxpwfbVd+vJKIKEn9n2HhQQ== tarball: file:projects/acs-chat-declarative.tgz version: 0.0.0 file:projects/acs-chat-selector.tgz_prettier@2.0.5: @@ -20241,6 +20244,25 @@ packages: integrity: sha512-vgq6DDxDUEWYFZ87cBH4q1E92dgwgtbVsPUf6YVIrtITro9kA+YrR7CmgI5smLDwJbCau5vxd9UIEASkg8cXCA== tarball: file:projects/acs-chat-selector.tgz version: 0.0.0 + file:projects/build-tools.tgz_typescript@4.1.5: + dependencies: + '@octokit/rest': 18.0.15 + '@rollup/plugin-commonjs': 17.1.0_rollup@2.42.4 + '@types/node': 14.14.35 + beachball: 1.53.2 + rollup: 2.42.4 + rollup-plugin-sourcemaps: 0.6.3_9135ee81d9218d0e99b56082525729b5 + rollup-plugin-svg: 2.0.0 + ts-node: 9.1.1_typescript@4.1.5 + dev: false + id: file:projects/build-tools.tgz + name: '@rush-temp/build-tools' + peerDependencies: + typescript: '*' + resolution: + integrity: sha512-b5hFauElrTQk+ieDLylltlsXYuREKzGdSgkbZY/NC9PgniOwHvxJPuuAQCWf0rHbgYzH8HOddbB5yIoFADO/ug== + tarball: file:projects/build-tools.tgz + version: 0.0.0 file:projects/calling.tgz_570bf42e92a70fb216c5cd4d5ed668ef: dependencies: '@azure/communication-administration': 1.0.0-beta.3 @@ -20463,7 +20485,7 @@ packages: peerDependencies: webpack-cli: '*' resolution: - integrity: sha512-KsffXOujTVbXbseiFJYZnzsNGbbtSmniaMzglpMaB75IK3QAeNsR5H7jHln/8jazplzE+O7EmdGLwuo9AHE5Ag== + integrity: sha512-irlqrdu6PIGa6dbiOIYfrBqwhBSeZIVB8gAKPgSCmefAJtSlAgmYTKRxlwNhhjA7Az0ZXF4ICXiM3nya8ZChgw== tarball: file:projects/communication-ui.tgz version: 0.0.0 file:projects/one-to-one-call.tgz_570bf42e92a70fb216c5cd4d5ed668ef: @@ -20536,21 +20558,6 @@ packages: integrity: sha512-7Eei6TVL74VGNBmON8HLssHISzQr8G8ImvnnvLBOTTGUat72KR7QjO16GHMr4QUYlKFLFd/+hvFFiwjvu6u/hw== tarball: file:projects/one-to-one-call.tgz version: 0.0.0 - file:projects/release-tools.tgz_typescript@4.1.5: - dependencies: - '@octokit/rest': 18.0.15 - '@types/node': 14.14.35 - beachball: 1.53.2 - ts-node: 9.1.1_typescript@4.1.5 - dev: false - id: file:projects/release-tools.tgz - name: '@rush-temp/release-tools' - peerDependencies: - typescript: '*' - resolution: - integrity: sha512-z8gCO5dSCyziWJ+KCb64AK7YSaU+hep4QQ9rcswo/dTE2JpMHkrACkdV/jjOKrx0wtUHIH6BmypWIROVzaf7Zw== - tarball: file:projects/release-tools.tgz - version: 0.0.0 file:projects/server.tgz: dependencies: '@azure/communication-chat': 1.0.0-beta.3 @@ -20715,11 +20722,11 @@ specifiers: '@rush-temp/acs-calling-declarative': file:./projects/acs-calling-declarative.tgz '@rush-temp/acs-chat-declarative': file:./projects/acs-chat-declarative.tgz '@rush-temp/acs-chat-selector': file:./projects/acs-chat-selector.tgz + '@rush-temp/build-tools': file:./projects/build-tools.tgz '@rush-temp/calling': file:./projects/calling.tgz '@rush-temp/chat': file:./projects/chat.tgz '@rush-temp/communication-ui': file:./projects/communication-ui.tgz '@rush-temp/one-to-one-call': file:./projects/one-to-one-call.tgz - '@rush-temp/release-tools': file:./projects/release-tools.tgz '@rush-temp/server': file:./projects/server.tgz '@rush-temp/storybook': file:./projects/storybook.tgz '@storybook/addon-actions': ^6.1.1 @@ -20782,6 +20789,7 @@ specifiers: eslint-plugin-prettier: ^3.1.4 eslint-plugin-react: ^7.18.3 eslint-plugin-react-hooks: ^4.1.2 + events: ~3.3.0 express: ~4.16.1 http-errors: ~1.6.3 husky: ^4.3.0 diff --git a/docs/contributing-guide/3. running-a-sample-or-storybook.md b/docs/contributing-guide/3. running-a-sample-or-storybook.md index 7dd73abfca8..389ea9e5621 100644 --- a/docs/contributing-guide/3. running-a-sample-or-storybook.md +++ b/docs/contributing-guide/3. running-a-sample-or-storybook.md @@ -52,6 +52,8 @@ cd packages\storybook rushx start ``` +When `rushx start` completes you should be able to view the storybook at: http://localhost:6006/ + --- * Next: [Testing your changes](<./4. testing-your-changes.md>) diff --git a/docs/infrastructure/api-extractor.md b/docs/infrastructure/api-extractor.md index 6a9b2df1500..f13bfa3a1ce 100644 --- a/docs/infrastructure/api-extractor.md +++ b/docs/infrastructure/api-extractor.md @@ -20,7 +20,7 @@ API Extractor is run as part of the build commands for each package. Running `ru ## Configuration Files -The primary configuration file can be found here: [common/api-extractor/api-extractor.json](https://github.com/Azure/communication-ui-sdk/blob/main/common/api-extractor/api-extractor.json). Each package has their own `api-extractor.json` that extends from this. +The primary configuration file can be found here: [common/config/api-extractor/api-extractor.json](https://github.com/Azure/communication-ui-sdk/blob/main/common/config/api-extractor/api-extractor.json). Each package has their own `api-extractor.json` that extends from this. ## Gating PRs diff --git a/docs/infrastructure/beachball.md b/docs/infrastructure/beachball.md index 53bc28ddf44..c4a40da4626 100644 --- a/docs/infrastructure/beachball.md +++ b/docs/infrastructure/beachball.md @@ -41,14 +41,14 @@ For writing a good changelog entry for the change file see: [Tips for writing me ### Package version bumping -This is done by our github actions. If this needs to be down manually you can run `npm run beachball -- bump` under `common/release`. +This is done by our github actions. If this needs to be down manually you can run `npm run beachball -- bump` under `common/config`. See [creating a release](./creating-a-release.md) for more information. ### Changelog Generation This happens as part of the `beachball bump` command. In our repo however we have custom changelog renderers to create a feature rich changelog with links to PRs and authors. -These custom renderers are located here: [common/release/changelog-custom-renders.ts](https://github.com/Azure/communication-ui-sdk/blob/main/common/release/changelog-custom-renders.ts). +These custom renderers are located here: [common/config/beachball/changelog-custom-renders.ts](https://github.com/Azure/communication-ui-sdk/blob/main/common/config/beachball/changelog-custom-renders.ts). ## Gating PRs @@ -57,6 +57,6 @@ To see all PR gates, view [pull requests](./pull-requests.md) docs. ## Configuration Files -The primary beachball configuration file is at: [common/release/changelog-config.ts](https://github.com/Azure/communication-ui-sdk/blob/main/common/release/changelog-config.ts). This is picked up by the root level `beachball.config.js`. +The primary beachball configuration file is at: [common/config/beachball/changelog-config.ts](https://github.com/Azure/communication-ui-sdk/blob/main/common/config/beachball/changelog-config.ts). This is picked up by the root level `beachball.config.js`. Each `package.json` must also not be marked `private:true` or beachball will ignore it and may optionally contain a `beachball:` section that contains package specific configuration. diff --git a/packages/acs-calling-declarative/.npmignore b/packages/acs-calling-declarative/.npmignore index 7355ac9034e..930b707f526 100644 --- a/packages/acs-calling-declarative/.npmignore +++ b/packages/acs-calling-declarative/.npmignore @@ -1,14 +1,10 @@ -public/ -node_modules/ -.vs/ -.vscode/ -jest/ -src/ -tests/ -scripts/ -tsconfig.json -.eslintignore -.prettierignore -.prettierrc -.eslintrc.js -jest.config.js +# Disallow everything by default so new files aren't accidently included: +* + +# Allow dist folder, this is the folder that should be packed and published: +!dist/**/* + +# Exceptions in the dist folder that should still be disallowed: +dist/dist-esm/mocks/ +**/*.test.* +**/*.spec.* diff --git a/packages/acs-calling-declarative/api-extractor.json b/packages/acs-calling-declarative/api-extractor.json index 5bec1d218ca..38e05d2267b 100644 --- a/packages/acs-calling-declarative/api-extractor.json +++ b/packages/acs-calling-declarative/api-extractor.json @@ -1,3 +1,3 @@ { - "extends": "../../common/api-extractor/api-extractor.json" + "extends": "../../common/config/api-extractor/api-extractor.json" } diff --git a/packages/acs-calling-declarative/package.json b/packages/acs-calling-declarative/package.json index 69c433c2f4c..8fd4b163445 100644 --- a/packages/acs-calling-declarative/package.json +++ b/packages/acs-calling-declarative/package.json @@ -3,10 +3,12 @@ "version": "1.0.0-beta", "description": "ACS UI SDK", "module": "dist/dist-esm/index.js", - "main": "dist/dist-esm/index.js", + "main": "dist/dist-cjs/index.js", "types": "dist/acs-calling-declarative.d.ts", "scripts": { - "build": "tsc && api-extractor run --local", + "build": "rushx build:esm && rushx build:cjs && api-extractor run --local", + "build:esm": "tsc", + "build:cjs": "rollup -c --silent --failAfterWarnings", "build:watch": "rushx build", "test": "jest", "test:coverage": "npm run test -- --coverage", @@ -14,7 +16,8 @@ "lint:fix": "npm run lint -- --fix", "lint:quiet": "npm run lint -- --quiet", "api-extractor": "tsc && api-extractor run --local", - "generate-doc": "api-documenter markdown -i temp -o docGen" + "generate-doc": "api-documenter markdown -i temp -o docGen", + "postpack": "copyfiles -E \"./*.tgz\" private-preview" }, "browserslist": { "production": [ @@ -31,6 +34,7 @@ "dependencies": { "@azure/communication-common": "1.0.0-beta.4", "@azure/communication-calling": "1.0.0-beta.9", + "events": "~3.3.0", "immer": "~8.0.1" }, "devDependencies": { @@ -39,12 +43,14 @@ "@types/jest": "^26.0.20", "@typescript-eslint/eslint-plugin": "^4.12.0", "@typescript-eslint/parser": "^4.12.0", + "copyfiles": "^2.4.1", "eslint-config-prettier": "^6.12.0", "eslint-plugin-header": "^3.1.0", "eslint-plugin-import": "^2.20.1", "eslint-plugin-prettier": "^3.1.4", "eslint": "^7.7.0", "jest": "26.6.0", + "rollup": "~2.42.4", "ts-jest": "^26.4.4", "typescript": "4.1.5" }, diff --git a/packages/acs-calling-declarative/rollup.config.js b/packages/acs-calling-declarative/rollup.config.js new file mode 100644 index 00000000000..9176127ca35 --- /dev/null +++ b/packages/acs-calling-declarative/rollup.config.js @@ -0,0 +1,6 @@ +// © Microsoft Corporation. All rights reserved. + +import Package from './package.json'; +import commonConfig from '../../common/config/rollup/rollup.config'; + +export default commonConfig(Package); diff --git a/packages/acs-chat-declarative/.npmignore b/packages/acs-chat-declarative/.npmignore index 7355ac9034e..930b707f526 100644 --- a/packages/acs-chat-declarative/.npmignore +++ b/packages/acs-chat-declarative/.npmignore @@ -1,14 +1,10 @@ -public/ -node_modules/ -.vs/ -.vscode/ -jest/ -src/ -tests/ -scripts/ -tsconfig.json -.eslintignore -.prettierignore -.prettierrc -.eslintrc.js -jest.config.js +# Disallow everything by default so new files aren't accidently included: +* + +# Allow dist folder, this is the folder that should be packed and published: +!dist/**/* + +# Exceptions in the dist folder that should still be disallowed: +dist/dist-esm/mocks/ +**/*.test.* +**/*.spec.* diff --git a/packages/acs-chat-declarative/api-extractor.json b/packages/acs-chat-declarative/api-extractor.json index 5bec1d218ca..38e05d2267b 100644 --- a/packages/acs-chat-declarative/api-extractor.json +++ b/packages/acs-chat-declarative/api-extractor.json @@ -1,3 +1,3 @@ { - "extends": "../../common/api-extractor/api-extractor.json" + "extends": "../../common/config/api-extractor/api-extractor.json" } diff --git a/packages/acs-chat-declarative/package.json b/packages/acs-chat-declarative/package.json index c2270c6fd9a..38ed2511a7d 100644 --- a/packages/acs-chat-declarative/package.json +++ b/packages/acs-chat-declarative/package.json @@ -3,10 +3,12 @@ "version": "1.0.0-beta", "description": "ACS UI SDK", "module": "dist/dist-esm/index.js", - "main": "dist/dist-esm/index.js", + "main": "dist/dist-cjs/index.js", "types": "dist/acs-chat-declarative.d.ts", "scripts": { - "build": "tsc && api-extractor run --local", + "build": "rushx build:esm && rushx build:cjs && api-extractor run --local", + "build:esm": "tsc", + "build:cjs": "rollup -c --silent --failAfterWarnings", "build:watch": "rushx build", "test": "jest", "test:coverage": "npm run test -- --coverage", @@ -14,7 +16,8 @@ "lint:fix": "npm run lint -- --fix", "lint:quiet": "npm run lint -- --quiet", "api-extractor": "tsc && api-extractor run --local", - "generate-doc": "api-documenter markdown -i temp -o docGen" + "generate-doc": "api-documenter markdown -i temp -o docGen", + "postpack": "copyfiles -E \"./*.tgz\" private-preview" }, "browserslist": { "production": [ @@ -31,9 +34,10 @@ "dependencies": { "@azure/communication-chat": "1.0.0-beta.4", "@azure/communication-signaling": "1.0.0-beta.2", + "@azure/core-paging": "~1.1.3", + "events": "~3.3.0", "immer": "~8.0.1", - "nanoid": "~3.1.20", - "@azure/core-paging": "~1.1.3" + "nanoid": "~3.1.20" }, "devDependencies": { "@microsoft/api-documenter": "~7.12.11", @@ -41,12 +45,14 @@ "@types/jest": "^26.0.20", "@typescript-eslint/eslint-plugin": "^4.12.0", "@typescript-eslint/parser": "^4.12.0", + "copyfiles": "^2.4.1", "eslint-config-prettier": "^6.12.0", "eslint-plugin-header": "^3.1.0", "eslint-plugin-import": "^2.20.1", "eslint-plugin-prettier": "^3.1.4", "eslint": "^7.7.0", "jest": "26.6.0", + "rollup": "~2.42.4", "ts-jest": "^26.4.4", "typescript": "4.1.5" }, diff --git a/packages/acs-chat-declarative/rollup.config.js b/packages/acs-chat-declarative/rollup.config.js new file mode 100644 index 00000000000..9176127ca35 --- /dev/null +++ b/packages/acs-chat-declarative/rollup.config.js @@ -0,0 +1,6 @@ +// © Microsoft Corporation. All rights reserved. + +import Package from './package.json'; +import commonConfig from '../../common/config/rollup/rollup.config'; + +export default commonConfig(Package); diff --git a/packages/acs-chat-declarative/src/ChatThreadClientDeclarative.ts b/packages/acs-chat-declarative/src/ChatThreadClientDeclarative.ts index 86cc65575d5..3b752238941 100644 --- a/packages/acs-chat-declarative/src/ChatThreadClientDeclarative.ts +++ b/packages/acs-chat-declarative/src/ChatThreadClientDeclarative.ts @@ -1,23 +1,12 @@ // © Microsoft Corporation. All rights reserved. -import { ChatMessage, ChatThreadClient, SendChatMessageResult, WithResponse } from '@azure/communication-chat'; -import { ChatMessageWithStatus, MessageStatus } from './types/ChatMessageWithStatus'; +import { ChatThreadClient, SendChatMessageResult, WithResponse } from '@azure/communication-chat'; +import { ChatMessageWithStatus } from './types/ChatMessageWithStatus'; import { ChatContext } from './ChatContext'; import { nanoid } from 'nanoid'; import { createDecoratedListMessages } from './iterators/createDecoratedListMessages'; import { createDecoratedListReadReceipts } from './iterators/createDecoratedListReadReceipts'; import { createDecoratedListParticipants } from './iterators/createDecoratedListParticipants'; - -export const convertChatMessage = ( - message: ChatMessage, - status: MessageStatus = 'delivered', - clientMessageId?: string -): ChatMessageWithStatus => { - return { - ...message, - clientMessageId: clientMessageId, - status - }; -}; +import { convertChatMessage } from './convertChatMessage'; class ProxyChatThreadClient implements ProxyHandler { private _context: ChatContext; diff --git a/packages/acs-chat-declarative/src/EventSubscriber.ts b/packages/acs-chat-declarative/src/EventSubscriber.ts index 8243423f884..d27cca14fdf 100644 --- a/packages/acs-chat-declarative/src/EventSubscriber.ts +++ b/packages/acs-chat-declarative/src/EventSubscriber.ts @@ -13,7 +13,7 @@ import { TypingIndicatorReceivedEvent } from '@azure/communication-signaling'; import { ChatContext } from './ChatContext'; -import { convertChatMessage } from './ChatThreadClientDeclarative'; +import { convertChatMessage } from './convertChatMessage'; import { ChatMessageWithStatus } from './types/ChatMessageWithStatus'; import { ReadReceipt } from './types/ReadReceipt'; import { TypingIndicator } from './types/TypingIndicator'; diff --git a/packages/acs-chat-declarative/src/convertChatMessage.ts b/packages/acs-chat-declarative/src/convertChatMessage.ts new file mode 100644 index 00000000000..3395f989ec3 --- /dev/null +++ b/packages/acs-chat-declarative/src/convertChatMessage.ts @@ -0,0 +1,16 @@ +// © Microsoft Corporation. All rights reserved. + +import { ChatMessage } from '@azure/communication-chat'; +import { ChatMessageWithStatus, MessageStatus } from './types/ChatMessageWithStatus'; + +export const convertChatMessage = ( + message: ChatMessage, + status: MessageStatus = 'delivered', + clientMessageId?: string +): ChatMessageWithStatus => { + return { + ...message, + clientMessageId: clientMessageId, + status + }; +}; diff --git a/packages/acs-chat-declarative/src/iterators/createDecoratedListMessages.ts b/packages/acs-chat-declarative/src/iterators/createDecoratedListMessages.ts index a0b3ffbc866..331e1a452c4 100644 --- a/packages/acs-chat-declarative/src/iterators/createDecoratedListMessages.ts +++ b/packages/acs-chat-declarative/src/iterators/createDecoratedListMessages.ts @@ -1,7 +1,7 @@ // © Microsoft Corporation. All rights reserved. import { ChatMessage, ChatThreadClient, RestListMessagesOptions } from '@azure/communication-chat'; import { ChatContext } from '../ChatContext'; -import { convertChatMessage } from '../ChatThreadClientDeclarative'; +import { convertChatMessage } from '../convertChatMessage'; import { createDecoratedIterator } from './createDecoratedIterator'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; diff --git a/packages/acs-chat-selector/.npmignore b/packages/acs-chat-selector/.npmignore index 7355ac9034e..930b707f526 100644 --- a/packages/acs-chat-selector/.npmignore +++ b/packages/acs-chat-selector/.npmignore @@ -1,14 +1,10 @@ -public/ -node_modules/ -.vs/ -.vscode/ -jest/ -src/ -tests/ -scripts/ -tsconfig.json -.eslintignore -.prettierignore -.prettierrc -.eslintrc.js -jest.config.js +# Disallow everything by default so new files aren't accidently included: +* + +# Allow dist folder, this is the folder that should be packed and published: +!dist/**/* + +# Exceptions in the dist folder that should still be disallowed: +dist/dist-esm/mocks/ +**/*.test.* +**/*.spec.* diff --git a/packages/acs-chat-selector/api-extractor.json b/packages/acs-chat-selector/api-extractor.json index 5bec1d218ca..38e05d2267b 100644 --- a/packages/acs-chat-selector/api-extractor.json +++ b/packages/acs-chat-selector/api-extractor.json @@ -1,3 +1,3 @@ { - "extends": "../../common/api-extractor/api-extractor.json" + "extends": "../../common/config/api-extractor/api-extractor.json" } diff --git a/packages/acs-chat-selector/package.json b/packages/acs-chat-selector/package.json index fb2ac1dedc1..92828d46a4f 100644 --- a/packages/acs-chat-selector/package.json +++ b/packages/acs-chat-selector/package.json @@ -3,10 +3,12 @@ "version": "1.0.0-beta", "description": "ACS UI SDK", "module": "dist/dist-esm/index.js", - "main": "dist/dist-esm/index.js", + "main": "dist/dist-cjs/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc && api-extractor run --local", + "build": "rushx build:esm && rushx build:cjs && api-extractor run --local", + "build:esm": "tsc", + "build:cjs": "rollup -c --silent --failAfterWarnings", "build:watch": "rushx build", "test": "jest --passWithNoTests", "test:coverage": "npm run test -- --coverage", @@ -14,7 +16,8 @@ "lint:fix": "npm run lint -- --fix", "lint:quiet": "npm run lint -- --quiet", "api-extractor": "tsc && api-extractor run --local", - "generate-doc": "api-documenter markdown -i temp -o docGen" + "generate-doc": "api-documenter markdown -i temp -o docGen", + "postpack": "copyfiles -E \"./*.tgz\" private-preview" }, "browserslist": { "production": [ @@ -29,20 +32,22 @@ ] }, "dependencies": { + "@azure/acs-chat-declarative": "~1.0.0-beta", "@azure/communication-chat": "1.0.0-beta.4", "reselect": "~4.0.0", - "@azure/acs-chat-declarative": "~1.0.0-beta", "memoize-one": "~5.1.1" }, "devDependencies": { "@microsoft/api-documenter": "~7.12.11", "@microsoft/api-extractor": "~7.13.2", "@types/react": "^16.9.49", + "copyfiles": "^2.4.1", "eslint": "^7.7.0", "eslint-config-prettier": "^6.12.0", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-header": "^3.1.0", "eslint-plugin-import": "^2.20.1", + "rollup": "~2.42.4", "typescript": "4.1.5" }, "beachball": { diff --git a/packages/acs-chat-selector/rollup.config.js b/packages/acs-chat-selector/rollup.config.js new file mode 100644 index 00000000000..9176127ca35 --- /dev/null +++ b/packages/acs-chat-selector/rollup.config.js @@ -0,0 +1,6 @@ +// © Microsoft Corporation. All rights reserved. + +import Package from './package.json'; +import commonConfig from '../../common/config/rollup/rollup.config'; + +export default commonConfig(Package); diff --git a/packages/communication-ui/.npmignore b/packages/communication-ui/.npmignore index c3438f31dfe..930b707f526 100644 --- a/packages/communication-ui/.npmignore +++ b/packages/communication-ui/.npmignore @@ -1,18 +1,10 @@ -public/ -node_modules/ -.vs/ -.vscode/ -dist/stories/ -jest/ -src/ -tests/ -Media/ -scripts/ -cached-package.json -tsconfig.json -.eslintignore -.prettierignore -.prettierrc -.eslintrc.js -jest.config.js -*.tgz +# Disallow everything by default so new files aren't accidently included: +* + +# Allow dist folder, this is the folder that should be packed and published: +!dist/**/* + +# Exceptions in the dist folder that should still be disallowed: +dist/dist-esm/mocks/ +**/*.test.* +**/*.spec.* diff --git a/packages/communication-ui/api-extractor.json b/packages/communication-ui/api-extractor.json index fe84e4af1ed..b9fc10749c5 100644 --- a/packages/communication-ui/api-extractor.json +++ b/packages/communication-ui/api-extractor.json @@ -1,4 +1,4 @@ { - "extends": "../../common/api-extractor/api-extractor.json", + "extends": "../../common/config/api-extractor/api-extractor.json", "mainEntryPointFilePath": "/dist/dist-esm/release.index.d.ts" } diff --git a/packages/communication-ui/package.json b/packages/communication-ui/package.json index b775a89572c..7070accab96 100644 --- a/packages/communication-ui/package.json +++ b/packages/communication-ui/package.json @@ -53,7 +53,6 @@ "@mdx-js/react": "^1.6.22", "@microsoft/api-documenter": "~7.12.11", "@microsoft/api-extractor": "~7.13.2", - "@rollup/plugin-commonjs": "~17.1.0", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react-hooks": "^3.4.2", "@types/jest": "^26.0.20", @@ -95,8 +94,6 @@ "react": "^16.13.1", "regenerator-runtime": "^0.13.7", "rollup": "~2.42.4", - "rollup-plugin-sourcemaps": "~0.6.3", - "rollup-plugin-svg": "~2.0.0", "source-map-explorer": "^2.5.0", "styled-components": "~5.2.1", "ts-jest": "^26.4.4", diff --git a/packages/communication-ui/rollup.config.js b/packages/communication-ui/rollup.config.js index 83e01d781c9..9176127ca35 100644 --- a/packages/communication-ui/rollup.config.js +++ b/packages/communication-ui/rollup.config.js @@ -1,22 +1,6 @@ // © Microsoft Corporation. All rights reserved. -import commonjs from '@rollup/plugin-commonjs'; -import sourcemaps from 'rollup-plugin-sourcemaps'; -import svg from 'rollup-plugin-svg'; import Package from './package.json'; +import commonConfig from '../../common/config/rollup/rollup.config'; -export default { - context: 'window', - external: [ - ...Object.keys(Package.dependencies), - ...Object.keys(Package.peerDependencies), - '@fluentui/react-northstar/dist/commonjs/components/Alert/Alert' - ], - input: './dist/dist-esm/index.js', - output: { - file: './dist/dist-cjs/index.js', - format: 'cjs', - sourcemap: true - }, - plugins: [commonjs(), sourcemaps(), svg()] -}; +export default commonConfig(Package); diff --git a/rush.json b/rush.json index 76c83c190fa..1019c2f877b 100644 --- a/rush.json +++ b/rush.json @@ -63,8 +63,8 @@ "reviewCategory": "tools" }, { - "packageName": "release-tools", - "projectFolder": "common/release", + "packageName": "build-tools", + "projectFolder": "common/config", "reviewCategory": "tools" } ]