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 all 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
25 changes: 25 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.
# These settings re-create yarn's broken dep management behavior
#
# To fix, we need to:
# - adjust usage of ephemeral directory,
# - probably use tmp
# - properly manage dependencies under test
# - link to our workspace packages
# - potentially use scenario-tester to manage package linking
# - properly manage dependencies
# - no package cycles
# - whatever is imported must be in local package.json
shamefully-hoist=true
node-linker=hoisted
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
3 changes: 1 addition & 2 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 Down
7 changes: 6 additions & 1 deletion packages/template/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"extends": "../../../tsconfig.compileroptions.json",
"compilerOptions": {
"noEmit": true,
"lib": ["es2020", "dom"]
"lib": ["es2020", "dom"],
"paths": {
"@glint/template": [".."],
"@glint/template/*": ["../*"],
"@glint/environment-ember-loose/*": ["../../environment-ember-loose/*"]
}
}
}
1 change: 1 addition & 0 deletions packages/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@glimmer/component": "^1.1.2",
"@glimmerx/component": "^0.6.7",
"@types/ember__component": "~4.0.8",
"@types/ember__template": "^4.0.5",
"expect-type": "^0.15.0",
"sums-up": "^2.1.0"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/type-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
"expect-type": "^0.15.0"
},
"peerDependencies": {
"@glint/template": "^1.2.1"
"@glint/template": "workspace:*"
},
"devDependencies": {
"@glint/environment-ember-loose": "workspace:^",
"@glint/template": "workspace:*"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"Linters"
],
"scripts": {
"pretest": "yarn build",
"pretest": "pnpm build",
"test": "node lib/__tests__/support/launch-from-cli.mjs",
"build": "yarn compile && yarn bundle",
"build": "pnpm compile && pnpm bundle",
"compile": "tsc --build",
"bundle": "esbuild lib/src/extension.js --bundle --outfile=dist/extension.js --platform=node --external:vscode --minify",
"vscode:prepublish": "yarn build",
"vscode:prepublish": "pnpm build",
"extension:package": "vsce package --no-dependencies",
"extension:publish": "vsce publish --no-dependencies"
},
Expand Down Expand Up @@ -104,7 +104,7 @@
"@vscode/test-electron": "Dropped support for Node < 16 in the 2.2.1 patch release, so locking to 2.2.0 while we still support Node 14."
},
"devDependencies": {
"@glint/core": "^1.2.1",
"@glint/core": "workspace:*",
"@types/mocha": "^10.0.1",
"@types/vscode": "^1.68.1",
"@vscode/test-electron": "^2.3.8",
Expand Down
Loading
Loading