Skip to content
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

refactor: use pnpm #72

Merged
merged 6 commits into from
Dec 22, 2023
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
29 changes: 16 additions & 13 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup yarn
node-version: '20'
- name: Setup pnpm
run: corepack enable
- name: Get yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_ENV
- name: Cache yarn dependencies
uses: actions/cache@v3
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Build
run: |
yarn build
yarn pack
pnpm build
pnpm pack
cp adofai-gg-*.tgz package.tgz
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup yarn
node-version: '20'
- name: Setup pnpm
run: corepack enable
- name: Get yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_ENV
- name: Cache yarn dependencies
uses: actions/cache@v3
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Lint
run: yarn lint
run: pnpm lint
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
pnpm commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
pnpm lint-staged
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ src/assets

storybook-static
src/utils/search/parser.ts

pnpm-lock.yaml
9 changes: 0 additions & 9 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@
"no-empty-source": null,
"number-max-precision": 2,
"color-no-hex": true,
"block-opening-brace-newline-before": null,
"block-closing-brace-newline-before": "always-multi-line",
"block-opening-brace-space-before": "always",
"declaration-block-no-redundant-longhand-properties": true,
"declaration-block-no-duplicate-custom-properties": true,
"custom-property-empty-line-before": null,
"declaration-block-no-duplicate-properties": true,
"declaration-colon-newline-after": null,
"value-list-comma-newline-after": null,
"value-list-comma-newline-before": null,
"hue-degree-notation": "angle",
"function-calc-no-unspaced-operator": true,
"font-family-name-quotes": "always-unless-keyword",
Expand All @@ -39,9 +33,6 @@
"selector-no-vendor-prefix": null,
"media-feature-name-no-vendor-prefix": null,
"at-rule-no-vendor-prefix": null,
"string-quotes": "single",
"indentation": null,
"selector-descendant-combinator-no-non-space": null,
"selector-class-pattern": null,
"string-no-newline": null,
"selector-pseudo-class-no-unknown": [
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"prettier.prettierPath": "./node_modules/prettier"
"prettier.prettierPath": "./node_modules/prettier",
"stylelint.stylelintPath": "./node_modules/stylelint"
}
9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-after-install.cjs

This file was deleted.

807 changes: 0 additions & 807 deletions .yarn/releases/yarn-3.3.0.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarnrc.yml

This file was deleted.

16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ RUN mkdir -p /app

WORKDIR /app

COPY package.json .yarnrc.yml yarn.lock ./
COPY package.json pnpm-lock.yaml ./
COPY patches ./patches

COPY .yarn .yarn

RUN corepack enable && yarn --frozen-lockfile
RUN corepack enable && pnpm i --frozen-lockfile

COPY . .

Expand All @@ -33,14 +32,14 @@ RUN apk add git && \
PUBLIC_GTM_ID=${GTM_ID} PUBLIC_GA_ID=${GA_ID} SENTRY_ORG=${SENTRY_ORG} PUBLIC_USE_ACCOUNT=${USE_ACCOUNT} \
PUBLIC_SENTRY_ENV=${SENTRY_ENV} PUBLIC_SENTRY_DSN=${SENTRY_DSN} SENTRY_ORG=${SENTRY_ORG} SENTRY_PROJECT=${SENTRY_PROJECT} \
SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} PUBLIC_SENTRY_RELEASE=$(git rev-parse --short HEAD) \
SENTRY_URL=${SENTRY_URL} yarn build && \
SENTRY_URL=${SENTRY_URL} pnpm build && \
mv static/~partytown build/client/~partytown

RUN apk add jq

RUN cat package.json | jq 'del(.devDependencies) | del(.resolutions) | del(.scripts)' | tee package.json

RUN yarn pack
RUN pnpm pack && mv adofai-gg-*.tgz package.tgz

FROM node:18-alpine AS runner

Expand All @@ -50,10 +49,9 @@ RUN tar xvzf package.tgz && \
rm package.tgz && \
mv package app && \
cd app && \
echo "nodeLinker: pnpm" >> .yarnrc.yml && \
corepack enable && \
yarn
pnpm i --production

WORKDIR /app

CMD ["yarn", "node", "server.js"]
CMD ["node", "server.js"]
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
"name": "adofai-gg",
"version": "0.0.1",
"scripts": {
"dev": "yarn prebuild && vite dev",
"build": "yarn prebuild && vite build",
"dev": "pnpm prebuild && vite dev",
"build": "pnpm prebuild && vite build",
"package": "vite package",
"preview": "vite preview",
"test": "yarn build && playwright test",
"test": "pnpm build && playwright test",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check --plugin-search-dir=. . && eslint --max-warnings=0 .",
"lint": "pnpm run \"/lint:.*/\"",
"lint:stylelint": "pnpm stylelint --fix \"src/**/*.{svelte,css,scss}\"",
"lint:prettier": "prettier --check --plugin-search-dir=. .",
"lint:eslint": "eslint --max-warnings=0 .",
"format": "prettier --write --plugin-search-dir=. .",
"prebuild": "peggy --plugin ts-pegjs src/utils/search/parser.peggy -o src/utils/search/parser.ts",
"storybook": "storybook dev -p 6006",
Expand All @@ -26,7 +29,7 @@
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@fluent/bundle": "^0.18.0",
"@fontsource/m-plus-rounded-1c": "^5.0.11",
"@fontsource/m-plus-rounded-1c": "4.5.10",
"@fontsource/quicksand": "^5.0.16",
"@fontsource/roboto-mono": "^5.0.16",
"@playwright/test": "^1.40.1",
Expand Down Expand Up @@ -129,8 +132,10 @@
"*.{js,ts,jsx,tsx,svelte}": "eslint --cache --fix",
"*.{js,ts,jsx,tsx,svelte,css,scss,md}": "prettier --ignore-path .gitignore --write"
},
"packageManager": "[email protected]",
"resolutions": {
"@fontsource/[email protected]": "patch:@fontsource/m-plus-rounded-1c@npm%3A4.5.10#./.yarn/patches/@fontsource-m-plus-rounded-1c-npm-4.5.10-3cae002275.patch"
"packageManager": "[email protected]",
"pnpm": {
"patchedDependencies": {
"@fontsource/[email protected]": "patches/@[email protected]"
}
}
}
File renamed without changes.
Loading