Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fa72b4c
fix: :construction: added initializeGit, installDependencies and inte…
Dec 6, 2022
3116ad1
removed "--default" flag
BoyuanShao Dec 6, 2022
a5c54db
Merge branch 'main' of https://github.com/hannahbrooks/booster into f…
Dec 6, 2022
e255329
WIP: fixed tests and removed default flag
BoyuanShao Dec 6, 2022
cd1b2b1
Merge branch 'fix/1196_remove-params-from-new-project' of https://git…
BoyuanShao Dec 6, 2022
3636269
test: :white_check_mark: update tests for new flags
Dec 6, 2022
d498eca
test: :construction: update tests for initializeGit, interactive an i…
Dec 6, 2022
cd2ba96
fix: :construction: changed flags back to skipInstall and skipGit to …
Dec 6, 2022
f9c8c54
fix: :white_check_mark: updated tests for new requirements
Dec 6, 2022
6078e18
refactor: :recycle: updated error text
Dec 6, 2022
6029573
refactor: :art: removed leftover code from previous commit and change…
Dec 9, 2022
61fb982
docs: :memo: updated documentation for new project changes
Dec 11, 2022
9c42f74
docs: :memo: removed low level detail from getting-started section wi…
Dec 12, 2022
7cf3e64
refactor: :speech_balloon: updated interactive flag description
Dec 12, 2022
c8d36f4
refactor: :recycle: removed promise resolves from async function
Dec 12, 2022
a59bfed
docs: :memo: simplified tip for provider options in getting started
Dec 12, 2022
4abc6cc
test: :memo: added description field for minor change
Dec 14, 2022
c049734
Merge pull request #1263 from hannahbrooks/fix/1196_remove-params-fro…
Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@boostercloud/framework-core",
"comment": "updated default behaviour for new:project",
"type": "minor"
}
],
"packageName": "@boostercloud/framework-core"
}
13 changes: 5 additions & 8 deletions docs/chapters/02_getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ running for a blog application in just a few minutes. The steps to follow will b

### 1. Create the project

First of all, we will use the Booster generators to create a project. Run this command `boost new:project boosted-blog` and follow
First of all, we will use the Booster generators to create a project. Run this command `boost new:project boosted-blog --interactive` and follow
the instructions. After some prompted questions, the CLI will ask you to select one of the available providers to set up as the main provider that will be used.

```shell
Expand Down Expand Up @@ -373,14 +373,11 @@ After choosing your provider, you will see your project generated!:
ℹ Project generated!
```

> [!TIP] If you prefer to create the project with default parameters, you can run the command as `boost new:project booster-blog --default`. The default
> parameters are as follows:
> [!TIP] If you prefer to create the project with default parameters, you can run the command as `boost new:project booster-blog --providerPackageName <package-name>`. The package name of the provider is the only required parameter and can be any `npm` package that implements Booster's provider interfaces. The framework provides the following:
>
> - Project name: The one provided when running the command, in this case "booster-blog"
> - Provider: AWS
> - Description, author, homepage and repository: ""
> - License: MIT
> - Version: 0.1.0
> - `@boostercloud/framework-provider-aws`: Runs your app in AWS.
> - `@boostercloud/framework-provider-azure`: Runs your app in Azure.
> - `@boostercloud/framework-provider-kubernetes` (Experimental): Proof of concept that shows how to run your app on a Kubernetes cluster.

In case you want to specify each parameter without following the instructions, you can use the following flags with this structure `<flag>=<parameter>`.

Expand Down
84 changes: 45 additions & 39 deletions packages/cli/src/commands/new/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export default class Project extends Command {
description: 'skip git initialization',
default: false,
}),
interactive: flags.boolean({
description: 'run an interactive wizard to configure your project',
default: false,
}),
}

public static args = [{ name: 'projectName' }]
Expand All @@ -71,6 +75,8 @@ export default class Project extends Command {
assertNameIsCorrect(projectName)
await checkProjectAlreadyExists(projectName)
const parsedFlags = { projectName, ...flags }
if (!flags.interactive && !flags.providerPackageName)
throw 'You must set a provider runtime package using the --provider flag or use the interactive mode with the --interactive flag.'
await run(parsedFlags as Partial<ProjectInitializerConfig>, this.config.version)
} catch (error) {
console.error(error)
Expand Down Expand Up @@ -126,54 +132,54 @@ export const parseConfig = async (
flags: Partial<ProjectInitializerConfig>,
boosterVersion: string
): Promise<ProjectInitializerConfig> => {
if (flags.default) {
return Promise.resolve({
if (flags.interactive) {
const description = await prompter.defaultOrPrompt(
flags.description,
'What\'s your project description? (default: "")'
)
const versionPrompt = await prompter.defaultOrPrompt(flags.version, "What's the first version? (default: 0.1.0)")
const version = versionPrompt || '0.1.0'
const author = await prompter.defaultOrPrompt(flags.author, 'Who\'s the author? (default: "")')
const homepage = await prompter.defaultOrPrompt(flags.homepage, 'What\'s the website? (default: "")')
const licensePrompt = await prompter.defaultOrPrompt(
flags.license,
'What license will you be publishing this under? (default: MIT)'
)
const license = licensePrompt || 'MIT'
const repository = await prompter.defaultOrPrompt(
flags.repository,
'What\'s the URL of the repository? (default: "")'
)
const providerPackageName = await getProviderPackageName(prompter, flags.providerPackageName)

return {
projectName: flags.projectName as string,
providerPackageName,
description,
version,
author,
homepage,
license,
repository,
boosterVersion,
skipInstall: flags.skipInstall || false,
skipGit: flags.skipGit || false,
interactive: true,
}
} else {
return {
projectName: flags.projectName as string,
providerPackageName: '@boostercloud/framework-provider-aws',
providerPackageName: flags.providerPackageName as string,
description: '',
version: '0.1.0',
author: '',
homepage: '',
license: 'MIT',
repository: '',
boosterVersion,
default: flags.default,
skipInstall: flags.skipInstall || false,
skipGit: flags.skipGit || false,
})
interactive: false,
}
}

const description = await prompter.defaultOrPrompt(
flags.description,
'What\'s your project description? (default: "")'
)
const versionPrompt = await prompter.defaultOrPrompt(flags.version, "What's the first version? (default: 0.1.0)")
const version = versionPrompt || '0.1.0'
const author = await prompter.defaultOrPrompt(flags.author, 'Who\'s the author? (default: "")')
const homepage = await prompter.defaultOrPrompt(flags.homepage, 'What\'s the website? (default: "")')
const licensePrompt = await prompter.defaultOrPrompt(
flags.license,
'What license will you be publishing this under? (default: MIT)'
)
const license = licensePrompt || 'MIT'
const repository = await prompter.defaultOrPrompt(
flags.repository,
'What\'s the URL of the repository? (default: "")'
)
const providerPackageName = await getProviderPackageName(prompter, flags.providerPackageName)

return Promise.resolve({
projectName: flags.projectName as string,
providerPackageName,
description,
version,
author,
homepage,
license,
repository,
boosterVersion,
default: false,
skipInstall: flags.skipInstall || false,
skipGit: flags.skipGit || false,
})
}
2 changes: 1 addition & 1 deletion packages/cli/src/services/project-initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ export interface ProjectInitializerConfig {
repository: string
providerPackageName: string
boosterVersion: string
default: boolean
skipInstall: boolean
skipGit: boolean
interactive: boolean
}

function renderToFile(templateData: ProjectInitializerConfig): (_: [Array<string>, string]) => Promise<void> {
Expand Down
Loading