Skip to content

Commit

Permalink
Switch to pnpm and restore @ember/test-helpers to latest patch (#894)
Browse files Browse the repository at this point in the history
Allows us to continue to test Ember 3.28 via ember try.

I've been struggling with that particular build since: emberjs/ember-test-helpers#1232

To my best understanding a quirk in yarn's (incorrect) handling of peerDependencies with monorepo causes incorrect resolution of ember-source.

I wasn't able to find a nohoist config with yarn which worked, although I'm open to suggestions.

As suggested in this comment pnpm handles peerDeps more correctly, and provides the dependenciesMeta.*.injected option.

This issue has been blocking the release of ember-file-upload because this addon includes @ember/test-helpers in its own dependencies (we ship custom test helpers which depend on that package). I don't want to cut a release with a restrictive @ember/test-helpers dependency version.
  • Loading branch information
gilest authored Jan 21, 2023
1 parent 9f11d75 commit 735cc25
Show file tree
Hide file tree
Showing 17 changed files with 14,028 additions and 13,527 deletions.
116 changes: 35 additions & 81 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,20 @@ jobs:
with:
fetch-depth: 1

- uses: actions/setup-node@v2-beta
- uses: pnpm/action-setup@v2.2.4
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
version: 7

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v3
- uses: actions/setup-node@v3
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-
- name: Install Dependencies
run: yarn install --frozen-lockfile
node-version: '${{ env.NODE_VERSION }}'
cache: 'pnpm'

- name: 'Install dependencies'
run: pnpm install --frozen-lockfile

- name: Lint
run: yarn workspace ember-file-upload lint
run: pnpm --filter ember-file-upload lint

test:
name: Tests
Expand All @@ -90,32 +78,20 @@ jobs:
with:
fetch-depth: 1

- uses: actions/setup-node@v2-beta
- uses: pnpm/action-setup@v2.2.4
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
version: 7

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v3
- uses: actions/setup-node@v3
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-
- name: Install Dependencies
run: yarn install --frozen-lockfile
node-version: '${{ env.NODE_VERSION }}'
cache: 'pnpm'

- name: 'Install dependencies'
run: pnpm install --frozen-lockfile

- name: Test
run: yarn workspace test-app test:ember --launch ${{ matrix.browser }}
run: pnpm --filter test-app test:ember --launch ${{ matrix.browser }}

floating-dependencies:
name: Floating Dependencies
Expand All @@ -132,30 +108,20 @@ jobs:
with:
fetch-depth: 1

- uses: actions/setup-node@v2-beta
- uses: pnpm/action-setup@v2.2.4
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
version: 7

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v3
- uses: actions/setup-node@v3
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-floating-deps
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-
node-version: '${{ env.NODE_VERSION }}'
cache: 'pnpm'

- name: Install Dependencies
run: yarn install --no-lockfile --non-interactive
- name: 'Install dependencies'
run: rm pnpm-lock.yaml && pnpm install

- name: Test
run: yarn workspace test-app test:ember --launch ${{ matrix.browser }}
run: pnpm --filter test-app test:ember --launch ${{ matrix.browser }}

try-scenarios:
name: Tests - ${{ matrix.ember-try-scenario }}
Expand All @@ -181,31 +147,19 @@ jobs:
with:
fetch-depth: 1

- uses: actions/setup-node@v2-beta
- uses: pnpm/action-setup@v2.2.4
with:
node-version: '${{ env.NODE_VERSION }}'
version: 7

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v3
- uses: actions/setup-node@v3
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-
- name: Install Dependencies
run: yarn install --frozen-lockfile
node-version: '${{ env.NODE_VERSION }}'
cache: 'pnpm'

- name: 'Install dependencies'
run: pnpm install --frozen-lockfile

- name: Test
env:
EMBER_TRY_SCENARIO: ${{ matrix.ember-try-scenario }}
run: yarn workspace test-app ember try:one $EMBER_TRY_SCENARIO
run: pnpm --filter test-app test:ember-try $EMBER_TRY_SCENARIO
56 changes: 16 additions & 40 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,20 @@ jobs:
with:
fetch-depth: 1

- uses: actions/setup-node@v2-beta
- uses: pnpm/action-setup@v2.2.4
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
version: 7

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v3
- uses: actions/setup-node@v3
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-
node-version: '${{ env.NODE_VERSION }}'
cache: 'pnpm'

- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: 'Install dependencies'
run: pnpm install --frozen-lockfile

- name: Lint
run: yarn workspace website lint
run: pnpm --filter website lint

test:
name: Tests
Expand All @@ -60,29 +48,17 @@ jobs:
with:
fetch-depth: 1

- uses: actions/setup-node@v2-beta
- uses: pnpm/action-setup@v2.2.4
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
version: 7

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v3
- uses: actions/setup-node@v3
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-
node-version: '${{ env.NODE_VERSION }}'
cache: 'pnpm'

- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: 'Install dependencies'
run: pnpm install --frozen-lockfile

- name: Test
run: yarn workspace website test:ember --launch ${{ matrix.browser }}
run: pnpm --filter website test:ember --launch ${{ matrix.browser }}
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

* `git clone <repository-url>`
* `cd ember-file-upload`
* `yarn install`
* `pnpm install`

## Linting

* `yarn lint`
* `yarn lint:fix`
* `pnpm lint`
* `pnpm lint:fix`

## Running tests

Expand Down
13 changes: 10 additions & 3 deletions ember-file-upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"lint:types": "tsc --noEmit",
"start": "rollup --config --watch",
"test": "echo 'Addon does not have tests, run tests in test-app'",
"prepare": "yarn build"
"prepare": "pnpm build"
},
"dependencies": {
"@ember/test-helpers": "~2.7.0",
"@ember/test-helpers": "^2.9.3",
"@ember/test-waiters": "^3.0.0",
"@embroider/addon-shim": "^1.5.0",
"@embroider/macros": "^1.0.0",
Expand All @@ -63,12 +63,16 @@
"@babel/plugin-transform-runtime": "^7.18.2",
"@babel/plugin-transform-typescript": "^7.18.4",
"@babel/preset-typescript": "^7.17.12",
"@babel/runtime": "^7.20.7",
"@ember/string": "^3.0.1",
"@embroider/addon-dev": "^3.0.0",
"@rollup/plugin-babel": "^6.0.0",
"@types/ember__application": "^4.0.0",
"@types/ember__component": "^4.0.0",
"@types/ember__debug": "^4.0.0",
"@types/ember__destroyable": "^4.0.0",
"@types/ember__engine": "^4.0.0",
"@types/ember__object": "^4.0.0",
"@types/ember__runloop": "^4.0.0",
"@types/ember__service": "^4.0.0",
"@types/ember__string": "^3.16.3",
Expand All @@ -80,6 +84,8 @@
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"babel-eslint": "^10.1.0",
"ember-cli-htmlbars": "^6.1.1",
"ember-source": "~4.8.0",
"ember-template-lint": "^5.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -92,7 +98,8 @@
"release-it-lerna-changelog": "^5.0.0",
"rollup": "^2.70.1",
"rollup-plugin-ts": "^3.0.1",
"typescript": "^4.7.2"
"typescript": "^4.7.2",
"webpack": "^5.74.0"
},
"peerDependencies": {
"ember-cli-mirage": "*",
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
"test-app"
],
"scripts": {
"prepare": "yarn workspace ember-file-upload prepare",
"test": "yarn workspace test-app test:ember -s",
"website": "yarn workspace website ember s"
"prepare": "pnpm --filter ember-file-upload run prepare",
"test": "pnpm --filter test-app run test:ember -s",
"website": "pnpm --filter website run ember s"
},
"repository": "https://github.com/adopted-ember-addons/ember-file-upload",
"resolutions": {
"@embroider/macros": "^1.5.0",
"@embroider/util": "^1.5.0",
"ember-auto-import": "^2.0.0",
"ember-cli-babel": "^7.26.6"
"pnpm": {
"overrides": {
"@embroider/macros": "^1.5.0",
"@embroider/util": "^1.5.0",
"ember-auto-import": "^2.0.0",
"ember-cli-babel": "^7.26.6"
}
}
}
Loading

0 comments on commit 735cc25

Please sign in to comment.