create-webiny-project 6.4.11 → 6.6.0-alpha.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.
Files changed (47) hide show
  1. package/_templates/base/example.gitignore +1 -0
  2. package/_templates/base/template.package.json +1 -3
  3. package/_templates/server/postgres/.env.example +26 -0
  4. package/_templates/server/postgres/webiny.config.tsx +46 -0
  5. package/_templates/server/sqlite/.env.example +22 -0
  6. package/_templates/server/sqlite/webiny.config.tsx +40 -0
  7. package/bin.js +6 -0
  8. package/bin.js.map +1 -1
  9. package/features/CreateWebinyProject/projects/addProjectDependencies.d.ts +9 -0
  10. package/features/CreateWebinyProject/projects/addProjectDependencies.js +17 -0
  11. package/features/CreateWebinyProject/projects/addProjectDependencies.js.map +1 -0
  12. package/features/CreateWebinyProject/projects/addProjectScripts.d.ts +8 -0
  13. package/features/CreateWebinyProject/projects/addProjectScripts.js +16 -0
  14. package/features/CreateWebinyProject/projects/addProjectScripts.js.map +1 -0
  15. package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js +5 -0
  16. package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js.map +1 -1
  17. package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.d.ts +1 -1
  18. package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js +6 -1
  19. package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js.map +1 -1
  20. package/features/CreateWebinyProject/projects/runHostingTypePrompt.d.ts +2 -0
  21. package/features/CreateWebinyProject/projects/runHostingTypePrompt.js +28 -0
  22. package/features/CreateWebinyProject/projects/runHostingTypePrompt.js.map +1 -0
  23. package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.d.ts +6 -0
  24. package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.js +43 -0
  25. package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.js.map +1 -0
  26. package/features/CreateWebinyProject/projects/server/runInteractivePrompt.d.ts +4 -0
  27. package/features/CreateWebinyProject/projects/server/runInteractivePrompt.js +46 -0
  28. package/features/CreateWebinyProject/projects/server/runInteractivePrompt.js.map +1 -0
  29. package/features/CreateWebinyProject/projects/server/types.d.ts +6 -0
  30. package/features/CreateWebinyProject/projects/server/types.js +0 -0
  31. package/features/CreateWebinyProject.js +54 -14
  32. package/features/CreateWebinyProject.js.map +1 -1
  33. package/package.json +14 -14
  34. package/services/EnsureNoGlobalWebinyCli.js +1 -1
  35. package/services/EnsureNoGlobalWebinyCli.js.map +1 -1
  36. package/services/EnsureSystemWebinyConfig.js +2 -2
  37. package/services/EnsureSystemWebinyConfig.js.map +1 -1
  38. package/services/InitGit.js +3 -3
  39. package/services/InitGit.js.map +1 -1
  40. package/services/IsGitAvailable.js +2 -2
  41. package/services/IsGitAvailable.js.map +1 -1
  42. package/services/SetupYarn/binaries/yarn-4.17.1.cjs +944 -0
  43. package/services/SetupYarn.js +5 -5
  44. package/services/SetupYarn.js.map +1 -1
  45. package/types.d.ts +2 -0
  46. package/services/SetupYarn/binaries/yarn-4.14.1.cjs +0 -940
  47. package/services/SetupYarn/binaries/yarn-4.14.1.d.cts +0 -2
@@ -1,4 +1,4 @@
1
- import execa from "execa";
1
+ import { execa } from "execa";
2
2
  import fs_extra from "fs-extra";
3
3
  import { Listr } from "listr2";
4
4
  import path from "path";
@@ -8,6 +8,8 @@ import yesno from "yesno";
8
8
  import { configureMcp } from "@webiny/mcp";
9
9
  import { SetupBaseWebinyProject } from "./CreateWebinyProject/projects/base/SetupBaseWebinyProject.js";
10
10
  import { SetupAwsWebinyProject } from "./CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js";
11
+ import { SetupServerWebinyProject } from "./CreateWebinyProject/projects/server/SetupServerWebinyProject.js";
12
+ import { runHostingTypePrompt } from "./CreateWebinyProject/projects/runHostingTypePrompt.js";
11
13
  import { Analytics, EnsureNoGlobalWebinyCli, EnsureNoTargetFolder, EnsureNoYarnLockPackageJson, EnsureValidProjectName, GetProjectRootPath, InitGit, IsGitAvailable, PrintErrorInfo, PrintSystemInfo, SetWebinyPackageVersions, SetupYarn } from "../services/index.js";
12
14
  import ora from "ora";
13
15
  const { green: green, bold: bold, cyan: cyan, gray: gray, yellow: yellow } = chalk;
@@ -49,11 +51,9 @@ class CreateWebinyProject {
49
51
  console.log(`Initializing a new Webiny project in ${green(projectRootPath)}...`);
50
52
  const analytics = new Analytics();
51
53
  await analytics.track("start");
52
- let awsProjectParams = {
53
- region: "us-east-1",
54
- storageOps: "ddb",
55
- aiAgent: "other"
56
- };
54
+ let aiAgent = "other";
55
+ let hostingType = "server" === cliArgs.hostingType ? "server" : "aws";
56
+ let hostingTypeResolved = false === cliArgs.interactive;
57
57
  try {
58
58
  const taskItems = [
59
59
  {
@@ -82,10 +82,22 @@ class CreateWebinyProject {
82
82
  const tasks = new Listr(taskItems);
83
83
  await tasks.run();
84
84
  console.log();
85
+ if (false !== cliArgs.interactive) {
86
+ hostingType = await runHostingTypePrompt();
87
+ hostingTypeResolved = true;
88
+ console.log();
89
+ }
85
90
  const setupBaseWebinyProject = new SetupBaseWebinyProject();
86
91
  setupBaseWebinyProject.execute(cliArgs);
87
- const setupAwsWebinyProject = new SetupAwsWebinyProject();
88
- awsProjectParams = await setupAwsWebinyProject.execute(cliArgs);
92
+ if ("server" === hostingType) {
93
+ const setupServerWebinyProject = new SetupServerWebinyProject();
94
+ const serverProjectParams = await setupServerWebinyProject.execute(cliArgs);
95
+ aiAgent = serverProjectParams.aiAgent;
96
+ } else {
97
+ const setupAwsWebinyProject = new SetupAwsWebinyProject();
98
+ const awsProjectParams = await setupAwsWebinyProject.execute(cliArgs);
99
+ aiAgent = awsProjectParams.aiAgent;
100
+ }
89
101
  const setWebinyPackageVersions = new SetWebinyPackageVersions();
90
102
  await setWebinyPackageVersions.execute(cliArgs);
91
103
  console.log();
@@ -104,20 +116,23 @@ class CreateWebinyProject {
104
116
  cause: e
105
117
  });
106
118
  }
107
- if ("other" !== awsProjectParams.aiAgent) {
119
+ if ("other" !== aiAgent) {
108
120
  console.log();
109
- console.log(bold(`Configuring MCP server for ${cyan(awsProjectParams.aiAgent)}...`));
121
+ console.log(bold(`Configuring MCP server for ${cyan(aiAgent)}...`));
110
122
  console.log();
111
123
  await configureMcp({
112
- agent: awsProjectParams.aiAgent,
124
+ agent: aiAgent,
113
125
  ui: new CwpUi(),
114
126
  cwd: projectRootPath
115
127
  });
116
128
  }
117
- await analytics.track("end");
129
+ await analytics.track("end", {
130
+ hostingType
131
+ });
118
132
  } catch (err) {
119
133
  const stage = "error";
120
134
  await analytics.track(stage, {
135
+ hostingType: hostingTypeResolved ? hostingType : "unknown",
121
136
  errorMessage: err.cause?.message || err.message,
122
137
  errorStack: err.cause?.stack || err.stack
123
138
  });
@@ -135,6 +150,31 @@ class CreateWebinyProject {
135
150
  process.exit(1);
136
151
  }
137
152
  console.log();
153
+ if ("server" === hostingType) {
154
+ console.log(`🎉 Your new self-hosted Webiny project ${green(projectName)} has been created!`);
155
+ console.log();
156
+ console.log(yellow("⚠ The self-hosted (server) hosting type is in ALPHA. It's for local\n development and testing with `webiny watch api` / `webiny watch admin`.\n It's still maturing, so expect some rough edges."));
157
+ console.log();
158
+ if ("other" === aiAgent) await configureMcp({
159
+ instructions: true
160
+ });
161
+ console.log([
162
+ `First, enter the project directory: ${green(`cd ${projectName}`)}`,
163
+ "",
164
+ "Then start development mode. Watching all apps at once isn't supported yet,",
165
+ `so run the API and Admin apps separately, each in its own terminal: ${green("yarn webiny watch api")} and ${green("yarn webiny watch admin")}.`,
166
+ "",
167
+ `To see all of the available CLI commands, run ${green("yarn webiny --help")} in your ${green(projectName)} directory.`,
168
+ "",
169
+ "Want to dive deeper into Webiny? Check out https://webiny.com/docs/!",
170
+ "Like the project? Star us on https://github.com/webiny/webiny-js!",
171
+ "",
172
+ "Need help? Join our Slack community! https://www.webiny.com/slack",
173
+ "",
174
+ "🚀 Happy coding!"
175
+ ].join("\n"));
176
+ return;
177
+ }
138
178
  console.log(`🎉 Your new Webiny project ${green(projectName)} has been created and is ready to be deployed for the first time!`);
139
179
  console.log();
140
180
  const ok = await yesno({
@@ -156,12 +196,12 @@ class CreateWebinyProject {
156
196
  stdio: "inherit"
157
197
  });
158
198
  } catch {}
159
- if ("other" === awsProjectParams.aiAgent) await configureMcp({
199
+ if ("other" === aiAgent) await configureMcp({
160
200
  instructions: true
161
201
  });
162
202
  return;
163
203
  }
164
- if ("other" === awsProjectParams.aiAgent) await configureMcp({
204
+ if ("other" === aiAgent) await configureMcp({
165
205
  instructions: true
166
206
  });
167
207
  console.log([
@@ -1 +1 @@
1
- {"version":3,"file":"features/CreateWebinyProject.js","sources":["../../src/features/CreateWebinyProject.ts"],"sourcesContent":["import execa from \"execa\";\nimport fs from \"fs-extra\";\nimport type { ListrTask } from \"listr2\";\nimport { Listr } from \"listr2\";\nimport path from \"path\";\nimport { rimrafSync } from \"rimraf\";\nimport chalk from \"chalk\";\nimport yesno from \"yesno\";\nimport { configureMcp } from \"@webiny/mcp\";\nimport type { IUi } from \"@webiny/mcp\";\nimport { SetupBaseWebinyProject } from \"./CreateWebinyProject/projects/base/SetupBaseWebinyProject.js\";\nimport { SetupAwsWebinyProject } from \"./CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js\";\nimport {\n Analytics,\n EnsureNoGlobalWebinyCli,\n EnsureNoTargetFolder,\n EnsureNoYarnLockPackageJson,\n EnsureValidProjectName,\n GetProjectRootPath,\n InitGit,\n IsGitAvailable,\n PrintErrorInfo,\n PrintSystemInfo,\n SetupYarn,\n SetWebinyPackageVersions\n} from \"../services/index.js\";\nimport { CliParams } from \"../types.js\";\nimport { AwsProjectParams } from \"./CreateWebinyProject/projects/aws/types.js\";\nimport ora from \"ora\";\n\nconst { green, bold, cyan, gray, yellow } = chalk;\n\n/* Styled UI for MCP setup output — aligns visually with the rest of CWP output. */\nclass CwpUi implements IUi {\n info(text: string, ...args: any[]): void {\n console.log(gray(text), ...args);\n }\n\n success(text: string, ...args: any[]): void {\n console.log(`${green(\"✔\")} ${text}`, ...args);\n }\n\n error(text: string, ...args: any[]): void {\n console.error(`${chalk.red(\"✘\")} ${text}`, ...args);\n }\n\n warning(text: string, ...args: any[]): void {\n console.warn(`${yellow(\"⚠\")} ${text}`, ...args);\n }\n\n text(text: string): void {\n console.log(text);\n }\n\n emptyLine(): void {\n console.log();\n }\n}\n\nexport class CreateWebinyProject {\n async execute(cliArgs: CliParams) {\n const { projectName, debug, cleanup, log } = cliArgs;\n\n if (!projectName) {\n throw Error(\"You must provide a name for the project to use.\");\n }\n\n const getProjectRootPath = new GetProjectRootPath();\n const projectRootPath = getProjectRootPath.execute(cliArgs);\n\n // All of these `ensureXyz` services will terminate the process if something is wrong.\n const ensureValidProjectName = new EnsureValidProjectName();\n ensureValidProjectName.execute(projectName);\n\n const ensureNoTargetFolder = new EnsureNoTargetFolder();\n ensureNoTargetFolder.execute(cliArgs);\n\n const ensureNoYarnLockPackageJson = new EnsureNoYarnLockPackageJson();\n await ensureNoYarnLockPackageJson.execute();\n\n const ensureNoGlobalWebinyCli = new EnsureNoGlobalWebinyCli();\n await ensureNoGlobalWebinyCli.execute();\n\n const isGitAvailable = new IsGitAvailable().execute();\n\n console.log(`Initializing a new Webiny project in ${green(projectRootPath)}...`);\n\n const analytics = new Analytics();\n await analytics.track(\"start\");\n\n let awsProjectParams: AwsProjectParams = {\n region: \"us-east-1\",\n storageOps: \"ddb\",\n aiAgent: \"other\"\n };\n\n try {\n const taskItems: ListrTask[] = [\n {\n // Creates root package.json.\n title: \"Prepare project folder\",\n task: () => fs.ensureDirSync(projectName)\n },\n {\n title: \"Setup Yarn\",\n task: async () => {\n const setupYarn = new SetupYarn();\n await setupYarn.execute(cliArgs);\n }\n }\n ];\n\n if (isGitAvailable) {\n taskItems.push({\n title: `Initialize git`,\n task: (_, task) => {\n const initGit = new InitGit();\n try {\n initGit.execute(cliArgs);\n } catch {\n task.skip(\"Git repo not initialized\");\n }\n }\n });\n }\n\n const tasks = new Listr(taskItems);\n await tasks.run();\n\n console.log();\n\n const setupBaseWebinyProject = new SetupBaseWebinyProject();\n setupBaseWebinyProject.execute(cliArgs);\n\n const setupAwsWebinyProject = new SetupAwsWebinyProject();\n awsProjectParams = await setupAwsWebinyProject.execute(cliArgs);\n\n const setWebinyPackageVersions = new SetWebinyPackageVersions();\n await setWebinyPackageVersions.execute(cliArgs);\n\n // Install dependencies.\n console.log();\n const spinner = ora(\"Installing packages...\").start();\n try {\n const subprocess = execa(\"yarn\", [], {\n cwd: projectRootPath,\n maxBuffer: 500_000_000\n });\n await subprocess;\n spinner.succeed(\"Packages installed successfully.\");\n } catch (e) {\n spinner.fail(\"Failed to install packages.\");\n\n console.log(e.message);\n\n throw new Error(\n \"Failed while installing project dependencies. Please check the above Yarn logs for more information.\",\n { cause: e }\n );\n }\n\n // Configure MCP server for the selected AI agent.\n if (awsProjectParams.aiAgent !== \"other\") {\n console.log();\n console.log(\n bold(`Configuring MCP server for ${cyan(awsProjectParams.aiAgent)}...`)\n );\n console.log();\n await configureMcp({\n agent: awsProjectParams.aiAgent,\n ui: new CwpUi(),\n cwd: projectRootPath\n });\n }\n\n await analytics.track(\"end\");\n } catch (err) {\n const stage = \"error\";\n // Commenting out for now, as we don't have any graceful errors implemented yet.\n // if (err instanceof GracefulError) {\n // stage = \"error-graceful\";\n // }\n\n await analytics.track(stage, {\n errorMessage: err.cause?.message || err.message,\n errorStack: err.cause?.stack || err.stack\n });\n\n const printErrorInfo = new PrintErrorInfo();\n printErrorInfo.execute(err, cliArgs);\n\n const printSystemInfo = new PrintSystemInfo();\n printSystemInfo.execute(cliArgs);\n\n console.log(`Writing logs to ${green(path.resolve(log))}...`);\n fs.writeFileSync(path.resolve(log), err.toString());\n\n console.log();\n if (cleanup) {\n console.log(\"Deleting created files and folders...\");\n rimrafSync(projectRootPath);\n } else {\n console.log(\"Project cleanup skipped.\");\n }\n\n process.exit(1);\n }\n\n console.log();\n console.log(\n `🎉 Your new Webiny project ${green(\n projectName\n )} has been created and is ready to be deployed for the first time!`\n );\n console.log();\n\n const ok = await yesno({\n question: bold(`${green(\"?\")} Would you like to deploy your project now (Y/n)?`),\n defaultValue: true\n });\n\n console.log();\n\n if (ok) {\n console.log(\"🚀 Deploying your new Webiny project...\");\n console.log();\n\n try {\n const command = [\"webiny\", \"deploy\"];\n if (debug) {\n command.push(\"--debug\");\n }\n\n await execa(\"yarn\", command, {\n cwd: projectRootPath,\n stdio: \"inherit\"\n });\n } catch {\n // Don't do anything. This is because the `webiny deploy` command has its own\n // error handling and will print the error message. As far as this setup script\n // is concerned, it succeeded, and it doesn't need to do anything else.\n }\n\n // For \"other\" agents, show manual MCP setup instructions after deploy has finished.\n if (awsProjectParams.aiAgent === \"other\") {\n await configureMcp({ instructions: true });\n }\n\n return;\n }\n\n // For \"other\" agents, show manual MCP setup instructions instead of blocking the deploy step.\n if (awsProjectParams.aiAgent === \"other\") {\n await configureMcp({ instructions: true });\n }\n\n console.log(\n [\n `Finish the setup by running the following command: ${green(\n `cd ${projectName} && yarn webiny deploy`\n )}`,\n \"\",\n `To see all of the available CLI commands, run ${green(\n \"yarn webiny --help\"\n )} in your ${green(projectName)} directory.`,\n \"\",\n \"Want to dive deeper into Webiny? Check out https://webiny.com/docs/!\",\n \"Like the project? Star us on https://github.com/webiny/webiny-js!\",\n \"\",\n \"Need help? Join our Slack community! https://www.webiny.com/slack\",\n \"\",\n \"🚀 Happy coding!\"\n ].join(\"\\n\")\n );\n }\n}\n"],"names":["green","bold","cyan","gray","yellow","chalk","CwpUi","text","args","console","CreateWebinyProject","cliArgs","projectName","debug","cleanup","log","Error","getProjectRootPath","GetProjectRootPath","projectRootPath","ensureValidProjectName","EnsureValidProjectName","ensureNoTargetFolder","EnsureNoTargetFolder","ensureNoYarnLockPackageJson","EnsureNoYarnLockPackageJson","ensureNoGlobalWebinyCli","EnsureNoGlobalWebinyCli","isGitAvailable","IsGitAvailable","analytics","Analytics","awsProjectParams","taskItems","fs","setupYarn","SetupYarn","_","task","initGit","InitGit","tasks","Listr","setupBaseWebinyProject","SetupBaseWebinyProject","setupAwsWebinyProject","SetupAwsWebinyProject","setWebinyPackageVersions","SetWebinyPackageVersions","spinner","ora","subprocess","execa","e","configureMcp","err","stage","printErrorInfo","PrintErrorInfo","printSystemInfo","PrintSystemInfo","path","rimrafSync","process","ok","yesno","command"],"mappings":";;;;;;;;;;;;AA8BA,MAAM,EAAEA,OAAAA,KAAK,EAAEC,MAAAA,IAAI,EAAEC,MAAAA,IAAI,EAAEC,MAAAA,IAAI,EAAEC,QAAAA,MAAM,EAAE,GAAGC;AAG5C,MAAMC;IACF,KAAKC,IAAY,EAAE,GAAGC,IAAW,EAAQ;QACrCC,QAAQ,GAAG,CAACN,KAAKI,UAAUC;IAC/B;IAEA,QAAQD,IAAY,EAAE,GAAGC,IAAW,EAAQ;QACxCC,QAAQ,GAAG,CAAC,GAAGT,MAAM,KAAK,CAAC,EAAEO,MAAM,KAAKC;IAC5C;IAEA,MAAMD,IAAY,EAAE,GAAGC,IAAW,EAAQ;QACtCC,QAAQ,KAAK,CAAC,GAAGJ,MAAM,GAAG,CAAC,KAAK,CAAC,EAAEE,MAAM,KAAKC;IAClD;IAEA,QAAQD,IAAY,EAAE,GAAGC,IAAW,EAAQ;QACxCC,QAAQ,IAAI,CAAC,GAAGL,OAAO,KAAK,CAAC,EAAEG,MAAM,KAAKC;IAC9C;IAEA,KAAKD,IAAY,EAAQ;QACrBE,QAAQ,GAAG,CAACF;IAChB;IAEA,YAAkB;QACdE,QAAQ,GAAG;IACf;AACJ;AAEO,MAAMC;IACT,MAAM,QAAQC,OAAkB,EAAE;QAC9B,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,OAAO,EAAEC,GAAG,EAAE,GAAGJ;QAE7C,IAAI,CAACC,aACD,MAAMI,MAAM;QAGhB,MAAMC,qBAAqB,IAAIC;QAC/B,MAAMC,kBAAkBF,mBAAmB,OAAO,CAACN;QAGnD,MAAMS,yBAAyB,IAAIC;QACnCD,uBA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QAAQ,GAAG;QACXA,QAAQ,GAAG,CACP,CAAC,2BAA2B,EAAET,MAC1BY,aACF,iEAAiE,CAAC;QAExEH,QAAQ,GAAG;QAEX,MAAMuD,KAAK,MAAMC,MAAM;YACnB,UAAUhE,KAAK,GAAGD,MAAM,KAAK,iDAAiD,CAAC;YAC/E,cAAc;QAClB;QAEAS,QAAQ,GAAG;QAEX,IAAIuD,IAAI;YACJvD,QAAQ,GAAG,CAAC;YACZA,QAAQ,GAAG;YAEX,IAAI;gBACA,MAAMyD,UAAU;oBAAC;oBAAU;iBAAS;gBACpC,IAAIrD,OACAqD,QAAQ,IAAI,CAAC;gBAGjB,MAAMd,MAAM,QAAQc,SAAS;oBACzB,KAAK/C;oBACL,OAAO;gBACX;YACJ,EAAE,OAAM,CAIR;YAGA,IAAIa,AAA6B,YAA7BA,iBAAiB,OAAO,EACxB,MAAMsB,aAAa;gBAAE,cAAc;YAAK;YAG5C;QACJ;QAGA,IAAItB,AAA6B,YAA7BA,iBAAiB,OAAO,EACxB,MAAMsB,aAAa;YAAE,cAAc;QAAK;QAG5C7C,QAAQ,GAAG,CACP;YACI,CAAC,mDAAmD,EAAET,MAClD,CAAC,GAAG,EAAEY,YAAY,sBAAsB,CAAC,GAC1C;YACH;YACA,CAAC,8CAA8C,EAAEZ,MAC7C,sBACF,SAAS,EAAEA,MAAMY,aAAa,WAAW,CAAC;YAC5C;YACA;YACA;YACA;YACA;YACA;YACA;SACH,CAAC,IAAI,CAAC;IAEf;AACJ"}
1
+ {"version":3,"file":"features/CreateWebinyProject.js","sources":["../../src/features/CreateWebinyProject.ts"],"sourcesContent":["import { execa } from \"execa\";\nimport fs from \"fs-extra\";\nimport type { ListrTask } from \"listr2\";\nimport { Listr } from \"listr2\";\nimport path from \"path\";\nimport { rimrafSync } from \"rimraf\";\nimport chalk from \"chalk\";\nimport yesno from \"yesno\";\nimport { configureMcp } from \"@webiny/mcp\";\nimport type { IUi } from \"@webiny/mcp\";\nimport { SetupBaseWebinyProject } from \"./CreateWebinyProject/projects/base/SetupBaseWebinyProject.js\";\nimport { SetupAwsWebinyProject } from \"./CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js\";\nimport { SetupServerWebinyProject } from \"./CreateWebinyProject/projects/server/SetupServerWebinyProject.js\";\nimport {\n runHostingTypePrompt,\n type HostingType\n} from \"./CreateWebinyProject/projects/runHostingTypePrompt.js\";\nimport {\n Analytics,\n EnsureNoGlobalWebinyCli,\n EnsureNoTargetFolder,\n EnsureNoYarnLockPackageJson,\n EnsureValidProjectName,\n GetProjectRootPath,\n InitGit,\n IsGitAvailable,\n PrintErrorInfo,\n PrintSystemInfo,\n SetupYarn,\n SetWebinyPackageVersions\n} from \"../services/index.js\";\nimport { CliParams } from \"../types.js\";\nimport ora from \"ora\";\n\nconst { green, bold, cyan, gray, yellow } = chalk;\n\n/* Styled UI for MCP setup output — aligns visually with the rest of CWP output. */\nclass CwpUi implements IUi {\n info(text: string, ...args: any[]): void {\n console.log(gray(text), ...args);\n }\n\n success(text: string, ...args: any[]): void {\n console.log(`${green(\"✔\")} ${text}`, ...args);\n }\n\n error(text: string, ...args: any[]): void {\n console.error(`${chalk.red(\"✘\")} ${text}`, ...args);\n }\n\n warning(text: string, ...args: any[]): void {\n console.warn(`${yellow(\"⚠\")} ${text}`, ...args);\n }\n\n text(text: string): void {\n console.log(text);\n }\n\n emptyLine(): void {\n console.log();\n }\n}\n\nexport class CreateWebinyProject {\n async execute(cliArgs: CliParams) {\n const { projectName, debug, cleanup, log } = cliArgs;\n\n if (!projectName) {\n throw Error(\"You must provide a name for the project to use.\");\n }\n\n const getProjectRootPath = new GetProjectRootPath();\n const projectRootPath = getProjectRootPath.execute(cliArgs);\n\n // All of these `ensureXyz` services will terminate the process if something is wrong.\n const ensureValidProjectName = new EnsureValidProjectName();\n ensureValidProjectName.execute(projectName);\n\n const ensureNoTargetFolder = new EnsureNoTargetFolder();\n ensureNoTargetFolder.execute(cliArgs);\n\n const ensureNoYarnLockPackageJson = new EnsureNoYarnLockPackageJson();\n await ensureNoYarnLockPackageJson.execute();\n\n const ensureNoGlobalWebinyCli = new EnsureNoGlobalWebinyCli();\n await ensureNoGlobalWebinyCli.execute();\n\n const isGitAvailable = new IsGitAvailable().execute();\n\n console.log(`Initializing a new Webiny project in ${green(projectRootPath)}...`);\n\n const analytics = new Analytics();\n // No `hostingType` here: in interactive mode the choice hasn't been made yet, and reporting\n // the placeholder default would inflate \"aws\". Use `-end` / `-error` to segment by hosting\n // type, and this event as the funnel denominator.\n await analytics.track(\"start\");\n\n // AI agent selected during the hosting-type prompt (used for MCP setup + final messages).\n let aiAgent: string = \"other\";\n\n // Hosting type. Resolved interactively below, or taken from `--hosting-type` in non-interactive\n // mode (defaults to \"aws\").\n let hostingType: HostingType = cliArgs.hostingType === \"server\" ? \"server\" : \"aws\";\n\n // In interactive mode the value above is only a placeholder until the prompt below runs.\n // Telemetry reports \"unknown\" while that's the case, so a failure before the prompt isn't\n // counted as an AWS project.\n let hostingTypeResolved = cliArgs.interactive === false;\n\n try {\n const taskItems: ListrTask[] = [\n {\n // Creates root package.json.\n title: \"Prepare project folder\",\n task: () => fs.ensureDirSync(projectName)\n },\n {\n title: \"Setup Yarn\",\n task: async () => {\n const setupYarn = new SetupYarn();\n await setupYarn.execute(cliArgs);\n }\n }\n ];\n\n if (isGitAvailable) {\n taskItems.push({\n title: `Initialize git`,\n task: (_, task) => {\n const initGit = new InitGit();\n try {\n initGit.execute(cliArgs);\n } catch {\n task.skip(\"Git repo not initialized\");\n }\n }\n });\n }\n\n const tasks = new Listr(taskItems);\n await tasks.run();\n\n console.log();\n\n // Ask which hosting type to scaffold before anything hosting-specific is copied.\n if (cliArgs.interactive !== false) {\n hostingType = await runHostingTypePrompt();\n hostingTypeResolved = true;\n console.log();\n }\n\n const setupBaseWebinyProject = new SetupBaseWebinyProject();\n setupBaseWebinyProject.execute(cliArgs);\n\n if (hostingType === \"server\") {\n const setupServerWebinyProject = new SetupServerWebinyProject();\n const serverProjectParams = await setupServerWebinyProject.execute(cliArgs);\n aiAgent = serverProjectParams.aiAgent;\n } else {\n const setupAwsWebinyProject = new SetupAwsWebinyProject();\n const awsProjectParams = await setupAwsWebinyProject.execute(cliArgs);\n aiAgent = awsProjectParams.aiAgent;\n }\n\n const setWebinyPackageVersions = new SetWebinyPackageVersions();\n await setWebinyPackageVersions.execute(cliArgs);\n\n // Install dependencies.\n console.log();\n const spinner = ora(\"Installing packages...\").start();\n try {\n const subprocess = execa(\"yarn\", [], {\n cwd: projectRootPath,\n maxBuffer: 500_000_000\n });\n await subprocess;\n spinner.succeed(\"Packages installed successfully.\");\n } catch (e) {\n spinner.fail(\"Failed to install packages.\");\n\n console.log(e.message);\n\n throw new Error(\n \"Failed while installing project dependencies. Please check the above Yarn logs for more information.\",\n { cause: e }\n );\n }\n\n // Configure MCP server for the selected AI agent.\n if (aiAgent !== \"other\") {\n console.log();\n console.log(bold(`Configuring MCP server for ${cyan(aiAgent)}...`));\n console.log();\n await configureMcp({\n agent: aiAgent,\n ui: new CwpUi(),\n cwd: projectRootPath\n });\n }\n\n await analytics.track(\"end\", { hostingType });\n } catch (err) {\n const stage = \"error\";\n // Commenting out for now, as we don't have any graceful errors implemented yet.\n // if (err instanceof GracefulError) {\n // stage = \"error-graceful\";\n // }\n\n await analytics.track(stage, {\n hostingType: hostingTypeResolved ? hostingType : \"unknown\",\n errorMessage: err.cause?.message || err.message,\n errorStack: err.cause?.stack || err.stack\n });\n\n const printErrorInfo = new PrintErrorInfo();\n printErrorInfo.execute(err, cliArgs);\n\n const printSystemInfo = new PrintSystemInfo();\n printSystemInfo.execute(cliArgs);\n\n console.log(`Writing logs to ${green(path.resolve(log))}...`);\n fs.writeFileSync(path.resolve(log), err.toString());\n\n console.log();\n if (cleanup) {\n console.log(\"Deleting created files and folders...\");\n rimrafSync(projectRootPath);\n } else {\n console.log(\"Project cleanup skipped.\");\n }\n\n process.exit(1);\n }\n\n console.log();\n\n // Self-hosted (server) hosting type: no deploy step (ALPHA — dev-first, run with `webiny watch`).\n if (hostingType === \"server\") {\n console.log(\n `🎉 Your new self-hosted Webiny project ${green(projectName)} has been created!`\n );\n console.log();\n console.log(\n yellow(\n \"⚠ The self-hosted (server) hosting type is in ALPHA. It's for local\\n\" +\n \" development and testing with `webiny watch api` / `webiny watch admin`.\\n\" +\n \" It's still maturing, so expect some rough edges.\"\n )\n );\n console.log();\n\n // For \"other\" agents, show manual MCP setup instructions.\n if (aiAgent === \"other\") {\n await configureMcp({ instructions: true });\n }\n\n console.log(\n [\n `First, enter the project directory: ${green(`cd ${projectName}`)}`,\n \"\",\n \"Then start development mode. Watching all apps at once isn't supported yet,\",\n `so run the API and Admin apps separately, each in its own terminal: ${green(\n \"yarn webiny watch api\"\n )} and ${green(\"yarn webiny watch admin\")}.`,\n \"\",\n `To see all of the available CLI commands, run ${green(\n \"yarn webiny --help\"\n )} in your ${green(projectName)} directory.`,\n \"\",\n \"Want to dive deeper into Webiny? Check out https://webiny.com/docs/!\",\n \"Like the project? Star us on https://github.com/webiny/webiny-js!\",\n \"\",\n \"Need help? Join our Slack community! https://www.webiny.com/slack\",\n \"\",\n \"🚀 Happy coding!\"\n ].join(\"\\n\")\n );\n\n return;\n }\n\n console.log(\n `🎉 Your new Webiny project ${green(\n projectName\n )} has been created and is ready to be deployed for the first time!`\n );\n console.log();\n\n const ok = await yesno({\n question: bold(`${green(\"?\")} Would you like to deploy your project now (Y/n)?`),\n defaultValue: true\n });\n\n console.log();\n\n if (ok) {\n console.log(\"🚀 Deploying your new Webiny project...\");\n console.log();\n\n try {\n const command = [\"webiny\", \"deploy\"];\n if (debug) {\n command.push(\"--debug\");\n }\n\n await execa(\"yarn\", command, {\n cwd: projectRootPath,\n stdio: \"inherit\"\n });\n } catch {\n // Don't do anything. This is because the `webiny deploy` command has its own\n // error handling and will print the error message. As far as this setup script\n // is concerned, it succeeded, and it doesn't need to do anything else.\n }\n\n // For \"other\" agents, show manual MCP setup instructions after deploy has finished.\n if (aiAgent === \"other\") {\n await configureMcp({ instructions: true });\n }\n\n return;\n }\n\n // For \"other\" agents, show manual MCP setup instructions instead of blocking the deploy step.\n if (aiAgent === \"other\") {\n await configureMcp({ instructions: true });\n }\n\n console.log(\n [\n `Finish the setup by running the following command: ${green(\n `cd ${projectName} && yarn webiny deploy`\n )}`,\n \"\",\n `To see all of the available CLI commands, run ${green(\n \"yarn webiny --help\"\n )} in your ${green(projectName)} directory.`,\n \"\",\n \"Want to dive deeper into Webiny? Check out https://webiny.com/docs/!\",\n \"Like the project? Star us on https://github.com/webiny/webiny-js!\",\n \"\",\n \"Need help? Join our Slack community! https://www.webiny.com/slack\",\n \"\",\n \"🚀 Happy coding!\"\n ].join(\"\\n\")\n );\n }\n}\n"],"names":["green","bold","cyan","gray","yellow","chalk","CwpUi","text","args","console","CreateWebinyProject","cliArgs","projectName","debug","cleanup","log","Error","getProjectRootPath","GetProjectRootPath","projectRootPath","ensureValidProjectName","EnsureValidProjectName","ensureNoTargetFolder","EnsureNoTargetFolder","ensureNoYarnLockPackageJson","EnsureNoYarnLockPackageJson","ensureNoGlobalWebinyCli","EnsureNoGlobalWebinyCli","isGitAvailable","IsGitAvailable","analytics","Analytics","aiAgent","hostingType","hostingTypeResolved","taskItems","fs","setupYarn","SetupYarn","_","task","initGit","InitGit","tasks","Listr","runHostingTypePrompt","setupBaseWebinyProject","SetupBaseWebinyProject","setupServerWebinyProject","SetupServerWebinyProject","serverProjectParams","setupAwsWebinyProject","SetupAwsWebinyProject","awsProjectParams","setWebinyPackageVersions","SetWebinyPackageVersions","spinner","ora","subprocess","execa","e","configureMcp","err","stage","printErrorInfo","PrintErrorInfo","printSystemInfo","PrintSystemInfo","path","rimrafSync","process","ok","yesno","command"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM,EAAEA,OAAAA,KAAK,EAAEC,MAAAA,IAAI,EAAEC,MAAAA,IAAI,EAAEC,MAAAA,IAAI,EAAEC,QAAAA,MAAM,EAAE,GAAGC;AAG5C,MAAMC;IAC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,SACA,MAAM6B,aAAa;YAAE,cAAc;QAAK;QAG5CpD,QAAQ,GAAG,CACP;YACI,CAAC,mDAAmD,EAAET,MAClD,CAAC,GAAG,EAAEY,YAAY,sBAAsB,CAAC,GAC1C;YACH;YACA,CAAC,8CAA8C,EAAEZ,MAC7C,sBACF,SAAS,EAAEA,MAAMY,aAAa,WAAW,CAAC;YAC5C;YACA;YACA;YACA;YACA;YACA;YACA;SACH,CAAC,IAAI,CAAC;IAEf;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-webiny-project",
3
- "version": "6.4.11",
3
+ "version": "6.6.0-alpha.1",
4
4
  "type": "module",
5
5
  "description": "Webiny project bootstrap tool.",
6
6
  "exports": {
@@ -13,32 +13,32 @@
13
13
  "author": "Webiny Ltd.",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@webiny/build-tools": "6.4.11",
17
- "@webiny/mcp": "6.4.11",
18
- "@webiny/system-requirements": "6.4.11",
19
- "@webiny/telemetry": "6.4.11",
20
- "chalk": "5.6.2",
21
- "execa": "5.1.1",
16
+ "@webiny/build-tools": "6.6.0-alpha.1",
17
+ "@webiny/mcp": "6.6.0-alpha.1",
18
+ "@webiny/stdlib": "0.0.17",
19
+ "@webiny/system-requirements": "6.6.0-alpha.1",
20
+ "@webiny/telemetry": "6.6.0-alpha.1",
21
+ "chalk": "6.0.0",
22
+ "execa": "10.0.1",
22
23
  "find-up": "8.0.0",
23
- "fs-extra": "11.3.6",
24
- "inquirer": "14.0.2",
25
- "js-yaml": "5.2.1",
26
- "listr2": "10.2.2",
24
+ "fs-extra": "11.4.0",
25
+ "inquirer": "14.1.0",
26
+ "js-yaml": "5.3.0",
27
+ "listr2": "11.0.0",
27
28
  "load-json-file": "7.0.1",
28
29
  "ora": "9.4.1",
29
30
  "os": "0.1.2",
30
31
  "rimraf": "6.1.3",
31
32
  "type-fest": "5.8.0",
32
- "uuid": "14.0.1",
33
33
  "validate-npm-package-name": "8.0.0",
34
34
  "write-json-file": "7.0.0",
35
- "yargs": "18.0.0",
35
+ "yargs": "18.1.0",
36
36
  "yesno": "0.4.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/js-yaml": "4.0.9",
40
40
  "@types/validate-npm-package-name": "4.0.2",
41
- "vitest": "4.1.10"
41
+ "vitest": "4.1.11"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"
@@ -1,4 +1,4 @@
1
- import execa from "execa";
1
+ import { execa } from "execa";
2
2
  import chalk from "chalk";
3
3
  const { green: green } = chalk;
4
4
  class EnsureNoGlobalWebinyCli {
@@ -1 +1 @@
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
+ {"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"}
@@ -2,7 +2,7 @@ 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 } from "uuid";
5
+ import { uuid } from "@webiny/stdlib";
6
6
  const configPath = path.join(os.homedir(), ".webiny", "config");
7
7
  class EnsureSystemWebinyConfig {
8
8
  execute() {
@@ -11,7 +11,7 @@ class EnsureSystemWebinyConfig {
11
11
  if (!config.id) throw Error("Invalid Webiny config.");
12
12
  } catch {
13
13
  writeJsonFileSync(configPath, {
14
- id: v4(),
14
+ id: uuid(),
15
15
  telemetry: true
16
16
  });
17
17
  }
@@ -1 +1 @@
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
+ {"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 { uuid as uuidv4 } from \"@webiny/stdlib\";\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,15 +1,15 @@
1
1
  import path from "path";
2
2
  import fs_extra from "fs-extra";
3
- import execa from "execa";
3
+ import { execaSync } from "execa";
4
4
  import { GetProjectRootPath } from "./GetProjectRootPath.js";
5
5
  class InitGit {
6
6
  execute(cliArgs) {
7
7
  const getProjectRootPath = new GetProjectRootPath();
8
8
  const projectRootPath = getProjectRootPath.execute(cliArgs);
9
- execa.sync("git", [
9
+ execaSync("git", [
10
10
  "--version"
11
11
  ]);
12
- execa.sync("git", [
12
+ execaSync("git", [
13
13
  "init"
14
14
  ], {
15
15
  cwd: projectRootPath
@@ -1 +1 @@
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
+ {"version":3,"file":"services/InitGit.js","sources":["../../src/services/InitGit.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs-extra\";\nimport { execaSync } 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 execaSync(\"git\", [\"--version\"]);\n execaSync(\"git\", [\"init\"], { cwd: projectRootPath });\n fs.writeFileSync(path.join(projectRootPath, \".gitignore\"), \"node_modules/\");\n }\n}\n"],"names":["InitGit","cliArgs","getProjectRootPath","GetProjectRootPath","projectRootPath","execaSync","fs","path"],"mappings":";;;;AAMO,MAAMA;IACT,QAAQC,OAAkB,EAAE;QACxB,MAAMC,qBAAqB,IAAIC;QAC/B,MAAMC,kBAAkBF,mBAAmB,OAAO,CAACD;QAEnDI,UAAU,OAAO;YAAC;SAAY;QAC9BA,UAAU,OAAO;YAAC;SAAO,EAAE;YAAE,KAAKD;QAAgB;QAClDE,SAAAA,aAAgB,CAACC,KAAK,IAAI,CAACH,iBAAiB,eAAe;IAC/D;AACJ"}
@@ -1,8 +1,8 @@
1
- import execa from "execa";
1
+ import { execaSync } from "execa";
2
2
  class IsGitAvailable {
3
3
  execute() {
4
4
  try {
5
- execa.sync("git", [
5
+ execaSync("git", [
6
6
  "--version"
7
7
  ]);
8
8
  return true;
@@ -1 +1 @@
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
+ {"version":3,"file":"services/IsGitAvailable.js","sources":["../../src/services/IsGitAvailable.ts"],"sourcesContent":["import { execaSync } from \"execa\";\n\nexport class IsGitAvailable {\n execute() {\n try {\n execaSync(\"git\", [\"--version\"]);\n return true;\n } catch {\n return false;\n }\n }\n}\n"],"names":["IsGitAvailable","execaSync"],"mappings":";AAEO,MAAMA;IACT,UAAU;QACN,IAAI;YACAC,UAAU,OAAO;gBAAC;aAAY;YAC9B,OAAO;QACX,EAAE,OAAM;YACJ,OAAO;QACX;IACJ;AACJ"}