mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
enh: Switch to pnpm (#3820)
This commit is contained in:
parent
258afbd347
commit
558cdb4f7a
@ -29,7 +29,7 @@ executors:
|
||||
|
||||
playwright-executor:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/playwright:v1.56.1-noble
|
||||
- image: mcr.microsoft.com/playwright:v1.57.0-noble
|
||||
resource_class: medium
|
||||
working_directory: ~/project
|
||||
|
||||
@ -57,18 +57,17 @@ commands:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "yarn.lock" }}
|
||||
- v1-dependencies-{{ checksum "pnpm-lock.yaml" }}
|
||||
- v1-dependencies-
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: |
|
||||
yarn install --frozen-lockfile
|
||||
echo "PLAYWRIGHT_VERSION=$(yarn info @playwright/test -A --json | jq '.children.Version')" >> $BASH_ENV
|
||||
pnpm install --frozen-lockfile
|
||||
echo "PLAYWRIGHT_VERSION=$(pnpm view @playwright/test version --json | jq -r '.')" >> $BASH_ENV
|
||||
- save_cache:
|
||||
key: v1-dependencies-{{ checksum "yarn.lock" }}
|
||||
key: v1-dependencies-{{ checksum "pnpm-lock.yaml" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- .yarn/cache
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
@ -85,7 +84,7 @@ commands:
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-nx-cache-{{ checksum "yarn.lock" }}
|
||||
- v1-nx-cache-{{ checksum "pnpm-lock.yaml" }}
|
||||
- v1-nx-cache-
|
||||
- run:
|
||||
name: Setup NX
|
||||
@ -95,7 +94,7 @@ commands:
|
||||
description: 'Save NX cache'
|
||||
steps:
|
||||
- save_cache:
|
||||
key: v1-nx-cache-{{ checksum "yarn.lock" }}
|
||||
key: v1-nx-cache-{{ checksum "pnpm-lock.yaml" }}
|
||||
paths:
|
||||
- .nx/cache
|
||||
|
||||
@ -113,7 +112,7 @@ commands:
|
||||
environment:
|
||||
NODE_OPTIONS: '--max-old-space-size=3584'
|
||||
JEST_MAX_WORKERS: '1'
|
||||
command: yarn test:<< parameters.test_type >> --projects=<< parameters.package >>
|
||||
command: pnpm test:<< parameters.test_type >> --projects=<< parameters.package >>
|
||||
no_output_timeout: 30m
|
||||
- save_nx_cache
|
||||
|
||||
@ -135,7 +134,7 @@ jobs:
|
||||
- setup_nx_cache
|
||||
- run:
|
||||
name: Build packages
|
||||
command: yarn build
|
||||
command: pnpm build
|
||||
- save_nx_cache
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
@ -150,7 +149,7 @@ jobs:
|
||||
- setup_nx_cache
|
||||
- run:
|
||||
name: Lint code
|
||||
command: yarn lint
|
||||
command: pnpm lint
|
||||
- save_nx_cache
|
||||
|
||||
format:
|
||||
@ -161,7 +160,7 @@ jobs:
|
||||
- setup_nx_cache
|
||||
- run:
|
||||
name: Check formatting
|
||||
command: yarn format
|
||||
command: pnpm format
|
||||
- save_nx_cache
|
||||
|
||||
# ====================
|
||||
@ -235,7 +234,9 @@ jobs:
|
||||
- restore_workspace
|
||||
- run:
|
||||
name: Reinstall SWC for Ubuntu
|
||||
command: yarn add @swc/core
|
||||
command: |
|
||||
npm install -g pnpm@10.28.0
|
||||
pnpm -w --store-dir /home/circleci/.local/share/pnpm/store/v3 add @swc/core
|
||||
- run_package_tests:
|
||||
package: '@gitbeaker/rest'
|
||||
test_type: 'integration'
|
||||
@ -358,7 +359,9 @@ jobs:
|
||||
fi
|
||||
- run:
|
||||
name: Reinstall SWC for Ubuntu
|
||||
command: yarn add @swc/core
|
||||
command: |
|
||||
npm install -g pnpm@10.28.0
|
||||
pnpm -w --store-dir /home/circleci/.local/share/pnpm/store/v3 add @swc/core
|
||||
- run_package_tests:
|
||||
package: '@gitbeaker/rest'
|
||||
test_type: 'e2e'
|
||||
@ -421,7 +424,7 @@ jobs:
|
||||
if [ -f "$coverage_file" ]; then
|
||||
package=$(basename $(dirname $(dirname "$coverage_file")))
|
||||
echo "Uploading coverage for ${package}..."
|
||||
yarn dlx @codecov/cli upload-coverage \
|
||||
pnpm dlx @codecov/cli upload-coverage \
|
||||
--file "$coverage_file" \
|
||||
--flags ${package}
|
||||
fi
|
||||
@ -434,7 +437,7 @@ jobs:
|
||||
if [ -d "$reports_dir" ] && [ "$(ls -A "$reports_dir"/*.xml 2>/dev/null)" ]; then
|
||||
package=$(basename $(dirname "$reports_dir"))
|
||||
echo "Uploading test results for ${package}..."
|
||||
yarn dlx @codecov/cli upload-test-results \
|
||||
pnpm dlx @codecov/cli upload-test-results \
|
||||
--dir "$reports_dir"
|
||||
fi
|
||||
done
|
||||
@ -446,7 +449,7 @@ jobs:
|
||||
if [ -d "$dist_dir" ]; then
|
||||
package=$(basename $(dirname "$dist_dir"))
|
||||
echo "Uploading bundle analysis for ${package}..."
|
||||
yarn dlx @codecov/bundle-analyzer "$dist_dir" \
|
||||
pnpm dlx @codecov/bundle-analyzer "$dist_dir" \
|
||||
--bundle-name=${package} \
|
||||
--upload-token=$CODECOV_TOKEN
|
||||
fi
|
||||
@ -471,7 +474,7 @@ jobs:
|
||||
command: |
|
||||
export PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's/.*\/pull\///')
|
||||
|
||||
yarn release:canary
|
||||
pnpm release:canary
|
||||
|
||||
release-production:
|
||||
executor: node-executor
|
||||
@ -491,7 +494,7 @@ jobs:
|
||||
command: |
|
||||
export PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's/.*\/pull\///')
|
||||
|
||||
yarn release
|
||||
pnpm release
|
||||
|
||||
# ====================
|
||||
# WORKFLOWS
|
||||
|
||||
@ -15,7 +15,7 @@ The easiest way to run the full test suite is using Docker, which provides a con
|
||||
Run the complete test suite (unit + integration + e2e):
|
||||
|
||||
```bash
|
||||
yarn test:full
|
||||
pnpm test:full
|
||||
```
|
||||
|
||||
This command will:
|
||||
@ -33,16 +33,16 @@ You can also run specific test types individually:
|
||||
|
||||
```bash
|
||||
# Type tests only
|
||||
yarn test:types
|
||||
pnpm test:types
|
||||
|
||||
# Unit tests only
|
||||
yarn test:unit
|
||||
pnpm test:unit
|
||||
|
||||
# Integration tests only (requires GitLab running)
|
||||
yarn test:integration
|
||||
pnpm test:integration
|
||||
|
||||
# End-to-end tests only
|
||||
yarn test:e2e
|
||||
pnpm test:e2e
|
||||
```
|
||||
|
||||
### Manual GitLab Instance
|
||||
@ -66,7 +66,7 @@ For contributors who prefer to test locally without Docker:
|
||||
### Unit Tests
|
||||
|
||||
```bash
|
||||
yarn test:unit
|
||||
pnpm test:unit
|
||||
```
|
||||
|
||||
### Integration Tests
|
||||
@ -87,19 +87,19 @@ export GITLAB_PERSONAL_ACCESS_TOKEN="superstrongpassword123"
|
||||
3. Run the integration tests:
|
||||
|
||||
```bash
|
||||
yarn test:integration
|
||||
pnpm test:integration
|
||||
```
|
||||
|
||||
You can also define them inline:
|
||||
|
||||
```bash
|
||||
GITLAB_URL='http://localhost:8080' GITLAB_PERSONAL_ACCESS_TOKEN='superstrongpassword123' yarn test:integration
|
||||
GITLAB_URL='http://localhost:8080' GITLAB_PERSONAL_ACCESS_TOKEN='superstrongpassword123' pnpm test:integration
|
||||
```
|
||||
|
||||
### End-to-End Tests
|
||||
|
||||
```bash
|
||||
yarn test:e2e
|
||||
pnpm test:e2e
|
||||
```
|
||||
|
||||
> **Note:** It may take about 3 minutes for GitLab to fully start up in the container
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export default {
|
||||
'**/*.{ts,js,json,md,yml}': ['yarn format:fix'],
|
||||
'**/*.{ts,js}': ['yarn lint:fix'],
|
||||
'**/*.{ts,js,json,md,yml}': ['pnpm --workspace-root format:fix'],
|
||||
'**/*.{ts,js}': ['pnpm --workspace-root lint:fix'],
|
||||
};
|
||||
|
||||
17
package.json
17
package.json
@ -7,21 +7,20 @@
|
||||
"url": "https://github.com/jdalrymple/gitbeaker/issues"
|
||||
},
|
||||
"author": "Justin Dalrymple",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"tar": "^7.5.3"
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"tar": "^7.5.3"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "nx run-many --target=build",
|
||||
"lint": "nx run-many --target=lint",
|
||||
"lint:fix": "nx run-many --target=lint:fix",
|
||||
"clean": "yarn dlx rimraf --glob '**/{tmp,dist,node_modules,coverage,reports}'",
|
||||
"clean": "pnpm dlx rimraf --glob '**/{tmp,dist,node_modules,coverage,reports}'",
|
||||
"format:docs": "prettier './**/(*.json|*.yml|*.md|*.(c|m)js|*.(c|m)ts)' --ignore-path ./.prettierignore --config ./prettier.config.mjs --check ",
|
||||
"format:src": "prettier '**/{src,test,scripts}/**/*.ts' --ignore-path ./.prettierignore --config ./prettier.config.mjs --check",
|
||||
"format": "yarn format:src && yarn format:docs",
|
||||
"format:fix": "yarn format:src --write && yarn format:docs --write",
|
||||
"format": "pnpm format:src && pnpm format:docs",
|
||||
"format:fix": "pnpm format:src --write && pnpm format:docs --write",
|
||||
"test:types": "nx run-many --target=test:types",
|
||||
"test:unit": "nx run-many --target=test:unit",
|
||||
"test:integration": "nx run-many --target=test:integration",
|
||||
@ -64,5 +63,5 @@
|
||||
"tsup": "^8.5.1",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"packageManager": "yarn@4.11.0"
|
||||
"packageManager": "pnpm@9.15.2"
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
Node 18+
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install -g @gitbeaker/cli</code>, or <code>yarn add -g @gitbeaker/cli</code>
|
||||
Install with <code>npm install -g @gitbeaker/cli</code>, <code>yarn add -g @gitbeaker/cli</code>, or <code>pnpm add -g @gitbeaker/cli</code>
|
||||
|
||||
```bash
|
||||
gitbeaker [service name] [method name] --config_args pos_arg1 pos_argN --opts_arg1 --opts_argN
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
"test:unit": "jest --maxWorkers=50% test/unit",
|
||||
"test:e2e": "jest --maxWorkers=50% test/e2e",
|
||||
"lint": "eslint '**/{src,test,scripts}/**/*.ts'",
|
||||
"lint:fix": "yarn lint --fix"
|
||||
"lint:fix": "pnpm lint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gitbeaker/core": "^43.8.0",
|
||||
|
||||
@ -87,7 +87,7 @@ import { Gitlab } from 'https://esm.sh/@gitbeaker/core?dts';
|
||||
Node 18+
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @gitbeaker/core</code>, or <code>yarn add @gitbeaker/core</code>
|
||||
Install with <code>npm install @gitbeaker/core</code>, <code>yarn add @gitbeaker/core</code>, or <code>pnpm add @gitbeaker/core</code>
|
||||
|
||||
```js
|
||||
import { Gitlab } from '@gitbeaker/core';
|
||||
|
||||
@ -42,14 +42,14 @@
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "yarn run build:map && yarn run build:self",
|
||||
"build": "pnpm run build:map && pnpm run build:self",
|
||||
"build:map": "tsx scripts/generate.ts",
|
||||
"build:self": "tsup src/index.ts --format esm,cjs --dts --treeshake",
|
||||
"test:types": "tsc",
|
||||
"test:integration": "jest --maxWorkers=50% test/integration",
|
||||
"test:unit": "jest --maxWorkers=50% test/unit",
|
||||
"lint": "eslint '**/{src,test,scripts}/**/*.ts'",
|
||||
"lint:fix": "yarn lint --fix"
|
||||
"lint:fix": "pnpm lint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gitbeaker/requester-utils": "^43.8.0",
|
||||
|
||||
@ -88,7 +88,7 @@ import { RequesterUtils, BaseResource } from 'https://esm.sh/@gitbeaker/requeste
|
||||
Node 18+
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @gitbeaker/requester-utils</code>, or <code>yarn add @gitbeaker/requester-utils</code>
|
||||
Install with <code>npm install @gitbeaker/requester-utils</code>, <code>yarn add @gitbeaker/requester-utils</code>, or <code>pnpm add @gitbeaker/requester-utils</code>
|
||||
|
||||
```js
|
||||
import { RequesterUtils, BaseResource } from '@gitbeaker/requester-utils';
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
"test:types": "tsc",
|
||||
"test:unit": "jest --maxWorkers=50% test/unit",
|
||||
"lint": "eslint '**/{src,test,scripts}/**/*.ts'",
|
||||
"lint:fix": "yarn lint --fix"
|
||||
"lint:fix": "pnpm lint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"picomatch-browser": "^2.2.6",
|
||||
|
||||
@ -102,7 +102,7 @@ import { Gitlab } from 'https://esm.sh/@gitbeaker/rest?dts';
|
||||
Node 18+
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @gitbeaker/rest</code>, or <code>yarn add @gitbeaker/rest</code>
|
||||
Install with <code>npm install @gitbeaker/rest</code>, <code>yarn add @gitbeaker/rest</code>, or <code>pnpm add @gitbeaker/rest</code>
|
||||
|
||||
```js
|
||||
import { Gitlab } from '@gitbeaker/rest';
|
||||
|
||||
@ -46,19 +46,19 @@
|
||||
"test:types": "tsc",
|
||||
"test:e2e:browser": "playwright test --project=e2e",
|
||||
"test:e2e:nodejs": "jest --maxWorkers=50% test/e2e/nodejs",
|
||||
"test:e2e": "yarn test:e2e:browser && yarn test:e2e:nodejs",
|
||||
"test:e2e": "pnpm test:e2e:browser && pnpm test:e2e:nodejs",
|
||||
"test:integration:browser": "playwright test --project=integration",
|
||||
"test:integration": "yarn test:integration:browser",
|
||||
"test:integration": "pnpm test:integration:browser",
|
||||
"test:unit": "jest --maxWorkers=50% test/unit",
|
||||
"lint": "eslint '**/{src,test,scripts}/**/*.ts'",
|
||||
"lint:fix": "yarn lint --fix"
|
||||
"lint:fix": "pnpm lint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gitbeaker/core": "^43.8.0",
|
||||
"@gitbeaker/requester-utils": "^43.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.56.1",
|
||||
"@playwright/test": "1.57.0",
|
||||
"@types/node": "^24.10.1",
|
||||
"tsup": "^8.5.1",
|
||||
"typescript": "^5.9.3"
|
||||
|
||||
7876
pnpm-lock.yaml
generated
Normal file
7876
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
packages:
|
||||
- 'packages/*'
|
||||
@ -51,28 +51,28 @@ echo -e "${YELLOW}Running tests locally with GitLab environment...${NC}"
|
||||
|
||||
# Clean artifacts
|
||||
echo "Clean artifacts..."
|
||||
yarn clean
|
||||
pnpm clean
|
||||
|
||||
# Clean artifacts
|
||||
echo "Install deps..."
|
||||
yarn install
|
||||
pnpm install
|
||||
|
||||
# Build
|
||||
echo "Building project..."
|
||||
yarn build
|
||||
pnpm build
|
||||
|
||||
# Run the tests
|
||||
echo "Running type tests..."
|
||||
yarn test:types
|
||||
pnpm test:types
|
||||
|
||||
echo "Running unit tests..."
|
||||
yarn test:unit
|
||||
pnpm test:unit
|
||||
|
||||
echo "Running integration tests..."
|
||||
yarn test:integration
|
||||
pnpm test:integration
|
||||
|
||||
echo "Running e2e tests..."
|
||||
yarn test:e2e
|
||||
pnpm test:e2e
|
||||
|
||||
echo -e "${GREEN}All tests completed successfully!${NC}"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user