uswds / uswds-compile

Simple Gulp 4 functions for copying USWDS static assets and transforming USWDS Sass into browser-readable CSS.
Other
21 stars 12 forks source link

USWDS-Compile - Bug: pnpm support #75

Closed danielnaab closed 9 months ago

danielnaab commented 10 months ago

Describe the bug

Using gulp-compile within a pnpm workspace fails in the buildSass function. pnpm is a package manager that has a local package cache with a unique directory structure.

Steps to reproduce the bug

  1. Use gulpfile.js example from documentation
  2. pnpm gulp build

Expected Behavior

Same as via npx gulp build

Related code

The path resolved here does not exist: https://github.com/uswds/uswds-compile/blob/cd6f8dddddf5155b065fcbe3999ed8f4f89e2e8f/gulpfile.js#L159

Screenshots

The corresponding exception is:

[14:05:47] 'buildSass' errored after 536 μs
[14:05:47] Error: Cannot find module '../../uswds/package.json'
Require stack:
- /Users/danielnaab/src/10x/atj-platform/node_modules/.pnpm/@uswds+compile@1.0.0_ts-node@10.9.1/node_modules/@uswds/compile/gulpfile.js
- /Users/danielnaab/src/10x/atj-platform/packages/design/gulpfile.js
- /Users/danielnaab/src/10x/atj-platform/node_modules/.pnpm/gulp-cli@2.3.0/node_modules/gulp-cli/lib/shared/require-or-import.js
- /Users/danielnaab/src/10x/atj-platform/node_modules/.pnpm/gulp-cli@2.3.0/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /Users/danielnaab/src/10x/atj-platform/node_modules/.pnpm/gulp-cli@2.3.0/node_modules/gulp-cli/index.js
- /Users/danielnaab/src/10x/atj-platform/node_modules/.pnpm/gulp@4.0.2/node_modules/gulp/bin/gulp.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at buildSass (/Users/danielnaab/src/10x/atj-platform/node_modules/.pnpm/@uswds+compile@1.0.0_ts-node@10.9.1/node_modules/@uswds/compile/gulpfile.js:159:15)
    at bound (node:domain:433:15)
    at runBound (node:domain:444:12)
    at asyncRunner (/Users/danielnaab/src/10x/atj-platform/node_modules/.pnpm/async-done@1.3.2/node_modules/async-done/index.js:55:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
[14:05:47] 'compile' errored after 2.47 ms
 ELIFECYCLE  Command failed with exit code 1.

System setup

Additional context

No response

Code of Conduct

mejiaj commented 9 months ago

I'm able to reproduce the error.

How I tested

  1. Install pnpm via brew install pnpm.
  2. Go to uswds/uswds-sandbox repo.
  3. Install dependencies with pnpm install
  4. Try a build task, like pnpm run uswds:buildSass
  5. Confirm error

System setup