create-webiny-project 5.44.1-beta.0 → 5.45.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -153
- package/_templates/aws/ddb/webiny.config.tsx +12 -0
- package/_templates/aws/ddb-os/webiny.config.tsx +13 -0
- package/_templates/base/example.eslint.config.js +30 -0
- package/_templates/base/example.gitattributes +39 -0
- package/_templates/base/example.gitignore +30 -0
- package/_templates/base/example.prettierignore +4 -0
- package/_templates/base/example.prettierrc.ts +14 -0
- package/_templates/base/extensions/README.md +12 -0
- package/_templates/base/public/favicon.ico +0 -0
- package/_templates/base/public/global.css +8 -0
- package/_templates/base/public/index.html +13 -0
- package/_templates/base/public/robots.txt +3 -0
- package/_templates/base/template.package.json +28 -0
- package/_templates/base/tsconfig.json +10 -0
- package/_templates/base/webiny-env.d.ts +1 -0
- package/_templates/base/webiny.config.tsx +5 -0
- package/bin.d.ts +2 -0
- package/bin.js +87 -99
- package/bin.js.map +1 -0
- package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.d.ts +5 -0
- package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js +44 -0
- package/features/CreateWebinyProject/projects/aws/SetupAwsWebinyProject.js.map +1 -0
- package/features/CreateWebinyProject/projects/aws/availableAwsRegions.d.ts +4 -0
- package/features/CreateWebinyProject/projects/aws/availableAwsRegions.js +60 -0
- package/features/CreateWebinyProject/projects/aws/availableAwsRegions.js.map +1 -0
- package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.d.ts +4 -0
- package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.js +32 -0
- package/features/CreateWebinyProject/projects/aws/runInteractivePrompt.js.map +1 -0
- package/features/CreateWebinyProject/projects/aws/types.d.ts +5 -0
- package/features/CreateWebinyProject/projects/aws/types.js +3 -0
- package/features/CreateWebinyProject/projects/aws/types.js.map +1 -0
- package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.d.ts +8 -0
- package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js +40 -0
- package/features/CreateWebinyProject/projects/base/SetupBaseWebinyProject.js.map +1 -0
- package/features/CreateWebinyProject.d.ts +4 -0
- package/features/CreateWebinyProject.js +153 -0
- package/features/CreateWebinyProject.js.map +1 -0
- package/package.json +27 -19
- package/services/Analytics.d.ts +4 -0
- package/services/Analytics.js +15 -0
- package/services/Analytics.js.map +1 -0
- package/services/EnsureNoGlobalWebinyCli.d.ts +3 -0
- package/services/EnsureNoGlobalWebinyCli.js +18 -0
- package/services/EnsureNoGlobalWebinyCli.js.map +1 -0
- package/services/EnsureNoTargetFolder.d.ts +4 -0
- package/services/EnsureNoTargetFolder.js +25 -0
- package/services/EnsureNoTargetFolder.js.map +1 -0
- package/services/EnsureNoYarnLockPackageJson.d.ts +3 -0
- package/services/EnsureNoYarnLockPackageJson.js +18 -0
- package/services/EnsureNoYarnLockPackageJson.js.map +1 -0
- package/services/EnsureSystemWebinyConfig.d.ts +3 -0
- package/services/EnsureSystemWebinyConfig.js +25 -0
- package/services/EnsureSystemWebinyConfig.js.map +1 -0
- package/services/EnsureValidProjectName.d.ts +3 -0
- package/services/EnsureValidProjectName.js +21 -0
- package/services/EnsureValidProjectName.js.map +1 -0
- package/services/GetCwpVersion.d.ts +3 -0
- package/services/GetCwpVersion.js +19 -0
- package/services/GetCwpVersion.js.map +1 -0
- package/services/GetProjectRootPath.d.ts +4 -0
- package/services/GetProjectRootPath.js +8 -0
- package/services/GetProjectRootPath.js.map +1 -0
- package/services/GetTemplatesFolderPath.d.ts +3 -0
- package/services/GetTemplatesFolderPath.js +18 -0
- package/services/GetTemplatesFolderPath.js.map +1 -0
- package/services/InitGit.d.ts +4 -0
- package/services/InitGit.js +17 -0
- package/services/InitGit.js.map +1 -0
- package/services/IsGitAvailable.d.ts +3 -0
- package/services/IsGitAvailable.js +13 -0
- package/services/IsGitAvailable.js.map +1 -0
- package/services/PrintErrorInfo.d.ts +4 -0
- package/services/PrintErrorInfo.js +16 -0
- package/services/PrintErrorInfo.js.map +1 -0
- package/services/PrintSystemInfo.d.ts +4 -0
- package/services/PrintSystemInfo.js +38 -0
- package/services/PrintSystemInfo.js.map +1 -0
- package/services/SetWebinyPackageVersions.d.ts +5 -0
- package/services/SetWebinyPackageVersions.js +31 -0
- package/services/SetWebinyPackageVersions.js.map +1 -0
- package/services/SetupYarn/binaries/yarn-4.10.2.cjs +942 -0
- package/services/SetupYarn/binaries/yarn-4.10.2.d.cts +2 -0
- package/services/SetupYarn.d.ts +4 -0
- package/services/SetupYarn.js +60 -0
- package/services/SetupYarn.js.map +1 -0
- package/services/index.d.ts +14 -0
- package/services/index.js +16 -0
- package/services/index.js.map +1 -0
- package/types.d.ts +22 -0
- package/types.js +3 -0
- package/types.js.map +1 -0
- package/index.js +0 -100
- package/utils/GracefulError.d.ts +0 -1
- package/utils/GracefulError.js +0 -3
- package/utils/GracefulYarnError.d.ts +0 -3
- package/utils/GracefulYarnError.js +0 -31
- package/utils/binaries/yarn-4.6.0.cjs +0 -934
- package/utils/createProject.js +0 -427
- package/utils/ensureConfig.js +0 -22
- package/utils/getPackageJson.js +0 -5
- package/utils/getPackageVersion.js +0 -24
- package/utils/gracefulYarnErrorHandlers/index.js +0 -1
- package/utils/validateProjectName.js +0 -22
package/README.md
CHANGED
|
@@ -1,158 +1,11 @@
|
|
|
1
1
|
# create-webiny-project
|
|
2
2
|
|
|
3
|
-
[!
|
|
4
|
-
[
|
|
5
|
-
|
|
6
|
-
[](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
|
-
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
---
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
npx create-webiny-project@local-npm my-test-project --tag local-npm
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
#### Advanced:
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
npx create-webiny-project@local-npm my-test-project
|
|
22
|
-
--tag local-npm --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
|
|
30
|
-
because in real project's CI/CD pipelines, users would simply start off by cloning the project from their private
|
|
31
|
-
repository, and not create a new one with the above command.
|
|
32
|
-
|
|
33
|
-
## Development Notes
|
|
34
|
-
|
|
35
|
-
Testing this, and related packages (like [cwp-template-aws](./../cwp-template-aws)) is a bit complicated, because in
|
|
36
|
-
order to get the best results, it's recommended to test everything with packages published to a real NPM.
|
|
37
|
-
|
|
38
|
-
But of course, publishing to NPM just to test something is not ideal, and that's why, we
|
|
39
|
-
use [Verdaccio](https://verdaccio.org/) instead, which is, basically, an NPM-like service you can run locally. So,
|
|
40
|
-
instead of publishing packages to NPM, you publish them to Verdaccio, which is much cleaner, because everything stays on
|
|
41
|
-
your laptop.
|
|
42
|
-
|
|
43
|
-
#### Usage
|
|
44
|
-
|
|
45
|
-
So, you've made some changes, and now you'd like to see the `create-webiny-project` in action.
|
|
46
|
-
|
|
47
|
-
The following steps show how to do it.
|
|
48
|
-
|
|
49
|
-
#### 0. TLDR
|
|
50
|
-
|
|
51
|
-
1. `yarn verdaccio:start`
|
|
52
|
-
2. `npm config set registry http://localhost:4873`
|
|
53
|
-
3. `yarn release --type=verdaccio`
|
|
54
|
-
|
|
55
|
-
Once the release is done:
|
|
56
|
-
|
|
57
|
-
4. `npx create-webiny-project@local-npm my-test-project --tag local-npm --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'`
|
|
58
|
-
|
|
59
|
-
#### 1. Start Verdaccio
|
|
60
|
-
|
|
61
|
-
Start by running the `yarn verdaccio:start` command, which will, as the script name itself suggests, spin up Verdaccio
|
|
62
|
-
locally.
|
|
63
|
-
|
|
64
|
-
> All of the files uploaded to Verdaccio service will be stored in the `.verdaccio` folder, located in your project
|
|
65
|
-
> root.
|
|
66
|
-
|
|
67
|
-
#### 2. Set default NPM registry
|
|
68
|
-
|
|
69
|
-
Once you have Verdaccio up and running, you'll also need to change the default NPM registry. Meaning, when you
|
|
70
|
-
run `npx create-webiny-project ...`, you want it to start fetching packages from Verdaccio, not real NPM. Verdaccio runs
|
|
71
|
-
on localhost, on port 4873, so, in your terminal, run the following command:
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
npm config set registry http://localhost:4873
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Note that this will only help you with `npx`, but won't help you when a new project foundation is created, and the
|
|
78
|
-
dependencies start to get pulled. This is because we're using yarn2, which actually doesn't respect the values that were
|
|
79
|
-
written by the `npm config set ...` command we just executed.
|
|
80
|
-
|
|
81
|
-
It's super important that, when you're testing your npx project, you also pass the following argument:
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
--assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
This will set the necessary values in yarn2 config file, which will be located in your newly created project. But don't
|
|
88
|
-
worry about it right now, this will be revisited in step 4.
|
|
89
|
-
|
|
90
|
-
> Yarn2 projects don't rely on global configurations and is not installed globally, but on per-project basis. This
|
|
91
|
-
> allows having multiple versions of yarn2, for different projects.
|
|
92
|
-
|
|
93
|
-
#### 3. Release
|
|
94
|
-
|
|
95
|
-
Commit (no need to push it if you don't want to) all of the code changes, and execute the following command:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
yarn release --type=verdaccio
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
#### 4. Test
|
|
102
|
-
|
|
103
|
-
Test your changes with the following command:
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
npx create-webiny-project@local-npm my-test-project --tag local-npm --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
This should create a project, with all of the packages pulled from Verdaccio.
|
|
110
|
-
|
|
111
|
-
#### 5. Cleanup
|
|
112
|
-
|
|
113
|
-
Once you're done, do the following:
|
|
114
|
-
|
|
115
|
-
1. Reset NPM registry with `npm config set registry https://registry.npmjs.org/`
|
|
116
|
-
2. Remove `.verdaccio` folder
|
|
117
|
-
|
|
118
|
-
### Commands Cheat Sheet
|
|
119
|
-
|
|
120
|
-
| Description | Command |
|
|
121
|
-
|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
122
|
-
| Remove `.verdaccio` folder | `rm -rf .verdaccio` |
|
|
123
|
-
| List all v5\* tags | `git tag -l "v5*"` |
|
|
124
|
-
| Remove specific tag | `git tag -d "v5.0.0-next.5"` |
|
|
125
|
-
| Set Verdaccio as the NPM registry | `npm config set registry http://localhost:4873` |
|
|
126
|
-
| Reset NPM registry | `npm config set registry https://registry.npmjs.org/` |
|
|
127
|
-
| Start Verdaccio | `yarn verdaccio:start` |
|
|
128
|
-
| Release to Verdaccio | `yarn release --type=verdaccio` | |
|
|
129
|
-
| Create a new Webiny project | `npx create-webiny-project@local-npm my-test-project --tag local-npm --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}` |
|
|
130
|
-
| Revert versioning commit | `git reset HEAD~ && git reset --hard HEAD` |
|
|
131
|
-
|
|
132
|
-
## Troubleshooting
|
|
133
|
-
|
|
134
|
-
#### I made a new release to Verdaccio, but I still receive old code.
|
|
135
|
-
|
|
136
|
-
This is probably because of one of the Yarn package caching mechanisms.
|
|
137
|
-
|
|
138
|
-
Yarn has two levels of cache - local and shared.
|
|
139
|
-
|
|
140
|
-
When you install a package, it gets cached in the local cache folder (located in your project), and in the shared cache
|
|
141
|
-
folder. This makes it much faster when you're working on a couple of projects on your local machine, and you're pulling
|
|
142
|
-
the same package in each. If the package doesn't exist in local cache, it will be pulled from shared cache.
|
|
143
|
-
|
|
144
|
-
On Windows, the shared cache folder should be located in: `C:\Users\{USER-NAME}\AppData\Local\Yarn`.
|
|
145
|
-
On Linux/Mac, the shared cache folder should be located in: `/Users/adrian/Library/Caches/Yarn`.
|
|
146
|
-
|
|
147
|
-
In these folders, most probably, you'll also have the `\Berry\cache` folder. But, there were also cases where this
|
|
148
|
-
folder did not exist.
|
|
149
|
-
|
|
150
|
-
Deleting the mentioned cache folders should help with the issue of still receiving old packages in your testing
|
|
151
|
-
sessions.
|
|
152
|
-
|
|
153
|
-
With all of this being said, you can also try
|
|
154
|
-
the [following command](https://yarnpkg.com/features/offline-cache#cleaning-the-cache):
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
yarn cache clean --mirror
|
|
158
|
-
````
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
<Cognito />
|
|
11
|
+
</>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import ts from "typescript-eslint";
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{ languageOptions: { globals: globals.browser } },
|
|
7
|
+
js.configs.recommended,
|
|
8
|
+
...ts.configs.recommended,
|
|
9
|
+
{
|
|
10
|
+
rules: {
|
|
11
|
+
"@typescript-eslint/no-namespace": "off"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
ignores: [
|
|
16
|
+
"**/node_modules/",
|
|
17
|
+
"**/dist/",
|
|
18
|
+
"**/build/",
|
|
19
|
+
"**/.out/",
|
|
20
|
+
"**/*.d.ts",
|
|
21
|
+
".idea/**",
|
|
22
|
+
".webiny/*",
|
|
23
|
+
".pulumi/*",
|
|
24
|
+
".yarn/*",
|
|
25
|
+
"public/*",
|
|
26
|
+
"idea.js",
|
|
27
|
+
"scripts"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
];
|
|
@@ -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.
|
|
Binary file
|
|
@@ -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,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"devDependencies": {
|
|
4
|
+
"@eslint/js": "^10.0.1",
|
|
5
|
+
"@types/node": "^24.10.13",
|
|
6
|
+
"@types/react": "18.2.79",
|
|
7
|
+
"@types/react-dom": "18.2.25",
|
|
8
|
+
"@webiny/cli": "latest",
|
|
9
|
+
"@webiny/cognito": "latest",
|
|
10
|
+
"eslint": "^10.0.0",
|
|
11
|
+
"eslint-plugin-react": "^7.37.5",
|
|
12
|
+
"globals": "^16.3.0",
|
|
13
|
+
"prettier": "^3.6.2",
|
|
14
|
+
"typescript": "5.9.3",
|
|
15
|
+
"typescript-eslint": "^8.56.0",
|
|
16
|
+
"webiny": "latest"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\" --max-warnings=0",
|
|
20
|
+
"link:fix": "yarn eslint --fix",
|
|
21
|
+
"format": "prettier \"**/**/*.{js,jsx,ts,tsx,json}\" --config .prettierrc.js",
|
|
22
|
+
"format:check": "yarn format --check",
|
|
23
|
+
"format:fix": "yarn format --write"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "^24.0.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="webiny/global.d.ts" />
|
package/bin.d.ts
ADDED
package/bin.js
CHANGED
|
@@ -1,107 +1,95 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// Ensure system requirements are met.
|
|
4
|
-
|
|
4
|
+
import { ensureSystemRequirements } from "@webiny/system-requirements";
|
|
5
|
+
ensureSystemRequirements();
|
|
5
6
|
|
|
6
7
|
// Verify `.webiny` config file and continue.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import { EnsureSystemWebinyConfig } from "./services/index.js";
|
|
9
|
+
const ensureSystemWebinyConfig = new EnsureSystemWebinyConfig();
|
|
10
|
+
ensureSystemWebinyConfig.execute();
|
|
11
|
+
import yargs from "yargs";
|
|
12
|
+
import { hideBin } from "yargs/helpers";
|
|
13
|
+
import { GetCwpVersion } from "./services/index.js";
|
|
14
|
+
import { CreateWebinyProject } from "./features/CreateWebinyProject.js";
|
|
13
15
|
process.on("unhandledRejection", err => {
|
|
14
|
-
|
|
16
|
+
throw err;
|
|
15
17
|
});
|
|
18
|
+
const getCwpVersion = new GetCwpVersion();
|
|
19
|
+
const version = getCwpVersion.execute();
|
|
20
|
+
const argv = yargs(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) {
|
|
21
|
+
if (msg) {
|
|
22
|
+
console.log(msg);
|
|
23
|
+
}
|
|
24
|
+
if (err) {
|
|
25
|
+
console.log(err);
|
|
26
|
+
}
|
|
27
|
+
process.exit(1);
|
|
28
|
+
});
|
|
29
|
+
argv.command("$0 <project-name> [options]", "Name of application and template to use", yargs => {
|
|
30
|
+
yargs.positional("project-name", {
|
|
31
|
+
describe: "Project name"
|
|
32
|
+
});
|
|
33
|
+
yargs.option("force", {
|
|
34
|
+
describe: "All project creation within an existing folder",
|
|
35
|
+
default: false,
|
|
36
|
+
type: "boolean",
|
|
37
|
+
demandOption: false
|
|
38
|
+
});
|
|
39
|
+
yargs.option("template", {
|
|
40
|
+
describe: `Name of template to use, if no template is provided it will default to "aws" template`,
|
|
41
|
+
alias: "t",
|
|
42
|
+
type: "string",
|
|
43
|
+
default: "aws",
|
|
44
|
+
demandOption: false
|
|
45
|
+
});
|
|
46
|
+
yargs.option("template-options", {
|
|
47
|
+
describe: `A JSON containing template-specific options (usually used in non-interactive environments)`,
|
|
48
|
+
default: null,
|
|
49
|
+
type: "string",
|
|
50
|
+
demandOption: false
|
|
51
|
+
});
|
|
52
|
+
yargs.option("assign-to-yarnrc", {
|
|
53
|
+
describe: `A JSON containing additional options that will be assigned into the "yarnrc.yml" configuration file`,
|
|
54
|
+
default: null,
|
|
55
|
+
type: "string",
|
|
56
|
+
demandOption: false
|
|
57
|
+
});
|
|
58
|
+
yargs.option("tag", {
|
|
59
|
+
describe: "NPM tag to use for @webiny packages",
|
|
60
|
+
type: "string",
|
|
61
|
+
default: "latest",
|
|
62
|
+
demandOption: false
|
|
63
|
+
});
|
|
64
|
+
yargs.option("interactive", {
|
|
65
|
+
describe: "Enable interactive mode for all commands",
|
|
66
|
+
default: true,
|
|
67
|
+
type: "boolean",
|
|
68
|
+
demandOption: false
|
|
69
|
+
});
|
|
70
|
+
yargs.option("log", {
|
|
71
|
+
describe: "Creates a log file to see output of installation. Defaults to create-webiny-project-logs.txt in current directory",
|
|
72
|
+
alias: "l",
|
|
73
|
+
default: "create-webiny-project-logs.txt",
|
|
74
|
+
type: "string",
|
|
75
|
+
demandOption: false
|
|
76
|
+
});
|
|
77
|
+
yargs.option("debug", {
|
|
78
|
+
describe: "Turn on debug logs",
|
|
79
|
+
default: false,
|
|
80
|
+
type: "boolean",
|
|
81
|
+
demandOption: false
|
|
82
|
+
});
|
|
83
|
+
yargs.option("cleanup", {
|
|
84
|
+
describe: "If an error occurs upon project creation, deletes all generated files",
|
|
85
|
+
alias: "c",
|
|
86
|
+
default: true,
|
|
87
|
+
type: "boolean",
|
|
88
|
+
demandOption: false
|
|
89
|
+
});
|
|
90
|
+
}, cliArgs => {
|
|
91
|
+
const createWebinyProject = new CreateWebinyProject();
|
|
92
|
+
return createWebinyProject.execute(cliArgs);
|
|
93
|
+
}).argv;
|
|
16
94
|
|
|
17
|
-
|
|
18
|
-
.usage("Usage: create-webiny-project <project-name> [options]")
|
|
19
|
-
.version(packageJson.version)
|
|
20
|
-
.demandCommand(1)
|
|
21
|
-
.help()
|
|
22
|
-
.alias("help", "h")
|
|
23
|
-
.scriptName("create-webiny-project")
|
|
24
|
-
.fail(function (msg, err) {
|
|
25
|
-
if (msg) {
|
|
26
|
-
console.log(msg);
|
|
27
|
-
}
|
|
28
|
-
if (err) {
|
|
29
|
-
console.log(err);
|
|
30
|
-
}
|
|
31
|
-
process.exit(1);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// noinspection BadExpressionStatementJS
|
|
35
|
-
yargs.command(
|
|
36
|
-
"$0 <project-name> [options]",
|
|
37
|
-
"Name of application and template to use",
|
|
38
|
-
yargs => {
|
|
39
|
-
yargs.positional("project-name", {
|
|
40
|
-
describe: "Project name"
|
|
41
|
-
});
|
|
42
|
-
yargs.option("force", {
|
|
43
|
-
describe: "All project creation within an existing folder",
|
|
44
|
-
default: false,
|
|
45
|
-
type: "boolean",
|
|
46
|
-
demandOption: false
|
|
47
|
-
});
|
|
48
|
-
yargs.option("template", {
|
|
49
|
-
describe: `Name of template to use, if no template is provided it will default to "aws" template`,
|
|
50
|
-
alias: "t",
|
|
51
|
-
type: "string",
|
|
52
|
-
default: "aws",
|
|
53
|
-
demandOption: false
|
|
54
|
-
});
|
|
55
|
-
yargs.option("template-options", {
|
|
56
|
-
describe: `A JSON containing template-specific options (usually used in non-interactive environments)`,
|
|
57
|
-
default: null,
|
|
58
|
-
type: "string",
|
|
59
|
-
demandOption: false
|
|
60
|
-
});
|
|
61
|
-
yargs.option("assign-to-yarnrc", {
|
|
62
|
-
describe: `A JSON containing additional options that will be assigned into the "yarnrc.yml" configuration file`,
|
|
63
|
-
default: null,
|
|
64
|
-
type: "string",
|
|
65
|
-
demandOption: false
|
|
66
|
-
});
|
|
67
|
-
yargs.option("tag", {
|
|
68
|
-
describe: "NPM tag to use for @webiny packages",
|
|
69
|
-
type: "string",
|
|
70
|
-
default: "latest",
|
|
71
|
-
demandOption: false
|
|
72
|
-
});
|
|
73
|
-
yargs.option("interactive", {
|
|
74
|
-
describe: "Enable interactive mode for all commands",
|
|
75
|
-
default: true,
|
|
76
|
-
type: "boolean",
|
|
77
|
-
demandOption: false
|
|
78
|
-
});
|
|
79
|
-
yargs.option("log", {
|
|
80
|
-
describe:
|
|
81
|
-
"Creates a log file to see output of installation. Defaults to create-webiny-project-logs.txt in current directory",
|
|
82
|
-
alias: "l",
|
|
83
|
-
default: "create-webiny-project-logs.txt",
|
|
84
|
-
type: "string",
|
|
85
|
-
demandOption: false
|
|
86
|
-
});
|
|
87
|
-
yargs.option("debug", {
|
|
88
|
-
describe: "Turn on debug logs",
|
|
89
|
-
default: false,
|
|
90
|
-
type: "boolean",
|
|
91
|
-
demandOption: false
|
|
92
|
-
});
|
|
93
|
-
yargs.option("cleanup", {
|
|
94
|
-
describe: "If an error occurs upon project creation, deletes all generated files",
|
|
95
|
-
alias: "c",
|
|
96
|
-
default: true,
|
|
97
|
-
type: "boolean",
|
|
98
|
-
demandOption: false
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
yargs.example("$0 <project-name>");
|
|
102
|
-
yargs.example("$0 <project-name> --template=aws");
|
|
103
|
-
yargs.example("$0 <project-name> --template=../path/to/template");
|
|
104
|
-
yargs.example("$0 <project-name> --log=./my-logs.txt");
|
|
105
|
-
},
|
|
106
|
-
argv => createProject(argv)
|
|
107
|
-
).argv;
|
|
95
|
+
//# sourceMappingURL=bin.js.map
|
package/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ensureSystemRequirements","EnsureSystemWebinyConfig","ensureSystemWebinyConfig","execute","yargs","hideBin","GetCwpVersion","CreateWebinyProject","process","on","err","getCwpVersion","version","argv","usage","demandCommand","help","alias","scriptName","fail","msg","console","log","exit","command","positional","describe","option","default","type","demandOption","cliArgs","createWebinyProject"],"sources":["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"],"mappings":"AAAA;;AAEA;AACA,SAASA,wBAAwB,QAAQ,6BAA6B;AACtEA,wBAAwB,CAAC,CAAC;;AAE1B;AACA,SAASC,wBAAwB;AAEjC,MAAMC,wBAAwB,GAAG,IAAID,wBAAwB,CAAC,CAAC;AAC/DC,wBAAwB,CAACC,OAAO,CAAC,CAAC;AAElC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AAEvC,SAASC,aAAa;AACtB,SAASC,mBAAmB;AAG5BC,OAAO,CAACC,EAAE,CAAC,oBAAoB,EAAEC,GAAG,IAAI;EACpC,MAAMA,GAAG;AACb,CAAC,CAAC;AAEF,MAAMC,aAAa,GAAG,IAAIL,aAAa,CAAC,CAAC;AACzC,MAAMM,OAAO,GAAGD,aAAa,CAACR,OAAO,CAAC,CAAC;AAEvC,MAAMU,IAAI,GAAGT,KAAK,CAACC,OAAO,CAACG,OAAO,CAACK,IAAI,CAAC,CAAC,CACpCC,KAAK,CAAC,uDAAuD,CAAC,CAC9DF,OAAO,CAACA,OAAO,CAAC,CAChBG,aAAa,CAAC,CAAC,CAA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