@shopify/create-hydrogen 4.3.6 → 4.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-app.js +31 -0
- package/package.json +2 -2
package/dist/create-app.js
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
2
4
|
import { runInit } from '@shopify/cli-hydrogen/commands/hydrogen/init';
|
|
3
5
|
|
|
6
|
+
let isReactError = false;
|
|
7
|
+
const reactErrorRE = /(useState|Invalid hook call)/gims;
|
|
8
|
+
const stdoutWrite = process.stdout.write.bind(process.stdout);
|
|
9
|
+
process.stdout.write = function(item, encoding, cb) {
|
|
10
|
+
if (reactErrorRE.test(item?.toString() ?? "")) {
|
|
11
|
+
isReactError = true;
|
|
12
|
+
} else {
|
|
13
|
+
stdoutWrite(item, encoding, cb);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const stderrWrite = process.stderr.write.bind(process.stderr);
|
|
17
|
+
process.stderr.write = function(item, encoding, cb) {
|
|
18
|
+
if (reactErrorRE.test(item?.toString() ?? "")) {
|
|
19
|
+
isReactError = true;
|
|
20
|
+
} else {
|
|
21
|
+
stderrWrite(item, encoding, cb);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
process.on("beforeExit", () => {
|
|
25
|
+
if (isReactError) {
|
|
26
|
+
const randomTmpDir = join(tmpdir(), Math.random().toString(36).slice(2));
|
|
27
|
+
const message = `There is a React version mismatch. If this command failed, try the following:
|
|
28
|
+
|
|
29
|
+
npm create @shopify/hydrogen@latest --legacy-peer-deps --cache ${randomTmpDir}
|
|
30
|
+
|
|
31
|
+
Learn more in https://github.com/Shopify/hydrogen/discussions/2055`;
|
|
32
|
+
console.warn("\n\x1B[30m\x1B[43m WARNING \x1B[0m", message);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
4
35
|
runInit();
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"@shopify:registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "4.3.
|
|
8
|
+
"version": "4.3.8",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsup --clean",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@shopify/cli-hydrogen": "^8.0.
|
|
16
|
+
"@shopify/cli-hydrogen": "^8.0.3"
|
|
17
17
|
},
|
|
18
18
|
"bin": "dist/create-app.js",
|
|
19
19
|
"files": [
|