create-webiny-project
Advanced tools
Comparing version
140
bin.js
#!/usr/bin/env node | ||
"use strict"; | ||
const semver = require("semver"); | ||
const chalk = require("chalk"); | ||
const getYarnVersion = require("./utils/getYarnVersion"); | ||
const verifyConfig = require("./utils/verifyConfig"); | ||
// Ensure system requirements are met. | ||
require("@webiny/system-requirements").ensureSystemRequirements(); | ||
(async () => { | ||
const nodeVersion = process.versions.node; | ||
if (!semver.satisfies(nodeVersion, ">=14")) { | ||
console.error( | ||
chalk.red( | ||
[ | ||
`You are running Node.js ${nodeVersion}, but Webiny requires version 14 or higher.`, | ||
`Please switch to one of the required versions and try again.`, | ||
"For more information, please visit https://docs.webiny.com/docs/tutorials/install-webiny#prerequisites." | ||
].join(" ") | ||
) | ||
); | ||
process.exit(1); | ||
} | ||
// Verify `.webiny` config file and continue. | ||
require("./utils/ensureConfig").ensureConfig(); | ||
try { | ||
const yarnVersion = await getYarnVersion(); | ||
if (!semver.satisfies(yarnVersion, ">=1.22.0")) { | ||
console.error( | ||
chalk.red( | ||
[ | ||
`Webiny requires yarn@^1.22.0 or higher.`, | ||
`Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.` | ||
].join("\n") | ||
) | ||
); | ||
process.exit(1); | ||
} | ||
} catch (err) { | ||
console.error( | ||
chalk.red(`Webiny depends on "yarn" and its built-in support for workspaces.`) | ||
); | ||
const yargs = require("yargs"); | ||
const packageJson = require("./package.json"); | ||
const createProject = require("./utils/createProject"); | ||
console.log(`Please visit https://yarnpkg.com/ to install ${chalk.green("yarn")}.`); | ||
process.on("unhandledRejection", err => { | ||
throw err; | ||
}); | ||
yargs | ||
.usage("Usage: create-webiny-project <project-name> [options]") | ||
.version(packageJson.version) | ||
.demandCommand(1) | ||
.help() | ||
.alias("help", "h") | ||
.scriptName("create-webiny-project") | ||
.fail(function (msg, err) { | ||
if (msg) { | ||
console.log(msg); | ||
} | ||
if (err) { | ||
console.log(err); | ||
} | ||
process.exit(1); | ||
} | ||
}); | ||
await verifyConfig(); | ||
require("./index"); | ||
})(); | ||
// noinspection BadExpressionStatementJS | ||
yargs.command( | ||
"$0 <project-name> [options]", | ||
"Name of application and template to use", | ||
yargs => { | ||
yargs.positional("project-name", { | ||
describe: "Project name" | ||
}); | ||
yargs.option("force", { | ||
describe: "All project creation within an existing folder", | ||
default: false, | ||
type: "boolean", | ||
demandOption: false | ||
}); | ||
yargs.option("template", { | ||
describe: `Name of template to use, if no template is provided it will default to "aws" template`, | ||
alias: "t", | ||
type: "string", | ||
default: "aws", | ||
demandOption: false | ||
}); | ||
yargs.option("template-options", { | ||
describe: `A JSON containing template-specific options (usually used in non-interactive environments)`, | ||
default: null, | ||
type: "string", | ||
demandOption: false | ||
}); | ||
yargs.option("assign-to-yarnrc", { | ||
describe: `A JSON containing additional options that will be assigned into the "yarnrc.yml" configuration file`, | ||
default: null, | ||
type: "string", | ||
demandOption: false | ||
}); | ||
yargs.option("tag", { | ||
describe: "NPM tag to use for @webiny packages", | ||
type: "string", | ||
default: "latest", | ||
demandOption: false | ||
}); | ||
yargs.option("interactive", { | ||
describe: "Enable interactive mode for all commands", | ||
default: true, | ||
type: "boolean", | ||
demandOption: false | ||
}); | ||
yargs.option("log", { | ||
describe: | ||
"Creates a log file to see output of installation. Defaults to create-webiny-project-logs.txt in current directory", | ||
alias: "l", | ||
default: "create-webiny-project-logs.txt", | ||
type: "string", | ||
demandOption: false | ||
}); | ||
yargs.option("debug", { | ||
describe: "Turn on debug logs", | ||
default: false, | ||
type: "boolean", | ||
demandOption: false | ||
}); | ||
yargs.option("cleanup", { | ||
describe: "If an error occurs upon project creation, deletes all generated files", | ||
alias: "c", | ||
default: true, | ||
type: "boolean", | ||
demandOption: false | ||
}); | ||
yargs.example("$0 <project-name>"); | ||
yargs.example("$0 <project-name> --template=aws"); | ||
yargs.example("$0 <project-name> --template=../path/to/template"); | ||
yargs.example("$0 <project-name> --log=./my-logs.txt"); | ||
}, | ||
argv => createProject(argv) | ||
).argv; |
10
index.js
@@ -74,8 +74,14 @@ #!/usr/bin/env node | ||
describe: | ||
"Creates a log file to see output of installation. Defaults to creating cwp-logs.txt in current directory", | ||
"Creates a log file to see output of installation. Defaults to create-webiny-project-logs.txt in current directory", | ||
alias: "l", | ||
default: "cwp-logs.txt", | ||
default: "create-webiny-project-logs.txt", | ||
type: "string", | ||
demandOption: false | ||
}); | ||
yargs.option("debug", { | ||
describe: "Turn on debug logs", | ||
default: false, | ||
type: "boolean", | ||
demandOption: false | ||
}); | ||
yargs.option("cleanup", { | ||
@@ -82,0 +88,0 @@ describe: "If an error occurs upon project creation, deletes all generated files", |
{ | ||
"name": "create-webiny-project", | ||
"version": "0.0.0-unstable.e3f4727c56", | ||
"version": "0.0.0-unstable.e53eceafb5", | ||
"description": "Webiny project bootstrap tool.", | ||
@@ -16,19 +16,21 @@ "main": "index.js", | ||
"dependencies": { | ||
"@webiny/telemetry": "0.0.0-unstable.e3f4727c56", | ||
"@webiny/system-requirements": "0.0.0-unstable.e53eceafb5", | ||
"@webiny/telemetry": "0.0.0-unstable.e53eceafb5", | ||
"chalk": "4.1.2", | ||
"execa": "5.1.1", | ||
"find-up": "5.0.0", | ||
"fs-extra": "9.1.0", | ||
"fs-extra": "11.2.0", | ||
"js-yaml": "3.14.1", | ||
"listr": "0.14.3", | ||
"load-json-file": "6.2.0", | ||
"node-fetch": "2.6.9", | ||
"node-fetch": "2.6.7", | ||
"os": "0.1.1", | ||
"p-retry": "4.6.2", | ||
"rimraf": "3.0.2", | ||
"semver": "7.3.8", | ||
"uuid": "8.3.2", | ||
"rimraf": "6.0.1", | ||
"semver": "7.6.3", | ||
"uuid": "9.0.1", | ||
"validate-npm-package-name": "3.0.0", | ||
"write-json-file": "4.3.0", | ||
"yargs": "17.6.2" | ||
"yargs": "17.7.2", | ||
"yesno": "0.4.0" | ||
}, | ||
@@ -39,3 +41,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "e3f4727c567484dc53e1efceacfb37dbacd7f4de" | ||
"gitHead": "e53eceafb5ce1a3872c9b4548939bb2eae5b1aef" | ||
} |
@@ -15,3 +15,3 @@ # create-webiny-project | ||
``` | ||
npx create-webiny-project@beta my-test-project --tag beta | ||
npx create-webiny-project@local-npm my-test-project --tag local-npm | ||
``` | ||
@@ -22,4 +22,4 @@ | ||
``` | ||
npx create-webiny-project@beta my-test-project | ||
--tag beta --no-interactive | ||
npx create-webiny-project@local-npm my-test-project | ||
--tag local-npm --no-interactive | ||
--assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' | ||
@@ -31,9 +31,15 @@ --template-options '{"region":"eu-central-1","vpc":false}' | ||
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. | ||
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. | ||
## Development Notes | ||
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. | ||
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. | ||
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. | ||
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. | ||
@@ -46,11 +52,25 @@ #### Usage | ||
#### 0. TLDR | ||
1. `yarn verdaccio:start` | ||
2. `npm config set registry http://localhost:4873` | ||
3. `yarn release --type=verdaccio` | ||
Once the release is done: | ||
4. `npx create-webiny-project@local-npm my-test-project --tag local-npm --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'` | ||
#### 1. Start Verdaccio | ||
Start by running the `yarn verdaccio:start` command, which will, as the script name itself suggests, spin up Verdaccio locally. | ||
Start by running the `yarn verdaccio:start` command, which will, as the script name itself suggests, spin up Verdaccio | ||
locally. | ||
> All of the files uploaded to Verdaccio service will be stored in the `.verdaccio` folder, located in your project root. | ||
> All of the files uploaded to Verdaccio service will be stored in the `.verdaccio` folder, located in your project | ||
> root. | ||
#### 2. Set default NPM registry | ||
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: | ||
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: | ||
@@ -61,3 +81,5 @@ ``` | ||
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. | ||
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. | ||
@@ -70,5 +92,7 @@ It's super important that, when you're testing your npx project, you also pass the following argument: | ||
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. | ||
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. | ||
> 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. | ||
> 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. | ||
@@ -79,3 +103,2 @@ #### 3. Release | ||
```bash | ||
@@ -90,3 +113,3 @@ yarn release --type=verdaccio | ||
``` | ||
npx create-webiny-project@next my-test-project --tag next --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' | ||
npx create-webiny-project@local-npm my-test-project --tag local-npm --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' | ||
``` | ||
@@ -105,13 +128,13 @@ | ||
| Description | Command | | ||
|-----------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| Remove `.verdaccio` folder | `rm -rf .verdaccio` | | ||
| List all v5\* tags | `git tag -l "v5*"` | | ||
| Remove specific tag | `git tag -d "v5.0.0-next.5"` | | ||
| Set Verdaccio as the NPM registry | `npm config set registry http://localhost:4873` | | ||
| Reset NPM registry | `npm config set registry https://registry.npmjs.org/` | | ||
| Start Verdaccio | `yarn verdaccio:start` | | ||
| Release to Verdaccio | `yarn release --type=verdaccio` | | ||
| Create a new Webiny project | `npx create-webiny-project@next my-test-project --tag next --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}'` | | ||
| Revert versioning commit | `git reset HEAD~ && git reset --hard HEAD` | | ||
| Description | Command | | ||
|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| Remove `.verdaccio` folder | `rm -rf .verdaccio` | | ||
| List all v5\* tags | `git tag -l "v5*"` | | ||
| Remove specific tag | `git tag -d "v5.0.0-next.5"` | | ||
| Set Verdaccio as the NPM registry | `npm config set registry http://localhost:4873` | | ||
| Reset NPM registry | `npm config set registry https://registry.npmjs.org/` | | ||
| Start Verdaccio | `yarn verdaccio:start` | | ||
| Release to Verdaccio | `yarn release --type=verdaccio` | | | ||
| 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"]}` | | ||
| Revert versioning commit | `git reset HEAD~ && git reset --hard HEAD` | | ||
@@ -124,14 +147,19 @@ ## Troubleshooting | ||
Yarn has two levels of cache - local and shared. | ||
Yarn has two levels of cache - local and shared. | ||
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. | ||
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. | ||
On Windows, the shared cache folder should be located in: `C:\Users\{USER-NAME}\AppData\Local\Yarn`. | ||
On Windows, the shared cache folder should be located in: `C:\Users\{USER-NAME}\AppData\Local\Yarn`. | ||
On Linux/Mac, the shared cache folder should be located in: `/Users/adrian/Library/Caches/Yarn`. | ||
In these folders, most probably, you'll also have the `\Berry\cache` folder. But, there were also cases where this folder did not exist. | ||
In these folders, most probably, you'll also have the `\Berry\cache` folder. But, there were also cases where this | ||
folder did not exist. | ||
Deleting the mentioned cache folders should help with the issue of still receiving old packages in your testing sessions. | ||
Deleting the mentioned cache folders should help with the issue of still receiving old packages in your testing | ||
sessions. | ||
With all of this being said, you can also try the [following command](https://yarnpkg.com/features/offline-cache#cleaning-the-cache): | ||
With all of this being said, you can also try | ||
the [following command](https://yarnpkg.com/features/offline-cache#cleaning-the-cache): | ||
@@ -138,0 +166,0 @@ ```bash |
#!/usr/bin/env node | ||
const { yellow, red, green, gray } = require("chalk"); | ||
const { yellow, red, green, gray, bold } = require("chalk"); | ||
const execa = require("execa"); | ||
@@ -11,8 +11,20 @@ const fs = require("fs-extra"); | ||
const getPackageJson = require("./getPackageJson"); | ||
const checkProjectName = require("./checkProjectName"); | ||
const validateProjectName = require("./validateProjectName"); | ||
const yaml = require("js-yaml"); | ||
const findUp = require("find-up"); | ||
const { GracefulError } = require("./GracefulError"); | ||
const yesno = require("yesno"); | ||
const NOT_APPLICABLE = gray("N/A"); | ||
const HL = bold(gray("—")).repeat(30); | ||
const sleep = () => | ||
new Promise(resolve => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 500); | ||
}); | ||
const getTelemetryEventName = stage => `cli-create-webiny-project-${stage}`; | ||
module.exports = async function createProject({ | ||
@@ -24,2 +36,3 @@ projectName, | ||
log, | ||
debug, | ||
cleanup, | ||
@@ -96,5 +109,7 @@ interactive, | ||
validateProjectName(projectName); | ||
console.log(`Initializing a new Webiny project in ${green(projectRoot)}...`); | ||
await sendEvent({ event: "create-webiny-project-start" }); | ||
await sendEvent({ event: getTelemetryEventName("start") }); | ||
@@ -115,3 +130,2 @@ let isGitAvailable = false; | ||
task: () => { | ||
checkProjectName(projectName); | ||
fs.ensureDirSync(projectName); | ||
@@ -126,12 +140,37 @@ writeJson.sync( | ||
// Setup yarn | ||
title: "Setup yarn", | ||
title: "Setup Yarn", | ||
task: async () => { | ||
await execa("yarn", ["set", "version", "berry"], { cwd: projectRoot }); | ||
const yarnVersion = "4.6.0"; | ||
const yarnFile = `yarn-${yarnVersion}.cjs`; | ||
const yarnPath = `.yarn`; | ||
const yarnReleasesPath = path.join(yarnPath, "releases"); | ||
const yarnReleasesFilePath = path.join(yarnReleasesPath, yarnFile); | ||
const yamlPath = path.join(projectRoot, ".yarnrc.yml"); | ||
const parsedYaml = yaml.load(fs.readFileSync(yamlPath, "utf-8")); | ||
/** | ||
* We do not want to do the recursive directory creating as it might do something in parent directories which we do not want. | ||
*/ | ||
const yarnReleaseFullPath = path.join(projectRoot, yarnReleasesPath); | ||
fs.ensureDirSync(yarnReleaseFullPath); | ||
// Default settings are applied here. Currently we only apply the `nodeLinker` param. | ||
parsedYaml.nodeLinker = "node-modules"; | ||
const source = path.join(__dirname, path.join("binaries", yarnFile)); | ||
if (!fs.existsSync(source)) { | ||
throw new Error(`No yarn binary source file: ${source}`); | ||
} | ||
const target = path.join(projectRoot, yarnReleasesFilePath); | ||
fs.copyFileSync(source, target); | ||
// `.yarnrc.yml` file is created here. | ||
const yarnRcPath = path.join(projectRoot, ".yarnrc.yml"); | ||
let rawYarnRc = `yarnPath: ${yarnReleasesFilePath}`; | ||
if (fs.existsSync(yarnRcPath)) { | ||
rawYarnRc = fs.readFileSync(yarnRcPath, "utf-8"); | ||
} | ||
const parsedYarnRc = yaml.load(rawYarnRc); | ||
// Default settings are applied here. Currently, we only apply the `nodeLinker` param. | ||
parsedYarnRc.nodeLinker = "node-modules"; | ||
// Enables adding additional params into the `.yarnrc.yml` file. | ||
@@ -149,11 +188,11 @@ if (assignToYarnRc) { | ||
if (parsedAssignToYarnRc) { | ||
Object.assign(parsedYaml, parsedAssignToYarnRc); | ||
Object.assign(parsedYarnRc, parsedAssignToYarnRc); | ||
} | ||
} | ||
fs.writeFileSync(yamlPath, yaml.dump(parsedYaml)); | ||
fs.writeFileSync(yarnRcPath, yaml.dump(parsedYarnRc)); | ||
} | ||
}, | ||
{ | ||
// "yarn adds" given template which can be either a real package or a path of a local package. | ||
// Yarn adds given template which can be either a real package or a path of a local package. | ||
title: `Install template package`, | ||
@@ -167,2 +206,3 @@ task: async context => { | ||
"file:" + path.relative(projectName, template.replace("file:", "")); | ||
templateName = `@webiny/cwp-template-aws@` + templateName; | ||
add = templateName; | ||
@@ -207,6 +247,5 @@ } else { | ||
let templateName = context.templateName; | ||
console.log(`Starting ${green(templateName)} template ...`); | ||
if (templateName.startsWith("file:")) { | ||
templateName = templateName.replace("file:", ""); | ||
if (templateName.includes("file:")) { | ||
const [, templatePath] = templateName.match(/.*?file\:(.*)/); | ||
templateName = templatePath; | ||
} | ||
@@ -220,7 +259,3 @@ | ||
await new Promise(resolve => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 500); | ||
}); | ||
await sleep(); | ||
@@ -237,3 +272,5 @@ let parsedTemplateOptions = {}; | ||
console.log(); | ||
await require(templatePath)({ | ||
const setupTemplate = require(templatePath); | ||
await setupTemplate({ | ||
log, | ||
@@ -244,12 +281,18 @@ isGitAvailable, | ||
interactive, | ||
debug, | ||
templateOptions: parsedTemplateOptions | ||
}); | ||
await sendEvent({ event: "create-webiny-project-end" }); | ||
await sendEvent({ event: getTelemetryEventName("end") }); | ||
} catch (err) { | ||
let event = getTelemetryEventName("error"); | ||
if (err instanceof GracefulError) { | ||
event = getTelemetryEventName("error-graceful"); | ||
} | ||
await sendEvent({ | ||
event: "create-webiny-project-error", | ||
event, | ||
properties: { | ||
errorMessage: err.message, | ||
errorStack: err.stack | ||
errorMessage: err.cause?.message || err.message, | ||
errorStack: err.cause?.stack || err.stack | ||
} | ||
@@ -261,2 +304,14 @@ }); | ||
let npm = NOT_APPLICABLE; | ||
try { | ||
const subprocess = await execa("npm", ["--version"], { cwd: projectRoot }); | ||
npm = subprocess.stdout; | ||
} catch {} | ||
let npx = NOT_APPLICABLE; | ||
try { | ||
const subprocess = await execa("npx", ["--version"], { cwd: projectRoot }); | ||
npx = subprocess.stdout; | ||
} catch {} | ||
let yarn = NOT_APPLICABLE; | ||
@@ -293,12 +348,14 @@ try { | ||
"", | ||
`${green("ERROR OUTPUT: ")}`, | ||
"----------------------------------------", | ||
`${bold("Error Logs")}`, | ||
HL, | ||
err.message, | ||
"", | ||
`${green("SYSTEM INFORMATION: ")}`, | ||
"----------------------------------------", | ||
`${bold("System Information")}`, | ||
HL, | ||
`create-webiny-project: ${cwp}`, | ||
`Operating System: ${os}`, | ||
`Node: ${node}`, | ||
`Yarn: ${yarn}`, | ||
`create-webiny-project: ${cwp}`, | ||
`Npm: ${npm}`, | ||
`Npx: ${npx}`, | ||
`Template: ${cwpTemplate}`, | ||
@@ -313,9 +370,9 @@ `Template Options: ${templateOptionsJson}`, | ||
console.log(`Writing log to ${green(path.resolve(log))}...`); | ||
console.log(`Writing logs to ${green(path.resolve(log))}...`); | ||
fs.writeFileSync(path.resolve(log), err.toString()); | ||
console.log(); | ||
if (cleanup) { | ||
console.log("Cleaning up generated files and folders..."); | ||
console.log("Deleting created files and folders..."); | ||
rimraf.sync(projectRoot); | ||
console.log("Done."); | ||
} else { | ||
@@ -325,5 +382,61 @@ console.log("Project cleanup skipped."); | ||
await sendEvent({ event: "create-webiny-project-end" }); | ||
process.exit(1); | ||
} | ||
console.log(); | ||
console.log( | ||
`🎉 Your new Webiny project ${green( | ||
projectName | ||
)} has been created and is ready to be deployed for the first time!` | ||
); | ||
console.log(); | ||
const ok = await yesno({ | ||
question: bold(`${green("?")} Would you like to deploy your project now (Y/n)?`), | ||
defaultValue: true | ||
}); | ||
console.log(); | ||
if (ok) { | ||
console.log("🚀 Deploying your new Webiny project..."); | ||
console.log(); | ||
try { | ||
const command = ["webiny", "deploy"]; | ||
if (debug) { | ||
command.push("--debug"); | ||
} | ||
await execa("yarn", command, { | ||
cwd: projectRoot, | ||
stdio: "inherit" | ||
}); | ||
} catch { | ||
// Don't do anything. This is because the `webiny deploy` command has its own | ||
// error handling and will print the error message. As far as this setup script | ||
// is concerned, it succeeded, and it doesn't need to do anything else. | ||
} | ||
return; | ||
} | ||
console.log( | ||
[ | ||
`Finish the setup by running the following command: ${green( | ||
`cd ${projectName} && yarn webiny deploy` | ||
)}`, | ||
"", | ||
`To see all of the available CLI commands, run ${green( | ||
"yarn webiny --help" | ||
)} in your ${green(projectName)} directory.`, | ||
"", | ||
"Want to dive deeper into Webiny? Check out https://webiny.com/docs/!", | ||
"Like the project? Star us on https://github.com/webiny/webiny-js!", | ||
"", | ||
"Need help? Join our Slack community! https://www.webiny.com/slack", | ||
"", | ||
"🚀 Happy coding!" | ||
].join("\n") | ||
); | ||
}; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
2800647
9859.63%16
45.45%11795
2342.03%159
21.37%19
11.76%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated
Updated