Skip to content
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
3 changes: 1 addition & 2 deletions .github/workflows/set-up-everything/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ runs:
python-version: 3.12.4

- name: Install dependencies
# I learned about https://github.com/yarnpkg/yarn/issues/2739 painfully.
run: yarn --production=false --frozen-lockfile
run: yarn --immutable
shell: bash
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ node_modules/
yarn-error.log

.DS_Store

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.4.1-patched.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.4.1-patched.cjs
6 changes: 3 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This document aims to get you up-and-running developing on this project! If afte
At a minimum, you will need:

- Node.js, version 20 or higher
- Yarn 1.\* (i.e. classic Yarn)
- Yarn 4+
- a Bash shell

For the most enjoyable development experience, or if you plan to contribute to the [Adventure Pack](workspaces/adventure-pack/), you will additionally need:
Expand All @@ -19,7 +19,7 @@ See below for more context on each prerequisite and how to install it.

### Node

This project is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager. So even if you don't intend to write any TypeScript/JavaScript code, it will be beneficial to have a recent version of Node, so you can run the repository management code, which is generally written in TypeScript or JavaScript.
This project is structured as a Node module, using Yarn as the package manager. So even if you don't intend to write any TypeScript/JavaScript code, it will be beneficial to have a recent version of Node, so you can run the repository management code, which is generally written in TypeScript or JavaScript.

We recommend installing Node using the Node Version Manager (`nvm`). Follow the installation instructions at https://nvm.sh/ then:

Expand All @@ -33,7 +33,7 @@ node -v

### Yarn

As mentioned, Yarn (specifically [classic Yarn](https://classic.yarnpkg.com/)) is the package manager we currently use for the TypeScript/JavaScript code. If you have a recent version of Node, you will have access to all the package managers your heart desires, though you may need to enable them using [Corepack](https://nodejs.org/api/corepack.html):
As mentioned, [Yarn](https://yarnpkg.com/) is the package manager we currently use for the TypeScript/JavaScript code. If you have a recent version of Node, you will have access to all the package managers your heart desires, though you may need to enable them using [Corepack](https://nodejs.org/api/corepack.html):

```sh
# The `corepack` command is distributed with Node.
Expand Down
11 changes: 8 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import config from "@code-chronicles/eslint-config";
export default [
...config,
{
// Ignore the workspaces directory, it will handle its own linting.
// See the "lint" script in `package.json`.
ignores: ["workspaces/"],
ignores: [
// Ignore the workspaces directory, it will handle its own linting.
// See the "lint" script in `package.json`.
"workspaces/",

// Minified Yarn code!
".yarn/releases/",
],
},
];
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"workspaces/util"
],
"scripts": {
"format": "yarn --silent workspace @code-chronicles/repository-scripts start format",
"lint": "yarn --silent workspace @code-chronicles/repository-scripts start lint",
"test": "yarn --silent workspace @code-chronicles/repository-scripts start test",
"typecheck": "yarn --silent workspace @code-chronicles/repository-scripts start typecheck"
"format": "yarn workspace @code-chronicles/repository-scripts start format",
"lint": "yarn workspace @code-chronicles/repository-scripts start lint",
"test": "yarn workspace @code-chronicles/repository-scripts start test",
"typecheck": "yarn workspace @code-chronicles/repository-scripts start typecheck"
},
"devDependencies": {
"@code-chronicles/eslint-config": "0.0.1",
"eslint": "9.9.0",
"prettier": "3.3.3"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"packageManager": "yarn@4.4.1-patched"
}
2 changes: 1 addition & 1 deletion workspaces/download-leetcode-submissions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ As such it's safe to run the script multiple times, without redoing too much wor

## Development

Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager.
Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [Yarn](https://yarnpkg.com/) as the package manager.

You can install dependencies by running `yarn`, either in this package's directory, or in the repository root. The usual `yarn format`, `yarn lint`, and `yarn typecheck` scripts are available to aid in development and occasionally to annoy.

Expand Down
2 changes: 1 addition & 1 deletion workspaces/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default [...config, { ignores: ["dist/"] }];

## Development

Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager.
Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [Yarn](https://yarnpkg.com/) as the package manager.

You can install dependencies by running `yarn`, either in this package's directory, or in the repository root. The usual `yarn format` and `yarn lint` commands are available, but for the time being there is no `yarn typecheck`, since this package is pure JavaScript rather than TypeScript. (However, it hopefully will be [in the near future](https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files)!)

Expand Down
2 changes: 1 addition & 1 deletion workspaces/fetch-leetcode-problem-list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This repository includes [a Github Actions workflow](../../.github/workflows/upd

## Development

Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager.
Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [Yarn](https://yarnpkg.com/) as the package manager.

You can install dependencies by running `yarn`, either in this package's directory, or in the repository root. The usual `yarn format`, `yarn lint`, and `yarn typecheck` scripts are available to aid in development and occasionally to annoy. Read more in the repository's general [development guide](../../DEVELOPMENT.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ The output is JSON and will look something like:
}
```

You can redirect it to a file for later consumption. If using `yarn`, add the `--silent` flag to skip any output from Yarn itself:
You can redirect it to a file for later consumption:

```sh
yarn --silent start elimanzo VehicleOfPuzzle > data.json
yarn start elimanzo VehicleOfPuzzle > data.json
```

## Development

Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager.
Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [Yarn](https://yarnpkg.com/) as the package manager.

You can install dependencies by running `yarn`, either in this package's directory, or in the repository root. The usual `yarn format`, `yarn lint`, and `yarn typecheck` scripts are available to aid in development and occasionally to annoy. Read more in the repository's general [development guide](../../DEVELOPMENT.md).

Expand Down
2 changes: 1 addition & 1 deletion workspaces/leetcode-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Used to power sibling packages like:

## Development

Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager.
Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [Yarn](https://yarnpkg.com/) as the package manager.

You can install dependencies by running `yarn`, either in this package's directory, or in the repository root. The usual `yarn format`, `yarn lint`, and `yarn typecheck` scripts are available to aid in development and occasionally to annoy.

Expand Down
2 changes: 1 addition & 1 deletion workspaces/post-leetcode-potd-to-discord/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The script also checks that the problem date reported by the LeetCode API matche

## Development

Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager.
Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [Yarn](https://yarnpkg.com/) as the package manager.

You can install dependencies by running `yarn`, either in this package's directory, or in the repository root. The usual `yarn format`, `yarn lint`, and `yarn typecheck` scripts are available to aid in development and occasionally to annoy. Read more in the repository's general [development guide](../../DEVELOPMENT.md).

Expand Down
2 changes: 1 addition & 1 deletion workspaces/util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ console.log(stripPrefix("hello", "how"));

## Development

Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [classic Yarn](https://classic.yarnpkg.com/) as the package manager.
Like the rest of the [Code Chronicles Leetcode ecosystem](../../), this package is structured as a Node module, using [Yarn](https://yarnpkg.com/) as the package manager.

You can install dependencies by running `yarn`, either in this package's directory, or in the repository root. The usual `yarn format`, `yarn lint`, and `yarn typecheck` scripts are available to aid in development and occasionally to annoy. `yarn test` is also available, though we could definitely use more tests!

Expand Down
14 changes: 9 additions & 5 deletions workspaces/util/src/readWorkspaces.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { assertIsObject } from "@code-chronicles/util/assertIsObject";
import { assertIsString } from "@code-chronicles/util/assertIsString";
import { getLines } from "@code-chronicles/util/getLines";
import { execWithArgsOrThrowOnNzec } from "@code-chronicles/util/execWithArgsOrThrowOnNzec";

export async function readWorkspaces(): Promise<string[]> {
const yarnCommandResult = await execWithArgsOrThrowOnNzec("yarn", [
"--silent",
"workspaces",
"info",
"list",
"--json",
]);

return Object.keys(
assertIsObject(JSON.parse(yarnCommandResult.stdout)),
).sort();
return [...getLines(yarnCommandResult.stdout)]
.map((line) => assertIsObject(JSON.parse(line)))
.filter((workspace) => workspace.location !== ".")
.map(({ name }) => assertIsString(name))
.sort();
}
Loading