kentcdodds / react-workshop-app

An abstraction for all my React workshops
https://kentcdodds.com/workshops
MIT License
149 stars 37 forks source link

Validation (and pre-commit) fails on Windows #17

Closed Snaptags closed 4 years ago

Snaptags commented 4 years ago

Relevant code or config

D:\dev\epicreact\react-workshop-app\src\index.js: preval.macro: Command failed: postcss

What you did:

Run the "validate" script

What happened:

> @kentcdodds/react-workshop-app@0.0.0-semantically-released validate D:\dev\epicreact\react-workshop-app
> kcd-scripts validate

[build] Input Error: You must pass a valid list of files to parse
[build] Error: D:\dev\epicreact\react-workshop-app\src\index.js: preval.macro: Command failed: postcss "D:\dev\epicreact\react-workshop-app\node_modules\normalize.css\normalize.css" --use cssnano --no-map
[build] Input Error: You must pass a valid list of files to parse
[build]  Learn more: https://www.npmjs.com/package/preval.macro
[build]     at checkExecSyncError (child_process.js:616:11)
[build]     at execSync (child_process.js:652:15)
[build]     at module.exports (D:\dev\epicreact\react-workshop-app\other\css-file-to-string.js:5:3)
[build]     at Object.<anonymous> (D:\dev\epicreact\react-workshop-app\src\index.js:1:56)
[build]     at Module._compile (internal/modules/cjs/loader.js:1076:30)
[build]     at requireFromString (D:\dev\epicreact\react-workshop-app\node_modules\require-from-string\index.js:28:4)
[build]     at requireFromString (D:\dev\epicreact\react-workshop-app\node_modules\babel-plugin-preval\dist\helpers.js:21:13)
[build]     at getReplacement (D:\dev\epicreact\react-workshop-app\node_modules\babel-plugin-preval\dist\helpers.js:39:15)
[build]     at asTag (D:\dev\epicreact\react-workshop-app\node_modules\babel-plugin-preval\dist\macro.js:41:36)
[build]     at D:\dev\epicreact\react-workshop-app\node_modules\babel-plugin-preval\dist\macro.js:21:7 {
[build]   status: 1,
[build]   signal: null,
[build]   output: [
[build]     null,
[build]     <Buffer >,
[build]     <Buffer 1b 5b 33 31 6d 49 6e 70 75 74 20 45 72 72 6f 72 3a 20 59 6f 75 20 6d 75 73 74 20 70 61 73 73 20 61 20 76 61 6c 69 64 20 6c 69 73 74 20 6f 66 20 66 69 ... 18 more bytes>
[build]   ],
[build]   pid: 564,
[build]   stdout: <Buffer >,
[build]   stderr: <Buffer 1b 5b 33 31 6d 49 6e 70 75 74 20 45 72 72 6f 72 3a 20 59 6f 75 20 6d 75 73 74 20 70 61 73 73 20 61 20 76 61 6c 69 64 20 6c 69 73 74 20 6f 66 20 66 69 ... 18 more bytes>,
[build]   code: 'BABEL_TRANSFORM_ERROR'
[build] }

Reproduction repository:

this one :-)

Problem description:

I'm not sure if that rather is a kcd-scripts issue… On the other hand: validating the kcd-scripts projects works just fine.

Suggested solution:

Be able to run cross-platform.

Snaptags commented 4 years ago

postcss-cli seems not to be able to handle Windows paths?

postcss "D:\\dev\\epicreact\\react-workshop-app\\node_modules\\normalize.css\\normalize.css" --cssnano --no-map ✔️ postcss "D:/dev/epicreact/react-workshop-app/node_modules/normalize.css/normalize.css" --cssnano --no-map

kentcdodds commented 4 years ago

Thanks for the fix!