create-webiny-project 6.6.0-alpha.3 → 6.6.0-alpha.4
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/{server → standalone}/postgres/.env.example +1 -1
- package/_templates/{server → standalone}/postgres/webiny.config.tsx +3 -3
- package/_templates/{server → standalone}/sqlite/.env.example +1 -1
- package/_templates/{server → standalone}/sqlite/webiny.config.tsx +3 -3
- package/bin.js +1 -1
- package/bin.js.map +1 -1
- package/features/CreateWebinyProject/projects/addProjectScripts.d.ts +1 -1
- package/features/CreateWebinyProject/projects/addProjectScripts.js.map +1 -1
- package/features/CreateWebinyProject/projects/runHostingTypePrompt.d.ts +1 -1
- package/features/CreateWebinyProject/projects/runHostingTypePrompt.js +2 -2
- package/features/CreateWebinyProject/projects/runHostingTypePrompt.js.map +1 -1
- package/features/CreateWebinyProject/projects/standalone/SetupStandaloneWebinyProject.d.ts +6 -0
- package/features/CreateWebinyProject/projects/{server/SetupServerWebinyProject.js → standalone/SetupStandaloneWebinyProject.js} +14 -14
- package/features/CreateWebinyProject/projects/standalone/SetupStandaloneWebinyProject.js.map +1 -0
- package/features/CreateWebinyProject/projects/{server → standalone}/runInteractivePrompt.js +1 -1
- package/features/CreateWebinyProject/projects/standalone/runInteractivePrompt.js.map +1 -0
- package/features/CreateWebinyProject/projects/{server → standalone}/types.d.ts +1 -1
- package/features/CreateWebinyProject.js +9 -9
- package/features/CreateWebinyProject.js.map +1 -1
- package/package.json +6 -6
- package/services/EnsureSystemWebinyConfig.d.ts +15 -0
- package/services/EnsureSystemWebinyConfig.js +2 -15
- package/services/EnsureSystemWebinyConfig.js.map +1 -1
- package/types.d.ts +2 -2
- package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.d.ts +0 -6
- package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.js.map +0 -1
- package/features/CreateWebinyProject/projects/server/runInteractivePrompt.js.map +0 -1
- /package/features/CreateWebinyProject/projects/{server → standalone}/runInteractivePrompt.d.ts +0 -0
- /package/features/CreateWebinyProject/projects/{server → standalone}/types.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Standalone hosting-type environment variables.
|
|
2
2
|
#
|
|
3
3
|
# Everything here is OPTIONAL — the project runs with sensible defaults out of the box
|
|
4
4
|
# (`yarn webiny watch`). To override a value, copy this file to `.env` and uncomment the line.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Admin } from "webiny/extensions";
|
|
3
|
-
// Server-only namespaces come from the
|
|
3
|
+
// Server-only namespaces come from the standalone hosting-type package. `webiny/extensions` exposes the
|
|
4
4
|
// AWS namespaces, which don't include server-only extensions like `Infra.Postgres`.
|
|
5
|
-
import { Infra } from "@webiny/project-
|
|
5
|
+
import { Infra } from "@webiny/project-standalone";
|
|
6
6
|
import { SelfHostedAuth } from "@webiny/self-hosted-auth";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Standalone hosting-type project extensions. No AWS, no Pulumi, no `deploy` — a single
|
|
10
10
|
* long-running Node HTTP server backed by SQL storage. Run it with `yarn webiny watch`.
|
|
11
11
|
*/
|
|
12
12
|
export const Extensions = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Standalone hosting-type environment variables.
|
|
2
2
|
#
|
|
3
3
|
# Everything here is OPTIONAL — the project runs with sensible defaults out of the box
|
|
4
4
|
# (`yarn webiny watch`). To override a value, copy this file to `.env` and uncomment the line.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Admin } from "webiny/extensions";
|
|
3
|
-
// Server-only namespaces come from the
|
|
3
|
+
// Server-only namespaces come from the standalone hosting-type package. `webiny/extensions` exposes the
|
|
4
4
|
// AWS namespaces, which don't include server-only extensions like `Infra.Sqlite`.
|
|
5
|
-
import { Infra } from "@webiny/project-
|
|
5
|
+
import { Infra } from "@webiny/project-standalone";
|
|
6
6
|
import { SelfHostedAuth } from "@webiny/self-hosted-auth";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Standalone hosting-type project extensions. No AWS, no Pulumi, no `deploy` — a single
|
|
10
10
|
* long-running Node HTTP server backed by SQL storage. Run it with `yarn webiny watch`.
|
|
11
11
|
*/
|
|
12
12
|
export const Extensions = () => {
|
package/bin.js
CHANGED
|
@@ -35,7 +35,7 @@ argv.command("$0 <project-name> [options]", "Name of application and template to
|
|
|
35
35
|
demandOption: false
|
|
36
36
|
});
|
|
37
37
|
yargs.option("hosting-type", {
|
|
38
|
-
describe: 'Hosting type to use: "aws" (default) or "server" (
|
|
38
|
+
describe: 'Hosting type to use: "aws" (default) or "server" (standalone, ALPHA). Used in non-interactive mode',
|
|
39
39
|
type: "string",
|
|
40
40
|
default: "aws",
|
|
41
41
|
demandOption: false
|
package/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// Ensure system requirements are met.\nimport { ensureSystemRequirements } from \"@webiny/system-requirements\";\nensureSystemRequirements();\n\n// Verify `.webiny` config file and continue.\nimport { EnsureSystemWebinyConfig } from \"./services/index.js\";\n\nconst ensureSystemWebinyConfig = new EnsureSystemWebinyConfig();\nensureSystemWebinyConfig.execute();\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport { GetCwpVersion } from \"./services/index.js\";\nimport { CreateWebinyProject } from \"./features/CreateWebinyProject.js\";\nimport { type CliParams } from \"./types.js\";\n\nprocess.on(\"unhandledRejection\", err => {\n throw err;\n});\n\nconst getCwpVersion = new GetCwpVersion();\nconst version = getCwpVersion.execute();\n\nconst argv = yargs(hideBin(process.argv))\n .usage(\"Usage: create-webiny-project <project-name> [options]\")\n .version(version)\n .demandCommand(1)\n .help()\n .alias(\"help\", \"h\")\n .scriptName(\"create-webiny-project\")\n .fail(function (msg, err) {\n if (msg) {\n console.log(msg);\n }\n if (err) {\n console.log(err);\n }\n process.exit(1);\n });\n\nargv.command<CliParams>(\n \"$0 <project-name> [options]\",\n \"Name of application and template to use\",\n yargs => {\n yargs.positional(\"project-name\", {\n describe: \"Project name\"\n });\n yargs.option(\"force\", {\n describe: \"All project creation within an existing folder\",\n default: false,\n type: \"boolean\",\n demandOption: false\n });\n yargs.option(\"template\", {\n describe: `Name of template to use, if no template is provided it will default to \"aws\" template`,\n alias: \"t\",\n type: \"string\",\n default: \"aws\",\n demandOption: false\n });\n yargs.option(\"hosting-type\", {\n describe: `Hosting type to use: \"aws\" (default) or \"server\" (
|
|
1
|
+
{"version":3,"file":"bin.js","sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// Ensure system requirements are met.\nimport { ensureSystemRequirements } from \"@webiny/system-requirements\";\nensureSystemRequirements();\n\n// Verify `.webiny` config file and continue.\nimport { EnsureSystemWebinyConfig } from \"./services/index.js\";\n\nconst ensureSystemWebinyConfig = new EnsureSystemWebinyConfig();\nensureSystemWebinyConfig.execute();\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport { GetCwpVersion } from \"./services/index.js\";\nimport { CreateWebinyProject } from \"./features/CreateWebinyProject.js\";\nimport { type CliParams } from \"./types.js\";\n\nprocess.on(\"unhandledRejection\", err => {\n throw err;\n});\n\nconst getCwpVersion = new GetCwpVersion();\nconst version = getCwpVersion.execute();\n\nconst argv = yargs(hideBin(process.argv))\n .usage(\"Usage: create-webiny-project <project-name> [options]\")\n .version(version)\n .demandCommand(1)\n .help()\n .alias(\"help\", \"h\")\n .scriptName(\"create-webiny-project\")\n .fail(function (msg, err) {\n if (msg) {\n console.log(msg);\n }\n if (err) {\n console.log(err);\n }\n process.exit(1);\n });\n\nargv.command<CliParams>(\n \"$0 <project-name> [options]\",\n \"Name of application and template to use\",\n yargs => {\n yargs.positional(\"project-name\", {\n describe: \"Project name\"\n });\n yargs.option(\"force\", {\n describe: \"All project creation within an existing folder\",\n default: false,\n type: \"boolean\",\n demandOption: false\n });\n yargs.option(\"template\", {\n describe: `Name of template to use, if no template is provided it will default to \"aws\" template`,\n alias: \"t\",\n type: \"string\",\n default: \"aws\",\n demandOption: false\n });\n yargs.option(\"hosting-type\", {\n describe: `Hosting type to use: \"aws\" (default) or \"server\" (standalone, ALPHA). Used in non-interactive mode`,\n type: \"string\",\n default: \"aws\",\n demandOption: false\n });\n yargs.option(\"template-options\", {\n describe: `A JSON containing template-specific options (usually used in non-interactive environments)`,\n default: null,\n type: \"string\",\n demandOption: false\n });\n yargs.option(\"assign-to-yarnrc\", {\n describe: `A JSON containing additional options that will be assigned into the \"yarnrc.yml\" configuration file`,\n default: null,\n type: \"string\",\n demandOption: false\n });\n yargs.option(\"tag\", {\n describe: \"NPM tag to use for @webiny packages\",\n type: \"string\",\n default: \"latest\",\n demandOption: false\n });\n yargs.option(\"interactive\", {\n describe: \"Enable interactive mode for all commands\",\n default: true,\n type: \"boolean\",\n demandOption: false\n });\n yargs.option(\"log\", {\n describe:\n \"Creates a log file to see output of installation. Defaults to create-webiny-project-logs.txt in current directory\",\n alias: \"l\",\n default: \"create-webiny-project-logs.txt\",\n type: \"string\",\n demandOption: false\n });\n yargs.option(\"debug\", {\n describe: \"Turn on debug logs\",\n default: false,\n type: \"boolean\",\n demandOption: false\n });\n yargs.option(\"cleanup\", {\n describe: \"If an error occurs upon project creation, deletes all generated files\",\n alias: \"c\",\n default: true,\n type: \"boolean\",\n demandOption: false\n });\n },\n cliArgs => {\n const createWebinyProject = new CreateWebinyProject();\n return createWebinyProject.execute(cliArgs);\n }\n).argv;\n"],"names":["ensureSystemRequirements","ensureSystemWebinyConfig","EnsureSystemWebinyConfig","process","err","getCwpVersion","GetCwpVersion","version","argv","yargs","hideBin","msg","console","cliArgs","createWebinyProject","CreateWebinyProject"],"mappings":";;;;;;AAIAA;AAKA,MAAMC,2BAA2B,IAAIC;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AA,MAAM,MAAM,CAAC,SAAS;QAClB,UAAU;QACV,SAAS;QACT,MAAM;QACN,cAAc;IAClB;IACAA,MAAM,MAAM,CAAC,WAAW;QACpB,UAAU;QACV,OAAO;QACP,SAAS;QACT,MAAM;QACN,cAAc;IAClB;AACJ,GACAI,CAAAA;IACI,MAAMC,sBAAsB,IAAIC;IAChC,OAAOD,oBAAoB,OAAO,CAACD;AACvC,GACF,IAAI"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Merges hosting-specific npm scripts into the generated project's `package.json`.
|
|
3
3
|
*
|
|
4
4
|
* The base template ships an empty `scripts` block because the useful shortcuts differ per hosting
|
|
5
|
-
* type — e.g.
|
|
5
|
+
* type — e.g. standalone can watch everything with a single command, while AWS watches each app
|
|
6
6
|
* against its own cloud environment.
|
|
7
7
|
*/
|
|
8
8
|
export declare const addProjectScripts: (projectRootFolderPath: string, scripts: Record<string, string>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/CreateWebinyProject/projects/addProjectScripts.js","sources":["../../../../src/features/CreateWebinyProject/projects/addProjectScripts.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport path from \"path\";\n\n/**\n * Merges hosting-specific npm scripts into the generated project's `package.json`.\n *\n * The base template ships an empty `scripts` block because the useful shortcuts differ per hosting\n * type — e.g.
|
|
1
|
+
{"version":3,"file":"features/CreateWebinyProject/projects/addProjectScripts.js","sources":["../../../../src/features/CreateWebinyProject/projects/addProjectScripts.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport path from \"path\";\n\n/**\n * Merges hosting-specific npm scripts into the generated project's `package.json`.\n *\n * The base template ships an empty `scripts` block because the useful shortcuts differ per hosting\n * type — e.g. standalone can watch everything with a single command, while AWS watches each app\n * against its own cloud environment.\n */\nexport const addProjectScripts = (\n projectRootFolderPath: string,\n scripts: Record<string, string>\n) => {\n const pkgPath = path.join(projectRootFolderPath, \"package.json\");\n const pkg = fs.readJsonSync(pkgPath);\n\n pkg.scripts = {\n ...pkg.scripts,\n ...scripts\n };\n\n fs.writeJsonSync(pkgPath, pkg, { spaces: 2 });\n};\n"],"names":["addProjectScripts","projectRootFolderPath","scripts","pkgPath","path","pkg","fs"],"mappings":";;AAUO,MAAMA,oBAAoB,CAC7BC,uBACAC;IAEA,MAAMC,UAAUC,KAAK,IAAI,CAACH,uBAAuB;IACjD,MAAMI,MAAMC,SAAAA,YAAe,CAACH;IAE5BE,IAAI,OAAO,GAAG;QACV,GAAGA,IAAI,OAAO;QACd,GAAGH,OAAO;IACd;IAEAI,SAAAA,aAAgB,CAACH,SAASE,KAAK;QAAE,QAAQ;IAAE;AAC/C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type HostingType = "aws" | "
|
|
1
|
+
export type HostingType = "aws" | "standalone";
|
|
2
2
|
export declare const runHostingTypePrompt: () => Promise<HostingType>;
|
|
@@ -5,8 +5,8 @@ const HOSTING_TYPE_OPTIONS = [
|
|
|
5
5
|
name: "AWS (Lambda, DynamoDB, API Gateway — deployed with Pulumi)"
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
|
-
value: "
|
|
9
|
-
name: "
|
|
8
|
+
value: "standalone",
|
|
9
|
+
name: "Standalone (Node HTTP server + SQL storage) — ALPHA"
|
|
10
10
|
}
|
|
11
11
|
];
|
|
12
12
|
const runHostingTypePrompt = async ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/CreateWebinyProject/projects/runHostingTypePrompt.js","sources":["../../../../src/features/CreateWebinyProject/projects/runHostingTypePrompt.ts"],"sourcesContent":["import inquirer from \"inquirer\";\n\nexport type HostingType = \"aws\" | \"
|
|
1
|
+
{"version":3,"file":"features/CreateWebinyProject/projects/runHostingTypePrompt.js","sources":["../../../../src/features/CreateWebinyProject/projects/runHostingTypePrompt.ts"],"sourcesContent":["import inquirer from \"inquirer\";\n\nexport type HostingType = \"aws\" | \"standalone\";\n\nconst HOSTING_TYPE_OPTIONS: { value: HostingType; name: string }[] = [\n {\n value: \"aws\",\n name: \"AWS (Lambda, DynamoDB, API Gateway — deployed with Pulumi)\"\n },\n {\n value: \"standalone\",\n name: \"Standalone (Node HTTP server + SQL storage) — ALPHA\"\n }\n];\n\nexport const runHostingTypePrompt = async (): Promise<HostingType> => {\n console.log(\"How would you like to host your new Webiny project?\");\n console.log();\n\n const { hostingType } = await inquirer.prompt<{ hostingType: HostingType }>([\n {\n type: \"select\",\n name: \"hostingType\",\n default: \"aws\",\n message: \"Please choose how you would like to host your project:\",\n choices: HOSTING_TYPE_OPTIONS\n }\n ]);\n\n return hostingType;\n};\n"],"names":["HOSTING_TYPE_OPTIONS","runHostingTypePrompt","console","hostingType","inquirer"],"mappings":";AAIA,MAAMA,uBAA+D;IACjE;QACI,OAAO;QACP,MAAM;IACV;IACA;QACI,OAAO;QACP,MAAM;IACV;CACH;AAEM,MAAMC,uBAAuB;IAChCC,QAAQ,GAAG,CAAC;IACZA,QAAQ,GAAG;IAEX,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAMC,SAAS,MAAM,CAA+B;QACxE;YACI,MAAM;YACN,MAAM;YACN,SAAS;YACT,SAAS;YACT,SAASJ;QACb;KACH;IAED,OAAOG;AACX"}
|
|
@@ -5,39 +5,39 @@ import { GetProjectRootPath } from "../../../../services/index.js";
|
|
|
5
5
|
import { GetTemplatesFolderPath } from "../../../../services/GetTemplatesFolderPath.js";
|
|
6
6
|
import { addProjectDependencies } from "../addProjectDependencies.js";
|
|
7
7
|
import { addProjectScripts } from "../addProjectScripts.js";
|
|
8
|
-
class
|
|
8
|
+
class SetupStandaloneWebinyProject {
|
|
9
9
|
async execute(cliArgs) {
|
|
10
|
-
const
|
|
10
|
+
const standaloneArgs = await this.getStandaloneArgs(cliArgs);
|
|
11
11
|
const getTemplatesFolderPath = new GetTemplatesFolderPath();
|
|
12
12
|
const templatesFolderPath = getTemplatesFolderPath.execute();
|
|
13
|
-
const storageTemplatePath = path.join(templatesFolderPath, "
|
|
13
|
+
const storageTemplatePath = path.join(templatesFolderPath, "standalone", standaloneArgs.storageOps);
|
|
14
14
|
const getProjectRoot = new GetProjectRootPath();
|
|
15
15
|
const projectRootFolderPath = getProjectRoot.execute(cliArgs);
|
|
16
16
|
fs_extra.copySync(storageTemplatePath, projectRootFolderPath);
|
|
17
17
|
addProjectDependencies(projectRootFolderPath, {
|
|
18
|
-
"@webiny/cli-
|
|
19
|
-
"@webiny/project-
|
|
20
|
-
"@webiny/project-
|
|
18
|
+
"@webiny/cli-standalone": "latest",
|
|
19
|
+
"@webiny/project-standalone": "latest",
|
|
20
|
+
"@webiny/project-standalone-template": "latest",
|
|
21
21
|
"@webiny/self-hosted-auth": "latest"
|
|
22
22
|
});
|
|
23
23
|
addProjectScripts(projectRootFolderPath, {
|
|
24
24
|
dev: "webiny watch"
|
|
25
25
|
});
|
|
26
|
-
return
|
|
26
|
+
return standaloneArgs;
|
|
27
27
|
}
|
|
28
|
-
async
|
|
29
|
-
const
|
|
28
|
+
async getStandaloneArgs(cliArgs) {
|
|
29
|
+
const standaloneArgs = {
|
|
30
30
|
storageOps: "sqlite",
|
|
31
31
|
aiAgent: "other"
|
|
32
32
|
};
|
|
33
33
|
const { templateOptions: templateOptionsString } = cliArgs;
|
|
34
34
|
if (templateOptionsString) try {
|
|
35
|
-
Object.assign(
|
|
35
|
+
Object.assign(standaloneArgs, JSON.parse(templateOptionsString));
|
|
36
36
|
} catch {}
|
|
37
|
-
if (false !== cliArgs.interactive) Object.assign(
|
|
38
|
-
return
|
|
37
|
+
if (false !== cliArgs.interactive) Object.assign(standaloneArgs, await runInteractivePrompt());
|
|
38
|
+
return standaloneArgs;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
export {
|
|
41
|
+
export { SetupStandaloneWebinyProject };
|
|
42
42
|
|
|
43
|
-
//# sourceMappingURL=
|
|
43
|
+
//# sourceMappingURL=SetupStandaloneWebinyProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/CreateWebinyProject/projects/standalone/SetupStandaloneWebinyProject.js","sources":["../../../../../src/features/CreateWebinyProject/projects/standalone/SetupStandaloneWebinyProject.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport path from \"path\";\nimport { runInteractivePrompt } from \"./runInteractivePrompt.js\";\nimport { CliParams } from \"../../../../types.js\";\nimport { GetProjectRootPath } from \"../../../../services/index.js\";\nimport { StandaloneProjectParams } from \"./types.js\";\nimport { GetTemplatesFolderPath } from \"../../../../services/GetTemplatesFolderPath.js\";\nimport { addProjectDependencies } from \"../addProjectDependencies.js\";\nimport { addProjectScripts } from \"../addProjectScripts.js\";\n\nexport class SetupStandaloneWebinyProject {\n async execute(cliArgs: CliParams): Promise<StandaloneProjectParams> {\n const standaloneArgs = await this.getStandaloneArgs(cliArgs);\n\n const getTemplatesFolderPath = new GetTemplatesFolderPath();\n const templatesFolderPath = getTemplatesFolderPath.execute();\n\n const storageTemplatePath = path.join(\n templatesFolderPath,\n \"standalone\",\n standaloneArgs.storageOps\n );\n\n const getProjectRoot = new GetProjectRootPath();\n const projectRootFolderPath = getProjectRoot.execute(cliArgs);\n\n // Copies the storage-specific template files into the project — `webiny.config.tsx` and a\n // `.env.example` (all vars commented; the project runs on config defaults with no `.env`).\n fs.copySync(storageTemplatePath, projectRootFolderPath);\n\n // Standalone hosting-type dependencies. The `webiny` CLI (server bin) sets\n // WEBINY_HOSTING_TYPE=standalone; `@webiny/project-standalone` provides the server `Infra.*` extensions\n // and resolves `@webiny/project-standalone-template` (the workspace base config) at build time;\n // `@webiny/self-hosted-auth` is the built-in JWT identity provider (replaces Cognito).\n addProjectDependencies(projectRootFolderPath, {\n \"@webiny/cli-standalone\": \"latest\",\n \"@webiny/project-standalone\": \"latest\",\n \"@webiny/project-standalone-template\": \"latest\",\n \"@webiny/self-hosted-auth\": \"latest\"\n });\n\n // Standalone watches every default app in a single process, so `yarn dev` is all a developer\n // needs to get the whole project running locally. Standalone-only — on AWS the apps are watched\n // separately, so there's no single command to alias.\n addProjectScripts(projectRootFolderPath, {\n dev: \"webiny watch\"\n });\n\n return standaloneArgs;\n }\n\n private async getStandaloneArgs(cliArgs: CliParams) {\n const standaloneArgs: StandaloneProjectParams = {\n storageOps: \"sqlite\",\n aiAgent: \"other\"\n };\n\n const { templateOptions: templateOptionsString } = cliArgs;\n if (templateOptionsString) {\n try {\n Object.assign(standaloneArgs, JSON.parse(templateOptionsString));\n } catch {\n // Do nothing.\n }\n }\n\n if (cliArgs.interactive !== false) {\n Object.assign(standaloneArgs, await runInteractivePrompt());\n }\n\n return standaloneArgs;\n }\n}\n"],"names":["SetupStandaloneWebinyProject","cliArgs","standaloneArgs","getTemplatesFolderPath","GetTemplatesFolderPath","templatesFolderPath","storageTemplatePath","path","getProjectRoot","GetProjectRootPath","projectRootFolderPath","fs","addProjectDependencies","addProjectScripts","templateOptionsString","Object","JSON","runInteractivePrompt"],"mappings":";;;;;;;AAUO,MAAMA;IACT,MAAM,QAAQC,OAAkB,EAAoC;QAChE,MAAMC,iBAAiB,MAAM,IAAI,CAAC,iBAAiB,CAACD;QAEpD,MAAME,yBAAyB,IAAIC;QACnC,MAAMC,sBAAsBF,uBAAuB,OAAO;QAE1D,MAAMG,sBAAsBC,KAAK,IAAI,CACjCF,qBACA,cACAH,eAAe,UAAU;QAG7B,MAAMM,iBAAiB,IAAIC;QAC3B,MAAMC,wBAAwBF,eAAe,OAAO,CAACP;QAIrDU,SAAAA,QAAW,CAACL,qBAAqBI;QAMjCE,uBAAuBF,uBAAuB;YAC1C,0BAA0B;YAC1B,8BAA8B;YAC9B,uCAAuC;YACvC,4BAA4B;QAChC;QAKAG,kBAAkBH,uBAAuB;YACrC,KAAK;QACT;QAEA,OAAOR;IACX;IAEA,MAAc,kBAAkBD,OAAkB,EAAE;QAChD,MAAMC,iBAA0C;YAC5C,YAAY;YACZ,SAAS;QACb;QAEA,MAAM,EAAE,iBAAiBY,qBAAqB,EAAE,GAAGb;QACnD,IAAIa,uBACA,IAAI;YACAC,OAAO,MAAM,CAACb,gBAAgBc,KAAK,KAAK,CAACF;QAC7C,EAAE,OAAM,CAER;QAGJ,IAAIb,AAAwB,UAAxBA,QAAQ,WAAW,EACnBc,OAAO,MAAM,CAACb,gBAAgB,MAAMe;QAGxC,OAAOf;IACX;AACJ"}
|
|
@@ -11,7 +11,7 @@ const STORAGE_OPTIONS = {
|
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
const runInteractivePrompt = async ()=>{
|
|
14
|
-
console.log("In order to create your new
|
|
14
|
+
console.log("In order to create your new standalone Webiny project, please answer the following questions.");
|
|
15
15
|
console.log();
|
|
16
16
|
const agents = await discoverAgents();
|
|
17
17
|
const agentChoices = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/CreateWebinyProject/projects/standalone/runInteractivePrompt.js","sources":["../../../../../src/features/CreateWebinyProject/projects/standalone/runInteractivePrompt.ts"],"sourcesContent":["import inquirer from \"inquirer\";\nimport { discoverAgents } from \"@webiny/mcp\";\nimport { StorageOps } from \"./types.js\";\n\nconst STORAGE_OPTIONS: Record<StorageOps, { value: StorageOps; name: string }> = {\n sqlite: {\n value: \"sqlite\",\n name: \"SQLite (single-file local database)\"\n },\n postgres: {\n value: \"postgres\",\n name: \"PostgreSQL (connect to a Postgres server)\"\n }\n};\n\nexport const runInteractivePrompt = async () => {\n console.log(\n \"In order to create your new standalone Webiny project, please answer the following questions.\"\n );\n console.log();\n\n const agents = await discoverAgents();\n const agentChoices = [\n ...Array.from(agents.values()).map(a => ({\n value: a.preset.slug,\n name: a.preset.displayName\n })),\n { value: \"other\", name: \"Other / not listed\" }\n ];\n\n return inquirer.prompt([\n {\n type: \"select\",\n name: \"storageOps\",\n default: \"sqlite\",\n message: `Please choose the database setup you wish to use with your project:`,\n choices: Object.values(STORAGE_OPTIONS)\n },\n {\n type: \"select\",\n name: \"aiAgent\",\n default: \"claude\",\n message: \"Please choose the AI agent you will use with your project:\",\n choices: agentChoices\n }\n ]);\n};\n"],"names":["STORAGE_OPTIONS","runInteractivePrompt","console","agents","discoverAgents","agentChoices","Array","a","inquirer","Object"],"mappings":";;AAIA,MAAMA,kBAA2E;IAC7E,QAAQ;QACJ,OAAO;QACP,MAAM;IACV;IACA,UAAU;QACN,OAAO;QACP,MAAM;IACV;AACJ;AAEO,MAAMC,uBAAuB;IAChCC,QAAQ,GAAG,CACP;IAEJA,QAAQ,GAAG;IAEX,MAAMC,SAAS,MAAMC;IACrB,MAAMC,eAAe;WACdC,MAAM,IAAI,CAACH,OAAO,MAAM,IAAI,GAAG,CAACI,CAAAA,IAAM;gBACrC,OAAOA,EAAE,MAAM,CAAC,IAAI;gBACpB,MAAMA,EAAE,MAAM,CAAC,WAAW;YAC9B;QACA;YAAE,OAAO;YAAS,MAAM;QAAqB;KAChD;IAED,OAAOC,SAAS,MAAM,CAAC;QACnB;YACI,MAAM;YACN,MAAM;YACN,SAAS;YACT,SAAS;YACT,SAASC,OAAO,MAAM,CAACT;QAC3B;QACA;YACI,MAAM;YACN,MAAM;YACN,SAAS;YACT,SAAS;YACT,SAASK;QACb;KACH;AACL"}
|
|
@@ -8,7 +8,7 @@ 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 {
|
|
11
|
+
import { SetupStandaloneWebinyProject } from "./CreateWebinyProject/projects/standalone/SetupStandaloneWebinyProject.js";
|
|
12
12
|
import { runHostingTypePrompt } from "./CreateWebinyProject/projects/runHostingTypePrompt.js";
|
|
13
13
|
import { Analytics, EnsureNoGlobalWebinyCli, EnsureNoTargetFolder, EnsureNoYarnLockPackageJson, EnsureValidProjectName, GetProjectRootPath, InitGit, IsGitAvailable, PrintErrorInfo, PrintSystemInfo, SetWebinyPackageVersions, SetupYarn } from "../services/index.js";
|
|
14
14
|
import ora from "ora";
|
|
@@ -52,7 +52,7 @@ class CreateWebinyProject {
|
|
|
52
52
|
const analytics = new Analytics();
|
|
53
53
|
await analytics.track("start");
|
|
54
54
|
let aiAgent = "other";
|
|
55
|
-
let hostingType = "
|
|
55
|
+
let hostingType = "standalone" === cliArgs.hostingType ? "standalone" : "aws";
|
|
56
56
|
let hostingTypeResolved = false === cliArgs.interactive;
|
|
57
57
|
try {
|
|
58
58
|
const taskItems = [
|
|
@@ -89,10 +89,10 @@ class CreateWebinyProject {
|
|
|
89
89
|
}
|
|
90
90
|
const setupBaseWebinyProject = new SetupBaseWebinyProject();
|
|
91
91
|
setupBaseWebinyProject.execute(cliArgs);
|
|
92
|
-
if ("
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
aiAgent =
|
|
92
|
+
if ("standalone" === hostingType) {
|
|
93
|
+
const setupStandaloneWebinyProject = new SetupStandaloneWebinyProject();
|
|
94
|
+
const standaloneProjectParams = await setupStandaloneWebinyProject.execute(cliArgs);
|
|
95
|
+
aiAgent = standaloneProjectParams.aiAgent;
|
|
96
96
|
} else {
|
|
97
97
|
const setupAwsWebinyProject = new SetupAwsWebinyProject();
|
|
98
98
|
const awsProjectParams = await setupAwsWebinyProject.execute(cliArgs);
|
|
@@ -150,10 +150,10 @@ class CreateWebinyProject {
|
|
|
150
150
|
process.exit(1);
|
|
151
151
|
}
|
|
152
152
|
console.log();
|
|
153
|
-
if ("
|
|
154
|
-
console.log(`🎉 Your new
|
|
153
|
+
if ("standalone" === hostingType) {
|
|
154
|
+
console.log(`🎉 Your new standalone Webiny project ${green(projectName)} has been created!`);
|
|
155
155
|
console.log();
|
|
156
|
-
console.log(yellow("⚠ The
|
|
156
|
+
console.log(yellow("⚠ The standalone hosting type is in ALPHA. It's for local\n development and testing with `webiny watch`.\n It's still maturing, so expect some rough edges."));
|
|
157
157
|
console.log();
|
|
158
158
|
if ("other" === aiAgent) await configureMcp({
|
|
159
159
|
instructions: true
|
|
@@ -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 { 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`.\\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 Webiny locally: ${green(\"yarn dev\")}`,\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","configure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AC;gBAGjB,MAAMd,MAAM,QAAQc,SAAS;oBACzB,KAAKtD;oBACL,OAAO;gBACX;YACJ,EAAE,OAAM,CAIR;YAGA,IAAIa,AAAY,YAAZA,SACA,MAAM6B,aAAa;gBAAE,cAAc;YAAK;YAG5C;QACJ;QAGA,IAAI7B,AAAY,YAAZA,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"}
|
|
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 { SetupStandaloneWebinyProject } from \"./CreateWebinyProject/projects/standalone/SetupStandaloneWebinyProject.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 === \"standalone\" ? \"standalone\" : \"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 === \"standalone\") {\n const setupStandaloneWebinyProject = new SetupStandaloneWebinyProject();\n const standaloneProjectParams = await setupStandaloneWebinyProject.execute(cliArgs);\n aiAgent = standaloneProjectParams.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 // Standalone hosting type: no deploy step (ALPHA — dev-first, run with `webiny watch`).\n if (hostingType === \"standalone\") {\n console.log(\n `🎉 Your new standalone Webiny project ${green(projectName)} has been created!`\n );\n console.log();\n console.log(\n yellow(\n \"⚠ The standalone hosting type is in ALPHA. It's for local\\n\" +\n \" development and testing with `webiny watch`.\\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 Webiny locally: ${green(\"yarn dev\")}`,\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","setupStandaloneWebinyProject","SetupStandaloneWebinyProject","standaloneProjectParams","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;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,KAA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ACF,SAAS,EAAEA,MAAMY,aAAa,WAAW,CAAC;gBAC5C;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACH,CAAC,IAAI,CAAC;YAGX;QACJ;QAEAH,QAAQ,GAAG,CACP,CAAC,2BAA2B,EAAET,MAC1BY,aACF,iEAAiE,CAAC;QAExEH,QAAQ,GAAG;QAEX,MAAM8D,KAAK,MAAMC,MAAM;YACnB,UAAUvE,KAAK,GAAGD,MAAM,KAAK,iDAAiD,CAAC;YAC/E,cAAc;QAClB;QAEAS,QAAQ,GAAG;QAEX,IAAI8D,IAAI;YACJ9D,QAAQ,GAAG,CAAC;YACZA,QAAQ,GAAG;YAEX,IAAI;gBACA,MAAMgE,UAAU;oBAAC;oBAAU;iBAAS;gBACpC,IAAI5D,OACA4D,QAAQ,IAAI,CAAC;gBAGjB,MAAMd,MAAM,QAAQc,SAAS;oBACzB,KAAKtD;oBACL,OAAO;gBACX;YACJ,EAAE,OAAM,CAIR;YAGA,IAAIa,AAAY,YAAZA,SACA,MAAM6B,aAAa;gBAAE,cAAc;YAAK;YAG5C;QACJ;QAGA,IAAI7B,AAAY,YAAZA,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.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Webiny project bootstrap tool.",
|
|
6
6
|
"exports": {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"author": "Webiny Ltd.",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
17
|
-
"@webiny/
|
|
18
|
-
"@webiny/
|
|
19
|
-
"@webiny/system-requirements": "6.6.0-alpha.
|
|
20
|
-
"@webiny/telemetry": "6.6.0-alpha.
|
|
16
|
+
"@webiny/build-tools": "6.6.0-alpha.4",
|
|
17
|
+
"@webiny/global-config": "6.6.0-alpha.4",
|
|
18
|
+
"@webiny/mcp": "6.6.0-alpha.4",
|
|
19
|
+
"@webiny/system-requirements": "6.6.0-alpha.4",
|
|
20
|
+
"@webiny/telemetry": "6.6.0-alpha.4",
|
|
21
21
|
"chalk": "6.0.0",
|
|
22
22
|
"execa": "10.0.1",
|
|
23
23
|
"find-up": "8.0.0",
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes sure `~/.webiny/config` exists before anything reads it.
|
|
3
|
+
*
|
|
4
|
+
* This used to write the file itself, as `{ id, telemetry: true }`, with no
|
|
5
|
+
* `newUser` key. `globalConfig.get()` only fills in its defaults when the file
|
|
6
|
+
* is missing or has no `id`, so a config written here satisfied that check and
|
|
7
|
+
* `newUser` stayed `undefined` for the life of the machine. Telemetry reads it
|
|
8
|
+
* as `Boolean(undefined)`, so every event reported `newUser: "no"` — including
|
|
9
|
+
* the first event of a genuinely new user, which is the one case the flag
|
|
10
|
+
* exists for. Since `create-webiny-project` is where most people meet Webiny,
|
|
11
|
+
* that made the flag false for very nearly everyone.
|
|
12
|
+
*
|
|
13
|
+
* Delegating leaves one owner for the config shape, so there's no second
|
|
14
|
+
* definition of "a fresh config" to drift.
|
|
15
|
+
*/
|
|
1
16
|
export declare class EnsureSystemWebinyConfig {
|
|
2
17
|
execute(): void;
|
|
3
18
|
}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { loadJsonFileSync } from "load-json-file";
|
|
4
|
-
import { writeJsonFileSync } from "write-json-file";
|
|
5
|
-
import { uuid } from "@webiny/stdlib";
|
|
6
|
-
const configPath = path.join(os.homedir(), ".webiny", "config");
|
|
1
|
+
import { globalConfig } from "@webiny/global-config";
|
|
7
2
|
class EnsureSystemWebinyConfig {
|
|
8
3
|
execute() {
|
|
9
|
-
|
|
10
|
-
const config = loadJsonFileSync(configPath);
|
|
11
|
-
if (!config.id) throw Error("Invalid Webiny config.");
|
|
12
|
-
} catch {
|
|
13
|
-
writeJsonFileSync(configPath, {
|
|
14
|
-
id: uuid(),
|
|
15
|
-
telemetry: true
|
|
16
|
-
});
|
|
17
|
-
}
|
|
4
|
+
globalConfig.get();
|
|
18
5
|
}
|
|
19
6
|
}
|
|
20
7
|
export { EnsureSystemWebinyConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services/EnsureSystemWebinyConfig.js","sources":["../../src/services/EnsureSystemWebinyConfig.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"services/EnsureSystemWebinyConfig.js","sources":["../../src/services/EnsureSystemWebinyConfig.ts"],"sourcesContent":["import { globalConfig } from \"@webiny/global-config\";\n\n/**\n * Makes sure `~/.webiny/config` exists before anything reads it.\n *\n * This used to write the file itself, as `{ id, telemetry: true }`, with no\n * `newUser` key. `globalConfig.get()` only fills in its defaults when the file\n * is missing or has no `id`, so a config written here satisfied that check and\n * `newUser` stayed `undefined` for the life of the machine. Telemetry reads it\n * as `Boolean(undefined)`, so every event reported `newUser: \"no\"` — including\n * the first event of a genuinely new user, which is the one case the flag\n * exists for. Since `create-webiny-project` is where most people meet Webiny,\n * that made the flag false for very nearly everyone.\n *\n * Delegating leaves one owner for the config shape, so there's no second\n * definition of \"a fresh config\" to drift.\n */\nexport class EnsureSystemWebinyConfig {\n execute() {\n globalConfig.get();\n }\n}\n"],"names":["EnsureSystemWebinyConfig","globalConfig"],"mappings":";AAiBO,MAAMA;IACT,UAAU;QACNC,aAAa,GAAG;IACpB;AACJ"}
|
package/types.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export interface CliParams {
|
|
|
5
5
|
force: boolean;
|
|
6
6
|
/** Name of template to use (defaults to "aws") */
|
|
7
7
|
template: string;
|
|
8
|
-
/** Hosting type: "aws" or "server" (
|
|
9
|
-
hostingType: "aws" | "
|
|
8
|
+
/** Hosting type: "aws" or "server" (standalone). Used in non-interactive mode. */
|
|
9
|
+
hostingType: "aws" | "standalone";
|
|
10
10
|
/** JSON string with template-specific options */
|
|
11
11
|
templateOptions: string | null;
|
|
12
12
|
/** JSON string with additional options for yarnrc.yml */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/CreateWebinyProject/projects/server/SetupServerWebinyProject.js","sources":["../../../../../src/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.ts"],"sourcesContent":["import fs from \"fs-extra\";\nimport path from \"path\";\nimport { runInteractivePrompt } from \"./runInteractivePrompt.js\";\nimport { CliParams } from \"../../../../types.js\";\nimport { GetProjectRootPath } from \"../../../../services/index.js\";\nimport { ServerProjectParams } from \"./types.js\";\nimport { GetTemplatesFolderPath } from \"../../../../services/GetTemplatesFolderPath.js\";\nimport { addProjectDependencies } from \"../addProjectDependencies.js\";\nimport { addProjectScripts } from \"../addProjectScripts.js\";\n\nexport class SetupServerWebinyProject {\n async execute(cliArgs: CliParams): Promise<ServerProjectParams> {\n const serverArgs = await this.getServerArgs(cliArgs);\n\n const getTemplatesFolderPath = new GetTemplatesFolderPath();\n const templatesFolderPath = getTemplatesFolderPath.execute();\n\n const storageTemplatePath = path.join(templatesFolderPath, \"server\", serverArgs.storageOps);\n\n const getProjectRoot = new GetProjectRootPath();\n const projectRootFolderPath = getProjectRoot.execute(cliArgs);\n\n // Copies the storage-specific template files into the project — `webiny.config.tsx` and a\n // `.env.example` (all vars commented; the project runs on config defaults with no `.env`).\n fs.copySync(storageTemplatePath, projectRootFolderPath);\n\n // Server (self-hosted) hosting-type dependencies. The `webiny` CLI (server bin) sets\n // WEBINY_HOSTING_TYPE=server; `@webiny/project-server` provides the server `Infra.*` extensions\n // and resolves `@webiny/project-server-template` (the workspace base config) at build time;\n // `@webiny/self-hosted-auth` is the built-in JWT identity provider (replaces Cognito).\n addProjectDependencies(projectRootFolderPath, {\n \"@webiny/cli-server\": \"latest\",\n \"@webiny/project-server\": \"latest\",\n \"@webiny/project-server-template\": \"latest\",\n \"@webiny/self-hosted-auth\": \"latest\"\n });\n\n // Self-hosted watches every default app in a single process, so `yarn dev` is all a developer\n // needs to get the whole project running locally. Server-only — on AWS the apps are watched\n // separately, so there's no single command to alias.\n addProjectScripts(projectRootFolderPath, {\n dev: \"webiny watch\"\n });\n\n return serverArgs;\n }\n\n private async getServerArgs(cliArgs: CliParams) {\n const serverArgs: ServerProjectParams = {\n storageOps: \"sqlite\",\n aiAgent: \"other\"\n };\n\n const { templateOptions: templateOptionsString } = cliArgs;\n if (templateOptionsString) {\n try {\n Object.assign(serverArgs, JSON.parse(templateOptionsString));\n } catch {\n // Do nothing.\n }\n }\n\n if (cliArgs.interactive !== false) {\n Object.assign(serverArgs, await runInteractivePrompt());\n }\n\n return serverArgs;\n }\n}\n"],"names":["SetupServerWebinyProject","cliArgs","serverArgs","getTemplatesFolderPath","GetTemplatesFolderPath","templatesFolderPath","storageTemplatePath","path","getProjectRoot","GetProjectRootPath","projectRootFolderPath","fs","addProjectDependencies","addProjectScripts","templateOptionsString","Object","JSON","runInteractivePrompt"],"mappings":";;;;;;;AAUO,MAAMA;IACT,MAAM,QAAQC,OAAkB,EAAgC;QAC5D,MAAMC,aAAa,MAAM,IAAI,CAAC,aAAa,CAACD;QAE5C,MAAME,yBAAyB,IAAIC;QACnC,MAAMC,sBAAsBF,uBAAuB,OAAO;QAE1D,MAAMG,sBAAsBC,KAAK,IAAI,CAACF,qBAAqB,UAAUH,WAAW,UAAU;QAE1F,MAAMM,iBAAiB,IAAIC;QAC3B,MAAMC,wBAAwBF,eAAe,OAAO,CAACP;QAIrDU,SAAAA,QAAW,CAACL,qBAAqBI;QAMjCE,uBAAuBF,uBAAuB;YAC1C,sBAAsB;YACtB,0BAA0B;YAC1B,mCAAmC;YACnC,4BAA4B;QAChC;QAKAG,kBAAkBH,uBAAuB;YACrC,KAAK;QACT;QAEA,OAAOR;IACX;IAEA,MAAc,cAAcD,OAAkB,EAAE;QAC5C,MAAMC,aAAkC;YACpC,YAAY;YACZ,SAAS;QACb;QAEA,MAAM,EAAE,iBAAiBY,qBAAqB,EAAE,GAAGb;QACnD,IAAIa,uBACA,IAAI;YACAC,OAAO,MAAM,CAACb,YAAYc,KAAK,KAAK,CAACF;QACzC,EAAE,OAAM,CAER;QAGJ,IAAIb,AAAwB,UAAxBA,QAAQ,WAAW,EACnBc,OAAO,MAAM,CAACb,YAAY,MAAMe;QAGpC,OAAOf;IACX;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/CreateWebinyProject/projects/server/runInteractivePrompt.js","sources":["../../../../../src/features/CreateWebinyProject/projects/server/runInteractivePrompt.ts"],"sourcesContent":["import inquirer from \"inquirer\";\nimport { discoverAgents } from \"@webiny/mcp\";\nimport { StorageOps } from \"./types.js\";\n\nconst STORAGE_OPTIONS: Record<StorageOps, { value: StorageOps; name: string }> = {\n sqlite: {\n value: \"sqlite\",\n name: \"SQLite (single-file local database)\"\n },\n postgres: {\n value: \"postgres\",\n name: \"PostgreSQL (connect to a Postgres server)\"\n }\n};\n\nexport const runInteractivePrompt = async () => {\n console.log(\n \"In order to create your new self-hosted Webiny project, please answer the following questions.\"\n );\n console.log();\n\n const agents = await discoverAgents();\n const agentChoices = [\n ...Array.from(agents.values()).map(a => ({\n value: a.preset.slug,\n name: a.preset.displayName\n })),\n { value: \"other\", name: \"Other / not listed\" }\n ];\n\n return inquirer.prompt([\n {\n type: \"select\",\n name: \"storageOps\",\n default: \"sqlite\",\n message: `Please choose the database setup you wish to use with your project:`,\n choices: Object.values(STORAGE_OPTIONS)\n },\n {\n type: \"select\",\n name: \"aiAgent\",\n default: \"claude\",\n message: \"Please choose the AI agent you will use with your project:\",\n choices: agentChoices\n }\n ]);\n};\n"],"names":["STORAGE_OPTIONS","runInteractivePrompt","console","agents","discoverAgents","agentChoices","Array","a","inquirer","Object"],"mappings":";;AAIA,MAAMA,kBAA2E;IAC7E,QAAQ;QACJ,OAAO;QACP,MAAM;IACV;IACA,UAAU;QACN,OAAO;QACP,MAAM;IACV;AACJ;AAEO,MAAMC,uBAAuB;IAChCC,QAAQ,GAAG,CACP;IAEJA,QAAQ,GAAG;IAEX,MAAMC,SAAS,MAAMC;IACrB,MAAMC,eAAe;WACdC,MAAM,IAAI,CAACH,OAAO,MAAM,IAAI,GAAG,CAACI,CAAAA,IAAM;gBACrC,OAAOA,EAAE,MAAM,CAAC,IAAI;gBACpB,MAAMA,EAAE,MAAM,CAAC,WAAW;YAC9B;QACA;YAAE,OAAO;YAAS,MAAM;QAAqB;KAChD;IAED,OAAOC,SAAS,MAAM,CAAC;QACnB;YACI,MAAM;YACN,MAAM;YACN,SAAS;YACT,SAAS;YACT,SAASC,OAAO,MAAM,CAACT;QAC3B;QACA;YACI,MAAM;YACN,MAAM;YACN,SAAS;YACT,SAAS;YACT,SAASK;QACb;KACH;AACL"}
|
/package/features/CreateWebinyProject/projects/{server → standalone}/runInteractivePrompt.d.ts
RENAMED
|
File without changes
|
|
File without changes
|