Replace yarn with pnpm (#1240)

Should resolve startup issues in gitpod and be a lot faster 🚀
This commit is contained in:
Lukas 2022-10-08 16:15:07 +02:00 committed by GitHub
parent 57ed64e1ea
commit fd6923fe20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 20406 additions and 21994 deletions

View file

@ -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

2
.vscode/launch.json vendored
View file

@ -42,7 +42,7 @@
"name": "Woodpecker UI",
"type": "node",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeExecutable": "pnpm",
"runtimeArgs": [
"start",
],

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
@ -20,7 +21,8 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn lint
- corepack enable
- pnpm lint
when:
path: *when_path
@ -29,7 +31,8 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn formatcheck
- corepack enable
- pnpm formatcheck
when:
path: *when_path
@ -38,7 +41,8 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn typecheck
- corepack enable
- pnpm typecheck
when:
path: *when_path
@ -56,7 +60,7 @@ pipeline:
image: *node_image
commands:
- cd web/
- yarn test
- corepack enable
- pnpm test
when:
path: *when_path

View file

@ -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
@ -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/...
@ -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')
@ -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
@ -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

View file

@ -5,13 +5,13 @@ 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.
@ -19,7 +19,7 @@ This command starts a local development server and opens up a browser window. Mo
### Build
```
$ yarn build
$ pnpm build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
@ -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
```

View file

@ -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
@ -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

View file

@ -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

View file

@ -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
```

View file

@ -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",

View file

@ -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": {
@ -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": {
@ -27,5 +29,13 @@
"dependencies": {
"fuse.js": "^6.6.2",
"yaml": "^2.1.1"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"react",
"react-dom"
]
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

9074
docs/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

View file

@ -45,7 +45,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

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
yarn-lock.yaml
pnpm-lock.yaml
dist
coverage/
LICENSE

3429
web/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff