Skip to content

Replace npm with pnpm #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,14 @@ lazy val frontend = (project in file("frontend"))
buildFrontend := {
println("Installing frontend dependencies...")
import scala.sys.process._
val npmCiResult = Process("npm ci", file("frontend")).!
val pnpmCiResult = Process("pnpm install --frozen-lockfile", file("frontend")).!

if (npmCiResult != 0) {
sys.error("npm ci failed!")
if (pnpmCiResult != 0) {
sys.error("pnpm install failed!")
}

println("Building frontend...")
val buildResult = Process("npm run build", file("frontend")).!
val buildResult = Process("pnpm run build", file("frontend")).!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

CI environment needs pnpm configuration

The project is indeed using pnpm as the package manager (confirmed by package.json scripts and presence of pnpm-lock.yaml), but there's no CI configuration detected. This poses a risk for the build process.

  • No CI workflow files were found in common locations (.github/workflows/, .gitlab-ci.yml, etc.)
  • A pnpm-lock.yaml exists at frontend/pnpm-lock.yaml, confirming pnpm usage
  • Package.json shows heavy reliance on pnpm for various scripts (build, dev, test, etc.)

Action needed: Add CI configuration that includes:

  • pnpm installation step
  • Proper caching of pnpm dependencies
  • Execution of the build command with pnpm
🔗 Analysis chain

Verify CI environment compatibility

The build process now relies on pnpm. We should ensure that the CI environment has pnpm installed and properly configured.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if CI configuration files exist and contain pnpm setup
echo "Checking CI configuration files..."
fd -t f "^\.github/workflows/.*\.ya?ml$|^\.gitlab-ci\.ya?ml$|^\.circleci/.*\.ya?ml$|^azure-pipelines\.ya?ml$" -x cat {} \; | rg "pnpm"

# Check if there's a pnpm setup action or installation step
fd -t f "^\.github/workflows/.*\.ya?ml$" -x rg "actions/setup-node|pnpm install" {} \;

Length of output: 516


Script:

#!/bin/bash
# Check CI configuration files with hidden flag
echo "Checking CI configuration files..."
fd -H -t f "^\.github/workflows/.*\.ya?ml$|^\.gitlab-ci\.ya?ml$|^\.circleci/.*\.ya?ml$|^azure-pipelines\.ya?ml$" -x cat {} \;

# Also check package.json for any pnpm-related configurations
echo -e "\nChecking package.json in frontend directory..."
fd -H "package.json" frontend -x cat {} \;

# Check if there's any pnpm-lock.yaml file
echo -e "\nChecking for pnpm-lock.yaml..."
fd -H "pnpm-lock.yaml"

Length of output: 2888


if (buildResult == 0) {
println("Copying frontend assets to /hub/public...")
Expand Down
2 changes: 1 addition & 1 deletion docker-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $ docker compose -f docker-init/compose.yaml up

The **backend** is served at: http://localhost:9000

The **frontend** is served at: http://localhost:3000. This serves statically built code - no live dev server. `cd frontend; npm run dev` for a live dev server.
The **frontend** is served at: http://localhost:3000. This serves statically built code - no live dev server. `cd frontend; pnpm run dev` for a live dev server.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update npm reference in service/README.md to use pnpm

Found one remaining npm reference that needs to be updated:

  • In service/README.md: The instruction to install statsd-logger uses npm install -g statsd-logger and should be updated to use pnpm global install syntax
🔗 Analysis chain

Verify all npm references have been updated to pnpm

Let's ensure all npm references in the documentation have been updated to pnpm.


Let's examine the content of these files to see the specific npm references.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining npm references in markdown files
echo "Searching for npm references in markdown files..."
rg --type md "npm" -l

Length of output: 189


Script:

#!/bin/bash
# Check the content of npm references in each markdown file
echo "=== docker-init/README.md ==="
rg -A 2 -B 2 "npm" docker-init/README.md

echo -e "\n=== frontend/README.md ==="
rg -A 2 -B 2 "npm" frontend/README.md

echo -e "\n=== service/README.md ==="
rg -A 2 -B 2 "npm" service/README.md

Length of output: 1814

🧰 Tools
🪛 Markdownlint (0.37.0)

36-36: null
Bare URL used

(MD034, no-bare-urls)


You can also access the parquet anomaly data table. To do so, from another terminal run:

Expand Down
32 changes: 16 additions & 16 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The frontend for Chronon.
### Prerequisites

- [Node.js](https://nodejs.org/en/) (LTS version recommended)
- npm (comes with Node.js)
- [pnpm](https://pnpm.io/installation) - fast and disk space efficient package manager

### Installation

Expand All @@ -26,7 +26,7 @@ The frontend for Chronon.

3. Install dependencies:
```bash
npm install
pnpm install
```

### Development
Expand All @@ -53,7 +53,7 @@ Done uploading summaries! 🥳
3. Then, start the development server:

```bash
npm run dev
pnpm dev
```

This will start a local server. The app will automatically reload if you make changes to the code.
Expand All @@ -63,7 +63,7 @@ This will start a local server. The app will automatically reload if you make ch
To create an optimized production build:

```bash
npm run build
pnpm build
```

This will create an optimized version of your project in the `build` directory.
Expand All @@ -73,7 +73,7 @@ This will create an optimized version of your project in the `build` directory.
To preview the production build locally:

```bash
npm run preview
pnpm preview
```

### Running Tests
Expand All @@ -85,72 +85,72 @@ npm run preview
To run both unit and integration tests together:

```bash
npm run test
pnpm test
```

#### Unit Tests

To run unit tests using Vitest:

```bash
npm run test:unit
pnpm test:unit
```

To run unit tests once:

```bash
npm run test:unit:once
pnpm test:unit:once
```

#### Integration Tests

To run integration tests using Playwright:

```bash
npm run test:integration
pnpm test:integration
```

To run integration tests once:

```bash
npm run test:integration:once
pnpm test:integration:once
```

For the Playwright UI to explore test results:

```bash
npm run test:integration:ui
pnpm test:integration:ui
```

### Linting and Formatting

To check code formatting and linting issues:

```bash
npm run lint
pnpm lint
```

To format the codebase:

```bash
npm run format
pnpm format
```

### Type Checking

To check the TypeScript types:

```bash
npm run check
pnpm check
```

To continuously check types while developing:

```bash
npm run check:watch
pnpm check:watch
```

## Best Practices

1. **Code Style**: This project uses Prettier and ESLint for code formatting and linting. Please run `npm run lint` and `npm run format` before committing changes.
1. **Code Style**: This project uses Prettier and ESLint for code formatting and linting. Please run `pnpm lint` and `pnpm format` before committing changes.
2. **Testing**: Ensure all changes are covered with unit and integration tests. Use Vitest for unit tests and Playwright for integration tests.
Loading
Loading