create-webiny-project 5.41.4 → 5.42.0-beta.0

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
@@ -1,87 +1,107 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
2
 
4
- const semver = require("semver");
5
- const chalk = require("chalk");
6
- const getYarnVersion = require("./utils/getYarnVersion");
7
- const getNpmVersion = require("./utils/getNpmVersion");
8
- const verifyConfig = require("./utils/verifyConfig");
3
+ // Ensure system requirements are met.
4
+ require("@webiny/system-requirements").ensureSystemRequirements();
9
5
 
10
- (async () => {
11
- const minNpmVersion = "10";
12
- const minYarnVersion = "1.22.21";
13
- /**
14
- * Node
15
- */
16
- const nodeVersion = process.versions.node;
17
- if (!semver.satisfies(nodeVersion, `^18 || ^20`)) {
18
- console.error(
19
- chalk.red(
20
- [
21
- `You are running Node.js ${nodeVersion}, but Webiny requires version 18 or 20.`,
22
- `Please switch to one of the required versions and try again.`,
23
- "For more information, please visit https://www.webiny.com/docs/get-started/install-webiny#prerequisites."
24
- ].join(" ")
25
- )
26
- );
27
- process.exit(1);
28
- }
29
- /**
30
- * npm
31
- */
32
- try {
33
- const npmVersion = await getNpmVersion();
34
- if (!semver.satisfies(npmVersion, `>=${minNpmVersion}`)) {
35
- console.error(
36
- chalk.red(
37
- [
38
- `Webiny requires npm@^${minNpmVersion} or higher.`,
39
- `Please run ${chalk.green(
40
- "npm install npm@latest -g"
41
- )}, to get the latest version.`
42
- ].join("\n")
43
- )
44
- );
45
- process.exit(1);
46
- }
47
- } catch (err) {
48
- console.error(chalk.red(`Webiny depends on "npm".`));
6
+ // Verify `.webiny` config file and continue.
7
+ require("./utils/ensureConfig").ensureConfig();
49
8
 
50
- console.log(
51
- `Please visit https://docs.npmjs.com/try-the-latest-stable-version-of-npm to install ${chalk.green(
52
- "npm"
53
- )}.`
54
- );
9
+ const yargs = require("yargs");
10
+ const packageJson = require("./package.json");
11
+ const createProject = require("./utils/createProject");
55
12
 
56
- process.exit(1);
57
- }
13
+ process.on("unhandledRejection", err => {
14
+ throw err;
15
+ });
58
16
 
59
- /**
60
- * yarn
61
- */
62
- try {
63
- const yarnVersion = await getYarnVersion();
64
- if (!semver.satisfies(yarnVersion, `>=${minYarnVersion}`)) {
65
- console.error(
66
- chalk.red(
67
- [
68
- `Webiny requires yarn@^${minYarnVersion} or higher.`,
69
- `Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.`
70
- ].join("\n")
71
- )
72
- );
73
- process.exit(1);
17
+ yargs
18
+ .usage("Usage: create-webiny-project <project-name> [options]")
19
+ .version(packageJson.version)
20
+ .demandCommand(1)
21
+ .help()
22
+ .alias("help", "h")
23
+ .scriptName("create-webiny-project")
24
+ .fail(function (msg, err) {
25
+ if (msg) {
26
+ console.log(msg);
27
+ }
28
+ if (err) {
29
+ console.log(err);
74
30
  }
75
- } catch (err) {
76
- console.error(
77
- chalk.red(`Webiny depends on "yarn" and its built-in support for workspaces.`)
78
- );
79
-
80
- console.log(`Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.`);
81
-
82
31
  process.exit(1);
83
- }
32
+ });
33
+
34
+ // noinspection BadExpressionStatementJS
35
+ yargs.command(
36
+ "$0 <project-name> [options]",
37
+ "Name of application and template to use",
38
+ yargs => {
39
+ yargs.positional("project-name", {
40
+ describe: "Project name"
41
+ });
42
+ yargs.option("force", {
43
+ describe: "All project creation within an existing folder",
44
+ default: false,
45
+ type: "boolean",
46
+ demandOption: false
47
+ });
48
+ yargs.option("template", {
49
+ describe: `Name of template to use, if no template is provided it will default to "aws" template`,
50
+ alias: "t",
51
+ type: "string",
52
+ default: "aws",
53
+ demandOption: false
54
+ });
55
+ yargs.option("template-options", {
56
+ describe: `A JSON containing template-specific options (usually used in non-interactive environments)`,
57
+ default: null,
58
+ type: "string",
59
+ demandOption: false
60
+ });
61
+ yargs.option("assign-to-yarnrc", {
62
+ describe: `A JSON containing additional options that will be assigned into the "yarnrc.yml" configuration file`,
63
+ default: null,
64
+ type: "string",
65
+ demandOption: false
66
+ });
67
+ yargs.option("tag", {
68
+ describe: "NPM tag to use for @webiny packages",
69
+ type: "string",
70
+ default: "latest",
71
+ demandOption: false
72
+ });
73
+ yargs.option("interactive", {
74
+ describe: "Enable interactive mode for all commands",
75
+ default: true,
76
+ type: "boolean",
77
+ demandOption: false
78
+ });
79
+ yargs.option("log", {
80
+ describe:
81
+ "Creates a log file to see output of installation. Defaults to create-webiny-project-logs.txt in current directory",
82
+ alias: "l",
83
+ default: "create-webiny-project-logs.txt",
84
+ type: "string",
85
+ demandOption: false
86
+ });
87
+ yargs.option("debug", {
88
+ describe: "Turn on debug logs",
89
+ default: false,
90
+ type: "boolean",
91
+ demandOption: false
92
+ });
93
+ yargs.option("cleanup", {
94
+ describe: "If an error occurs upon project creation, deletes all generated files",
95
+ alias: "c",
96
+ default: true,
97
+ type: "boolean",
98
+ demandOption: false
99
+ });
84
100
 
85
- await verifyConfig();
86
- require("./index");
87
- })();
101
+ yargs.example("$0 <project-name>");
102
+ yargs.example("$0 <project-name> --template=aws");
103
+ yargs.example("$0 <project-name> --template=../path/to/template");
104
+ yargs.example("$0 <project-name> --log=./my-logs.txt");
105
+ },
106
+ argv => createProject(argv)
107
+ ).argv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-webiny-project",
3
- "version": "5.41.4",
3
+ "version": "5.42.0-beta.0",
4
4
  "description": "Webiny project bootstrap tool.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,8 @@
13
13
  "author": "Webiny Ltd.",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@webiny/telemetry": "5.41.4",
16
+ "@webiny/system-requirements": "5.42.0-beta.0",
17
+ "@webiny/telemetry": "5.42.0-beta.0",
17
18
  "chalk": "4.1.2",
18
19
  "execa": "5.1.1",
19
20
  "find-up": "5.0.0",
@@ -21,20 +22,20 @@
21
22
  "js-yaml": "3.14.1",
22
23
  "listr": "0.14.3",
23
24
  "load-json-file": "6.2.0",
24
- "node-fetch": "2.7.0",
25
+ "node-fetch": "2.6.7",
25
26
  "os": "0.1.1",
26
27
  "p-retry": "4.6.2",
27
- "rimraf": "5.0.5",
28
- "semver": "7.5.4",
28
+ "rimraf": "6.0.1",
29
+ "semver": "7.6.3",
29
30
  "uuid": "8.3.2",
30
31
  "validate-npm-package-name": "3.0.0",
31
32
  "write-json-file": "4.3.0",
32
- "yargs": "17.6.2",
33
+ "yargs": "17.7.2",
33
34
  "yesno": "0.4.0"
34
35
  },
35
36
  "publishConfig": {
36
37
  "access": "public",
37
38
  "directory": "."
38
39
  },
39
- "gitHead": "94922b33af59db5afe75127bb07443ce7f1448c4"
40
+ "gitHead": "ebf90f62ed3f28114ffdb012b7e5f80988af53d3"
40
41
  }