-
-
Notifications
You must be signed in to change notification settings - Fork 197
Init command #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Init command #605
Conversation
✅ |
---|--- | ||
General | `$ tns init [--path <Directory>] [--force]` | ||
|
||
Initializes a project for development. This will ask you a bunch of questions, and then write a package.json for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ask you a bunch of questions" does not look very professional to me. Perhaps "it will ask you interactively to configure the project". Ping @ikoevska
✅ |
let projectDataBackup = _.extend({}, projectData); | ||
|
||
try { | ||
this.$fs.writeJson(this.projectFilePath, projectData).wait(); // We need to create package.json file here in order to prevent "No project found at or above and neither was a --path specified." when resolving platformsData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be inside
if(!projectData[this.$staticConfig.CLIENT_NAME_KEY_IN_PROJECT_FILE])
as this is the only case when we do not have package.json or it is missing required information. In all cases when we do not "enter" the mentioned if, we should not write the package.json again as it is already existing and correct.
✅ |
|
||
let data = this.$npm.view(packageName, "versions").wait(); | ||
let versions = data[latestVersion].versions; | ||
let sortedVersions = versions.sort(helpers.versionCompare).reverse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to have minSupportedVersion, because currently we show all versions and the user may set something that will not be buildable after that, for example for tns-android I set 0.1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how can I select "minSupportedVersion"...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion is to define it in the platformData and pass it as parameter to this method. This way we'll set it to the minimum verified version that we are able to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" This way we'll set it to the minimum verified version that we are able to work with." - every next version has some improvements and fixes. I'm not able to choice if for example 1.0.0 is suitable to be "minSupportedVersion".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if I set 0.1.0 and execute tns install
, the result is:
~/Work/nativescript-cli/scratch/app16 $ cat package.json
{
"nativescript": {
"id": "org.nativescript.app16",
"tns-android": {
"version": "0.1.0"
}
}
}~/Work/nativescript-cli/scratch/app16 $ tns install
Project app16 was successfully created
Adding platforms...
Copying template files...
ENOENT, scandir '/home/rvladimirov/.npm/tns-android/0.1.0/package/framework/res'
Of course all versions have improvements, but when you use init, I think we must show you only recent versions, why would you init project with version 0.4.2 for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that the prompt is unneeded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea is to guide the people to use latest versions.
|
It is strange to have node_modules and doesn't have |
✅ |
Command | Description | ||
----------|---------- | ||
[init](init.html) | Initializes a project for development. It will ask you interactively to configure the project and will write a package.json for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the second sentence from the description. Also, consider adding this command to the Related Commands of install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install command is in project/configuration
section and the init command is in project/creation
. Do I need to relate them?
✅ |
---|--- | ||
General | `$ tns init [--path <Directory>] [--force]` | ||
|
||
Initializes a project for development. It will ask you interactively to configure the project and will write a package.json for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initializes a project for development. The command prompts you to provide your project configuration interactively and uses the information to create a new package.json
file or update the existing one.
✅ |
} | ||
|
||
private set projectFilePath(newProjectFilePath: string) { | ||
this._projectFilePath = newProjectFilePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we verify that newProjectFilePath is correct? I.e. is non-empty string and possibly that exists on the fs?
By the way, where is the setter used?
|
||
import constants = require("./../constants"); | ||
import helpers = require("./../common/helpers"); | ||
import Future = require("fibers/future"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future is not used anywhere, you can remove it
✅ |
---|--- | ||
General | `$ tns init [--path <Directory>] [--force]` | ||
|
||
Initializes a project for development. The command prompts you to provide your project configuration interactively and uses the information to create a new package.json file or update the existing one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting for package.json is missing.
👍 |
✅ |
✅ |
✅ |
👍 |
Should be merged after this telerik/mobile-cli-lib#371
#600