create-webiny-project 5.38.3-beta.0 → 5.38.3-beta.1

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/bin.js CHANGED
@@ -4,15 +4,22 @@
4
4
  const semver = require("semver");
5
5
  const chalk = require("chalk");
6
6
  const getYarnVersion = require("./utils/getYarnVersion");
7
+ const getNpmVersion = require("./utils/getNpmVersion");
7
8
  const verifyConfig = require("./utils/verifyConfig");
8
9
 
9
10
  (async () => {
11
+ const minNodeVersion = "16";
12
+ const minNpmVersion = "10";
13
+ const minYarnVersion = "1.22.21";
14
+ /**
15
+ * Node
16
+ */
10
17
  const nodeVersion = process.versions.node;
11
- if (!semver.satisfies(nodeVersion, ">=14")) {
18
+ if (!semver.satisfies(nodeVersion, `>=${minNodeVersion}`)) {
12
19
  console.error(
13
20
  chalk.red(
14
21
  [
15
- `You are running Node.js ${nodeVersion}, but Webiny requires version 14 or higher.`,
22
+ `You are running Node.js ${nodeVersion}, but Webiny requires version ${minNodeVersion} or higher.`,
16
23
  `Please switch to one of the required versions and try again.`,
17
24
  "For more information, please visit https://docs.webiny.com/docs/tutorials/install-webiny#prerequisites."
18
25
  ].join(" ")
@@ -20,14 +27,46 @@ const verifyConfig = require("./utils/verifyConfig");
20
27
  );
21
28
  process.exit(1);
22
29
  }
30
+ /**
31
+ * npm
32
+ */
33
+ try {
34
+ const npmVersion = await getNpmVersion();
35
+ if (!semver.satisfies(npmVersion, `>=${minNpmVersion}`)) {
36
+ console.error(
37
+ chalk.red(
38
+ [
39
+ `Webiny requires npm@^${minNpmVersion} or higher.`,
40
+ `Please run ${chalk.green(
41
+ "npm install npm@latest -g"
42
+ )}, to get the latest version.`
43
+ ].join("\n")
44
+ )
45
+ );
46
+ process.exit(1);
47
+ }
48
+ } catch (err) {
49
+ console.error(chalk.red(`Webiny depends on "npm".`));
50
+
51
+ console.log(
52
+ `Please visit https://docs.npmjs.com/try-the-latest-stable-version-of-npm to install ${chalk.green(
53
+ "npm"
54
+ )}.`
55
+ );
56
+
57
+ process.exit(1);
58
+ }
23
59
 
60
+ /**
61
+ * yarn
62
+ */
24
63
  try {
25
64
  const yarnVersion = await getYarnVersion();
26
- if (!semver.satisfies(yarnVersion, ">=1.22.0")) {
65
+ if (!semver.satisfies(yarnVersion, `>=${minYarnVersion}`)) {
27
66
  console.error(
28
67
  chalk.red(
29
68
  [
30
- `Webiny requires yarn@^1.22.0 or higher.`,
69
+ `Webiny requires yarn@^${minYarnVersion} or higher.`,
31
70
  `Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.`
32
71
  ].join("\n")
33
72
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-webiny-project",
3
- "version": "5.38.3-beta.0",
3
+ "version": "5.38.3-beta.1",
4
4
  "description": "Webiny project bootstrap tool.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "author": "Webiny Ltd.",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@webiny/telemetry": "5.38.3-beta.0",
16
+ "@webiny/telemetry": "5.38.3-beta.1",
17
17
  "chalk": "4.1.2",
18
18
  "execa": "5.1.1",
19
19
  "find-up": "5.0.0",
@@ -35,5 +35,5 @@
35
35
  "access": "public",
36
36
  "directory": "."
37
37
  },
38
- "gitHead": "6faefa3de84c4edb2feec1e5ff450a8af67a3d79"
38
+ "gitHead": "03e8e42ef2d12c9f73f4395cdad77d07f4cd9e32"
39
39
  }
@@ -140,10 +140,6 @@ module.exports = async function createProject({
140
140
  const target = path.join(projectRoot, yarnReleasesFilePath);
141
141
  fs.copyFileSync(source, target);
142
142
 
143
- await execa("yarn", ["set", "version", yarnVersion], {
144
- cwd: projectRoot
145
- });
146
-
147
143
  const yamlPath = path.join(projectRoot, ".yarnrc.yml");
148
144
  if (!fs.existsSync(yamlPath)) {
149
145
  fs.writeFileSync(yamlPath, `yarnPath: ${yarnReleasesFilePath}`, "utf-8");
@@ -272,6 +268,18 @@ module.exports = async function createProject({
272
268
  const node = process.versions.node;
273
269
  const os = process.platform;
274
270
 
271
+ let npm = NOT_APPLICABLE;
272
+ try {
273
+ const subprocess = await execa("npm", ["--version"], { cwd: projectRoot });
274
+ npm = subprocess.stdout;
275
+ } catch {}
276
+
277
+ let npx = NOT_APPLICABLE;
278
+ try {
279
+ const subprocess = await execa("npx", ["--version"], { cwd: projectRoot });
280
+ npx = subprocess.stdout;
281
+ } catch {}
282
+
275
283
  let yarn = NOT_APPLICABLE;
276
284
  try {
277
285
  const subprocess = await execa("yarn", ["--version"], { cwd: projectRoot });
@@ -312,6 +320,8 @@ module.exports = async function createProject({
312
320
  `Operating System: ${os}`,
313
321
  `Node: ${node}`,
314
322
  `Yarn: ${yarn}`,
323
+ `Npm: ${npm}`,
324
+ `Npx: ${npx}`,
315
325
  `create-webiny-project: ${cwp}`,
316
326
  `Template: ${cwpTemplate}`,
317
327
  `Template Options: ${templateOptionsJson}`,
@@ -0,0 +1,10 @@
1
+ const execa = require("execa");
2
+
3
+ module.exports = async () => {
4
+ try {
5
+ const { stdout } = await execa("npm", ["--version"]);
6
+ return stdout;
7
+ } catch (err) {
8
+ return "";
9
+ }
10
+ };