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.
- package/_templates/base/example.gitignore +1 -0
- package/_templates/base/template.package.json +1 -3
- package/_templates/server/postgres/.env.example +26 -0
- package/_templates/server/postgres/webiny.config.tsx +46 -0
- package/_templates/server/sqlite/.env.example +22 -0
- package/_templates/server/sqlite/webiny.config.tsx +40 -0
- package/bin.js +6 -0
- package/bin.js.map +1 -1
- package/features/CreateWebinyProject/projects/addProjectDependencies.d.ts +9 -0
- package/features/CreateWebinyProject/projects/addProjectDependencies.js +17 -0
- package/features/CreateWebinyProject/projects/addProjectDependencies.js.map +1 -0
- package/features/CreateWebinyProject/projects/addProjectScripts.d.ts +8 -0
- package/features/CreateWebinyProject/projects/addProjectScripts.js +16 -0
- package/features/CreateWebinyProject/projects/addProjectScripts.js.map +1 -0
- package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js +5 -0
- package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js.map +1 -1
- package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.d.ts +1 -1
- package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js +6 -1
- package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js.map +1 -1
- package/features/CreateWebinyProject/projects/runHostingTypePrompt.d.ts +2 -0
- package/features/CreateWebinyProject/projects/runHostingTypePrompt.js +28 -0
- package/features/CreateWebinyProject/projects/runHostingTypePrompt.js.map +1 -0
- package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.d.ts +6 -0
- package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.js +43 -0
- package/features/CreateWebinyProject/projects/server/SetupServerWebinyProject.js.map +1 -0
- package/features/CreateWebinyProject/projects/server/runInteractivePrompt.d.ts +4 -0
- package/features/CreateWebinyProject/projects/server/runInteractivePrompt.js +46 -0
- package/features/CreateWebinyProject/projects/server/runInteractivePrompt.js.map +1 -0
- package/features/CreateWebinyProject/projects/server/types.d.ts +6 -0
- package/features/CreateWebinyProject/projects/server/types.js +0 -0
- package/features/CreateWebinyProject.js +54 -14
- package/features/CreateWebinyProject.js.map +1 -1
- package/package.json +14 -14
- package/services/EnsureNoGlobalWebinyCli.js +1 -1
- package/services/EnsureNoGlobalWebinyCli.js.map +1 -1
- package/services/EnsureSystemWebinyConfig.js +2 -2
- package/services/EnsureSystemWebinyConfig.js.map +1 -1
- package/services/InitGit.js +3 -3
- package/services/InitGit.js.map +1 -1
- package/services/IsGitAvailable.js +2 -2
- package/services/IsGitAvailable.js.map +1 -1
- package/services/SetupYarn/binaries/yarn-4.17.1.cjs +944 -0
- package/services/SetupYarn.js +5 -5
- package/services/SetupYarn.js.map +1 -1
- package/types.d.ts +2 -0
- package/services/SetupYarn/binaries/yarn-4.14.1.cjs +0 -940
- package/services/SetupYarn/binaries/yarn-4.14.1.d.cts +0 -2
package/services/SetupYarn.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import fs_extra from "fs-extra";
|
|
3
|
+
import { dump, load } from "js-yaml";
|
|
3
4
|
import { GetProjectRootPath } from "./GetProjectRootPath.js";
|
|
4
5
|
import { GetTemplatesFolderPath } from "./GetTemplatesFolderPath.js";
|
|
5
6
|
import chalk from "chalk";
|
|
6
|
-
import * as __rspack_external_js_yaml_d418a540 from "js-yaml";
|
|
7
7
|
const { yellow: yellow } = chalk;
|
|
8
8
|
class SetupYarn {
|
|
9
9
|
async execute(cliArgs) {
|
|
10
|
-
const yarnVersion = "4.
|
|
10
|
+
const yarnVersion = "4.17.1";
|
|
11
11
|
const yarnFile = `yarn-${yarnVersion}.cjs`;
|
|
12
12
|
const yarnPath = ".yarn";
|
|
13
13
|
const yarnReleasesPath = path.join(yarnPath, "releases");
|
|
@@ -24,7 +24,7 @@ class SetupYarn {
|
|
|
24
24
|
const yarnRcPath = path.join(projectRootPath, ".yarnrc.yml");
|
|
25
25
|
let rawYarnRc = `yarnPath: ${yarnReleasesFilePath}`;
|
|
26
26
|
if (fs_extra.existsSync(yarnRcPath)) rawYarnRc = fs_extra.readFileSync(yarnRcPath, "utf-8");
|
|
27
|
-
const parsedYarnRc =
|
|
27
|
+
const parsedYarnRc = load(rawYarnRc);
|
|
28
28
|
parsedYarnRc.nodeLinker = "node-modules";
|
|
29
29
|
const exampleYarnRc = this.loadExampleYarnRc();
|
|
30
30
|
if (exampleYarnRc) Object.assign(parsedYarnRc, exampleYarnRc);
|
|
@@ -37,7 +37,7 @@ class SetupYarn {
|
|
|
37
37
|
}
|
|
38
38
|
if (parsedAssignToYarnRc) Object.assign(parsedYarnRc, parsedAssignToYarnRc);
|
|
39
39
|
}
|
|
40
|
-
fs_extra.writeFileSync(yarnRcPath,
|
|
40
|
+
fs_extra.writeFileSync(yarnRcPath, dump(parsedYarnRc));
|
|
41
41
|
}
|
|
42
42
|
loadExampleYarnRc() {
|
|
43
43
|
let templatesFolderPath;
|
|
@@ -55,7 +55,7 @@ class SetupYarn {
|
|
|
55
55
|
try {
|
|
56
56
|
const raw = fs_extra.readFileSync(exampleYarnRcPath, "utf-8");
|
|
57
57
|
console.log(`Loaded example .yarnrc.yml from: ${exampleYarnRcPath}`);
|
|
58
|
-
const parsed =
|
|
58
|
+
const parsed = load(raw);
|
|
59
59
|
if (!parsed || "object" != typeof parsed) {
|
|
60
60
|
console.log(yellow("Warning: example .yarnrc.yml parsed to a non-object value."));
|
|
61
61
|
console.log(yellow(` raw content: ${raw}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services/SetupYarn.js","sources":["../../src/services/SetupYarn.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs-extra\";\nimport
|
|
1
|
+
{"version":3,"file":"services/SetupYarn.js","sources":["../../src/services/SetupYarn.ts"],"sourcesContent":["import path from \"path\";\nimport fs from \"fs-extra\";\nimport { load as yamlLoad, dump as yamlDump } from \"js-yaml\";\nimport { GetProjectRootPath } from \"./GetProjectRootPath.js\";\nimport { GetTemplatesFolderPath } from \"./GetTemplatesFolderPath.js\";\nimport { CliParams } from \"../types.js\";\nimport chalk from \"chalk\";\n\nconst { yellow } = chalk;\n\nexport class SetupYarn {\n async execute(cliArgs: CliParams) {\n const yarnVersion = \"4.17.1\";\n const yarnFile = `yarn-${yarnVersion}.cjs`;\n const yarnPath = `.yarn`;\n const yarnReleasesPath = path.join(yarnPath, \"releases\");\n const yarnReleasesFilePath = path.join(yarnReleasesPath, yarnFile);\n\n const getProjectRootPath = new GetProjectRootPath();\n const projectRootPath = getProjectRootPath.execute(cliArgs);\n\n const { assignToYarnrc } = cliArgs;\n /**\n * We do not want to do the recursive directory creating as it might do something in parent directories which we do not want.\n */\n const yarnReleaseFullPath = path.join(projectRootPath, yarnReleasesPath);\n fs.ensureDirSync(yarnReleaseFullPath);\n\n const source = path.join(import.meta.dirname, \"SetupYarn\", path.join(\"binaries\", yarnFile));\n if (!fs.existsSync(source)) {\n throw new Error(`No yarn binary source file: ${source}`);\n }\n\n const target = path.join(projectRootPath, yarnReleasesFilePath);\n fs.copyFileSync(source, target);\n\n // `.yarnrc.yml` file is created here.\n const yarnRcPath = path.join(projectRootPath, \".yarnrc.yml\");\n\n let rawYarnRc = `yarnPath: ${yarnReleasesFilePath}`;\n if (fs.existsSync(yarnRcPath)) {\n rawYarnRc = fs.readFileSync(yarnRcPath, \"utf-8\");\n }\n\n const parsedYarnRc = yamlLoad(rawYarnRc) as Record<string, any>;\n\n // Default settings are applied here. Currently, we only apply the `nodeLinker` param.\n parsedYarnRc.nodeLinker = \"node-modules\";\n\n /* Apply defaults from the example .yarnrc.yml template. */\n const exampleYarnRc = this.loadExampleYarnRc();\n if (exampleYarnRc) {\n Object.assign(parsedYarnRc, exampleYarnRc);\n }\n\n // Enables adding additional params into the `.yarnrc.yml` file.\n if (assignToYarnrc) {\n let parsedAssignToYarnRc;\n try {\n parsedAssignToYarnRc = JSON.parse(assignToYarnrc);\n } catch {\n console.log(yellow(\"Warning: could not parse provided --assign-to-yarnrc JSON.\"));\n }\n\n if (parsedAssignToYarnRc) {\n Object.assign(parsedYarnRc, parsedAssignToYarnRc);\n }\n }\n\n fs.writeFileSync(yarnRcPath, yamlDump(parsedYarnRc));\n }\n\n private loadExampleYarnRc(): Record<string, any> | null {\n let templatesFolderPath: string;\n try {\n const getTemplatesFolderPath = new GetTemplatesFolderPath();\n templatesFolderPath = getTemplatesFolderPath.execute();\n } catch (err) {\n console.log(yellow(\"Warning: could not locate _templates folder.\"));\n console.log(yellow(` import.meta.dirname (SetupYarn): ${import.meta.dirname}`));\n console.log(\n yellow(\n ` parent contents: ${fs.readdirSync(path.join(import.meta.dirname, \"..\")).join(\", \")}`\n )\n );\n console.log(yellow(` error: ${(err as Error).message}`));\n return null;\n }\n\n const exampleYarnRcPath = path.join(templatesFolderPath, \"base\", \"example.yarnrc.yml\");\n\n try {\n const raw = fs.readFileSync(exampleYarnRcPath, \"utf-8\");\n console.log(`Loaded example .yarnrc.yml from: ${exampleYarnRcPath}`);\n const parsed = yamlLoad(raw) as Record<string, any>;\n if (!parsed || typeof parsed !== \"object\") {\n console.log(yellow(\"Warning: example .yarnrc.yml parsed to a non-object value.\"));\n console.log(yellow(` raw content: ${raw}`));\n return null;\n }\n return parsed;\n } catch (err) {\n console.log(yellow(\"Warning: could not load example .yarnrc.yml template.\"));\n console.log(yellow(` resolved path: ${exampleYarnRcPath}`));\n console.log(yellow(` file exists: ${fs.existsSync(exampleYarnRcPath)}`));\n console.log(yellow(` error: ${(err as Error).message}`));\n return null;\n }\n }\n}\n"],"names":["yellow","chalk","SetupYarn","cliArgs","yarnVersion","yarnFile","yarnPath","yarnReleasesPath","path","yarnReleasesFilePath","getProjectRootPath","GetProjectRootPath","projectRootPath","assignToYarnrc","yarnReleaseFullPath","fs","source","Error","target","yarnRcPath","rawYarnRc","parsedYarnRc","yamlLoad","exampleYarnRc","Object","parsedAssignToYarnRc","JSON","console","yamlDump","templ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,CAAC,SAAS,EAAGgC,IAAc,OAAO,EAAE;YACvD,OAAO;QACX;IACJ;AACJ"}
|
package/types.d.ts
CHANGED
|
@@ -5,6 +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" (self-hosted). Used in non-interactive mode. */
|
|
9
|
+
hostingType: "aws" | "server";
|
|
8
10
|
/** JSON string with template-specific options */
|
|
9
11
|
templateOptions: string | null;
|
|
10
12
|
/** JSON string with additional options for yarnrc.yml */
|