create-webiny-project 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9

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 (95) hide show
  1. package/README.md +6 -154
  2. package/_templates/aws/ddb/webiny.config.tsx +16 -0
  3. package/_templates/aws/ddb-os/webiny.config.tsx +17 -0
  4. package/_templates/base/example.gitattributes +39 -0
  5. package/_templates/base/example.gitignore +30 -0
  6. package/_templates/base/extensions/README.md +12 -0
  7. package/_templates/base/my-skills/README.md +48 -0
  8. package/_templates/base/public/favicon.ico +0 -0
  9. package/_templates/base/public/global.css +8 -0
  10. package/_templates/base/public/index.html +13 -0
  11. package/_templates/base/public/robots.txt +3 -0
  12. package/_templates/base/template.package.json +21 -0
  13. package/_templates/base/tsconfig.json +9 -0
  14. package/_templates/base/webiny-env.d.ts +1 -0
  15. package/_templates/base/webiny.config.tsx +5 -0
  16. package/bin.d.ts +2 -0
  17. package/bin.js +84 -47
  18. package/bin.js.map +1 -0
  19. package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.d.ts +6 -0
  20. package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js +37 -0
  21. package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js.map +1 -0
  22. package/features/CreateWebinyProject/projects/aws/availableAwsRegions.d.ts +4 -0
  23. package/features/CreateWebinyProject/projects/aws/availableAwsRegions.js +77 -0
  24. package/features/CreateWebinyProject/projects/aws/availableAwsRegions.js.map +1 -0
  25. package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.d.ts +5 -0
  26. package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.js +54 -0
  27. package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.js.map +1 -0
  28. package/features/CreateWebinyProject/projects/aws/types.d.ts +7 -0
  29. package/features/CreateWebinyProject/projects/aws/types.js +0 -0
  30. package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.d.ts +8 -0
  31. package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js +34 -0
  32. package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js.map +1 -0
  33. package/features/CreateWebinyProject.d.ts +4 -0
  34. package/features/CreateWebinyProject.js +183 -0
  35. package/features/CreateWebinyProject.js.map +1 -0
  36. package/package.json +38 -23
  37. package/services/Analytics.d.ts +4 -0
  38. package/services/Analytics.js +16 -0
  39. package/services/Analytics.js.map +1 -0
  40. package/services/EnsureNoGlobalWebinyCli.d.ts +3 -0
  41. package/services/EnsureNoGlobalWebinyCli.js +30 -0
  42. package/services/EnsureNoGlobalWebinyCli.js.map +1 -0
  43. package/services/EnsureNoTargetFolder.d.ts +4 -0
  44. package/services/EnsureNoTargetFolder.js +21 -0
  45. package/services/EnsureNoTargetFolder.js.map +1 -0
  46. package/services/EnsureNoYarnLockPackageJson.d.ts +3 -0
  47. package/services/EnsureNoYarnLockPackageJson.js +24 -0
  48. package/services/EnsureNoYarnLockPackageJson.js.map +1 -0
  49. package/services/EnsureSystemWebinyConfig.d.ts +3 -0
  50. package/services/EnsureSystemWebinyConfig.js +22 -0
  51. package/services/EnsureSystemWebinyConfig.js.map +1 -0
  52. package/services/EnsureValidProjectName.d.ts +3 -0
  53. package/services/EnsureValidProjectName.js +22 -0
  54. package/services/EnsureValidProjectName.js.map +1 -0
  55. package/services/GetCwpVersion.d.ts +3 -0
  56. package/services/GetCwpVersion.js +16 -0
  57. package/services/GetCwpVersion.js.map +1 -0
  58. package/services/GetProjectRootPath.d.ts +4 -0
  59. package/services/GetProjectRootPath.js +9 -0
  60. package/services/GetProjectRootPath.js.map +1 -0
  61. package/services/GetTemplatesFolderPath.d.ts +3 -0
  62. package/services/GetTemplatesFolderPath.js +16 -0
  63. package/services/GetTemplatesFolderPath.js.map +1 -0
  64. package/services/InitGit.d.ts +4 -0
  65. package/services/InitGit.js +22 -0
  66. package/services/InitGit.js.map +1 -0
  67. package/services/IsGitAvailable.d.ts +3 -0
  68. package/services/IsGitAvailable.js +16 -0
  69. package/services/IsGitAvailable.js.map +1 -0
  70. package/services/PrintErrorInfo.d.ts +4 -0
  71. package/services/PrintErrorInfo.js +18 -0
  72. package/services/PrintErrorInfo.js.map +1 -0
  73. package/services/PrintSystemInfo.d.ts +4 -0
  74. package/services/PrintSystemInfo.js +48 -0
  75. package/services/PrintSystemInfo.js.map +1 -0
  76. package/services/SetWebinyPackageVersions.d.ts +5 -0
  77. package/services/SetWebinyPackageVersions.js +24 -0
  78. package/services/SetWebinyPackageVersions.js.map +1 -0
  79. package/services/SetupYarn/binaries/yarn-4.14.1.cjs +940 -0
  80. package/services/SetupYarn/binaries/yarn-4.14.1.d.cts +2 -0
  81. package/services/SetupYarn.d.ts +4 -0
  82. package/services/SetupYarn.js +42 -0
  83. package/services/SetupYarn.js.map +1 -0
  84. package/services/index.d.ts +14 -0
  85. package/services/index.js +14 -0
  86. package/types.d.ts +22 -0
  87. package/types.js +0 -0
  88. package/CHANGELOG.md +0 -2409
  89. package/index.js +0 -94
  90. package/utils/checkProjectName.js +0 -22
  91. package/utils/createProject.js +0 -314
  92. package/utils/getPackageJson.js +0 -5
  93. package/utils/getPackageVersion.js +0 -24
  94. package/utils/getYarnVersion.js +0 -10
  95. package/utils/verifyConfig.js +0 -20
package/README.md CHANGED
@@ -1,159 +1,11 @@
1
1
  # create-webiny-project
2
2
 
3
- [![](https://img.shields.io/npm/dw/create-webiny-project.svg)](https://www.npmjs.com/package/create-webiny-project)
4
- [![](https://img.shields.io/npm/v/create-webiny-project.svg)](https://www.npmjs.com/package/create-webiny-project)
5
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
7
6
 
8
- A tool for setting up a new Webiny project.
7
+ 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
9
8
 
10
- ## Usage
9
+ ---
11
10
 
12
- #### Simple:
13
-
14
- ```
15
- npx create-webiny-project@beta my-test-project --tag beta
16
- ```
17
-
18
- #### Advanced:
19
-
20
- ```
21
- npx create-webiny-project@beta my-test-project
22
- --tag beta --no-interactive
23
- --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'
24
- --template-options '{"region":"eu-central-1","vpc":false}'
25
- ```
26
-
27
- This usage is more ideal for CI/CD environments, where interactivity is not available.
28
-
29
- But do note that this is probably more useful to us, Webiny developers, than for actual Webiny projects. This is simply because in real project's CI/CD pipelines, users would simply start off by cloning the project from their private repository, and not create a new one with the above command.
30
-
31
- ## Development Notes
32
-
33
- Testing this, and related packages (like [cwp-template-aws](./../cwp-template-aws)) is a bit complicated, because in order to get the best results, it's recommended to test everything with packages published to a real NPM.
34
-
35
- But of course, publishing to NPM just to test something is not ideal, and that's why, we use [Verdaccio](https://verdaccio.org/) instead, which is, basically, an NPM-like service you can run locally. So, instead of publishing packages to NPM, you publish them to Verdaccio, which is much cleaner, because everything stays on your laptop.
36
-
37
- #### Usage
38
-
39
- So, you've made some changes, and now you'd like to see the `create-webiny-project` in action.
40
-
41
- The following steps show how to do it.
42
-
43
- #### 1. Start Verdaccio
44
-
45
- Start by running the `yarn verdaccio:start` command, which will, as the script name itself suggests, spin up Verdaccio locally.
46
-
47
- > All of the files uploaded to Verdaccio service will be stored in the `.verdaccio` folder, located in your project root.
48
-
49
- #### 2. Set default NPM registry
50
-
51
- Once you have Verdaccio up and running, you'll also need to change the default NPM registry. Meaning, when you run `npx create-webiny-project ...`, you want it to start fetching packages from Verdaccio, not real NPM. Verdaccio runs on localhost, on port 4873, so, in your terminal, run the following command:
52
-
53
- ```
54
- npm config set registry http://localhost:4873
55
- ```
56
-
57
- Note that this will only help you with `npx`, but won't help you when a new project foundation is created, and the dependencies start to get pulled. This is because we're using yarn2, which actually doesn't respect the values that were written by the `npm config set ...` command we just executed.
58
-
59
- It's super important that, when you're testing your npx project, you also pass the following argument:
60
-
61
- ```
62
- --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'
63
- ```
64
-
65
- This will set the necessary values in yarn2 config file, which will be located in your newly created project. But don't worry about it right now, this will be revisited in step 4.
66
-
67
- > Yarn2 projects don't rely on global configurations and is not installed globally, but on per-project basis. This allows having multiple versions of yarn2, for different projects.
68
-
69
- #### 3. Version and publish packages
70
-
71
- Commit (no need to push it if you don't want to) all of the code changes, and execute the following command:
72
-
73
- ```
74
- yarn lerna:version:verdaccio
75
- ```
76
-
77
- This will increment the version of all packages in the repository, create a tag, and do some other preparations that are needed before we start publishing. Note that it will also create a new commit, which MUST NOT be pushed to your remote origin. If you happen to do it by accident, you'll need to revert the changes and push those.
78
-
79
- Once that's done, you run the following command:
80
-
81
- ```
82
- yarn lerna:publish:verdaccio
83
- ```
84
-
85
- This will publish the packages to Verdaccio. Once it's done, you can start testing.
86
-
87
- > You can also execute both commands immediately with:
88
- > ```
89
- > yarn lerna:version:verdaccio && yarn lerna:publish:verdaccio
90
- > ```
91
-
92
- #### 4. Test
93
-
94
- Test your changes with the following command:
95
-
96
- ```
97
- npx create-webiny-project@next my-test-project --tag next --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'
98
- ```
99
-
100
- This should create a project, with all of the packages pulled from Verdaccio.
101
-
102
- #### 5. Additional testing
103
-
104
- If, while testing, you've spotted an error or something that needs to be improved, you should revert the `lerna:version:verdaccio` commit that was made in your repo and start over, by adding your changes, and repeating the step 3.
105
-
106
- To revert the version commit, you can run `git reset HEAD~ && git reset --hard HEAD`.
107
- To restart Verdaccio, you can delete the `.verdaccio` folder created in your project root, stop the existing Verdaccio server (just CMD+C in terminal), and start it again with `yarn verdaccio:start`.
108
-
109
- ##### Why not just make another commit, and repeat step 3?
110
-
111
- The thing is, you will make your commits, and then another `lerna:version:verdaccio` commit, and so on. So, after a while, you'll end up having a mix of your own commits and `lerna:version:verdaccio` commits, and you still need to remove all of the `lerna:version:verdaccio` commits in the end.
112
-
113
- > If you come up with a better way to do this, feel free to let us know.
114
-
115
- #### 6. Cleanup
116
-
117
- Once you're done, do the following:
118
-
119
- 1. Undo all commits created with `lerna:version:verdaccio`.
120
- 2. Remove created tags. List all tags with `git tag -l "v5*"` and delete a tag with `git tag -d "v5.0.0-next.5"`.
121
- 3. Reset NPM registry with `npm config set registry https://registry.npmjs.org/`
122
- 4. Remove `.verdaccio` folder
123
-
124
- ### Commands Cheat Sheet
125
-
126
- | Description | Command |
127
- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
128
- | Remove `.verdaccio` folder | `rm -rf .verdaccio` |
129
- | List all v5\* tags | `git tag -l "v5*"` |
130
- | Remove specific tag | `git tag -d "v5.0.0-next.5"` |
131
- | Set Verdaccio as the NPM registry | `npm config set registry http://localhost:4873` |
132
- | Reset NPM registry | `npm config set registry https://registry.npmjs.org/` |
133
- | Start Verdaccio | `yarn verdaccio:start` |
134
- | Version and publish to Verdaccio | `yarn lerna:version:verdaccio && yarn lerna:publish:verdaccio` |
135
- | Create a new Webiny project | `npx create-webiny-project@next my-test-project --tag next --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'` |
136
- | Revert versioning commit | `git reset HEAD~ && git reset --hard HEAD` |
137
-
138
- ## Troubleshooting
139
-
140
- #### I made a new release to Verdaccio, but I still receive old code.
141
-
142
- This is probably because of one of the Yarn package caching mechanisms.
143
-
144
- Yarn has two levels of cache - local and shared.
145
-
146
- When you install a package, it gets cached in the local cache folder (located in your project), and in the shared cache folder. This makes it much faster when you're working on a couple of projects on your local machine, and you're pulling the same package in each. If the package doesn't exist in local cache, it will be pulled from shared cache.
147
-
148
- On Windows, the shared cache folder should be located in: `C:\Users\{USER-NAME}\AppData\Local\Yarn`.
149
- On Linux/Mac, the shared cache folder should be located in: `/Users/adrian/Library/Caches/Yarn`.
150
-
151
- In these folders, most probably, you'll also have the `\Berry\cache` folder. But, there were also cases where this folder did not exist.
152
-
153
- Deleting the mentioned cache folders should help with the issue of still receiving old packages in your testing sessions.
154
-
155
- With all of this being said, you can also try the [following command](https://yarnpkg.com/features/offline-cache#cleaning-the-cache):
156
-
157
- ```bash
158
- yarn cache clean --mirror
159
- ````
11
+ _This README file is automatically generated during the publish process._
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { Infra } from "webiny/extensions";
3
+ import { Cognito } from "@webiny/cognito";
4
+
5
+ export const Extensions = () => {
6
+ return (
7
+ <>
8
+ <Infra.Aws.DefaultRegion name={"{REGION}"} />
9
+ {/* Encryption MUST always be configured for production environments. */}
10
+ <Infra.Env.IsProd>
11
+ <Infra.Encryption passphrase={process.env.WEBINY_ENCRYPTION_PASSPHRASE || ""} />
12
+ </Infra.Env.IsProd>
13
+ <Cognito />
14
+ </>
15
+ );
16
+ };
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { Infra } from "webiny/extensions";
3
+ import { Cognito } from "@webiny/cognito";
4
+
5
+ export const Extensions = () => {
6
+ return (
7
+ <>
8
+ <Infra.Aws.DefaultRegion name={"{REGION}"} />
9
+ <Infra.OpenSearch enabled={true} />
10
+ {/* Encryption MUST always be configured for production environments. */}
11
+ <Infra.Env.IsProd>
12
+ <Infra.Encryption passphrase={process.env.WEBINY_ENCRYPTION_PASSPHRASE || ""} />
13
+ </Infra.Env.IsProd>
14
+ <Cognito />
15
+ </>
16
+ );
17
+ };
@@ -0,0 +1,39 @@
1
+ # Auto detect text files and perform LF normalization
2
+
3
+ * text=auto
4
+
5
+ *.html text diff=html
6
+ *.css text
7
+ *.js text
8
+ *.sql text
9
+ *.php text
10
+ *.md text
11
+ *.txt text
12
+ *.tpl text diff=html
13
+ *.json text
14
+ *.pdf diff=astextplain
15
+ *.h text
16
+ *.sh text
17
+ *.less text
18
+ *.svg text
19
+ *.yml text
20
+ *.xml text
21
+ Makefile text
22
+ Procfile text
23
+ *.c text
24
+ *.cfg text
25
+ *.coffee text
26
+ *.ini text
27
+
28
+ *.png binary
29
+ *.jpg binary
30
+ *.gif binary
31
+ *.bmp binary
32
+ *.bz2 binary
33
+ *.jar binary
34
+ *.jpe binary
35
+ *.tar.gz binary
36
+ *.zip binary
37
+
38
+ *.gitattributes text
39
+ *.gitignore text
@@ -0,0 +1,30 @@
1
+ .DS_Store
2
+ .idea
3
+ .webpack
4
+ .webiny
5
+ .tmp/
6
+ .env
7
+ .env.*
8
+ .npmrc
9
+ .pulumi
10
+ Pulumi.*.yaml
11
+ !Pulumi.yaml
12
+ htpasswd
13
+ npm-debug.log
14
+ node_modules
15
+ npm-debug.log*
16
+ yarn-debug.log*
17
+ yarn-error.log*
18
+ dist/
19
+ build/
20
+ .history
21
+ *.tsbuildinfo
22
+ cypress.json
23
+ # yarn2 files
24
+ .yarn/*
25
+ !.yarn/releases
26
+ !.yarn/patches
27
+ !.yarn/plugins
28
+ !.yarn/sdks
29
+ !.yarn/versions
30
+ .pnp.*
@@ -0,0 +1,12 @@
1
+ ## The `extensions` Folder
2
+
3
+ The extensions folder is the dedicated home for all extension implementations in your project.
4
+ While webiny.config.tsx (located in the project root) is responsible for registering extensions, the actual implementation code always lives inside this folder.
5
+
6
+ This structure keeps your project organized by separating:
7
+ • Extension registration → in webiny.config.tsx
8
+ • Extension implementation → in ./extensions
9
+
10
+ By keeping all implementations in one place, it becomes easier to maintain, share, and scale your custom logic across the project.
11
+
12
+ Learn more: https://webiny.link/extensions.
@@ -0,0 +1,48 @@
1
+ # My Skills
2
+
3
+ This directory contains project-specific skills for the Webiny MCP server. Skills placed here are automatically discovered and served alongside the built-in skills.
4
+
5
+ ## Adding a Skill
6
+
7
+ 1. Create a folder with a kebab-case name:
8
+
9
+ ```
10
+ my-skills/<skill-name>/SKILL.md
11
+ ```
12
+
13
+ 2. Add YAML front-matter with `name` and `description`:
14
+
15
+ ```markdown
16
+ ---
17
+ name: webiny-<skill-name>
18
+ description: >
19
+ What this skill covers and when to use it.
20
+ Be specific -- this text is shown in the skill catalog.
21
+ ---
22
+
23
+ # Skill Title
24
+
25
+ Your skill content here...
26
+ ```
27
+
28
+ 3. Restart your agent (it will automatically restart the MCP server). The skill will appear in `list_webiny_skills` automatically.
29
+
30
+ ## Structure
31
+
32
+ ```
33
+ my-skills/
34
+ ├── README.md # This file
35
+ ├── my-custom-skill/
36
+ │ └── SKILL.md # Discovered by MCP server
37
+ ├── another-skill/
38
+ │ └── SKILL.md
39
+ └── ...
40
+ ```
41
+
42
+ ## Rules
43
+
44
+ - The file **must** be named `SKILL.md` (case-sensitive). Other `.md` files are ignored.
45
+ - Front-matter **must** include both `name` and `description`. Files missing either are skipped.
46
+ - The `name` field is used as the skill identifier in `get_webiny_skill`.
47
+ - To override a built-in skill, use the same `name` value -- project skills take priority.
48
+ - Folders can be nested. The server scans recursively for `SKILL.md` files.
@@ -0,0 +1,8 @@
1
+ @import "@webiny/app-admin/lexical.css";
2
+
3
+ :root {
4
+ --wa-theme-color1: #fa5723;
5
+ --wa-theme-color2: #00ccb0;
6
+ --wa-theme-color-text-base: #0a0a0a;
7
+ --wa-theme-font-family: "Inter", sans-serif;
8
+ }
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Webiny CMS</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7
+ <link rel="shortcut icon" href="/favicon.ico" />
8
+ </head>
9
+ <body>
10
+ <noscript> You need to enable JavaScript to run this app. </noscript>
11
+ <div id="root"></div>
12
+ </body>
13
+ </html>
@@ -0,0 +1,3 @@
1
+ # No robots allowed.
2
+ User-agent: *
3
+ Disallow: /
@@ -0,0 +1,21 @@
1
+ {
2
+ "type": "module",
3
+ "dependencies": {
4
+ "@webiny/cli": "latest",
5
+ "@webiny/cognito": "latest",
6
+ "@webiny/mcp": "latest",
7
+ "react": "18.3.1",
8
+ "react-dom": "18.3.1",
9
+ "webiny": "latest"
10
+ },
11
+ "devDependencies": {
12
+ "@types/node": "^24.12.4",
13
+ "@types/react": "18.3.29",
14
+ "@types/react-dom": "18.3.7",
15
+ "typescript": "6.0.3"
16
+ },
17
+ "scripts": {},
18
+ "engines": {
19
+ "node": "^24.0.0"
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "webiny/configs/tsconfig.json",
3
+ "compilerOptions": {
4
+ "paths": {
5
+ "@/*": ["./*"]
6
+ }
7
+ },
8
+ "include": ["webiny-env.d.ts", "webiny.config.tsx", "extensions"]
9
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="webiny/global.d.ts" />
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+
3
+ export const Extensions = () => {
4
+ return <>{/* Register extensions here. */}</>;
5
+ };
package/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/bin.js CHANGED
@@ -1,49 +1,86 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
2
+ import { ensureSystemRequirements } from "@webiny/system-requirements";
3
+ import { EnsureSystemWebinyConfig, GetCwpVersion } from "./services/index.js";
4
+ import yargs_0 from "yargs";
5
+ import { hideBin } from "yargs/helpers";
6
+ import { CreateWebinyProject } from "./features/CreateWebinyProject.js";
7
+ ensureSystemRequirements();
8
+ const ensureSystemWebinyConfig = new EnsureSystemWebinyConfig();
9
+ ensureSystemWebinyConfig.execute();
10
+ process.on("unhandledRejection", (err)=>{
11
+ throw err;
12
+ });
13
+ const getCwpVersion = new GetCwpVersion();
14
+ const version = getCwpVersion.execute();
15
+ const argv = yargs_0(hideBin(process.argv)).usage("Usage: create-webiny-project <project-name> [options]").version(version).demandCommand(1).help().alias("help", "h").scriptName("create-webiny-project").fail(function(msg, err) {
16
+ if (msg) console.log(msg);
17
+ if (err) console.log(err);
18
+ process.exit(1);
19
+ });
20
+ argv.command("$0 <project-name> [options]", "Name of application and template to use", (yargs)=>{
21
+ yargs.positional("project-name", {
22
+ describe: "Project name"
23
+ });
24
+ yargs.option("force", {
25
+ describe: "All project creation within an existing folder",
26
+ default: false,
27
+ type: "boolean",
28
+ demandOption: false
29
+ });
30
+ yargs.option("template", {
31
+ describe: 'Name of template to use, if no template is provided it will default to "aws" template',
32
+ alias: "t",
33
+ type: "string",
34
+ default: "aws",
35
+ demandOption: false
36
+ });
37
+ yargs.option("template-options", {
38
+ describe: "A JSON containing template-specific options (usually used in non-interactive environments)",
39
+ default: null,
40
+ type: "string",
41
+ demandOption: false
42
+ });
43
+ yargs.option("assign-to-yarnrc", {
44
+ describe: 'A JSON containing additional options that will be assigned into the "yarnrc.yml" configuration file',
45
+ default: null,
46
+ type: "string",
47
+ demandOption: false
48
+ });
49
+ yargs.option("tag", {
50
+ describe: "NPM tag to use for @webiny packages",
51
+ type: "string",
52
+ default: "latest",
53
+ demandOption: false
54
+ });
55
+ yargs.option("interactive", {
56
+ describe: "Enable interactive mode for all commands",
57
+ default: true,
58
+ type: "boolean",
59
+ demandOption: false
60
+ });
61
+ yargs.option("log", {
62
+ describe: "Creates a log file to see output of installation. Defaults to create-webiny-project-logs.txt in current directory",
63
+ alias: "l",
64
+ default: "create-webiny-project-logs.txt",
65
+ type: "string",
66
+ demandOption: false
67
+ });
68
+ yargs.option("debug", {
69
+ describe: "Turn on debug logs",
70
+ default: false,
71
+ type: "boolean",
72
+ demandOption: false
73
+ });
74
+ yargs.option("cleanup", {
75
+ describe: "If an error occurs upon project creation, deletes all generated files",
76
+ alias: "c",
77
+ default: true,
78
+ type: "boolean",
79
+ demandOption: false
80
+ });
81
+ }, (cliArgs)=>{
82
+ const createWebinyProject = new CreateWebinyProject();
83
+ return createWebinyProject.execute(cliArgs);
84
+ }).argv;
3
85
 
4
- const semver = require("semver");
5
- const chalk = require("chalk");
6
- const getYarnVersion = require("./utils/getYarnVersion");
7
- const verifyConfig = require("./utils/verifyConfig");
8
-
9
- (async () => {
10
- const nodeVersion = process.versions.node;
11
- if (!semver.satisfies(nodeVersion, ">=14")) {
12
- console.error(
13
- chalk.red(
14
- [
15
- `You are running Node.js ${nodeVersion}, but Webiny requires version 14 or higher.`,
16
- `Please switch to one of the required versions and try again.`,
17
- "For more information, please visit https://docs.webiny.com/docs/tutorials/install-webiny#prerequisites."
18
- ].join(" ")
19
- )
20
- );
21
- process.exit(1);
22
- }
23
-
24
- try {
25
- const yarnVersion = await getYarnVersion();
26
- if (!semver.satisfies(yarnVersion, ">=1.22.0")) {
27
- console.error(
28
- chalk.red(
29
- [
30
- `Webiny requires yarn@^1.22.0 or higher.`,
31
- `Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.`
32
- ].join("\n")
33
- )
34
- );
35
- process.exit(1);
36
- }
37
- } catch (err) {
38
- console.error(
39
- chalk.red(`Webiny depends on "yarn" and its built-in support for workspaces.`)
40
- );
41
-
42
- console.log(`Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.`);
43
-
44
- process.exit(1);
45
- }
46
-
47
- await verifyConfig();
48
- require("./index");
49
- })();
86
+ //# sourceMappingURL=bin.js.map
package/bin.js.map ADDED
@@ -0,0 +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(\"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;AACrCD,yBAAyB,OAAO;AAShCE,QAAQ,EAAE,CAAC,sBAAsBC,CAAAA;IAC7B,MAAMA;AACV;AAEA,MAAMC,gBAAgB,IAAIC;AAC1B,MAAMC,UAAUF,cAAc,OAAO;AAErC,MAAMG,OAAOC,QAAMC,QAAQP,QAAQ,IAAI,GAClC,KAAK,CAAC,yDACN,OAAO,CAACI,SACR,aAAa,CAAC,GACd,IAAI,GACJ,KAAK,CAAC,QAAQ,KACd,UAAU,CAAC,yBACX,IAAI,CAAC,SAAUI,GAAG,EAAEP,GAAG;IACpB,IAAIO,KACAC,QAAQ,GAAG,CAACD;IAEhB,IAAIP,KACAQ,QAAQ,GAAG,CAACR;IAEhBD,QAAQ,IAAI,CAAC;AACjB;AAEJK,KAAK,OAAO,CACR,+BACA,2CACAC,CAAAA;IACIA,MAAM,UAAU,CAAC,gBAAgB;QAC7B,UAAU;IACd;IACAA,MAAM,MAAM,CAAC,SAAS;QAClB,UAAU;QACV,SAAS;QACT,MAAM;QACN,cAAc;IAClB;IACAA,MAAM,MAAM,CAAC,YAAY;QACrB,UAAU;QACV,OAAO;QACP,MAAM;QACN,SAAS;QACT,cAAc;IAClB;IACAA,MAAM,MAAM,CAAC,oBAAoB;QAC7B,UAAU;QACV,SAAS;QACT,MAAM;QACN,cAAc;IAClB;IACAA,MAAM,MAAM,CAAC,oBAAoB;QAC7B,UAAU;QACV,SAAS;QACT,MAAM;QACN,cAAc;IAClB;IACAA,MAAM,MAAM,CAAC,OAAO;QAChB,UAAU;QACV,MAAM;QACN,SAAS;QACT,cAAc;IAClB;IACAA,MAAM,MAAM,CAAC,eAAe;QACxB,UAAU;QACV,SAAS;QACT,MAAM;QACN,cAAc;IAClB;IACAA,MAAM,MAAM,CAAC,OAAO;QAChB,UACI;QACJ,OAAO;QACP,SAAS;QACT,MAAM;QACN,cAAc;IAClB;IACAA,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"}
@@ -0,0 +1,6 @@
1
+ import { CliParams } from "../../../../types.js";
2
+ import { AwsProjectParams } from "./types.js";
3
+ export declare class SetupAwsWebinyProject {
4
+ execute(cliArgs: CliParams): Promise<AwsProjectParams>;
5
+ private getAwsArgs;
6
+ }
@@ -0,0 +1,37 @@
1
+ import fs_extra from "fs-extra";
2
+ import path from "path";
3
+ import { runInteractivePrompt } from "./runInteractivePrompt.js";
4
+ import { GetProjectRootPath } from "../../../../services/index.js";
5
+ import { GetTemplatesFolderPath } from "../../../../services/GetTemplatesFolderPath.js";
6
+ class SetupAwsWebinyProject {
7
+ async execute(cliArgs) {
8
+ const awsArgs = await this.getAwsArgs(cliArgs);
9
+ const getTemplatesFolderPath = new GetTemplatesFolderPath();
10
+ const templatesFolderPath = getTemplatesFolderPath.execute();
11
+ const storageTemplatePath = path.join(templatesFolderPath, "aws", awsArgs.storageOps);
12
+ const getProjectRoot = new GetProjectRootPath();
13
+ const projectRootFolderPath = getProjectRoot.execute(cliArgs);
14
+ fs_extra.copySync(storageTemplatePath, projectRootFolderPath);
15
+ const webinyConfigTsxEnvFilePath = path.join(projectRootFolderPath, "webiny.config.tsx");
16
+ let content = fs_extra.readFileSync(webinyConfigTsxEnvFilePath).toString();
17
+ content = content.replace("{REGION}", awsArgs.region);
18
+ fs_extra.writeFileSync(webinyConfigTsxEnvFilePath, content);
19
+ return awsArgs;
20
+ }
21
+ async getAwsArgs(cliArgs) {
22
+ const awsArgs = {
23
+ region: "us-east-1",
24
+ storageOps: "ddb",
25
+ aiAgent: "other"
26
+ };
27
+ const { templateOptions: templateOptionsString } = cliArgs;
28
+ if (templateOptionsString) try {
29
+ Object.assign(awsArgs, JSON.parse(templateOptionsString));
30
+ } catch {}
31
+ if (false !== cliArgs.interactive) Object.assign(awsArgs, await runInteractivePrompt());
32
+ return awsArgs;
33
+ }
34
+ }
35
+ export { SetupAwsWebinyProject };
36
+
37
+ //# sourceMappingURL=SetupAwsWebinyProject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js","sources":["../../../../../src/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.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 { AwsProjectParams } from \"./types.js\";\nimport { GetTemplatesFolderPath } from \"../../../../services/GetTemplatesFolderPath.js\";\n\nexport class SetupAwsWebinyProject {\n async execute(cliArgs: CliParams): Promise<AwsProjectParams> {\n const awsArgs = await this.getAwsArgs(cliArgs);\n\n const getTemplatesFolderPath = new GetTemplatesFolderPath();\n const templatesFolderPath = getTemplatesFolderPath.execute();\n\n const storageTemplatePath = path.join(templatesFolderPath, \"aws\", awsArgs.storageOps);\n\n const getProjectRoot = new GetProjectRootPath();\n const projectRootFolderPath = getProjectRoot.execute(cliArgs);\n\n fs.copySync(storageTemplatePath, projectRootFolderPath);\n\n // Update .env file.\n const webinyConfigTsxEnvFilePath = path.join(projectRootFolderPath, \"webiny.config.tsx\");\n let content = fs.readFileSync(webinyConfigTsxEnvFilePath).toString();\n content = content.replace(\"{REGION}\", awsArgs.region);\n fs.writeFileSync(webinyConfigTsxEnvFilePath, content);\n\n return awsArgs;\n }\n\n private async getAwsArgs(cliArgs: CliParams) {\n const awsArgs: AwsProjectParams = {\n region: \"us-east-1\",\n storageOps: \"ddb\",\n aiAgent: \"other\"\n };\n\n const { templateOptions: templateOptionsString } = cliArgs;\n if (templateOptionsString) {\n try {\n Object.assign(awsArgs, JSON.parse(templateOptionsString));\n } catch {\n // Do nothing.\n }\n }\n\n if (cliArgs.interactive !== false) {\n Object.assign(awsArgs, await runInteractivePrompt());\n }\n\n return awsArgs;\n }\n}\n"],"names":["SetupAwsWebinyProject","cliArgs","awsArgs","getTemplatesFolderPath","GetTemplatesFolderPath","templatesFolderPath","storageTemplatePath","path","getProjectRoot","GetProjectRootPath","projectRootFolderPath","fs","webinyConfigTsxEnvFilePath","content","templateOptionsString","Object","JSON","runInteractivePrompt"],"mappings":";;;;;AAQO,MAAMA;IACT,MAAM,QAAQC,OAAkB,EAA6B;QACzD,MAAMC,UAAU,MAAM,IAAI,CAAC,UAAU,CAACD;QAEtC,MAAME,yBAAyB,IAAIC;QACnC,MAAMC,sBAAsBF,uBAAuB,OAAO;QAE1D,MAAMG,sBAAsBC,KAAK,IAAI,CAACF,qBAAqB,OAAOH,QAAQ,UAAU;QAEpF,MAAMM,iBAAiB,IAAIC;QAC3B,MAAMC,wBAAwBF,eAAe,OAAO,CAACP;QAErDU,SAAAA,QAAW,CAACL,qBAAqBI;QAGjC,MAAME,6BAA6BL,KAAK,IAAI,CAACG,uBAAuB;QACpE,IAAIG,UAAUF,SAAAA,YAAe,CAACC,4BAA4B,QAAQ;QAClEC,UAAUA,QAAQ,OAAO,CAAC,YAAYX,QAAQ,MAAM;QACpDS,SAAAA,aAAgB,CAACC,4BAA4BC;QAE7C,OAAOX;IACX;IAEA,MAAc,WAAWD,OAAkB,EAAE;QACzC,MAAMC,UAA4B;YAC9B,QAAQ;YACR,YAAY;YACZ,SAAS;QACb;QAEA,MAAM,EAAE,iBAAiBY,qBAAqB,EAAE,GAAGb;QACnD,IAAIa,uBACA,IAAI;YACAC,OAAO,MAAM,CAACb,SAASc,KAAK,KAAK,CAACF;QACtC,EAAE,OAAM,CAER;QAGJ,IAAIb,AAAwB,UAAxBA,QAAQ,WAAW,EACnBc,OAAO,MAAM,CAACb,SAAS,MAAMe;QAGjC,OAAOf;IACX;AACJ"}
@@ -0,0 +1,4 @@
1
+ export declare const availableAwsRegions: {
2
+ value: string;
3
+ name: string;
4
+ }[];