Add an option to scaffold 3.x projects
- Add a new option to loopback-workspace's
createFromTemplateto specify which LoopBack version to use (2.x or 3.x) - Add a new prompt to generator-loopback asking the user which LoopBack version to use.
A proposal of tasks in this story:
- [ ] generator-loopback
Add a new prompt called lbVersion and pass it into createFromTemplate
{
name: 'lbVersion',
message: 'Which version of loopback do you want to install?',
default: 3.x,
choices: ['2.x', '3.x'],
}
- [ ] loopback-workspace
[1] Add new options in createFromTemplate called loopbackVersion and pass it into Workspace.addComponent.
[2] In Workspace.addComponent detect the loopbackVersion and select template.package.dependencies accordingly.
[3] In template/data.js define dependency version for each version:
var dependency_3_x = {
'loopback': '3.0.0.alpha.1^'
// ......
}
var dependency_2_x = {
'loopback': '2.22.0^'
// ......
}
template.package = {
'dependencies': dependency_version_x
// default one is dependency_2_x and could be set in `Workspace.addComponent`.
}
@bajtos Any thought?
@jannyHou your proposal sounds reasonable 👍
@ssh24 In this feature, I add a prompt in generator-loopback to choose the version of installed loopback. The choice will be passed to loopback-workspace to create the app with specific loopback version.
Verify steps:
- Upgrade to the latest strongloop in staging registry. Make sure
generator-loopbackandloobpack-workspaceincluded the latest commit. - Run slc loopback to create an app
- Verify that there is a prompt ask for loopback version and the default option is 2.x
- Verify
package.jsoncontains loopback 2.x if choose option 2.x - Verify
package.jsoncontains loobpack 3.x if choose option 3.x
Please verify it when you have time, thank you :)
Verified
- Change registry to:
npm config set registry http://ci.strongloop.com:4873/ - Install the latest commit:
npm install -g strongloop - Create a loopback app:
slc loopback --name APP_NAME - The loopback version prompt should look like:

- Select version
2.xand thenpackage.jsonshould look like:
- Repeat steps 3 and 4 and select version
3.xandpackage.jsonshould look like:
Published in [email protected] and [email protected]