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

switch to pnpm #2379

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 21 additions & 14 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,41 @@ runs:
with:
node-version: 16.18

- name: restore workspace cache
uses: actions/cache@v3
id: node_modules
- uses: pnpm/action-setup@v2
with:
version: 8.1.0
run_install: false

- 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: |
node_modules
packages/*/node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock', 'patches/*.patch') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
node-modules-${{ runner.os }}-
${{ runner.os }}-pnpm-store-

- run: yarn install --frozen-lockfile --network-timeout 9000000
if: steps.node_modules.outputs.cache-hit != 'true'
- name: Install dependencies
shell: bash
run: pnpm install

- name: restore pkg cache
uses: actions/cache@v3
id: pkg
with:
path: ~/.pkg-cache
key: pkg-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
key: pkg-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pkg-cache-${{ runner.os }}-

- name: Install pkg node binaries
if: steps.pkg.outputs.cache-hit != 'true'
shell: bash
run: |
yarn pkg-fetch -n node16 -p macos -a x64
yarn pkg-fetch -n node16 -p win -a x64
yarn pkg-fetch -n node16 -p linux -a x64
pnpm pkg-fetch -n node16 -p macos -a x64
pnpm pkg-fetch -n node16 -p win -a x64
pnpm pkg-fetch -n node16 -p linux -a x64
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,29 +82,29 @@ Auto has an extensive plugin system and wide variety of official plugins. Make a
To get set up, fork and clone the project then run the following command:

```bash
yarn
pnpm
```

### Build/Typecheck

You must build at least once before running the tests or lint.

```bash
yarn build
pnpm build
```

In watch mode:

```bash
yarn start
pnpm start
```

### Installing the binary

Install the bundled binary onto your system. This requires the project to be built or in watch mode.

```bash
yarn install-mac
pnpm install-mac
```

If running this for the first time you may also have to run the following command.
Expand All @@ -116,25 +116,25 @@ chmod +x /usr/local/bin/auto
### Cleaning

```bash
yarn clean
pnpm clean
```

### Linting

```bash
yarn lint
pnpm lint
```

### Testing

```bash
yarn test
pnpm test
```

### Run the docs

```bash
yarn docs
pnpm docs
```

### Create a new plugin
Expand All @@ -147,7 +147,7 @@ The two arguments are:
2. A description

```bash
yarn create:plugin my-plugin "Do something really cool"
pnpm create:plugin my-plugin "Do something really cool"
```

### Create a new package
Expand All @@ -160,7 +160,7 @@ The two arguments are:
2. A description

```bash
yarn create:package my-package "Do something really cool"
pnpm create:package my-package "Do something really cool"
```

## :beers: Contributing :beers:
Expand Down Expand Up @@ -324,7 +324,7 @@ This project follows the [all-contributors](https://github.com/kentcdodds/all-co

### Adding a Contributor

To add a contributor run `yarn contributors:add`, choose "Add new contributor or edit contribution type" and follow the prompts.
To add a contributor run `pnpm contributors:add`, choose "Add new contributor or edit contribution type" and follow the prompts.

## License

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "11.0.0",
"npmClient": "yarn",
"npmClient": "yapnpmrn",
"packages": [
"packages/*",
"plugins/*"
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"auto": "chmod +x ./packages/cli/dist/bin/auto.js && ./packages/cli/dist/bin/auto.js",
"contributors:add": "all-contributors",
"contributors:generate": "all-contributors generate",
"docs": "yarn docs:generate && ignite dev",
"docs": "pnpm docs:generate && ignite dev",
"docs:generate": "./docs/generate-command-docs.js",
"docs:build": "yarn docs:generate && ignite build",
"docs:build": "pnpm docs:generate && ignite build",
"create:plugin": "./scripts/create-plugin.js",
"create:package": "./scripts/create-package.js",
"install-mac": "yarn lerna run bundle --scope=auto && gunzip -c ./packages/cli/binary/auto-macos.gz > /usr/local/bin/auto",
"install-mac": "pnpm lerna run bundle --scope=auto && gunzip -c ./packages/cli/binary/auto-macos.gz > /usr/local/bin/auto",
"postinstall": "patch-package"
},
"devDependencies": {
Expand All @@ -51,7 +51,7 @@
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"all-contributors-cli": "^6.4.0",
"change-case": "^4.0.0",
"change-case": "^4.1.2",
"command-line-docs": "^0.0.6",
"copy-template-dir": "^1.4.0",
"endent": "^2.1.0",
Expand All @@ -72,13 +72,14 @@
"mock-fs": "^5.1.2",
"next-ignite": "^0.10.11",
"patch-package": "^6.2.2",
"pkg-fetch": "^3.5.2",
"prettier": "^2.2.1",
"push-dir": "^0.4.1",
"rimraf": "^3.0.0",
"simple-react-lightbox": "^3.1.2-3",
"title-case": "^3.0.2",
"ts-jest": "^26.1.3",
"typescript": "~4.2.3",
"typescript": "~5.1.6",
"webpack": "^4.46.0"
},
"husky": {
Expand All @@ -92,7 +93,7 @@
],
"*.{ts,tsx}": [
"prettier --parser typescript --write",
"yarn lint --fix"
"pnpm lint --fix"
]
},
"jest": {
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@
"start": "npm run build -- -w",
"lint": "eslint src --ext .ts",
"test": "jest --maxWorkers=2",
"bundle": "yarn inject-version && yarn package && yarn gzip",
"bundle": "pnpm inject-version && pnpm package && pnpm gzip",
"inject-version": "node scripts/inject-version.js",
"package": "rimraf binary && pkg . --out-path binary",
"gzip": "ls binary/auto* | xargs gzip"
},
"dependencies": {
"@auto-it/core": "link:../core",
"@auto-it/npm": "link:../../plugins/npm",
"@auto-it/released": "link:../../plugins/released",
"@auto-it/version-file": "link:../../plugins/version-file",
"@auto-it/core": "workspace:*",
"@auto-it/npm": "workspace:*",
"@auto-it/released": "workspace:*",
"@auto-it/version-file": "workspace:*",
"await-to-js": "^3.0.0",
"chalk": "^4.0.0",
"command-line-application": "^0.10.1",
Expand Down
15 changes: 13 additions & 2 deletions packages/cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ export async function execute(command: string, args: ApiOptions) {
throw new Error(`idk what i'm doing.`);
}
} catch (error) {
if (error.status === 404) {
if (
error &&
typeof error === "object" &&
"status" in error &&
error.status === 404
) {
const [, project] = await on(auto.git!.getProject());
const repoLink = link(
`${auto.git?.options.owner}/${auto.git?.options.repo}`,
Expand All @@ -118,7 +123,13 @@ export async function execute(command: string, args: ApiOptions) {
`);
console.log("");
auto.logger.verbose.error(error);
} else if (error.message.includes("TypeError: Cannot read property 'tap")) {
} else if (
error &&
typeof error === "object" &&
"message" in error &&
typeof error.message === "string" &&
error.message.includes("TypeError: Cannot read property 'tap")
) {
auto.logger.log.error(endent`
One of the plugins you're using calls an unknown hook!

Expand Down
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
"test": "jest --maxWorkers=2 --config ../../package.json"
},
"dependencies": {
"@auto-it/bot-list": "link:../../packages/bot-list",
"@auto-it/bot-list": "workspace:*",
"@endemolshinegroup/cosmiconfig-typescript-loader": "^3.0.2",
"@octokit/core": "^3.5.1",
"@octokit/plugin-paginate-rest": "^2.21.3",
"@octokit/plugin-enterprise-compatibility": "1.3.0",
"@octokit/plugin-retry": "^3.0.9",
"@octokit/plugin-throttling": "^3.6.2",
Expand All @@ -48,18 +49,18 @@
"chalk": "^4.0.0",
"cosmiconfig": "7.0.0",
"deepmerge": "^4.0.0",
"dotenv": "^8.0.0",
"dotenv": "^15.0.0",
"endent": "^2.1.0",
"enquirer": "^2.3.4",
"enquirer": "^2.4.0",
"env-ci": "^5.0.1",
"fast-glob": "^3.1.1",
"fp-ts": "^2.5.3",
"fp-ts": "^2.16.1",
"fromentries": "^1.2.0",
"gitlog": "^4.0.3",
"https-proxy-agent": "^5.0.0",
"import-cwd": "^3.0.0",
"import-from": "^3.0.0",
"io-ts": "^2.1.2",
"io-ts": "^2.2.20",
"lodash.chunk": "^4.2.0",
"log-symbols": "^4.0.0",
"node-fetch": "2.6.7",
Expand Down Expand Up @@ -87,7 +88,6 @@
}
},
"devDependencies": {
"@types/dotenv": "^8.2.0",
"@types/env-ci": "^3.1.0",
"@types/graphql": "^14.2.0",
"@types/jest": "~26.0.7",
Expand Down
17 changes: 14 additions & 3 deletions packages/core/src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,11 @@ export default class Auto {
});
} catch (error) {
throw new Error(
`Failed to post status to Pull Request with error code ${error.status}`
`Failed to post status to Pull Request with error code ${
error && typeof error === "object" && "status" in error
? error.status
: ""
}`
);
}

Expand Down Expand Up @@ -1076,7 +1080,10 @@ export default class Auto {
}
} catch (error) {
msg = {
description: error.message,
description:
error && typeof error === "object" && "message" in error
? error.message
: "",
state: "error",
};
}
Expand All @@ -1097,7 +1104,11 @@ export default class Auto {
this.logger.log.success("Posted status to Pull Request.");
} catch (error) {
throw new Error(
`Failed to post status to Pull Request with error code ${error.status}`
`Failed to post status to Pull Request with error code ${
error && typeof error === "object" && "status" in error
? error.status
: ""
}`
);
}
}
Expand Down
9 changes: 8 additions & 1 deletion packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,14 @@ export default class Config {
config = (await fetch(extend)).json();
this.logger.verbose.note(`${extend} found: ${config}`);
} catch (error) {
error.message = `Failed to get extended config from ${extend} -- ${error.message}`;
if (
error &&
typeof error === "object" &&
"message" in error &&
typeof error.message === "object"
) {
error.message = `Failed to get extended config from ${extend} -- ${error.message}`;
}
throw error;
}
} else if (extend.startsWith(".")) {
Expand Down