Skip to content

R4 #1057

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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

R4 #1057

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions .changeset/common-jeans-throw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'simple-git': minor
---

Build tooling upgrade - pnpm, vite and vitest
1 change: 0 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@simple-git/test-utils"
]
}
12 changes: 7 additions & 5 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- run: yarn install --immutable
- run: yarn build
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm -r run build:publish

- uses: changesets/action@v1
with:
publish: yarn changeset publish
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ jobs:
node-version: [18, 20, 22, 23]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: yarn install --immutable
- run: yarn build
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm -r run build:publish
- name: Test
env:
GIT_AUTHOR_NAME: 'Simple Git Tests'
GIT_AUTHOR_EMAIL: '[email protected]'
run: yarn test
run: pnpm test
10 changes: 5 additions & 5 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn install --immutable
- run: yarn prettier --check .
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm prettier --check .
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.md
.changeset
.yarn
pnpm-lock.yaml
dist
coverage
node_modules
935 changes: 0 additions & 935 deletions .yarn/releases/yarn-4.7.0.cjs

This file was deleted.

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

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 Steve King
Copyright (c) 2025 Steve King

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
const { writeFile } = require('fs');
const { resolve } = require('path');
const { writeFile, existsSync } = require('fs');
const { resolve, basename } = require('path');
const { logger } = require('./log');

const input = process.argv[2];

if (!input || !input.startsWith('.')) {
console.error(`❌ Supply a relative path to a package.json in this repo`);
process.exit(1);
}

const src = resolve(__dirname, '../..', input);
if (!existsSync(src) || basename(src) !== 'package.json') {
console.error(`❌ Supply a valid path to a package.json in this repo`);
process.exit(1);
}

const log = logger('package.json');
const src = resolve(__dirname, '..', 'package.json');

(async function () {
log('Generating content');
const pkg = createPackageJson();
log('Writing content');
log('Writing content', pkg);
await save(pkg);
log('Done');
})();
Expand Down
11 changes: 0 additions & 11 deletions lerna.json

This file was deleted.

15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@
"name": "@simple-git/repo",
"version": "3.1.1",
"private": true,
"workspaces": [
"packages/*",
"simple-git"
],
"resolutions": {
"jest": "29.7.0"
},
"scripts": {
"build": "lerna run build",
"clean": "git clean -fxd -e .idea -e node_modules -e .yarn",
"clean:cache": "git clean -fxd .yarn node_modules packages simple-git",
"build": "pnpm -r run build",
"clean": "git clean -fxd packages simple-git",
"clean:cache": "git clean -fxd node_modules packages simple-git",
"format": "prettier --write .",
"test": "lerna run test"
"test": "pnpm -r run test"
},
"dependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.28.1",
"lerna": "^8.1.9",
"prettier": "^3.5.2"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].0"
}
6 changes: 3 additions & 3 deletions packages/babel-config/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function resolver(resolveToDist) {
const pkg = existsSync(dist) ? dist : root;

return [
'module-resolver',
require.resolve('babel-plugin-module-resolver'),
{
root: [pkg],
alias: {
Expand All @@ -23,14 +23,14 @@ module.exports = function (resolveToDist = false) {
return {
presets: [
[
'@babel/preset-env',
require.resolve('@babel/preset-env'),
{
targets: {
node: 'current',
},
},
],
'@babel/preset-typescript',
require.resolve('@babel/preset-typescript'),
],
plugins: [resolver(resolveToDist)],
};
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"main": "babel.config.js",
"devDependencies": {
"dependencies": {
"@babel/core": "^7.12.9",
"@babel/preset-env": "^7.12.7",
"@babel/preset-typescript": "^7.12.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-es-module-consumer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "node test.mjs"
},
"dependencies": {
"simple-git": "*"
"simple-git": "workspace:*"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/test-javascript-consumer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"private": true,
"version": "1.0.1",
"scripts": {
"test": "node test.js && node test-default.js"
"test": "node test.js"
},
"dependencies": {
"simple-git": "*"
"simple-git": "workspace:*"
},
"repository": {
"type": "git",
Expand Down
6 changes: 6 additions & 0 deletions packages/test-javascript-consumer/test-legacy-promise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { simpleGit, ResetMode } = require('simple-git/promise');
const { suite } = require('./suite');

(async () => {
await suite('require named', simpleGit, ResetMode);
})();
1 change: 1 addition & 0 deletions packages/test-javascript-consumer/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('./test-default');
require('./test-default-as');
require('./test-legacy-promise');
require('./test-named');
8 changes: 5 additions & 3 deletions packages/test-typescript-consumer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@
]
},
"scripts": {
"test": "yarn test:types && yarn test:jest",
"test": "pnpm run '/^test:/'",
"test:types": "tsc",
"test:jest": "jest"
},
"dependencies": {
"@simple-git/babel-config": "*",
"simple-git": "*"
"@simple-git/babel-config": "workspace:*",
"simple-git": "workspace:*"
},
"repository": {
"type": "git",
"url": "https://github.com/steveukx/git-js.git",
"directory": "packages/test-typescript-consumer"
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/node": "^24.0.10",
"jest": "^29.7.0",
"typescript": "^5.7.3"
}
Expand Down
6 changes: 4 additions & 2 deletions packages/test-typescript-esm-consumer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
"test": "jest"
},
"dependencies": {
"@simple-git/babel-config": "*",
"simple-git": "*"
"@simple-git/babel-config": "workspace:*",
"simple-git": "workspace:*"
},
"repository": {
"type": "git",
"url": "https://github.com/steveukx/git-js.git",
"directory": "packages/test-typescript-consumer"
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/node": "^24.0.10",
"jest": "^29.7.0"
}
}
8 changes: 7 additions & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"version": "4.0.0",
"private": true,
"peerDependencies": {
"simple-git": "*"
"simple-git": "workspace:*"
},
"devDependencies": {
"@types/node": "^24.0.10"
},
"dependencies": {
"vitest": "^3.2.4"
}
}
2 changes: 1 addition & 1 deletion packages/test-utils/src/create-abort-controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setMaxListeners } from 'events';
import { setMaxListeners } from 'node:events';

export function createAbortController() {
if (typeof AbortController === 'undefined') {
Expand Down
4 changes: 2 additions & 2 deletions packages/test-utils/src/create-test-context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'path';
import { existsSync, mkdir, mkdtemp, realpathSync, writeFile, WriteFileOptions } from 'fs';
import { join } from 'node:path';
import { existsSync, mkdir, mkdtemp, realpathSync, writeFile, WriteFileOptions } from 'node:fs';
import { simpleGit, SimpleGit } from 'simple-git';

export interface SimpleGitTestContext {
Expand Down
1 change: 1 addition & 0 deletions packages/test-utils/src/expectations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GitError, GitResponseError } from 'simple-git';
import { expect } from 'vitest';

/**
* Convenience for asserting the type and message of a `GitError`
Expand Down
6 changes: 4 additions & 2 deletions packages/test-utils/src/like.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export function like<T>(what: Partial<T>) {
return expect.objectContaining(what);
import { DeeplyAllowMatchers, expect } from 'vitest';

export function like<T>(what: DeeplyAllowMatchers<T>) {
return expect.objectContaining<T>(what);
}
18 changes: 18 additions & 0 deletions packages/test-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2018",
"module": "ESNext",
"lib": ["ES2020"],
"declaration": true,
"declarationDir": "dist/types",
"outDir": "dist",
"moduleResolution": "Node",
"esModuleInterop": true,
"skipLibCheck": true,
"strict": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "."
},
"files": ["index.ts"]
}
Loading