Skip to content

Commit

Permalink
Replace npm to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
alimtunc committed Jul 21, 2023
1 parent 6c18aef commit 82c734e
Show file tree
Hide file tree
Showing 13 changed files with 9,328 additions and 27,816 deletions.
14 changes: 7 additions & 7 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ $ git remote -v
### Install JS dependencies

```sh
npm install
npm run installUiDeps
pnpm install
pnpm run installUiDeps
```

### Install python dependencies
Expand All @@ -79,9 +79,9 @@ Make sure you have the Python code formatter `black` installed as it is used in
## Start the UI

```sh
npm run buildUi
pnpm run buildUi
cd src/chainlit/frontend
npm run dev -- --port 5174
pnpm run dev -- --port 5174
```

The `buildUi` step is currently needed by the server.
Expand All @@ -107,14 +107,14 @@ If you've made it this far, you can now replace `chainlit/hello.py` by your own

## Run the tests

Run `npm test`
Run `pnpm test`

Once you create a pull request, the tests will automatically run. It is a good practice to run the tests locally before pushing.

### Run one test

1. Find the folder containing the e2e test that you're looking for in `cypress/e2e`.
2. Run `SINGLE_TEST=FOLDER npm test` and change FOLDER with the folder from the previous step (example: `SINGLE_TEST=scoped_elements run test`).
2. Run `SINGLE_TEST=FOLDER pnpm test` and change FOLDER with the folder from the previous step (example: `SINGLE_TEST=scoped_elements run test`).

## Only contribute to one side of the project

Expand All @@ -136,7 +136,7 @@ const devServer = 'https://img-gen.chainlit.app/';
1. Build the UI.

```sh
npm run buildUi
pnpm run buildUi
```

2. Follow the instruction from [Install from local sources](#install-from-local-sources).
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ jobs:
- uses: actions/checkout@v3
with:
ref: main
- uses: pnpm/action-setup@v2
with:
version: 8.6.9
- name: Use Node.js 16.15.0
uses: actions/setup-node@v3
with:
node-version: "16.15.0"
cache: "npm"
cache: "pnpm"
- name: Install UI JS dependencies
run: npm run installUiDeps
run: pnpm run installUiDeps
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -38,7 +41,7 @@ jobs:
- name: Copy readme to src
run: cp README.md src/
- name: Build chainlit
run: npm run build
run: pnpm run build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.6.9
- name: Use Node.js 16.15.0
uses: actions/setup-node@v3
with:
node-version: "16.15.0"
cache: "npm"
cache: "pnpm"
- name: Install test JS dependencies
run: npm install
run: pnpm install --no-frozen-lockfile
- name: Install UI JS dependencies
run: npm run installUiDeps
run: pnpm run installUiDeps
- name: Lint UI
run: npm run lintUi
run: pnpm run lintUi
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -31,4 +34,4 @@ jobs:
- name: Run tests
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
run: npm test
run: pnpm test
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lintUi
npm run formatUi
npm run formatPython
pnpm run lintUi
pnpm run formatUi
pnpm run formatPython
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
shared-workspace-lockfile=false
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=@types*
2 changes: 1 addition & 1 deletion cypress/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function runCommand(command: string, cwd = ROOT) {
}

export function installChainlit() {
runCommand("npm run build", FRONTEND_DIR);
runCommand("pnpm run build", FRONTEND_DIR);
runCommand(`poetry install -C ${CHAINLIT_DIR} --with tests`);
}

Expand Down
Loading

0 comments on commit 82c734e

Please sign in to comment.