create-webiny-project 6.3.0 → 6.4.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/_templates/base/template.package.json +1 -1
- package/bin.js +74 -83
- package/bin.js.map +1 -1
- package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js +28 -37
- package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js.map +1 -1
- package/features/CreateWebinyProject/projects/aws/availableAwsRegions.js +75 -58
- package/features/CreateWebinyProject/projects/aws/availableAwsRegions.js.map +1 -1
- package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.js +46 -39
- package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.js.map +1 -1
- package/features/CreateWebinyProject/projects/aws/types.js +0 -3
- package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js +27 -24
- package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js.map +1 -1
- package/features/CreateWebinyProject.js +160 -187
- package/features/CreateWebinyProject.js.map +1 -1
- package/package.json +9 -9
- package/services/Analytics.js +12 -11
- package/services/Analytics.js.map +1 -1
- package/services/EnsureNoGlobalWebinyCli.js +24 -12
- package/services/EnsureNoGlobalWebinyCli.js.map +1 -1
- package/services/EnsureNoTargetFolder.js +15 -19
- package/services/EnsureNoTargetFolder.js.map +1 -1
- package/services/EnsureNoYarnLockPackageJson.js +19 -13
- package/services/EnsureNoYarnLockPackageJson.js.map +1 -1
- package/services/EnsureSystemWebinyConfig.js +13 -16
- package/services/EnsureSystemWebinyConfig.js.map +1 -1
- package/services/EnsureValidProjectName.js +17 -16
- package/services/EnsureValidProjectName.js.map +1 -1
- package/services/GetCwpVersion.js +10 -13
- package/services/GetCwpVersion.js.map +1 -1
- package/services/GetProjectRootPath.js +5 -4
- package/services/GetProjectRootPath.js.map +1 -1
- package/services/GetTemplatesFolderPath.js +9 -11
- package/services/GetTemplatesFolderPath.js.map +1 -1
- package/services/InitGit.js +16 -11
- package/services/InitGit.js.map +1 -1
- package/services/IsGitAvailable.js +11 -8
- package/services/IsGitAvailable.js.map +1 -1
- package/services/PrintErrorInfo.js +13 -11
- package/services/PrintErrorInfo.js.map +1 -1
- package/services/PrintSystemInfo.js +40 -30
- package/services/PrintSystemInfo.js.map +1 -1
- package/services/SetWebinyPackageVersions.js +14 -21
- package/services/SetWebinyPackageVersions.js.map +1 -1
- package/services/SetupYarn.js +35 -53
- package/services/SetupYarn.js.map +1 -1
- package/services/index.js +0 -2
- package/types.js +0 -3
- package/features/CreateWebinyProject/projects/aws/types.js.map +0 -1
- package/services/index.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import execa from "execa";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
const { green: green } = chalk;
|
|
4
|
+
class EnsureNoGlobalWebinyCli {
|
|
5
|
+
async execute() {
|
|
6
|
+
try {
|
|
7
|
+
await execa("npm", [
|
|
8
|
+
"list",
|
|
9
|
+
"-g",
|
|
10
|
+
"@webiny/cli"
|
|
11
|
+
]);
|
|
12
|
+
console.log([
|
|
13
|
+
"",
|
|
14
|
+
"🚨 IMPORTANT NOTICE:",
|
|
15
|
+
"----------------------------------------",
|
|
16
|
+
`We've detected a global installation of ${green("@webiny/cli")}. This might not play well with your new project.`,
|
|
17
|
+
`We recommend you do one of the following things:\n`,
|
|
18
|
+
` - uninstall the global @webiny/cli package by running ${green("npm rm -g @webiny/cli")} or`,
|
|
19
|
+
` - run webiny commands using ${green("yarn webiny")} so that the package is always resolved to your project dependencies\n`,
|
|
20
|
+
"The second option is also recommended if you have an older version of Webiny project you want to keep using.",
|
|
21
|
+
"----------------------------------------",
|
|
22
|
+
""
|
|
23
|
+
].join("\n"));
|
|
24
|
+
process.exit(1);
|
|
25
|
+
} catch {}
|
|
14
26
|
}
|
|
15
|
-
}
|
|
16
27
|
}
|
|
28
|
+
export { EnsureNoGlobalWebinyCli };
|
|
17
29
|
|
|
18
30
|
//# sourceMappingURL=EnsureNoGlobalWebinyCli.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/EnsureNoGlobalWebinyCli.js","sources":["../../src/services/EnsureNoGlobalWebinyCli.ts"],"sourcesContent":["import execa from \"execa\";\nimport chalk from \"chalk\";\nconst { green } = chalk;\n\nexport class EnsureNoGlobalWebinyCli {\n async execute() {\n try {\n await execa(\"npm\", [\"list\", \"-g\", \"@webiny/cli\"]);\n console.log(\n [\n \"\",\n \"🚨 IMPORTANT NOTICE:\",\n \"----------------------------------------\",\n `We've detected a global installation of ${green(\n \"@webiny/cli\"\n )}. This might not play well with your new project.`,\n `We recommend you do one of the following things:\\n`,\n ` - uninstall the global @webiny/cli package by running ${green(\n \"npm rm -g @webiny/cli\"\n )} or`,\n ` - run webiny commands using ${green(\n \"yarn webiny\"\n )} so that the package is always resolved to your project dependencies\\n`,\n `The second option is also recommended if you have an older version of Webiny project you want to keep using.`,\n \"----------------------------------------\",\n \"\"\n ].join(\"\\n\")\n );\n\n process.exit(1);\n } catch {\n // @webiny/cli is not installed globally\n }\n }\n}\n"],"names":["green","chalk","EnsureNoGlobalWebinyCli","execa","console","process"],"mappings":";;AAEA,MAAM,EAAEA,OAAAA,KAAK,EAAE,GAAGC;AAEX,MAAMC;IACT,MAAM,UAAU;QACZ,IAAI;YACA,MAAMC,MAAM,OAAO;gBAAC;gBAAQ;gBAAM;aAAc;YAChDC,QAAQ,GAAG,CACP;gBACI;gBACA;gBACA;gBACA,CAAC,wCAAwC,EAAEJ,MACvC,eACF,iDAAiD,CAAC;gBACpD,CAAC,kDAAkD,CAAC;gBACpD,CAAC,uDAAuD,EAAEA,MACtD,yBACF,GAAG,CAAC;gBACN,CAAC,6BAA6B,EAAEA,MAC5B,eACF,sEAAsE,CAAC;gBACzE;gBACA;gBACA;aACH,CAAC,IAAI,CAAC;YAGXK,QAAQ,IAAI,CAAC;QACjB,EAAE,OAAM,CAER;IACJ;AACJ"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs_extra from "fs-extra";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { GetProjectRootPath } from "./GetProjectRootPath.js";
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
console.log(`Cannot continue because the target folder ${red(projectName)} already exists.`);
|
|
18
|
-
console.log(`If you still wish to proceed, run the same command with the ${red("--force")} flag.`);
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
4
|
+
const { red: red } = chalk;
|
|
5
|
+
class EnsureNoTargetFolder {
|
|
6
|
+
execute(cliArgs) {
|
|
7
|
+
const getProjectRootPath = new GetProjectRootPath();
|
|
8
|
+
const projectRootPath = getProjectRootPath.execute(cliArgs);
|
|
9
|
+
const { force, projectName } = cliArgs;
|
|
10
|
+
if (fs_extra.existsSync(projectRootPath)) {
|
|
11
|
+
if (!force) {
|
|
12
|
+
console.log(`Cannot continue because the target folder ${red(projectName)} already exists.`);
|
|
13
|
+
console.log(`If you still wish to proceed, run the same command with the ${red("--force")} flag.`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
21
17
|
}
|
|
22
|
-
}
|
|
23
18
|
}
|
|
19
|
+
export { EnsureNoTargetFolder };
|
|
24
20
|
|
|
25
21
|
//# sourceMappingURL=EnsureNoTargetFolder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/EnsureNoTargetFolder.js","sources":["../../src/services/EnsureNoTargetFolder.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport chalk from \"chalk\";\nimport { CliParams } from \"../types.js\";\nimport { GetProjectRootPath } from \"./GetProjectRootPath.js\";\n\nconst { red } = chalk;\n\nexport class EnsureNoTargetFolder {\n execute(cliArgs: CliParams) {\n const getProjectRootPath = new GetProjectRootPath();\n const projectRootPath = getProjectRootPath.execute(cliArgs);\n\n const { force, projectName } = cliArgs;\n if (fs.existsSync(projectRootPath)) {\n if (!force) {\n console.log(\n `Cannot continue because the target folder ${red(projectName)} already exists.`\n );\n console.log(\n `If you still wish to proceed, run the same command with the ${red(\n \"--force\"\n )} flag.`\n );\n process.exit(1);\n }\n }\n }\n}\n"],"names":["red","chalk","EnsureNoTargetFolder","cliArgs","getProjectRootPath","GetProjectRootPath","projectRootPath","force","projectName","fs","console","process"],"mappings":";;;AAKA,MAAM,EAAEA,KAAAA,GAAG,EAAE,GAAGC;AAET,MAAMC;IACT,QAAQC,OAAkB,EAAE;QACxB,MAAMC,qBAAqB,IAAIC;QAC/B,MAAMC,kBAAkBF,mBAAmB,OAAO,CAACD;QAEnD,MAAM,EAAEI,KAAK,EAAEC,WAAW,EAAE,GAAGL;QAC/B,IAAIM,SAAAA,UAAa,CAACH,kBACd;YAAA,IAAI,CAACC,OAAO;gBACRG,QAAQ,GAAG,CACP,CAAC,0CAA0C,EAAEV,IAAIQ,aAAa,gBAAgB,CAAC;gBAEnFE,QAAQ,GAAG,CACP,CAAC,4DAA4D,EAAEV,IAC3D,WACF,MAAM,CAAC;gBAEbW,QAAQ,IAAI,CAAC;YACjB;QAAA;IAER;AACJ"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { findUp } from "find-up";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
const { red: red } = chalk;
|
|
4
|
+
class EnsureNoYarnLockPackageJson {
|
|
5
|
+
async execute() {
|
|
6
|
+
return Promise.all([
|
|
7
|
+
findUp("yarn.lock"),
|
|
8
|
+
findUp("package.json")
|
|
9
|
+
]).then((files)=>files.filter(Boolean)).then((files)=>{
|
|
10
|
+
if (files.length) {
|
|
11
|
+
const messages = [
|
|
12
|
+
"\nThe following file(s) will cause problems with project root detection:\n",
|
|
13
|
+
...files.map((file)=>red(file) + "\n"),
|
|
14
|
+
`\nMake sure you delete all ${red("yarn.lock")} and ${red("package.json")} files higher in the hierarchy.`
|
|
15
|
+
];
|
|
16
|
+
console.log(messages.join(""));
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
16
21
|
}
|
|
22
|
+
export { EnsureNoYarnLockPackageJson };
|
|
17
23
|
|
|
18
24
|
//# sourceMappingURL=EnsureNoYarnLockPackageJson.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/EnsureNoYarnLockPackageJson.js","sources":["../../src/services/EnsureNoYarnLockPackageJson.ts"],"sourcesContent":["import { findUp } from \"find-up\";\nimport chalk from \"chalk\";\n\nconst { red } = chalk;\n\nexport class EnsureNoYarnLockPackageJson {\n async execute() {\n return Promise.all([findUp(\"yarn.lock\"), findUp(\"package.json\")])\n .then(files => files.filter(Boolean))\n .then(files => {\n if (files.length) {\n const messages = [\n \"\\nThe following file(s) will cause problems with project root detection:\\n\",\n ...files.map(file => red(file) + \"\\n\"),\n `\\nMake sure you delete all ${red(\"yarn.lock\")} and ${red(\n \"package.json\"\n )} files higher in the hierarchy.`\n ];\n\n console.log(messages.join(\"\"));\n process.exit(1);\n }\n });\n }\n}\n"],"names":["red","chalk","EnsureNoYarnLockPackageJson","Promise","findUp","files","Boolean","messages","file","console","process"],"mappings":";;AAGA,MAAM,EAAEA,KAAAA,GAAG,EAAE,GAAGC;AAET,MAAMC;IACT,MAAM,UAAU;QACZ,OAAOC,QAAQ,GAAG,CAAC;YAACC,OAAO;YAAcA,OAAO;SAAgB,EAC3D,IAAI,CAACC,CAAAA,QAASA,MAAM,MAAM,CAACC,UAC3B,IAAI,CAACD,CAAAA;YACF,IAAIA,MAAM,MAAM,EAAE;gBACd,MAAME,WAAW;oBACb;uBACGF,MAAM,GAAG,CAACG,CAAAA,OAAQR,IAAIQ,QAAQ;oBACjC,CAAC,2BAA2B,EAAER,IAAI,aAAa,KAAK,EAAEA,IAClD,gBACF,+BAA+B,CAAC;iBACrC;gBAEDS,QAAQ,GAAG,CAACF,SAAS,IAAI,CAAC;gBAC1BG,QAAQ,IAAI,CAAC;YACjB;QACJ;IACR;AACJ"}
|
|
@@ -2,24 +2,21 @@ import os from "os";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { loadJsonFileSync } from "load-json-file";
|
|
4
4
|
import { writeJsonFileSync } from "write-json-file";
|
|
5
|
-
import { v4
|
|
5
|
+
import { v4 } from "uuid";
|
|
6
6
|
const configPath = path.join(os.homedir(), ".webiny", "config");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
id: uuidv4(),
|
|
19
|
-
telemetry: true
|
|
20
|
-
});
|
|
7
|
+
class EnsureSystemWebinyConfig {
|
|
8
|
+
execute() {
|
|
9
|
+
try {
|
|
10
|
+
const config = loadJsonFileSync(configPath);
|
|
11
|
+
if (!config.id) throw Error("Invalid Webiny config.");
|
|
12
|
+
} catch {
|
|
13
|
+
writeJsonFileSync(configPath, {
|
|
14
|
+
id: v4(),
|
|
15
|
+
telemetry: true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
21
18
|
}
|
|
22
|
-
}
|
|
23
19
|
}
|
|
20
|
+
export { EnsureSystemWebinyConfig };
|
|
24
21
|
|
|
25
22
|
//# sourceMappingURL=EnsureSystemWebinyConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/EnsureSystemWebinyConfig.js","sources":["../../src/services/EnsureSystemWebinyConfig.ts"],"sourcesContent":["import os from \"os\";\nimport path from \"path\";\nimport { loadJsonFileSync } from \"load-json-file\";\nimport { writeJsonFileSync } from \"write-json-file\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nconst configPath = path.join(os.homedir(), \".webiny\", \"config\");\n\nexport class EnsureSystemWebinyConfig {\n execute() {\n // Check user ID\n try {\n const config = loadJsonFileSync<Record<string, any>>(configPath);\n if (!config.id) {\n throw Error(\"Invalid Webiny config.\");\n }\n } catch {\n // A new config file is written if it doesn't exist or is invalid.\n writeJsonFileSync(configPath, { id: uuidv4(), telemetry: true });\n }\n }\n}\n"],"names":["configPath","path","os","EnsureSystemWebinyConfig","config","loadJsonFileSync","Error","writeJsonFileSync","uuidv4"],"mappings":";;;;;AAMA,MAAMA,aAAaC,KAAK,IAAI,CAACC,GAAG,OAAO,IAAI,WAAW;AAE/C,MAAMC;IACT,UAAU;QAEN,IAAI;YACA,MAAMC,SAASC,iBAAsCL;YACrD,IAAI,CAACI,OAAO,EAAE,EACV,MAAME,MAAM;QAEpB,EAAE,OAAM;YAEJC,kBAAkBP,YAAY;gBAAE,IAAIQ;gBAAU,WAAW;YAAK;QAClE;IACJ;AACJ"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import validate_npm_package_name from "validate-npm-package-name";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
const { red: red, green: green } = chalk;
|
|
4
|
+
class EnsureValidProjectName {
|
|
5
|
+
execute(projectName) {
|
|
6
|
+
const validationResult = validate_npm_package_name(projectName);
|
|
7
|
+
if (!validationResult.validForNewPackages) {
|
|
8
|
+
console.error(red(`Cannot create a project named ${green(`"${projectName}"`)} because of npm naming restrictions:\n`));
|
|
9
|
+
[
|
|
10
|
+
...validationResult.errors || [],
|
|
11
|
+
...validationResult.warnings || []
|
|
12
|
+
].forEach((error)=>{
|
|
13
|
+
console.error(red(` * ${error}`));
|
|
14
|
+
});
|
|
15
|
+
console.error(red("\nPlease choose a different project name."));
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
17
18
|
}
|
|
18
|
-
}
|
|
19
19
|
}
|
|
20
|
+
export { EnsureValidProjectName };
|
|
20
21
|
|
|
21
22
|
//# sourceMappingURL=EnsureValidProjectName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/EnsureValidProjectName.js","sources":["../../src/services/EnsureValidProjectName.ts"],"sourcesContent":["import validateNpmPkgName from \"validate-npm-package-name\";\nimport chalk from \"chalk\";\n\nconst { red, green } = chalk;\n\nexport class EnsureValidProjectName {\n execute(projectName: string) {\n const validationResult = validateNpmPkgName(projectName);\n if (!validationResult.validForNewPackages) {\n console.error(\n red(\n `Cannot create a project named ${green(\n `\"${projectName}\"`\n )} because of npm naming restrictions:\\n`\n )\n );\n [...(validationResult.errors || []), ...(validationResult.warnings || [])].forEach(\n error => {\n console.error(red(` * ${error}`));\n }\n );\n console.error(red(\"\\nPlease choose a different project name.\"));\n process.exit(1);\n }\n }\n}\n"],"names":["red","green","chalk","EnsureValidProjectName","projectName","validationResult","validateNpmPkgName","console","error","process"],"mappings":";;AAGA,MAAM,EAAEA,KAAAA,GAAG,EAAEC,OAAAA,KAAK,EAAE,GAAGC;AAEhB,MAAMC;IACT,QAAQC,WAAmB,EAAE;QACzB,MAAMC,mBAAmBC,0BAAmBF;QAC5C,IAAI,CAACC,iBAAiB,mBAAmB,EAAE;YACvCE,QAAQ,KAAK,CACTP,IACI,CAAC,8BAA8B,EAAEC,MAC7B,CAAC,CAAC,EAAEG,YAAY,CAAC,CAAC,EACpB,sCAAsC,CAAC;YAGjD;mBAAKC,iBAAiB,MAAM,IAAI,EAAE;mBAAOA,iBAAiB,QAAQ,IAAI,EAAE;aAAE,CAAC,OAAO,CAC9EG,CAAAA;gBACID,QAAQ,KAAK,CAACP,IAAI,CAAC,IAAI,EAAEQ,OAAO;YACpC;YAEJD,QAAQ,KAAK,CAACP,IAAI;YAClBS,QAAQ,IAAI,CAAC;QACjB;IACJ;AACJ"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { findUpSync } from "find-up";
|
|
2
2
|
import { loadJsonFileSync } from "load-json-file";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
class GetCwpVersion {
|
|
4
|
+
execute() {
|
|
5
|
+
const cwpPackageJsonPath = findUpSync("package.json", {
|
|
6
|
+
cwd: import.meta.dirname
|
|
7
|
+
});
|
|
8
|
+
if (!cwpPackageJsonPath) throw new Error("Could not find package.json for create-webiny-project.");
|
|
9
|
+
const cwpPackageJson = loadJsonFileSync(cwpPackageJsonPath);
|
|
10
|
+
if (!cwpPackageJson?.version) throw new Error("Could not find version in create-webiny-project's package.json.");
|
|
11
|
+
return cwpPackageJson.version;
|
|
10
12
|
}
|
|
11
|
-
const cwpPackageJson = loadJsonFileSync(cwpPackageJsonPath);
|
|
12
|
-
if (!cwpPackageJson?.version) {
|
|
13
|
-
throw new Error("Could not find version in create-webiny-project's package.json.");
|
|
14
|
-
}
|
|
15
|
-
return cwpPackageJson.version;
|
|
16
|
-
}
|
|
17
13
|
}
|
|
14
|
+
export { GetCwpVersion };
|
|
18
15
|
|
|
19
16
|
//# sourceMappingURL=GetCwpVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/GetCwpVersion.js","sources":["../../src/services/GetCwpVersion.ts"],"sourcesContent":["import { findUpSync } from \"find-up\";\nimport { loadJsonFileSync } from \"load-json-file\";\nimport type { PackageJson } from \"type-fest\";\n\nexport class GetCwpVersion {\n execute(): string {\n const cwpPackageJsonPath = findUpSync(\"package.json\", {\n cwd: import.meta.dirname\n });\n if (!cwpPackageJsonPath) {\n throw new Error(\"Could not find package.json for create-webiny-project.\");\n }\n const cwpPackageJson = loadJsonFileSync<PackageJson>(cwpPackageJsonPath);\n if (!cwpPackageJson?.version) {\n throw new Error(\"Could not find version in create-webiny-project's package.json.\");\n }\n return cwpPackageJson.version;\n }\n}\n"],"names":["GetCwpVersion","cwpPackageJsonPath","findUpSync","Error","cwpPackageJson","loadJsonFileSync"],"mappings":";;AAIO,MAAMA;IACT,UAAkB;QACd,MAAMC,qBAAqBC,WAAW,gBAAgB;YAClD,KAAK,YAAY,OAAO;QAC5B;QACA,IAAI,CAACD,oBACD,MAAM,IAAIE,MAAM;QAEpB,MAAMC,iBAAiBC,iBAA8BJ;QACrD,IAAI,CAACG,gBAAgB,SACjB,MAAM,IAAID,MAAM;QAEpB,OAAOC,eAAe,OAAO;IACjC;AACJ"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
class GetProjectRootPath {
|
|
3
|
+
execute(cliArgs) {
|
|
4
|
+
return path.resolve(cliArgs.projectName).replace(/\\/g, "/");
|
|
5
|
+
}
|
|
6
6
|
}
|
|
7
|
+
export { GetProjectRootPath };
|
|
7
8
|
|
|
8
9
|
//# sourceMappingURL=GetProjectRootPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/GetProjectRootPath.js","sources":["../../src/services/GetProjectRootPath.ts"],"sourcesContent":["import path from \"path\";\nimport { CliParams } from \"../types.js\";\n\nexport class GetProjectRootPath {\n execute(cliArgs: CliParams) {\n return path.resolve(cliArgs.projectName).replace(/\\\\/g, \"/\");\n }\n}\n"],"names":["GetProjectRootPath","cliArgs","path"],"mappings":";AAGO,MAAMA;IACT,QAAQC,OAAkB,EAAE;QACxB,OAAOC,KAAK,OAAO,CAACD,QAAQ,WAAW,EAAE,OAAO,CAAC,OAAO;IAC5D;AACJ"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { findUpSync } from "find-up";
|
|
2
2
|
import path from "path";
|
|
3
3
|
const TEMPLATES_FOLDER_NAME = "_templates";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
throw new Error("Could not find the `appTemplates` folder. Something went terribly wrong.");
|
|
4
|
+
class GetTemplatesFolderPath {
|
|
5
|
+
execute() {
|
|
6
|
+
const templatesFolderPath = findUpSync(TEMPLATES_FOLDER_NAME, {
|
|
7
|
+
type: "directory",
|
|
8
|
+
cwd: path.join(import.meta.dirname)
|
|
9
|
+
});
|
|
10
|
+
if (!templatesFolderPath) throw new Error("Could not find the `appTemplates` folder. Something went terribly wrong.");
|
|
11
|
+
return templatesFolderPath;
|
|
13
12
|
}
|
|
14
|
-
return templatesFolderPath;
|
|
15
|
-
}
|
|
16
13
|
}
|
|
14
|
+
export { GetTemplatesFolderPath };
|
|
17
15
|
|
|
18
16
|
//# sourceMappingURL=GetTemplatesFolderPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/GetTemplatesFolderPath.js","sources":["../../src/services/GetTemplatesFolderPath.ts"],"sourcesContent":["import { findUpSync } from \"find-up\";\nimport path from \"path\";\n\nconst TEMPLATES_FOLDER_NAME = \"_templates\";\n\nexport class GetTemplatesFolderPath {\n execute() {\n const templatesFolderPath = findUpSync(TEMPLATES_FOLDER_NAME, {\n type: \"directory\",\n cwd: path.join(import.meta.dirname)\n });\n\n if (!templatesFolderPath) {\n // This should never happen because we're controlling the templates.\n throw new Error(\n \"Could not find the `appTemplates` folder. Something went terribly wrong.\"\n );\n }\n\n return templatesFolderPath;\n }\n}\n"],"names":["TEMPLATES_FOLDER_NAME","GetTemplatesFolderPath","templatesFolderPath","findUpSync","path","Error"],"mappings":";;AAGA,MAAMA,wBAAwB;AAEvB,MAAMC;IACT,UAAU;QACN,MAAMC,sBAAsBC,WAAWH,uBAAuB;YAC1D,MAAM;YACN,KAAKI,KAAK,IAAI,CAAC,YAAY,OAAO;QACtC;QAEA,IAAI,CAACF,qBAED,MAAM,IAAIG,MACN;QAIR,OAAOH;IACX;AACJ"}
|
package/services/InitGit.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import
|
|
2
|
+
import fs_extra from "fs-extra";
|
|
3
3
|
import execa from "execa";
|
|
4
4
|
import { GetProjectRootPath } from "./GetProjectRootPath.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
class InitGit {
|
|
6
|
+
execute(cliArgs) {
|
|
7
|
+
const getProjectRootPath = new GetProjectRootPath();
|
|
8
|
+
const projectRootPath = getProjectRootPath.execute(cliArgs);
|
|
9
|
+
execa.sync("git", [
|
|
10
|
+
"--version"
|
|
11
|
+
]);
|
|
12
|
+
execa.sync("git", [
|
|
13
|
+
"init"
|
|
14
|
+
], {
|
|
15
|
+
cwd: projectRootPath
|
|
16
|
+
});
|
|
17
|
+
fs_extra.writeFileSync(path.join(projectRootPath, ".gitignore"), "node_modules/");
|
|
18
|
+
}
|
|
15
19
|
}
|
|
20
|
+
export { InitGit };
|
|
16
21
|
|
|
17
22
|
//# sourceMappingURL=InitGit.js.map
|
package/services/InitGit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/InitGit.js","sources":["../../src/services/InitGit.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs-extra\";\nimport execa from \"execa\";\nimport { CliParams } from \"../types.js\";\nimport { GetProjectRootPath } from \"./GetProjectRootPath.js\";\n\nexport class InitGit {\n execute(cliArgs: CliParams) {\n const getProjectRootPath = new GetProjectRootPath();\n const projectRootPath = getProjectRootPath.execute(cliArgs);\n\n execa.sync(\"git\", [\"--version\"]);\n execa.sync(\"git\", [\"init\"], { cwd: projectRootPath });\n fs.writeFileSync(path.join(projectRootPath, \".gitignore\"), \"node_modules/\");\n }\n}\n"],"names":["InitGit","cliArgs","getProjectRootPath","GetProjectRootPath","projectRootPath","execa","fs","path"],"mappings":";;;;AAMO,MAAMA;IACT,QAAQC,OAAkB,EAAE;QACxB,MAAMC,qBAAqB,IAAIC;QAC/B,MAAMC,kBAAkBF,mBAAmB,OAAO,CAACD;QAEnDI,MAAM,IAAI,CAAC,OAAO;YAAC;SAAY;QAC/BA,MAAM,IAAI,CAAC,OAAO;YAAC;SAAO,EAAE;YAAE,KAAKD;QAAgB;QACnDE,SAAAA,aAAgB,CAACC,KAAK,IAAI,CAACH,iBAAiB,eAAe;IAC/D;AACJ"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import execa from "execa";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
class IsGitAvailable {
|
|
3
|
+
execute() {
|
|
4
|
+
try {
|
|
5
|
+
execa.sync("git", [
|
|
6
|
+
"--version"
|
|
7
|
+
]);
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
|
-
}
|
|
11
13
|
}
|
|
14
|
+
export { IsGitAvailable };
|
|
12
15
|
|
|
13
16
|
//# sourceMappingURL=IsGitAvailable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/IsGitAvailable.js","sources":["../../src/services/IsGitAvailable.ts"],"sourcesContent":["import execa from \"execa\";\n\nexport class IsGitAvailable {\n execute() {\n try {\n execa.sync(\"git\", [\"--version\"]);\n return true;\n } catch {\n return false;\n }\n }\n}\n"],"names":["IsGitAvailable","execa"],"mappings":";AAEO,MAAMA;IACT,UAAU;QACN,IAAI;YACAC,MAAM,IAAI,CAAC,OAAO;gBAAC;aAAY;YAC/B,OAAO;QACX,EAAE,OAAM;YACJ,OAAO;QACX;IACJ;AACJ"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
const {
|
|
3
|
-
bold,
|
|
4
|
-
gray
|
|
5
|
-
} = chalk;
|
|
2
|
+
const { bold: bold, gray: gray } = chalk;
|
|
6
3
|
const HL = bold(gray("—")).repeat(30);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
class PrintErrorInfo {
|
|
5
|
+
execute(err, cliArgs) {
|
|
6
|
+
const { debug } = cliArgs;
|
|
7
|
+
console.log([
|
|
8
|
+
"",
|
|
9
|
+
`${bold("Error Logs")}`,
|
|
10
|
+
HL,
|
|
11
|
+
err.message,
|
|
12
|
+
debug && err.stack
|
|
13
|
+
].join("\n"));
|
|
14
|
+
}
|
|
14
15
|
}
|
|
16
|
+
export { PrintErrorInfo };
|
|
15
17
|
|
|
16
18
|
//# sourceMappingURL=PrintErrorInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"services/PrintErrorInfo.js","sources":["../../src/services/PrintErrorInfo.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport { CliParams } from \"../types.js\";\n\nconst { bold, gray } = chalk;\n\nconst HL = bold(gray(\"—\")).repeat(30);\n\nexport class PrintErrorInfo {\n execute(err: Error, cliArgs: CliParams) {\n const { debug } = cliArgs;\n console.log([\"\", `${bold(\"Error Logs\")}`, HL, err.message, debug && err.stack].join(\"\\n\"));\n }\n}\n"],"names":["bold","gray","chalk","HL","PrintErrorInfo","err","cliArgs","debug","console"],"mappings":";AAGA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,MAAAA,IAAI,EAAE,GAAGC;AAEvB,MAAMC,KAAKH,KAAKC,KAAK,MAAM,MAAM,CAAC;AAE3B,MAAMG;IACT,QAAQC,GAAU,EAAEC,OAAkB,EAAE;QACpC,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClBE,QAAQ,GAAG,CAAC;YAAC;YAAI,GAAGR,KAAK,eAAe;YAAEG;YAAIE,IAAI,OAAO;YAAEE,SAASF,IAAI,KAAK;SAAC,CAAC,IAAI,CAAC;IACxF;AACJ"}
|
|
@@ -1,38 +1,48 @@
|
|
|
1
1
|
import { SystemRequirements } from "@webiny/system-requirements";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { GetCwpVersion } from "./GetCwpVersion.js";
|
|
4
|
-
const {
|
|
5
|
-
bold,
|
|
6
|
-
gray
|
|
7
|
-
} = chalk;
|
|
4
|
+
const { bold: bold, gray: gray } = chalk;
|
|
8
5
|
const NOT_APPLICABLE = gray("N/A");
|
|
9
6
|
const HL = bold(gray("—")).repeat(30);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
class PrintSystemInfo {
|
|
8
|
+
execute(cliArgs) {
|
|
9
|
+
const node = SystemRequirements.getNodeVersion();
|
|
10
|
+
const os = SystemRequirements.getOsVersion();
|
|
11
|
+
let npm = NOT_APPLICABLE;
|
|
12
|
+
try {
|
|
13
|
+
npm = SystemRequirements.getNpmVersion();
|
|
14
|
+
} catch {}
|
|
15
|
+
let npx = NOT_APPLICABLE;
|
|
16
|
+
try {
|
|
17
|
+
npx = SystemRequirements.getNpxVersion();
|
|
18
|
+
} catch {}
|
|
19
|
+
let yarn = NOT_APPLICABLE;
|
|
20
|
+
try {
|
|
21
|
+
yarn = SystemRequirements.getYarnVersion();
|
|
22
|
+
} catch {}
|
|
23
|
+
let cwpVersion = NOT_APPLICABLE;
|
|
24
|
+
try {
|
|
25
|
+
const getCwpVersion = new GetCwpVersion();
|
|
26
|
+
cwpVersion = getCwpVersion.execute();
|
|
27
|
+
} catch {}
|
|
28
|
+
const { templateOptions } = cliArgs;
|
|
29
|
+
console.log([
|
|
30
|
+
`${bold("System Information")}`,
|
|
31
|
+
HL,
|
|
32
|
+
`create-webiny-project: ${cwpVersion}`,
|
|
33
|
+
`Operating System: ${os}`,
|
|
34
|
+
`Node: ${node}`,
|
|
35
|
+
`Yarn: ${yarn}`,
|
|
36
|
+
`Npm: ${npm}`,
|
|
37
|
+
`Npx: ${npx}`,
|
|
38
|
+
`Template Options: ${templateOptions}`,
|
|
39
|
+
"",
|
|
40
|
+
"Please open an issue including the error output at https://github.com/webiny/webiny-js/issues/new.",
|
|
41
|
+
"You can also get in touch with us on our Slack Community: https://www.webiny.com/slack",
|
|
42
|
+
""
|
|
43
|
+
].join("\n"));
|
|
44
|
+
}
|
|
36
45
|
}
|
|
46
|
+
export { PrintSystemInfo };
|
|
37
47
|
|
|
38
48
|
//# sourceMappingURL=PrintSystemInfo.js.map
|