feat: use pnpm

This commit is contained in:
Dominik Pschenitschni 2022-04-09 20:00:29 +02:00
parent f85a08afb4
commit d76b526916
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
11 changed files with 13347 additions and 13552 deletions

View File

@ -34,18 +34,19 @@ steps:
# endpoint: https://s3.fr-par.scw.cloud # endpoint: https://s3.fr-par.scw.cloud
# region: fr-par # region: fr-par
# path_style: true # path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "yarn.lock" }}_{{ arch }}_{{ os }}' # cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount: # mount:
# - '.cache' # - '.cache'
- name: dependencies - name: dependencies
image: node:18 image: node:18-alpine
pull: true pull: true
environment: environment:
YARN_CACHE_FOLDER: .cache/yarn/ PNPM_CACHE_FOLDER: .cache/pnpm/
CYPRESS_CACHE_FOLDER: .cache/cypress/ CYPRESS_CACHE_FOLDER: .cache/cypress/
commands: commands:
- yarn --frozen-lockfile --network-timeout 100000 - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnpm
- pnpm install --fetch-timeout 100000
# depends_on: # depends_on:
# - restore-cache # - restore-cache
@ -63,47 +64,52 @@ steps:
# endpoint: https://s3.fr-par.scw.cloud # endpoint: https://s3.fr-par.scw.cloud
# region: fr-par # region: fr-par
# path_style: true # path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "yarn.lock" }}_{{ arch }}_{{ os }}' # cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount: # mount:
# - '.cache' # - '.cache'
# depends_on: # depends_on:
# - dependencies # - dependencies
- name: lint - name: lint
image: node:18 image: node:18-alpine
pull: true pull: true
environment: environment:
YARN_CACHE_FOLDER: .cache/yarn/ PNPM_CACHE_FOLDER: .cache/pnpm/
CYPRESS_CACHE_FOLDER: .cache/cypress/
commands: commands:
- yarn run lint - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnpm
- pnpm run lint
depends_on: depends_on:
- dependencies - dependencies
- name: build-prod - name: build-prod
image: node:18 image: node:18-alpine
pull: true pull: true
environment: environment:
YARN_CACHE_FOLDER: .cache/yarn/ PNPM_CACHE_FOLDER: .cache/pnpm/
commands: commands:
- yarn build - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnpm
- pnpm run build
depends_on: depends_on:
- dependencies - dependencies
- name: test-unit - name: test-unit
image: node:18 image: node:18-alpine
pull: true pull: true
commands: commands:
- yarn test:unit - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnpm
- pnpm run test:unit
depends_on: depends_on:
- dependencies - dependencies
- name: typecheck - name: typecheck
failure: ignore failure: ignore
image: node:18 image: node:18-alpine
pull: true pull: true
environment:
PNPM_CACHE_FOLDER: .cache/pnpm/
commands: commands:
- yarn typecheck - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnpm
- pnpm run typecheck
depends_on: depends_on:
- dependencies - dependencies
@ -113,20 +119,21 @@ steps:
environment: environment:
CYPRESS_API_URL: http://api:3456/api/v1 CYPRESS_API_URL: http://api:3456/api/v1
CYPRESS_TEST_SECRET: averyLongSecretToSe33dtheDB CYPRESS_TEST_SECRET: averyLongSecretToSe33dtheDB
YARN_CACHE_FOLDER: .cache/yarn/ PNPM_CACHE_FOLDER: .cache/pnpm/
CYPRESS_CACHE_FOLDER: .cache/cypress/ CYPRESS_CACHE_FOLDER: .cache/cypress/
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 60000 CYPRESS_DEFAULT_COMMAND_TIMEOUT: 60000
CYPRESS_RECORD_KEY: CYPRESS_RECORD_KEY:
from_secret: cypress_project_key from_secret: cypress_project_key
commands: commands:
- sed -i 's/localhost/api/g' dist/index.html - sed -i 's/localhost/api/g' dist/index.html
- yarn serve:dist & npx wait-on http://localhost:4173 - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnpm
- yarn test:frontend --browser chrome --record - pnpm run serve:dist & npx wait-on http://localhost:4173
- pnpm run test:frontend --browser chrome --record
depends_on: depends_on:
- build-prod - build-prod
- name: deploy-preview - name: deploy-preview
image: node:18 image: node:18-alpine
pull: true pull: true
environment: environment:
NETLIFY_AUTH_TOKEN: NETLIFY_AUTH_TOKEN:
@ -139,6 +146,7 @@ steps:
- cp -r dist dist-preview - cp -r dist dist-preview
# Override the default api url used for preview # Override the default api url used for preview
- sed -i 's|localhost:3456|try.vikunja.io|g' dist-preview/index.html - sed -i 's|localhost:3456|try.vikunja.io|g' dist-preview/index.html
- apk add --no-cache perl-utils
- shasum -a 384 -c ./scripts/deploy-preview-netlify.js.sha384 - shasum -a 384 -c ./scripts/deploy-preview-netlify.js.sha384
- node ./scripts/deploy-preview-netlify.js - node ./scripts/deploy-preview-netlify.js
depends_on: depends_on:
@ -181,21 +189,22 @@ steps:
# endpoint: https://s3.fr-par.scw.cloud # endpoint: https://s3.fr-par.scw.cloud
# region: fr-par # region: fr-par
# path_style: true # path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "yarn.lock" }}_{{ arch }}_{{ os }}' # cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount: # mount:
# - '.cache' # - '.cache'
- name: build - name: build
image: node:18 image: node:18-alpine
pull: true pull: true
group: build-static group: build-static
environment: environment:
YARN_CACHE_FOLDER: .cache/yarn/ PNPM_CACHE_FOLDER: .cache/pnpm/
commands: commands:
- yarn --frozen-lockfile --network-timeout 100000 - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnp
- yarn run lint - pnpm install --fetch-timeout 100000
- pnpm run lint
- "echo '{\"VERSION\": \"'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'\"}' > src/version.json" - "echo '{\"VERSION\": \"'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'\"}' > src/version.json"
- yarn run build - pnpm run build
- sed -i 's/http\:\\/\\/localhost\\:3456\\/api\\/v1/\\/api\\/v1/g' dist/index.html # Override the default api url used for developing - sed -i 's/http\:\\/\\/localhost\\:3456\\/api\\/v1/\\/api\\/v1/g' dist/index.html # Override the default api url used for developing
# depends_on: # depends_on:
# - restore-cache # - restore-cache
@ -256,21 +265,22 @@ steps:
# endpoint: https://s3.fr-par.scw.cloud # endpoint: https://s3.fr-par.scw.cloud
# region: fr-par # region: fr-par
# path_style: true # path_style: true
# cache_key: '{{ .Repo.Name }}_{{ checksum "yarn.lock" }}_{{ arch }}_{{ os }}' # cache_key: '{{ .Repo.Name }}_{{ checksum "pnpm-lock.yaml" }}_{{ arch }}_{{ os }}'
# mount: # mount:
# - '.cache' # - '.cache'
- name: build - name: build
image: node:18 image: node:18-alpine
pull: true pull: true
group: build-static group: build-static
environment: environment:
YARN_CACHE_FOLDER: .cache/yarn/ PNPM_CACHE_FOLDER: .cache/pnpm/
commands: commands:
- yarn --frozen-lockfile --network-timeout 100000 - corepack enable && corepack prepare pnpm@7.9.3 --activate && pnpm config set store-dir .cache/.pnpm
- yarn run lint - pnpm install --fetch-timeout 100000
- pnpm run lint
- "echo '{\"VERSION\": \"'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'\"}' > src/version.json" - "echo '{\"VERSION\": \"'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'\"}' > src/version.json"
- yarn run build - pnpm run build
- sed -i 's/http\:\\/\\/localhost\\:3456\\/api\\/v1/\\/api\\/v1/g' dist/index.html # Override the default api url used for developing - sed -i 's/http\:\\/\\/localhost\\:3456\\/api\\/v1/\\/api\\/v1/g' dist/index.html # Override the default api url used for developing
# depends_on: # depends_on:
# - restore-cache # - restore-cache

4
.gitignore vendored
View File

@ -8,10 +8,14 @@ node_modules
.env.*.local .env.*.local
# Log files # Log files
logs
*.log
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
stats.html stats.html
pnpm-debug.log*
lerna-debug.log*
# Editor directories and files # Editor directories and files
.idea .idea

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
auto-install-peers=true
fetch-timeout=100000

View File

@ -1,5 +1,5 @@
{ {
"eslint.packageManager": "yarn", "eslint.packageManager": "pnpm",
"editor.formatOnSave": false, "editor.formatOnSave": false,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll": true "source.fixAll": true

View File

@ -1,28 +1,41 @@
# Stage 1: Build application # Stage 1: Build application
FROM node:18 AS compile-image FROM node:18-alpine AS compile-image
WORKDIR /build WORKDIR /build
ARG USE_RELEASE=false ARG USE_RELEASE=false
ARG RELEASE_VERSION=main ARG RELEASE_VERSION=main
ENV YARN_CACHE_FOLDER .cache/yarn/
COPY . ./
RUN \ RUN \
if [ $USE_RELEASE = true ]; then \ if [ $USE_RELEASE = true ]; then \
rm -rf dist/ && \
wget https://dl.vikunja.io/frontend/vikunja-frontend-$RELEASE_VERSION.zip -O frontend-release.zip && \ wget https://dl.vikunja.io/frontend/vikunja-frontend-$RELEASE_VERSION.zip -O frontend-release.zip && \
unzip frontend-release.zip -d dist/ && \ unzip frontend-release.zip -d dist/ && \
exit 0; \ exit 0; \
fi && \ fi
ENV PNPM_CACHE_FOLDER .cache/pnpm/
# pnpm fetch does require only lockfile
COPY pnpm-lock.yaml ./
RUN \
# https://pnpm.io/installation#using-corepack
corepack enable && \
corepack prepare pnpm@7.9.3 --activate && \
# Build the frontend # Build the frontend
yarn install --frozen-lockfile --network-timeout 100000 && \ pnpm fetch
echo '{"VERSION": "'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'"}' > src/version.json && \
yarn run build ADD . ./
RUN apk add --no-cache git
RUN \
pnpm install --offline && \
echo '{"VERSION": "'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'"}' > src/version.json && \
pnpm run build
# Stage 2: copy # Stage 2: copy
FROM nginx FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
COPY run.sh /run.sh COPY run.sh /run.sh
@ -36,4 +49,10 @@ ENV PGID 1000
LABEL maintainer="maintainers@vikunja.io" LABEL maintainer="maintainers@vikunja.io"
RUN apk add --no-cache \
# for sh file
bash \
# installs usermod and groupmod
shadow
CMD "/run.sh" CMD "/run.sh"

View File

@ -22,25 +22,25 @@ There is a [docker image available](https://hub.docker.com/r/vikunja/api) with s
## Project setup ## Project setup
```shell ```shell
yarn install pnpm install
``` ```
### Compiles and hot-reloads for development ### Compiles and hot-reloads for development
```shell ```shell
yarn run serve pnpm run serve
``` ```
### Compiles and minifies for production ### Compiles and minifies for production
```shell ```shell
yarn run build pnpm run build
``` ```
### Lints and fixes files ### Lints and fixes files
```shell ```shell
yarn run lint pnpm run lint
``` ```
## Sponsors ## Sponsors

View File

@ -36,7 +36,7 @@ to get a shell inside the cypress container.
In that shell you can then execute the tests with In that shell you can then execute the tests with
```shell ```shell
yarn test:frontend pnpm run test:frontend
``` ```
### Using The Cypress Dashboard ### Using The Cypress Dashboard
@ -44,5 +44,5 @@ yarn test:frontend
To open the Cypress Dashboard and run tests from there, run To open the Cypress Dashboard and run tests from there, run
```shell ```shell
yarn cypress:open pnpm run cypress:open
``` ```

View File

@ -1,5 +1,5 @@
[build] [build]
command = "yarn build" command = "pnpm run build"
publish = "dist-preview" publish = "dist-preview"
[[redirects]] [[redirects]]

View File

@ -35,6 +35,7 @@
"blurhash": "2.0.0", "blurhash": "2.0.0",
"bulma-css-variables": "0.9.33", "bulma-css-variables": "0.9.33",
"camel-case": "4.1.2", "camel-case": "4.1.2",
"codemirror": "5.65.7",
"date-fns": "2.29.3", "date-fns": "2.29.3",
"dompurify": "2.4.0", "dompurify": "2.4.0",
"easymde": "2.18.0", "easymde": "2.18.0",
@ -49,6 +50,7 @@
"pinia": "2.0.22", "pinia": "2.0.22",
"register-service-worker": "1.7.2", "register-service-worker": "1.7.2",
"snake-case": "3.0.4", "snake-case": "3.0.4",
"sortablejs": "1.15.0",
"ufo": "0.8.5", "ufo": "0.8.5",
"v-tooltip": "4.0.0-beta.17", "v-tooltip": "4.0.0-beta.17",
"vue": "3.2.39", "vue": "3.2.39",
@ -105,5 +107,5 @@
} }
}, },
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"packageManager": "yarn@1.22.19" "packageManager": "pnpm@7.9.3"
} }

13259
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

13501
yarn.lock

File diff suppressed because it is too large Load Diff