loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Add an option to scaffold 3.x projects

Open bajtos opened this issue 10 years ago • 5 comments

  • Add a new option to loopback-workspace's createFromTemplate to 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.

bajtos avatar May 16 '16 13:05 bajtos

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 avatar May 17 '16 01:05 jannyHou

@jannyHou your proposal sounds reasonable 👍

bajtos avatar May 27 '16 13:05 bajtos

@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:

  1. Upgrade to the latest strongloop in staging registry. Make sure generator-loopback and loobpack-workspace included the latest commit.
  2. Run slc loopback to create an app
  3. Verify that there is a prompt ask for loopback version and the default option is 2.x
  4. Verify package.json contains loopback 2.x if choose option 2.x
  5. Verify package.json contains loobpack 3.x if choose option 3.x

Please verify it when you have time, thank you :)

jannyHou avatar Jun 10 '16 18:06 jannyHou

Verified

  1. Change registry to: npm config set registry http://ci.strongloop.com:4873/
  2. Install the latest commit: npm install -g strongloop
  3. Create a loopback app: slc loopback --name APP_NAME
  4. The loopback version prompt should look like: 100616 node - nvm-versions-node-v4 4 3-bin-slc loopback --name loopback-issues-2344 80x24 terminal today at 3 17 08 pm
  5. Select version 2.x and then package.json should look like: package json sublime text today at 3 28 11 pm
  6. Repeat steps 3 and 4 and select version 3.x and package.json should look like: package json sublime text today at 3 30 31 pm

ssh24 avatar Jun 10 '16 19:06 ssh24

Published in [email protected] and [email protected]

bajtos avatar Jun 21 '16 08:06 bajtos