Skip to content

Commit

Permalink
Adopt PNPM (#492)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Jones <mattjones701@gmail.com>
  • Loading branch information
benjervis and mattcompiles committed Nov 24, 2021
1 parent d9d49ad commit f2d2d9e
Show file tree
Hide file tree
Showing 24 changed files with 14,059 additions and 19,190 deletions.
1 change: 1 addition & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"ignore": [
"@fixtures/*",
"test-helpers",
"tests",
"vanilla-extract-example-next",
"vanilla-extract-example-webpack-react"
]
Expand Down
11 changes: 11 additions & 0 deletions .changeset/metal-crabs-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@vanilla-extract/webpack-plugin': patch
---

Fix requiring of webpack loader

Previously, the webpack plugin would reference itself as a loader by requiring `@vanilla-extract/webpack-plugin/loader`, but this was technically incorrect, and only worked because of the flat node_modules structure that yarn provides.

When using a package manager like pnpm, which does not have a flat structure, this breaks.

This change uses relative references internally to ensure that the loader can always be required.
11 changes: 8 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
env:
CI: true
steps:
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.1

- name: Checkout Repo
uses: actions/checkout@main
with:
Expand All @@ -22,15 +26,16 @@ jobs:
uses: actions/setup-node@main
with:
node-version: 14.x
cache: 'pnpm'

- name: Install Dependencies
run: yarn --immutable
run: pnpm i

- name: Create release PR or publish to npm
uses: changesets/action@c2918239208f2162b9d27a87f491375c51592434
with:
version: yarn run version
publish: yarn release
version: pnpm run version
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }}
25 changes: 17 additions & 8 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,40 @@ jobs:
env:
CI: true
steps:
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.1

- name: Checkout Repo
uses: actions/checkout@main

- name: Setup Node.js 14.x
uses: actions/setup-node@main
with:
node-version: 14.x
cache: 'pnpm'

- name: Install Dependencies
run: yarn --immutable
run: pnpm i

- name: Build
run: yarn build && node ./site/makeDocsManifest
run: pnpm build && node ./site/makeDocsManifest

- name: Lint
run: yarn lint
run: pnpm lint

- name: Test
run: yarn test:jest
run: pnpm test:jest
playwright:
name: Playwright tests
runs-on: macos-11
env:
CI: true
steps:
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.1

- name: Checkout Repo
uses: actions/checkout@main

Expand All @@ -43,16 +52,16 @@ jobs:
node-version: 14.x

- name: Install Dependencies
run: yarn --immutable
run: pnpm i

- name: Install Browsers
run: yarn playwright install chromium
run: pnpm playwright install chromium

- name: Build packages
run: yarn build
run: pnpm build

- name: Screenshot tests
run: yarn test:playwright
run: pnpm test:playwright

- uses: actions/upload-artifact@v2
if: failure()
Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
node_modules
dist
tsconfig.tsbuildinfo
yarn-error.log
packages/**/README.md
!packages/sprinkles/README.md
!packages/integration/README.md
test-results


.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
.next
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
node_modules
dist
CHANGELOG.md
.yarn/
README.md
.yarnrc.yml
.github/ISSUE_TEMPLATE
site/docs-manifest.json
.changeset
.next
pnpm-lock.yaml
8 changes: 0 additions & 8 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

768 changes: 0 additions & 768 deletions .yarn/releases/yarn-3.1.0.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions .yarnrc.yml

This file was deleted.

5 changes: 4 additions & 1 deletion babel-jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ const baseConfig = require('./babel.config');

module.exports = {
...baseConfig,
plugins: [...(baseConfig.plugins ?? []), '@vanilla-extract/babel-plugin'],
plugins: [
...(baseConfig.plugins ?? []),
require.resolve('@vanilla-extract/babel-plugin'),
],
};
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"build": "preconstruct build",
"watch": "preconstruct watch",
"start-fixture": "ts-node --log-error ./test-helpers/src/startFixtureCLI",
"start": "yarn start-fixture themed",
"start": "pnpm start-fixture themed",
"start-site": "manypkg run site start",
"build-site": "manypkg run site build",
"postinstall": "yarn dev",
"postinstall": "pnpm dev",
"test:jest": "jest",
"test:playwright": "playwright test",
"format": "prettier --write .",
"lint": "manypkg check && prettier --check . && tsc",
"copy-readme-to-packages": "ts-node scripts/copy-readme-to-packages",
"version": "changeset version && yarn --mode=update-lockfile",
"release": "yarn copy-readme-to-packages && yarn build && changeset publish"
"version": "changeset version && pnpm --lockfile-only",
"release": "pnpm copy-readme-to-packages && pnpm build && changeset publish"
},
"workspaces": [
"packages/*",
Expand All @@ -34,8 +34,7 @@
]
},
"volta": {
"node": "14.16.0",
"yarn": "1.22.10"
"node": "14.16.0"
},
"dependencies": {
"@babel/core": "^7.13.10",
Expand All @@ -47,9 +46,8 @@
"@manypkg/cli": "^0.17.0",
"@playwright/test": "^1.14.1",
"@preconstruct/cli": "^2.0.1",
"@testing-library/dom": "^7.30.0",
"@testing-library/jest-dom": "^5.11.9",
"@types/jest": "^26.0.20",
"@vanilla-extract/babel-plugin": "*",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"prettier": "^2.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class VanillaExtractPlugin {
test: this.test,
use: [
{
loader: require.resolve('@vanilla-extract/webpack-plugin/loader'),
loader: require.resolve('../loader'),
options: {
outputCss: this.outputCss,
childCompiler: this.childCompiler,
Expand Down
7 changes: 1 addition & 6 deletions packages/webpack-plugin/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ import { debug, formatResourcePath } from './logger';
import { ChildCompiler } from './compiler';

const emptyCssExtractionFile = require.resolve(
path.join(
path.dirname(
require.resolve('@vanilla-extract/webpack-plugin/package.json'),
),
'extracted',
),
path.join(path.dirname(require.resolve('../../package.json')), 'extracted'),
);

interface LoaderOptions {
Expand Down

0 comments on commit f2d2d9e

Please sign in to comment.