Skip to content

Commit

Permalink
Replace yarn with pnpm (woodpecker-ci#1240)
Browse files Browse the repository at this point in the history
Should resolve startup issues in gitpod and be a lot faster 🚀
  • Loading branch information
lukashass authored Oct 8, 2022
1 parent 57ed64e commit fd6923f
Show file tree
Hide file tree
Showing 21 changed files with 20,406 additions and 21,994 deletions.
10 changes: 5 additions & 5 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ tasks:
before: |
cd web/
init: |
yarn install
pnpm install
command: |
yarn start
pnpm start
- name: Docs
before: |
cd docs/
init: |
yarn install
yarn build:woodpecker-plugins
pnpm install
pnpm build:woodpecker-plugins
command: |
yarn start --port 4000
pnpm start --port 4000
ports:
- port: 3000
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"name": "Woodpecker UI",
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeExecutable": "pnpm",
"runtimeArgs": [
"start",
],
Expand Down
5 changes: 3 additions & 2 deletions .woodpecker/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn install --frozen-lockfile
- yarn build
- corepack enable
- pnpm install --frozen-lockfile
- pnpm build
when:
path: *when_path

Expand Down
5 changes: 3 additions & 2 deletions .woodpecker/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn install --frozen-lockfile
- yarn build
- corepack enable
- pnpm install --frozen-lockfile
- pnpm build

cross-compile-server:
image: *xgo_image
Expand Down
5 changes: 3 additions & 2 deletions .woodpecker/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ pipeline:
image: *node_image
commands:
- cd docs/
- yarn install --frozen-lockfile
- yarn build
- corepack enable
- pnpm install --frozen-lockfile
- pnpm build
when:
path: *when_path

Expand Down
16 changes: 10 additions & 6 deletions .woodpecker/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn install --frozen-lockfile
- corepack enable
- pnpm install --frozen-lockfile
when:
path: *when_path

Expand All @@ -20,7 +21,8 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn lint
- corepack enable
- pnpm lint
when:
path: *when_path

Expand All @@ -29,7 +31,8 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn formatcheck
- corepack enable
- pnpm formatcheck
when:
path: *when_path

Expand All @@ -38,7 +41,8 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn typecheck
- corepack enable
- pnpm typecheck
when:
path: *when_path

Expand All @@ -56,7 +60,7 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn test
- corepack enable
- pnpm test
when:
path: *when_path

20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ install-tools: ## Install development tools
fi

ui-dependencies: ## Install UI dependencies
(cd web/; yarn install --frozen-lockfile)
(cd web/; pnpm install --frozen-lockfile)

##@ Test

Expand All @@ -118,9 +118,9 @@ lint: install-tools ## Lint code
lint github.com/woodpecker-ci/woodpecker/cmd/server

lint-ui: ## Lint UI code
(cd web/; yarn)
(cd web/; yarn lesshint)
(cd web/; yarn lint --quiet)
(cd web/; pnpm install)
(cd web/; pnpm lesshint)
(cd web/; pnpm lint --quiet)

test-agent: ## Test agent code
go test -race -cover -coverprofile agent-coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/agent github.com/woodpecker-ci/woodpecker/agent/...
Expand All @@ -138,10 +138,10 @@ test-server-datastore-coverage: ## Test server datastore with coverage report
go test -race -cover -coverprofile datastore-coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/...

test-ui: ui-dependencies ## Test UI code
(cd web/; yarn run lint)
(cd web/; yarn run formatcheck)
(cd web/; yarn run typecheck)
(cd web/; yarn run test)
(cd web/; pnpm run lint)
(cd web/; pnpm run formatcheck)
(cd web/; pnpm run typecheck)
(cd web/; pnpm run test)

test-lib: ## Test lib code
go test -race -cover -coverprofile coverage.out -timeout 30s $(shell go list ./... | grep -v '/cmd\|/agent\|/cli\|/server')
Expand All @@ -151,7 +151,7 @@ test: test-agent test-server test-server-datastore test-cli test-lib test-ui ##
##@ Build

build-ui: ## Build UI
(cd web/; yarn install --frozen-lockfile; yarn build)
(cd web/; pnpm install --frozen-lockfile; pnpm build)

build-server: build-ui ## Build server
CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags '${LDFLAGS}' -o dist/woodpecker-server github.com/woodpecker-ci/woodpecker/cmd/server
Expand Down Expand Up @@ -246,7 +246,7 @@ release-tarball: ## Create tarball for release
web/package.json \
web/tsconfig.* \
web/*.ts \
web/yarn.lock \
web/pnpm-lock.yaml \
web/web.go

release-checksums: ## Create checksums for all release files
Expand Down
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern sta
### Installation

```
$ yarn
$ pnpm install
```

### Local Development

```
$ yarn start
$ pnpm start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
$ pnpm build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
Expand All @@ -31,5 +31,5 @@ Deployment happen via [CI](https://github.com/woodpecker-ci/woodpecker/blob/d59f
To manually build the website and push it exec:

```sh
GIT_USER=woodpecker-bot USE_SSH=true DEPLOYMENT_BRANCH=master yarn deploy
GIT_USER=woodpecker-bot USE_SSH=true DEPLOYMENT_BRANCH=master pnpm deploy
```
6 changes: 3 additions & 3 deletions docs/docs/92-development/01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ Install make on:
- [Windows](https://stackoverflow.com/a/32127632/8461267)
- Mac OS: `brew install make`

### Install Node.js & Yarn
### Install Node.js & pnpm

Install [Node.js (>=14)](https://nodejs.org/en/download/) if you want to build Woodpeckers UI or documentation.

For dependencies installation (node_modules) for the UI and documentation of Woodpecker the package-manager Yarn is used. The installation of Yarn is described by [this guide](https://yarnpkg.com/getting-started/install).
For dependencies installation (node_modules) for the UI and documentation of Woodpecker the package-manager pnpm is used. The installation of pnpm is described by [this guide](https://pnpm.io/installation).

### Create a `.env` file with your development configuration

Expand All @@ -61,7 +61,7 @@ WOODPECKER_SECRET=a-long-and-secure-password-used-for-the-local-development-syst
WOODPECKER_MAX_PROCS=1

# enable if you want to develop the UI
# WOODPECKER_DEV_WWW_PROXY=http://localhost:3000
# WOODPECKER_DEV_WWW_PROXY=http://localhost:8010

# used so you can login without using a public address
WOODPECKER_DEV_OAUTH_HOST=http://localhost:8000
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/92-development/03-ui.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# UI Development

To develop the UI you need to install [Node.js and Yarn](./01-getting-started.md#nodejs--yarn). In addition it is recommended to use VS-Code with the recommended plugin selection to get features like auto-formatting, linting and typechecking. The UI is written with [Vue 3](https://v3.vuejs.org/) as Single-Page-Application accessing the Woodpecker REST api.
To develop the UI you need to install [Node.js and pnpm](./01-getting-started.md#install-nodejs--pnpm). In addition it is recommended to use VS-Code with the recommended plugin selection to get features like auto-formatting, linting and typechecking. The UI is written with [Vue 3](https://v3.vuejs.org/) as Single-Page-Application accessing the Woodpecker REST api.

## Setup
The UI code is placed in `web/`. Change to that folder in your terminal with `cd web/` and install all dependencies by running `yarn install`. For production builds the generated UI code is integrated into the Woodpecker server by using [go-embed](https://pkg.go.dev/embed).
The UI code is placed in `web/`. Change to that folder in your terminal with `cd web/` and install all dependencies by running `pnpm install`. For production builds the generated UI code is integrated into the Woodpecker server by using [go-embed](https://pkg.go.dev/embed).

Testing UI changes would require us to rebuild the UI after each adjustment to the code by running `yarn build` and restarting the Woodpecker server. To avoid this you can make use of the dev-proxy integrated into the Woodpecker server. This integrated dev-proxy will forward all none api request to a separate http-server which will only serve the UI files.
Testing UI changes would require us to rebuild the UI after each adjustment to the code by running `pnpm build` and restarting the Woodpecker server. To avoid this you can make use of the dev-proxy integrated into the Woodpecker server. This integrated dev-proxy will forward all none api request to a separate http-server which will only serve the UI files.

![UI Proxy architecture](./ui-proxy.svg)

Start the UI server locally with [hot-reloading](https://stackoverflow.com/a/41429055/8461267) by running: `yarn start`. To enable the forwarding of requests to the UI server you have to enable the dev-proxy inside the Woodpecker server by adding `WOODPECKER_DEV_WWW_PROXY=http://localhost:8010` to your `.env` file.
Start the UI server locally with [hot-reloading](https://stackoverflow.com/a/41429055/8461267) by running: `pnpm start`. To enable the forwarding of requests to the UI server you have to enable the dev-proxy inside the Woodpecker server by adding `WOODPECKER_DEV_WWW_PROXY=http://localhost:8010` to your `.env` file.
After starting the Woodpecker server as explained in the [debugging](./01-getting-started.md#debugging) section, you should now be able to access the UI under [http://localhost:8000](http://localhost:8000).

## Tools and frameworks
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/92-development/04-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

The documentation is using docusaurus as framework. You can learn more about it from its [official documentation](https://docusaurus.io/docs/).

If you only want to change some text it probably is enough if you just search for the corresponding [Markdown](https://www.markdownguide.org/basic-syntax/) file inside the `docs/docs/` folder and adjust it. If you want to change larger parts and test the rendered documentation you can run docusaurus locally. Similarly to the UI you need to install [Node.js and Yarn](./01-getting-started.md#nodejs--yarn). After that you can run and build docusaurus locally by using the following commands:
If you only want to change some text it probably is enough if you just search for the corresponding [Markdown](https://www.markdownguide.org/basic-syntax/) file inside the `docs/docs/` folder and adjust it. If you want to change larger parts and test the rendered documentation you can run docusaurus locally. Similarly to the UI you need to install [Node.js and pnpm](./01-getting-started.md#install-nodejs--pnpm). After that you can run and build docusaurus locally by using the following commands:

```bash
cd docs/

yarn install
pnpm install

# build plugins used by the docs
yarn build:woodpecker-plugins
pnpm build:woodpecker-plugins

# start docs with hot-reloading, so you can change the docs and directly see the changes in the browser without reloading it manually
yarn start
pnpm start

# or build the docs to deploy it to some static page hosting
yarn build
pnpm build
```
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "yarn build:woodpecker-plugins && docusaurus build",
"build:woodpecker-plugins": "cd plugins/woodpecker-plugins && yarn && yarn build",
"build": "pnpm build:woodpecker-plugins && docusaurus build",
"build:woodpecker-plugins": "cd plugins/woodpecker-plugins && pnpm i && pnpm build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
Expand Down
14 changes: 12 additions & 2 deletions docs/plugins/woodpecker-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"start": "yarn run style && concurrently 'tsc -w' 'tsc -w -p tsconfig.jsx.json'",
"build": "yarn run style && tsc && tsc -p tsconfig.jsx.json",
"start": "pnpm run style && concurrently 'tsc -w' 'tsc -w -p tsconfig.jsx.json'",
"build": "pnpm run style && tsc && tsc -p tsconfig.jsx.json",
"style": "mkdir -p dist/theme/ && cp src/theme/style.css dist/theme/style.css"
},
"devDependencies": {
Expand All @@ -15,9 +15,11 @@
"@docusaurus/types": "^2.1.0",
"@tsconfig/docusaurus": "^1.0.6",
"@types/marked": "^4.0.7",
"@types/node": "^16.0.0",
"axios": "^0.27.2",
"concurrently": "^7.4.0",
"marked": "^4.1.0",
"tslib": "^2.4.0",
"typescript": "^4.7.4"
},
"peerDependencies": {
Expand All @@ -27,5 +29,13 @@
"dependencies": {
"fuse.js": "^6.6.2",
"yaml": "^2.1.1"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"react",
"react-dom"
]
}
}
}
Loading

0 comments on commit fd6923f

Please sign in to comment.