Skip to content

Commit

Permalink
Move to npm workspaces (microsoft#5301)
Browse files Browse the repository at this point in the history
* Rebuild package-lock for npm workspaces

* Target ESNext

* Clean up start scripts

* Remove prebump/postbump

* Cleaner bump scripts

* Clean up audit fix scripts

* Remove reference to lerna

* Bump Speech SDK

* Update husky script

* Remove tableflip

* Update steps

* No initial build

* Add --raw

* Simplify concurrently

* Bump Chrome version

* Add punycode

* Clean up concurrently and no globalize

* Add --prefix-colors

* Clean up

* Move to build

* Build serially

* Add test/web-server to workspaces

* Fix tsd path

* Add p-defer-es5

* Use npm install temporarily

* Only import type

* Add p-defer

* Move away from p-defer

* Add .js extension to import

* Use core-js-pure for withResolvers

* Use isomorphic-react

* Add entry

* Add entry

* Fix bump scripts

* Revert package-lock.json

* Add --strict-peer-deps

* Add more --strict-peer-deps

* Add 06.e.extending-ui to npm workspaces

* Fix use-state-with-ref

* Add build samples
  • Loading branch information
compulim authored Sep 23, 2024
1 parent 0ef9680 commit 9ba786e
Show file tree
Hide file tree
Showing 102 changed files with 19,837 additions and 202,924 deletions.
1 change: 0 additions & 1 deletion .eslintrc.node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ rules:
- jest-environment-node
- jest-image-snapshot
- node-fetch
- p-defer-es5
- selenium-webdriver
- strip-ansi
node/prefer-global/buffer: error
304 changes: 151 additions & 153 deletions .github/CONTRIBUTING.md

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions .github/workflows/daily-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ jobs:

- run: npx version-from-git --no-git-tag-version

- run: npm ci --no-production
- run: npm clean-install --no-production

- name: Propagate versions
run: node_modules/.bin/lerna version --exact --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version`
run: npm version --no-git-tag-version --workspaces `cat package.json | jq -r .version`

- run: npm run bootstrap
- run: npm run build
env:
- env:
NODE_ENV: production
run: npm run build

- run: mkdir -p artifacts/tarballs

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/playground.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ jobs:
- name: Checking out for ${{ github.ref }}
uses: actions/checkout@v2

- name: Run npm ci and lerna bootstrap
run: |
npm ci
npm run bootstrap
- run: npm clean-install

- run: |
npm run build
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/preview-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ jobs:
if: ${{ startsWith(github.ref, 'refs/heads/') }}
run: npx version-from-git --no-git-tag-version

- run: npm ci

- run: npm run bootstrap -- --ignore=playground
- run: npm clean-install

- name: Propagate versions
run: |
node_modules/.bin/lerna version --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version`
run: npm version --no-git-tag-version --workspaces `cat package.json | jq -r .version`

- name: Run npm run build
env:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/publish-github-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ jobs:
--exclude a.minimizable-web-chat \
--exclude b.speech-ui \
--exclude c.smart-display \
--exclude d.plain-ui
--exclude d.plain-ui \
--exclude e.extending-ui
mkdir gh-pages/06.recomposing-ui/a.minimizable-web-chat
rsync -av --progress samples/06.recomposing-ui/a.minimizable-web-chat/public/ gh-pages/06.recomposing-ui/a.minimizable-web-chat/
Expand All @@ -100,6 +101,9 @@ jobs:
mkdir gh-pages/06.recomposing-ui/d.plain-ui
rsync -av --progress samples/06.recomposing-ui/d.plain-ui/public/ gh-pages/06.recomposing-ui/d.plain-ui/
mkdir gh-pages/06.recomposing-ui/e.extending-ui
rsync -av --progress samples/06.recomposing-ui/e.extending-ui/public/ gh-pages/06.recomposing-ui/e.extending-ui/
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
45 changes: 28 additions & 17 deletions .github/workflows/pull-request-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ jobs:
node-version: ${{ env.node-version }}
cache: npm

- run: npm clean-install

- run: npm run bootstrap
- run: npm clean-install --strict-peer-deps

- run: npm run build --if-present # Add instrumentation code

Expand Down Expand Up @@ -76,6 +74,25 @@ jobs:
path: docker.zip
retention-days: 1

build-samples:
name: Build samples
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: npm

- run: npm clean-install --strict-peer-deps
working-directory: samples

- run: npm run build --if-present
working-directory: samples

static-code-analysis:
name: Static code analysis
runs-on: ubuntu-latest
Expand All @@ -89,9 +106,7 @@ jobs:
node-version: ${{ env.node-version }}
cache: npm

- run: npm clean-install

- run: npm run bootstrap
- run: npm clean-install --strict-peer-deps

- run: npm run build --if-present

Expand All @@ -110,9 +125,7 @@ jobs:
node-version: ${{ env.node-version }}
cache: npm

- run: npm clean-install

- run: npm run bootstrap
- run: npm clean-install --strict-peer-deps

- run: npm run build --if-present

Expand Down Expand Up @@ -162,26 +175,24 @@ jobs:
node-version: ${{ env.node-version }}
cache: npm

- run: npm clean-install

- run: npm run bootstrap
- run: npm clean-install --strict-peer-deps

- run: npm run build --if-present

- name: Run tsd under packages/bundle (CJS)
run: ./node_modules/.bin/tsd -t ./lib/index.d.ts
run: ../../node_modules/.bin/tsd -t ./lib/index.d.ts
working-directory: ./packages/bundle

- name: Run tsd under packages/bundle (ESM)
run: ./node_modules/.bin/tsd -t ./dist/botframework-webchat.d.mts
run: ../../node_modules/.bin/tsd -t ./dist/botframework-webchat.d.mts
working-directory: ./packages/bundle

- name: Run tsd under packages/core (CJS)
run: ./node_modules/.bin/tsd -t ./lib/index.d.ts
run: ../../node_modules/.bin/tsd -t ./lib/index.d.ts
working-directory: ./packages/core

- name: Run tsd under packages/core (ESM)
run: ./node_modules/.bin/tsd -t ./dist/botframework-webchat-core.d.mts
run: ../../node_modules/.bin/tsd -t ./dist/botframework-webchat-core.d.mts
working-directory: ./packages/core

html-test:
Expand Down Expand Up @@ -210,7 +221,7 @@ jobs:

- run: rm docker.zip

- run: npm clean-install
- run: npm clean-install --strict-peer-deps

- name: Run docker compose build
run: docker compose -f docker-compose-wsl2.yml build --build-arg REGISTRY=mcr.microsoft.com/mirror/docker/library
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/coverage
/debug.log
/gh-pages
/lerna-debug.log
/node_modules
/tarball.zip

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- Enhanced the visual presentation of the Fluent theme copilot variant, in PR [#5293](https://github.com/microsoft/BotFramework-WebChat/pull/5293), by [@OEvgeny](https://github.com/OEvgeny)
- Refactored spacing and layout for copilot variant in Fluent theme, improving visual consistency, in PR [#5296](https://github.com/microsoft/BotFramework-WebChat/pull/5296), by [@OEvgeny](https://github.com/OEvgeny)
- Added a content generated badge to AI-generated messages, in PR [#5298](https://github.com/microsoft/BotFramework-WebChat/pull/5298), by [@OEvgeny](https://github.com/OEvgeny)
- Resolved [#4847](https://github.com/microsoft/BotFramework-WebChat/issues/4847). Migrated to npm workspaces from lerna, in PR [#5301](https://github.com/microsoft/BotFramework-WebChat/pull/5301), by [@compulim](https://github.com/compulim)
- Resolved [#5302](https://github.com/microsoft/BotFramework-WebChat/issues/5302). Migrated to `core-js-pure/Promise.withResolveers` from `p-defer`, in PR [#5301](https://github.com/microsoft/BotFramework-WebChat/pull/5301), by [@compulim](https://github.com/compulim)

### Fixed

Expand All @@ -65,6 +67,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- Fixes [#5268](https://github.com/microsoft/BotFramework-WebChat/issues/5268). Concluded livestream is sealed and activities received afterwards are ignored, and `streamSequence` is not required in final activity, in PR [#5273](https://github.com/microsoft/BotFramework-WebChat/pull/5273), by [@compulim](https://github.com/compulim)
- Fixes [#5288](https://github.com/microsoft/BotFramework-WebChat/issues/5288). Fixed citation and sensitivity label bleeding when using Fluent skin pack, in PR [#5287](https://github.com/microsoft/BotFramework-WebChat/pull/5287), by [@compulim](https://github.com/compulim)
- Fixes [#5294](https://github.com/microsoft/BotFramework-WebChat/issues/5294). Fixed copy button animation reset to "Copied" after hiding and showing Web Chat, in PR [#5295](https://github.com/microsoft/BotFramework-WebChat/pull/5295), by [@compulim](https://github.com/compulim)
- Fixes [#5147](https://github.com/microsoft/BotFramework-WebChat/issues/5147). Added `punycode` to our dependencies as `markdown-it` requires it but did not have it in their `package.json`, in PR [#5301](https://github.com/microsoft/BotFramework-WebChat/pull/5301), by [@compulim](https://github.com/compulim)

# Removed

Expand Down
1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ steps:

- script: |
npm ci
npm run bootstrap
npm run eslint
npm run build
docker-compose up --build --detach
Expand Down
9 changes: 2 additions & 7 deletions docs/BUILD_SCRIPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ This article outlines the Web Chat build scripts design.

This section lists the requirements for an efficient design of build scripts. The Web Chat code closely follows the guidelines below.

### Bootstrap scripts
### Install dependencies for development

Only two NPM commands are needed to ready the repository for development:

- `npm ci`, followed by
- `npm run bootstrap`

On subsequent pulls, running `npm run tableflip` will reset all `node_modules`.
- `npm clean-install`

### Build scripts

Expand Down
17 changes: 0 additions & 17 deletions lerna.json

This file was deleted.

Loading

0 comments on commit 9ba786e

Please sign in to comment.