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 #670

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b51fbfe
Switch to pnpm
NullVoxPopuli Jan 5, 2024
a23c392
Tell volta (local) to use pnpm
NullVoxPopuli Jan 5, 2024
d5b45fe
update CI
NullVoxPopuli Jan 5, 2024
aa69d6b
Remove references to yarn, and don't try to format yaml files with pr…
NullVoxPopuli Jan 5, 2024
c1f481e
Set stricter defaults for library development
NullVoxPopuli Jan 5, 2024
6dbe991
regenerate lockfile with new settings, resolution-mode=highest
NullVoxPopuli Jan 5, 2024
1369b38
Set minimum @glimmer/validator
NullVoxPopuli Jan 5, 2024
6d7ff8c
Use workspace protocol
NullVoxPopuli Jan 5, 2024
78fdb8b
specify appropriate devDeps so TS can find types
NullVoxPopuli Jan 5, 2024
3dc02ed
lockfile
NullVoxPopuli Jan 5, 2024
bfc8ef5
We cannot depend on @glimmer for types, because @glimmer is ESM, and …
NullVoxPopuli Jan 5, 2024
52e24f0
Oooooooof
NullVoxPopuli Jan 5, 2024
cd907cd
Revert "Oooooooof"
NullVoxPopuli Jan 5, 2024
12bb631
Set to shamefully-hoist, because this monorepo relied on a ton of bro…
NullVoxPopuli Jan 5, 2024
9958a2f
Add missing dependencies
NullVoxPopuli Jan 5, 2024
c9a1cff
🎼 Everything is broken 🎵
NullVoxPopuli Jan 5, 2024
79d7153
formatting
NullVoxPopuli Jan 5, 2024
878acbf
Revert some path changes
NullVoxPopuli Jan 5, 2024
1fe8753
Update test app deps to get types
NullVoxPopuli Jan 5, 2024
6047c7d
the tsconfig for the template __tests__ project is wrong, try to do m…
NullVoxPopuli Jan 5, 2024
6c61e94
true is not a test command
NullVoxPopuli Jan 5, 2024
8d31915
Format
NullVoxPopuli Jan 5, 2024
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
65 changes: 19 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
with:
node-version: 16
- name: Locate Yarn Cache
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
run: pnpm lint
- name: Build
run: yarn build
run: pnpm build
- name: Run Tests
uses: coactions/setup-xvfb@v1
with:
run: yarn test
run: pnpm test

# The Windows runner can be super flaky both with Yarn installs and
# when launching browser tests, so we allow for retries in those steps.
Expand All @@ -56,7 +44,7 @@ jobs:
runs-on: windows-2022
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v3
with:
Expand All @@ -66,67 +54,52 @@ jobs:
with:
max_attempts: 2
timeout_minutes: 10
command: yarn install --frozen-lockfile
command: pnpm install
- name: Build
run: yarn build
run: pnpm build
- name: Test @glint/core
uses: nick-fields/retry@v2
with:
max_attempts: 2
timeout_minutes: 20
command: yarn workspace @glint/core test
command: pnpm --filter '@glint/core' test
- name: Test glint-vscode
uses: nick-fields/retry@v2
with:
max_attempts: 2
timeout_minutes: 10
command: yarn workspace glint-vscode test
command: pnpm --filter 'glint-vscode' test
- name: Test @glint/scripts
run: yarn workspace @glint/scripts test
run: pnpm --filter '@glint/scripts' test

test-floating-deps:
name: Test Floating Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
with:
node-version: 16
- name: Install Dependencies
run: yarn install --no-lockfile
- name: Build
run: yarn build
run: pnpm build
- name: Run Tests
uses: coactions/setup-xvfb@v1
with:
run: yarn test
run: pnpm test

test-ts-nightly:
name: Test TypeScript Nightly
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
with:
node-version: 16
- name: Locate Yarn Cache
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn add --dev -W typescript@next
- name: Build
run: yarn build
run: pnpm build
- name: Run Tests
uses: coactions/setup-xvfb@v1
with:
run: yarn test
run: pnpm test
14 changes: 14 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# as a library, we want to make sure we explicitly handle peers,
# and not rely on hidden behavior of package-managers.
auto-install-peers=false

# we never want to use packages from the registry over what's in the workspace
prefer-workspaces-packages=true

# use the highest version possible
resolution-mode=highest

# when migrating from yarn, too much sloppiness was revealed to
# deal with in one PR.
# This setting re-creates yarn's broken dep management behavior
shamefully-hoist=true
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ dist/
# the formatting applied by Gitbook. Having both present is a recipe for ongoing
# CI problems.
*.md
*.yml
*.yaml
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ We welcome contributions to Glint! To help us help you be successful, please fol

## Working on the project

Glint is a family of packages which all live in this repo as a Yarn workspace. To be most successful here, you should:
Glint is a family of packages which all live in this repo as a pnpm workspace. To be most successful here, you should:

- Install [Volta](https://volta.sh), a JavaScript toolchain manager we use to make sure everyone working on the project is using the same versions of Node and Yarn.
- Install [Volta](https://volta.sh), a JavaScript toolchain manager we use to make sure everyone working on the project is using the same versions of Node and pnpm.
- Clone the repo.
- Run `yarn` in the root of the repo to install all the package dependencies. If you have Volta installed, it will automatically fetch and use the correct versions of Node and Yarn for you.
- Run `yarn build` in the root of the repository to build all of the projects the first time. This will make sure that once you start working on one of the packages, you are working with an up to date version of the other packages in the project it depends on.
- Run `pnpm install` in the root of the repo to install all the package dependencies. If you have Volta installed, it will automatically fetch and use the correct versions of Node and Yarn for you.
- Run `pnpm build` in the root of the repository to build all of the projects the first time. This will make sure that once you start working on one of the packages, you are working with an up to date version of the other packages in the project it depends on.
- Read the project’s [ARCHITECTURE.md](./ARCHITECTURE.md) to understand the basics of how the code base works.

Once you have made changes and added tests to confirm they work correctly, you can then open a PR and we'll work with you to polish it up and get it landed!
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@
"name": "glint",
"repository": "https://github.com/typed-ember/glint",
"private": true,
"workspaces": [
"packages/*",
"test-packages/*"
],
"scripts": {
"lint": "yarn lint:scripts && yarn lint:formatting",
"lint:scripts": "yarn eslint --max-warnings 0 --cache .",
"lint:formatting": "yarn prettier --check .",
"test": "yarn workspaces run test",
"lint": "pnpm lint:scripts && pnpm lint:formatting",
"lint:scripts": "pnpm eslint --max-warnings 0 --cache .",
"lint:formatting": "pnpm prettier --check .",
"test": "pnpm --filter '*' run test",
"build": "tsc --build",
"release-it": "echo \"Running release-it via yarn breaks publishing! Use npx or a Volta global installation.\""
},
"volta": {
"node": "16.17.1",
"yarn": "1.22.4"
"pnpm": "8.14.0"
},
"devDependencies": {
"@release-it-plugins/lerna-changelog": "^5.0.0",
"@release-it-plugins/workspaces": "^3.2.0",
"@types/babel__traverse": "^7.18.2",
"@types/node": "^18.11.5",
"@types/yargs": "^17.0.10",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
Expand All @@ -30,7 +27,13 @@
"release-it": "^15.5.0",
"typescript": "~4.8.0"
},
"pnpm": {
"overrides": {
"@glimmer/validator": ">= 0.83.0"
}
},
"resolutions:notes": {
"@glimmer/validator": "Due to semver, and some dependency in the graph specifying @glimmer/validator 0.44, 0.44 is what gets installed. However, this is incorrect for type definitions",
"@types/yargs": "Locking temporarily to avoid an issue with the ESM types in 17.0.14; see DT#63373",
"@types/node": "Locking to avoid conflicts between the declared version in packages/core and floating '*' versions when we run in CI without the lockfile"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/environment-ember-loose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "glint --project __tests__/type-tests && vitest run",
"test:watch": "vitest watch",
"build": "tsc --build",
"prepack": "yarn build"
"prepack": "pnpm build"
},
"files": [
"README.md",
Expand Down Expand Up @@ -62,6 +62,8 @@
},
"devDependencies": {
"@glimmer/component": "^1.1.2",
"@glint/template": "workspace:*",
"@glint/core": "workspace:*",
"@types/ember__array": "^4.0.2",
"@types/ember__component": "^4.0.10",
"@types/ember__controller": "^4.0.2",
Expand Down
5 changes: 4 additions & 1 deletion packages/environment-ember-template-imports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "vitest run",
"test:watch": "vitest watch",
"build": "tsc --build",
"prepack": "yarn build"
"prepack": "pnpm build"
},
"files": [
"README.md",
Expand Down Expand Up @@ -52,6 +52,9 @@
}
},
"devDependencies": {
"@glint/environment-ember-loose": "workspace:*",
"@glint/core": "workspace:*",
"@glint/template": "workspace:*",
"@types/ember": "^4.0.0",
"@types/ember__component": "^4.0.10",
"@types/ember__helper": "^4.0.1",
Expand Down
4 changes: 3 additions & 1 deletion packages/environment-glimmerx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"test": "tsc --project __tests__",
"build": "tsc --build",
"prepack": "yarn build"
"prepack": "pnpm build"
},
"files": [
"README.md",
Expand Down Expand Up @@ -47,6 +47,8 @@
}
},
"devDependencies": {
"@glint/template": "workspace:*",
"@glint/core": "workspace:*",
"@glimmerx/component": "^0.6.7",
"@glimmerx/modifier": "^0.6.7",
"@glimmerx/helper": "^0.6.7",
Expand Down
7 changes: 5 additions & 2 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@
"scripts": {
"test": "vitest run",
"build": "tsc --build",
"prepack": "yarn build"
"prepack": "pnpm build"
},
"dependencies": {
"golden-fleece": "^1.0.9",
"glob": "^7.2.0",
"golden-fleece": "^1.0.9",
"js-yaml": "^4.1.0",
"ora": "^6.1.2",
"true-myth": "^6.1.0",
"yargs": "^17.5.1",
"zod": "^3.22.3"
},
"devDependencies": {
"@glint/core": "workspace:*",
"@types/glob": "^8.1.0",
"@types/js-yaml": "^4.0.5",
"@types/node": "^18.11.5",
"@types/yargs": "^17.0.10",
"json5": "^2.2.2",
"vitest": "^0.22.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/template/__tests__/emit-component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MyComponent<T> extends TestComponent<MyComponentSignature<T>> {
* ```
*/
static {
templateForBackingValue(this, function (𝚪) {
templateForBackingValue(this, function(𝚪) {
const component = emitComponent(resolve(globals.let)(𝚪.this.state.ready));
const [isReady] = component.blockParams.default;

Expand Down
5 changes: 2 additions & 3 deletions packages/template/__tests__/emit-content.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { SafeString } from '@glimmer/runtime';
import { htmlSafe } from '@ember/template';
import { emitContent } from '../-private/dsl';

// Glimmer's SafeString interface
let safeString: SafeString = {
let safeString: ReturnType<typeof htmlSafe> = {
toHTML(): string {
return '<span>Foo</span>';
},
Expand All @@ -20,7 +19,7 @@ emitContent(false);
emitContent(undefined);
emitContent(null);

const returnsVoid = (): void => {};
const returnsVoid = (): void => { };

// Using something that returns void at the top level is reasonable
emitContent(returnsVoid());
Expand Down
30 changes: 15 additions & 15 deletions packages/template/__tests__/modifier-like.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NamedArgsMarker, resolve } from '@glint/environment-ember-loose/-private/dsl';
import { expectTypeOf } from 'expect-type';
import { ModifierReturn, NamedArgs } from '@glint/template/-private/integration';
import { ModifierReturn, NamedArgs } from '../-private/integration';
import { ModifierLike, WithBoundArgs, WithBoundPositionals } from '@glint/template';

// Fixed signature params
Expand Down Expand Up @@ -63,22 +63,22 @@ import { ModifierLike, WithBoundArgs, WithBoundPositionals } from '@glint/templa
...args:
| [element: HTMLAudioElement, full: string, named: NamedArgs<{ force: boolean }>]
| [
element: HTMLAudioElement,
full: string,
named?: NamedArgs<Partial<{ foo: string; bar: string }>>
]
element: HTMLAudioElement,
full: string,
named?: NamedArgs<Partial<{ foo: string; bar: string }>>
]
| [
element: HTMLAudioElement,
first: string,
last: string,
named: NamedArgs<{ force: boolean }>
]
element: HTMLAudioElement,
first: string,
last: string,
named: NamedArgs<{ force: boolean }>
]
| [
element: HTMLAudioElement,
first: string,
last: string,
named?: NamedArgs<Partial<{ foo: string; bar: string }>>
]
element: HTMLAudioElement,
first: string,
last: string,
named?: NamedArgs<Partial<{ foo: string; bar: string }>>
]
) => ModifierReturn
>();
}
Expand Down
6 changes: 3 additions & 3 deletions packages/template/__tests__/resolution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ declare function value<T>(): T;
* ```
*/
static {
templateForBackingValue(this, function (𝚪) {
templateForBackingValue(this, function(𝚪) {
{
const component = emitComponent(resolve(globals.let)(𝚪.this.state.ready));

Expand All @@ -60,11 +60,11 @@ declare function value<T>(): T;
expectTypeOf(resolve(MyComponent)).toEqualTypeOf<ExpectedSignature>();

// Template context is inferred correctly
templateForBackingValue(MyComponent<number>, function (context) {
templateForBackingValue(MyComponent<number>, function(context) {
expectTypeOf(context).toEqualTypeOf<ExpectedContext<number>>();
});

templateForBackingValue(MyComponent<string>, function (context) {
templateForBackingValue(MyComponent<string>, function(context) {
expectTypeOf(context).toEqualTypeOf<ExpectedContext<string>>();
});
}
Expand Down
Loading
Loading