Skip to content

Commit

Permalink
chore: migrate to yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
phofmann committed Mar 19, 2024
1 parent 0e53584 commit 55e4c68
Show file tree
Hide file tree
Showing 19 changed files with 15,188 additions and 16,705 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FAST_REFRESH="true"
ENABLE_NEW_JSX_TRANSFORM="true"
APPLICATION_ID=TODO
APPLICATION_URL=https://your_app_hostname.com
HOST_GCP_STAGING=""
CTP_INITIAL_PROJECT_KEY=""
8 changes: 5 additions & 3 deletions .env.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FAST_REFRESH="true"
ENABLE_NEW_JSX_TRANSFORM="true"
ENABLE_EXPERIMENTAL_VITE_BUNDLER="true"
#CLOUD_IDENTIFIER=gcp-eu
#APPLICATION_ID=TODO
#APPLICATION_URL=https://your_app_hostname.com
#HOST_GCP_STAGING="europe-west1.gcp.commercetools.com"
#CTP_INITIAL_PROJECT_KEY=tech-sales-good-store
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Duplicate and rename this file to `.env`
# Duplicate and rename this file to `.env.local`

APPLICATION_ID="TODO"
APPLICATION_URL="https://your_app_hostname.com"
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,31 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
id: pnpm-install
with:
run_install: false
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Setup Node (uses version in .nvmrc)
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: pnpm install
run: yarn install --immutable

- name: Building application
run: pnpm build
run: yarn build

- name: Extract branch name
id: branch
Expand All @@ -44,7 +52,7 @@ jobs:
shell: bash

- name: Deploying to surge (preview)
run: pnpm run deploy
run: yarn deploy
env:
APPLICATION_ID: ${{ secrets.APPLICATION_ID_STAGING }}
APPLICATION_URL: https://graphql-explorer-commercetools-${{ steps.branch.outputs.name }}.surge.sh
Expand Down
30 changes: 19 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,34 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
id: pnpm-install
with:
run_install: false
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Setup Node (uses version in .nvmrc)
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: pnpm install
run: yarn install --immutable

- name: Building application
run: pnpm build
run: yarn build

- name: Deploying to surge (staging)
run: pnpm run deploy
run: yarn deploy
env:
APPLICATION_ID: ${{ secrets.APPLICATION_ID_STAGING }}
APPLICATION_URL: https://graphql-explorer-commercetools-staging.surge.sh
Expand All @@ -45,7 +53,7 @@ jobs:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}

- name: Deploying to surge (production eu)
run: pnpm run deploy
run: yarn deploy
env:
APPLICATION_ID: ${{ secrets.APPLICATION_ID_PRODUCTION_EU }}
APPLICATION_URL: https://graphql-explorer-commercetools-production-eu.surge.sh
Expand Down
32 changes: 20 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,43 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
id: pnpm-install
with:
run_install: false
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Setup Node (uses version in .nvmrc)
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: pnpm install
run: yarn install --immutable
env:
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L14-L18
# https://github.com/marketplace/actions/cypress-io#custom-install
CYPRESS_INSTALL_BINARY: 0

- name: Building application
run: pnpm build
run: yarn build
env:
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
APPLICATION_URL: https://graphql-explorer-commercetools-staging.surge.sh
HOST_GCP_STAGING: ${{ secrets.HOST_GCP_STAGING }}
CTP_INITIAL_PROJECT_KEY: ${{ secrets. CYPRESS_PROJECT_KEY }}

- name: Running linters and tests
run: pnpm jest --projects jest.{eslint,test}.config.js
run: yarn jest --projects jest.{eslint,test}.config.js
env:
CI: true

Expand All @@ -65,10 +73,10 @@ jobs:
key: ${{ runner.os }}-cypress-${{ hashFiles('**/package.json') }}

- name: Installing Cypress binary
run: pnpm cypress install && pnpm cypress cache list
run: yarn cypress install && yarn cypress cache list

- name: Running End-to-End tests
run: pnpm start-server-and-test 'pnpm start:prod:local' http-get://127.0.0.1:3001 'pnpm test:e2e'
run: yarn start-server-and-test 'yarn start:prod:local' 3001 'yarn test:e2e'
env:
NODE_ENV: test
CYPRESS_CI: "true"
Expand Down
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,11 @@ typings/
.yarn-integrity

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.yarn/

# dotenv environment variables file
.env
!.env
.env.local

# Lerna changelog cache
.changelog
Expand Down
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"

pnpm commitlint --edit $1
yarn 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"

pnpm lint-staged
yarn lint-staged
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ public/
.percy.yml
.cache
.yarn
pnpm-lock.yaml
pnpm-workspace.yaml
8 changes: 4 additions & 4 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
// Error: An error occurred while adding the reporter at path "/path/to/file".Reporter is not a constructor
//
// For that reason, we move the `--onlyChanged` flag next to it.
'pnpm lint --reporters=jest-silent-reporter --onlyChanged',
'yarn lint --reporters=jest-silent-reporter --onlyChanged',
],
'!(cypress)/**/*.{ts,tsx}': [
'prettier --write',
Expand All @@ -23,7 +23,7 @@ module.exports = {
// Error: An error occurred while adding the reporter at path "/path/to/file".Reporter is not a constructor
//
// For that reason, we move the `--onlyChanged` flag next to it.
'pnpm lint --passWithNoTests --reporters=jest-silent-reporter --onlyChanged',
'yarn lint --passWithNoTests --reporters=jest-silent-reporter --onlyChanged',
// Always include the `client.d.ts` file.
'tsc-files --noEmit node_modules/@commercetools-frontend/application-config/client.d.ts',
],
Expand All @@ -37,7 +37,7 @@ module.exports = {
// Error: An error occurred while adding the reporter at path "/path/to/file".Reporter is not a constructor
//
// For that reason, we move the `--onlyChanged` flag next to it.
'pnpm lint --reporters=jest-silent-reporter --onlyChanged',
() => 'pnpm typecheck:cypress',
'yarn lint --reporters=jest-silent-reporter --onlyChanged',
() => 'yarn typecheck:cypress',
],
};
72 changes: 35 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
"description": "",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"postinstall": "./scripts/postinstall.sh",
"build": "pnpm compile-data && mc-scripts build --build-only",
"build": "mc-scripts build",
"start": "mc-scripts start",
"compile-html": "NODE_ENV=production mc-scripts compile-html",
"compile-html:local": "NODE_ENV=production MC_APP_ENV=development mc-scripts compile-html --transformer @commercetools-frontend/mc-dev-authentication/transformer-local.js",
"start:prod:local": "pnpm compile-html:local && mc-scripts serve",
"extract-intl": "formatjs extract --format=./intl-formatter.js --out-file=./src/i18n/data/core.json 'src/**/!(*.spec).ts'",
"compile-data": "formatjs compile-folder --format=./intl-formatter.js --ast src/i18n/data src/i18n/compiled-data",
"lint": "jest --config jest.eslint.config.js",
"format": "prettier --write '**/*.{js,ts,tsx}'",
"postinstall": "./scripts/postinstall.sh",
"compile-html": "mc-scripts compile-html",
"compile-html:local": "MC_APP_ENV=development mc-scripts compile-html --transformer @commercetools-frontend/mc-dev-authentication/transformer-local.js",
"start:prod:local": "npm run compile-html:local && mc-scripts serve",
"extract-intl": "formatjs extract --format=./intl-formatter.js --out-file=./src/i18n/data/core.json 'src/**/!(*.spec).(ts|tsx)'",
"test": "jest --config jest.test.config.js",
"test:watch": "jest --config jest.test.config.js --watch",
"lint": "jest --config jest.eslint.config.js",
"format": "prettier --write '**/*.{js,ts,tsx}'",
"test:e2e": "cypress run",
"deploy": "pnpm compile-html && cp public/index.html public/200.html && echo '*' > public/CORS && surge public $APPLICATION_URL",
"typecheck": "tsc --noEmit",
"typecheck:cypress": "tsc --noEmit -p cypress"
"typecheck:cypress": "tsc --noEmit -p cypress",
"versions:appkit": "manypkg upgrade @commercetools-frontend",
"versions:uikit": "manypkg upgrade @commercetools-uikit",
"deploy": "yarn compile-html && cp public/index.html public/200.html && echo '*' > public/CORS && surge public $APPLICATION_URL",
"prepare": "husky"
},
"dependencies": {
"@apollo/client": "3.8.4",
Expand All @@ -44,18 +45,17 @@
"@commercetools-uikit/notifications": "18.4.0",
"@commercetools-uikit/spacings": "18.4.0",
"@commercetools-uikit/text": "18.4.0",
"@commercetools/http-user-agent": "3.0.0",
"@commitlint/cli": "17.7.1",
"@commitlint/config-conventional": "17.7.0",
"@emotion/react": "11.11.1",
"@commercetools/http-user-agent": "^3.0.0",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@emotion/react": "^11.11.1",
"@formatjs/cli": "6.2.0",
"@formatjs/ecma402-abstract": "^1.17.2",
"@formatjs/icu-messageformat-parser": "^2.6.2",
"@formatjs/intl": "^2.9.3",
"@formatjs/intl-displaynames": "^6.5.2",
"@formatjs/intl-listformat": "^7.4.2",
"@graphiql/react": "0.17.1",
"@graphiql/toolkit": "0.8.3",
"@graphiql/plugin-explorer": "^1.0.3",
"@manypkg/cli": "0.21.0",
"@testing-library/cypress": "10.0.1",
"@testing-library/react": "12.1.5",
Expand All @@ -68,23 +68,21 @@
"@types/react-dom": "^17.0.19",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"cypress": "13.2.0",
"dotenv": "16.3.1",
"eslint": "8.50.0",
"cypress": "^13.6.6",
"dotenv": "^16.4.5",
"eslint": "8.56.0",
"eslint-formatter-pretty": "4.1.0",
"graphiql": "2.4.1",
"graphiql-explorer": "0.9.0",
"graphiql": "^3.1.1",
"graphql": "16.8.1",
"graphql-config": "4.5.0",
"husky": "8.0.3",
"husky": "^9.0.11",
"intl-messageformat": "^10.5.3",
"jest": "29.7.0",
"jest-runner-eslint": "2.1.2",
"jest-silent-reporter": "0.5.0",
"jest-watch-typeahead": "2.2.2",
"lint-staged": "14.0.1",
"lint-staged": "^15.2.2",
"prettier": "3.0.3",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "6.4.7",
Expand All @@ -96,15 +94,15 @@
"tsc-files": "1.1.4",
"typescript": "5.0.4"
},
"packageManager": "pnpm@8.15.4",
"license": "MIT",
"pnpm": {
"overrides": {
"@flopflip/types": "13.1.3",
"@types/eslint": "^8.2.2"
},
"patchedDependencies": {
"@graphiql/react@0.17.1": "patches/@graphiql__react@0.17.1.patch"
}
}
"resolutions": {
"@formatjs/ecma402-abstract": "^1.11.8",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@types/eslint": "<9",
"@types/react": "<18",
"@types/react-dom": "<18",
"@types/react-router": "<6",
"@types/react-router-dom": "<6"
},
"license": "MIT"
}
Loading

0 comments on commit 55e4c68

Please sign in to comment.