Skip to content

Merge release 1.1.2 into master #613

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

Merged
merged 33 commits into from
Jul 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
28ddc2f
Implement install command https://github.com/NativeScript/nativescrip…
Jun 23, 2015
78df478
Merge pull request #589 from NativeScript/fatme/install-command
Jun 25, 2015
3536e66
Handle platform specific files in plugin
Jun 22, 2015
4b8342a
Merge pull request #588 from NativeScript/fatme/handle-platform-speci…
Jun 25, 2015
ea04549
Enable image resources from App_Resources in iOS
Jun 23, 2015
9395362
Merge pull request #590 from NativeScript/fatme/images-ios
Jun 26, 2015
d8affae
Fix broken android prepare
Jun 26, 2015
0768fa4
Merge pull request #597 from NativeScript/fatme/fix-broken-android-pr…
Jun 26, 2015
f2b9f22
Fix broken rebase
Jun 26, 2015
83c3d5c
Merge pull request #598 from NativeScript/fatme/fix-broken-rebase
Jun 26, 2015
32d168a
Fix symlinks that are added to output package and points to not exist…
Jun 26, 2015
7513ad6
Unit tests
Jun 26, 2015
572acff
Merge pull request #593 from NativeScript/fatme/fix-symlinks
Jun 29, 2015
30ed33f
Do not init new project when install command is executed
Fatme Jun 29, 2015
fcc8fc6
Doesn't handle the dependencies of devDependencies
Fatme Jun 29, 2015
62b7d1a
Merge pull request #602 from NativeScript/fatme/devDependencies
Jun 30, 2015
f95a53a
Merge pull request #603 from NativeScript/fatme/install
Jun 30, 2015
501b6d3
Bump version to 1.1.2
Fatme Jul 1, 2015
c14e84d
Merge pull request #609 from NativeScript/fatme/bump-version-1.1.2
Jul 1, 2015
9239231
Help for install command
Jun 26, 2015
938a9c5
Merge pull request #596 from NativeScript/fatme/help-for-install-command
Jul 1, 2015
c00be10
Init command
Fatme Jun 29, 2015
aac6be6
Validate platform in canExecute function
Fatme Jul 1, 2015
ff330c9
Merge pull request #605 from NativeScript/fatme/init
Jul 1, 2015
702b5ad
Merge pull request #608 from NativeScript/fatme/can-execute
Jul 1, 2015
e059ab5
Ensure all npm deps are installed when no platform is specified in pa…
Fatme Jul 1, 2015
3d6fc43
Merge pull request #610 from NativeScript/fatme/ensure-all-dependenci…
Jul 1, 2015
9339b84
Fix help for install command
rosen-vladimirov Jul 2, 2015
d4b372a
Merge pull request #611 from NativeScript/vladimirov/fix-install-help
rosen-vladimirov Jul 2, 2015
b86ba53
Changelog for 1.1.2
ikoevska Jul 2, 2015
5fd2615
Merge pull request #612 from NativeScript/ikoevska/changelog-112
rosen-vladimirov Jul 2, 2015
c34b472
Merge branch 'release' into fatme/merge-release-1.1.2-into-master
Fatme Jul 2, 2015
0b638e7
Update common lib
Fatme Jul 2, 2015
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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
NativeScript CLI Changelog
================

1.1.2 (2015, July 2)
==

### New

* [Implemented #600](https://github.com/NativeScript/nativescript-cli/issues/600): Added the `$ tns init` command. You can use it to initialize a NativeScript project for development. The command recreates or updates the `package.json` file of the project. You can then run `$ tns install` to install the platforms and dependencies described in the `package.json` file.
* [Implemented #587](https://github.com/NativeScript/nativescript-cli/issues/587): Added the `$ tns install` command. You can use it to quickly install all platforms and dependencies described in a `package.json` file.

### Fixed

* [Fixed #606](https://github.com/NativeScript/nativescript-cli/issues/606): The NativeScript CLI lets you run `<Platform>`-based commands on operating systems which do not support development for this platform. For example, you can run `$ tns build ios` on a Windows system.
* [Fixed #601](https://github.com/NativeScript/nativescript-cli/issues/601): The NativeScript CLI does not treat the dependencies of devDependencies as devDependencies.
* [Fixed #599](https://github.com/NativeScript/nativescript-cli/issues/599): The NativeScript CLI always creates a `tmp` directory in the current directory when you run any command and modifies the `package.json` file for the project.
* [Fixed #584](https://github.com/NativeScript/nativescript-cli/issues/584): The NativeScript CLI references the files in the project with their absolute paths instead of their relative paths. This might cause the project to stop working when transfered to another location and might cause issues with your application packages.
* [Fixed #578](https://github.com/NativeScript/nativescript-cli/issues/578): Platform-specific files in NativeScript plugins are not processed correctly. The NativeScript CLI copies them to the correct platform-specific directory but does not rename them correctly.
* [Fixed #520](https://github.com/NativeScript/nativescript-cli/issues/520): iOS resources from the `App_Resources` folder are not included in the native Xcode project and are not accessible in the application package.

1.1.1 (2015, June 17)
==

Expand Down
Empty file modified bin/nativescript.js
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion docs/man_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Command | Description
[emulate `<Platform>`](project/testing/emulate.html) | Deploys the project in the native emulator for the selected target platform.
[run `<Platform>`](project/testing/run.html) | Runs your project on a connected device or in the native emulator, if configured.
[debug `<Platform>`](project/testing/debug.html) | Debugs your project on a connected device.
[plugin](plugin.html) | Lists all installed plugins for your project or lets you manage the plugins for your project.
[install](project/configuration/install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
[plugin](lib-management/plugin.html) | Lets you manage the plugins for your project.

## Device Commands
Command | Description
Expand Down
27 changes: 27 additions & 0 deletions docs/man_pages/project/configuration/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
install
==========

Usage | Synopsis
---|---
General | `$ tns install [--path]`

Installs all platforms and dependencies described in the `package.json` file in the current directory.

<% if(isHtml) { %>
The `package.json` file must be a valid `package.json` describing the configuration of a NativeScript project. If missing or corrupted, you can recreate the file by running `$ tns init` in the directory of a NativeScript project.
<% } %>

### Options
* `--path` - Specifies the directory which contains the `package.json` file, if different from the current directory.

<% if(isHtml) { %>
### Related Commands

Command | Description
----------|----------
[platform add](platform-add.html) | Configures the current project to target the selected platform.
[platform remove](platform-remove.html) | Removes the selected platform from the platforms that the project currently targets.
[platform update](platform-update.html) | Updates the NativeScript runtime for the specified platform.
[platform](platform.html) | Lists all platforms that the project currently targets.
[prepare](prepare.html) | Copies common and relevant platform-specific content from the app directory to the subdirectory for the selected target platform in the platforms directory.
<% } %>
1 change: 1 addition & 0 deletions docs/man_pages/project/configuration/platform-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ To list only experimental versions for iOS, run `$ npm view tns-ios dist-tags`

Command | Description
----------|----------
[install](install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
[platform remove](platform-remove.html) | Removes the selected platform from the platforms that the project currently targets.
[platform update](platform-update.html) | Updates the NativeScript runtime for the specified platform.
[platform](platform.html) | Lists all platforms that the project currently targets.
Expand Down
1 change: 1 addition & 0 deletions docs/man_pages/project/configuration/platform-remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Removes the selected platform from the platforms that the project currently targ

Command | Description
----------|----------
[install](install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
[platform add](platform-add.html) | Configures the current project to target the selected platform.
[platform update](platform-update.html) | Updates the NativeScript runtime for the specified platform.
[platform](platform.html) | Lists all platforms that the project currently targets.
Expand Down
1 change: 1 addition & 0 deletions docs/man_pages/project/configuration/platform-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ To list only experimental versions for ios, run `$ npm view tns-ios dist-tags`

Command | Description
----------|----------
[install](install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
[platform add](platform-add.html) | Configures the current project to target the selected platform.
[platform remove](platform-remove.html) | Removes the selected platform from the platforms that the project currently targets.
[platform](platform.html) | Lists all platforms that the project currently targets.
Expand Down
1 change: 1 addition & 0 deletions docs/man_pages/project/configuration/platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Lists all platforms that the project currently targets. You can build and deploy

Command | Description
----------|----------
[install](install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
[platform add](platform-add.html) | Configures the current project to target the selected platform.
[platform remove](platform-remove.html) | Removes the selected platform from the platforms that the project currently targets.
[platform update](platform-update.html) | Updates the NativeScript runtime for the specified platform.
Expand Down
1 change: 1 addition & 0 deletions docs/man_pages/project/configuration/prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ in the `platforms` directory. This lets you build the project with the SDK for t

Command | Description
----------|----------
[install](install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
[platform add](platform-add.html) | Configures the current project to target the selected platform.
[platform remove](platform-remove.html) | Removes the selected platform from the platforms that the project currently targets.
[platform update](platform-update.html) | Updates the NativeScript runtime for the specified platform.
Expand Down
11 changes: 10 additions & 1 deletion docs/man_pages/project/creation/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@ Creates a new project for native development with NativeScript from the default
* `<App Name>` is the name of project. The specified name must meet the requirements of all platforms that you want to target. <% if(isConsole) { %>For more information about the `<App Name>` requirements, run `$ tns help create`<% } %><% if(isHtml) { %>For projects that target Android, you can use uppercase or lowercase letters, numbers, and underscores. The name must start with a letter.
For projects that target iOS, you can use uppercase or lowercase letters, numbers, and hyphens.<% } %>
* `<App ID>` is the application identifier for your project. It must be a domain name in reverse and must meet the requirements of all platforms that you want to target. If not specified, the application identifier is set to `org.nativescript.<App name>` <% if(isConsole) { %>For more information about the `<App ID>` requirements, run `$ tns help create`<% } %><% if(isHtml) { %>For projects that target Android, you can use uppercase or lowercase letters, numbers, and underscores in the strings of the reversed domain name, separated by a dot. Strings must be separated by a dot and must start with a letter. For example: `com.nativescript.My_Andro1d_App`
For projects that target iOS, you can use uppercase or lowercase letters, numbers, and hyphens in the strings of the reversed domain name. Strings must be separated by a dot. For example: `com.nativescript.My-i0s-App`.<% } %>
For projects that target iOS, you can use uppercase or lowercase letters, numbers, and hyphens in the strings of the reversed domain name. Strings must be separated by a dot. For example: `com.nativescript.My-i0s-App`.<% } %>

<% if(isHtml) { %>
### Related Commands

Command | Description
----------|----------
[init](init.html) | 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.
[install](install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
<% } %>
21 changes: 21 additions & 0 deletions docs/man_pages/project/creation/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
init
==========

Usage | Synopsis
---|---
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.

### Options
* `--path` - Specifies the directory where you want to initialize the project, if different from the current directory. The directory must be empty.
* `--force` - If set, applies the default project configuration and does not show the interactive prompt. The default project configuration targets the latest official runtimes and sets `org.nativescript.<folder_name>` for application identifier.

<% if(isHtml) { %>
### Related Commands

Command | Description
----------|----------
[create](create.html) | Creates a new project for native development with NativeScript from the default template or from an existing NativeScript project.
[install](install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
<% } %>
6 changes: 6 additions & 0 deletions lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ $injector.requireCommand("plugin|add", "./commands/plugin/add-plugin");
$injector.requireCommand("plugin|remove", "./commands/plugin/remove-plugin");

$injector.require("doctorService", "./services/doctor-service");
$injector.requireCommand("install", "./commands/install");

$injector.require("initService", "./services/init-service");
$injector.requireCommand("init", "./commands/init");

$injector.require("projectFilesManager", "./services/project-files-manager");
16 changes: 16 additions & 0 deletions lib/commands/init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
///<reference path="../.d.ts"/>
"use strict";

import Future = require("fibers/future");

export class InitCommand implements ICommand {
constructor(private $initService: IInitService) { }

public allowedParameters: ICommandParameter[] = [];
public enableHooks = false;

public execute(args: string[]): IFuture<void> {
return this.$initService.initialize();
}
}
$injector.registerCommand("init", InitCommand);
44 changes: 44 additions & 0 deletions lib/commands/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
///<reference path="../.d.ts"/>
"use strict";

export class InstallCommand implements ICommand {
private _projectData: any;

constructor(private $platformsData: IPlatformsData,
private $platformService: IPlatformService,
private $projectData: IProjectData,
private $projectDataService: IProjectDataService,
private $pluginsService: IPluginsService,
private $logger: ILogger) { }

public enableHooks = false;

public allowedParameters: ICommandParameter[] = [];

public execute(args: string[]): IFuture<void> {
return (() => {
let error: string = "";

this.$pluginsService.ensureAllDependenciesAreInstalled().wait();

this.$projectDataService.initialize(this.$projectData.projectDir);
_.each(this.$platformsData.platformsNames, platform => {
let platformData = this.$platformsData.getPlatformData(platform);
let frameworkPackageData = this.$projectDataService.getValue(platformData.frameworkPackageName).wait();
if(frameworkPackageData && frameworkPackageData.version) {
try {
this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`]).wait();
} catch(err) {
error += err;
}
}
});

if(error) {
this.$logger.error(error);
}

}).future<void>()();
}
}
$injector.registerCommand("install", InstallCommand);
4 changes: 1 addition & 3 deletions lib/commands/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ export class PrepareCommand implements ICommand {
private $platformCommandParameter: ICommandParameter) { }

execute(args: string[]): IFuture<void> {
return (() => {
this.$platformService.preparePlatform(args[0]).wait();
}).future<void>()();
return this.$platformService.preparePlatform(args[0]);
}

allowedParameters = [this.$platformCommandParameter];
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class RunAndroidCommand extends RunCommandBase implements ICommand {
private $platformsData: IPlatformsData) {
super($platformService);
}

public allowedParameters: ICommandParameter[] = [];

public execute(args: string[]): IFuture<void> {
Expand Down
4 changes: 4 additions & 0 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@ export class StaticConfig extends staticConfigBaseLibPath.StaticConfigBase imple
public get HTML_CLI_HELPERS_DIR(): string {
return path.join(__dirname, "../docs/helpers");
}

public get pathToPackageJson(): string {
return path.join(__dirname, "..", "package.json");
}
}
$injector.register("staticConfig", StaticConfig);
1 change: 1 addition & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export var NATIVESCRIPT_KEY_NAME = "nativescript";
export var NODE_MODULES_FOLDER_NAME = "node_modules";
export var PACKAGE_JSON_FILE_NAME = "package.json";
export var NODE_MODULE_CACHE_PATH_KEY_NAME = "node-modules-cache-path";
export var DEFAULT_APP_IDENTIFIER_PREFIX = "org.nativescript";

export class ReleaseType {
static MAJOR = "major";
Expand Down
10 changes: 10 additions & 0 deletions lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ interface IOpener {

interface IOptions extends ICommonOptions {
frameworkPath: string;
frameworkName: string;
frameworkVersion: string;
copyFrom: string;
linkTo: string;
release: boolean;
Expand All @@ -64,3 +66,11 @@ interface IOptions extends ICommonOptions {
keyStoreAliasPassword: string;
sdk: string;
}

interface IProjectFilesManager {
processPlatformSpecificFiles(directoryPath: string, platform: string, excludedDirs?: string[]): IFuture<void>;
}

interface IInitService {
initialize(): IFuture<void>;
}
2 changes: 2 additions & 0 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ interface IPlatformProjectService {
interpolateData(projectRoot: string): IFuture<void>;
afterCreateProject(projectRoot: string): IFuture<void>;
buildProject(projectRoot: string): IFuture<void>;
prepareProject(): IFuture<void>;
prepareAppResources(appResourcesDirectoryPath: string): IFuture<void>;
isPlatformPrepared(projectRoot: string): IFuture<boolean>;
addLibrary(platformData: IPlatformData, libraryPath: string): IFuture<void>;
canUpdatePlatform(currentVersion: string, newVersion: string): IFuture<boolean>;
Expand Down
2 changes: 2 additions & 0 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class Options extends commonOptionsLibPath.OptionsBase {
$hostInfo: IHostInfo) {
super({
frameworkPath: { type: OptionType.String },
frameworkName: { type: OptionType.String },
frameworkVersion: { type: OptionType.String },
copyFrom: { type: OptionType.String },
linkTo: { type: OptionType.String },
release: { type: OptionType.Boolean },
Expand Down
16 changes: 15 additions & 1 deletion lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AndroidProjectService implements IPlatformProjectService {
frameworkFilesExtensions: [".jar", ".dat", ".so"],
configurationFileName: "AndroidManifest.xml",
configurationFilePath: path.join(this.$projectData.platformsDir, "android", "AndroidManifest.xml"),
mergeXmlConfig: [{ "nodename": "manifest", "attrname": "*" }]
mergeXmlConfig: [{ "nodename": "manifest", "attrname": "*" }, { "application": "manifest", "attrname": "*" }]
};
}

Expand Down Expand Up @@ -181,6 +181,16 @@ class AndroidProjectService implements IPlatformProjectService {
public isPlatformPrepared(projectRoot: string): IFuture<boolean> {
return this.$fs.exists(path.join(projectRoot, "assets", constants.APP_FOLDER_NAME));
}

public prepareAppResources(appResourcesDirectoryPath: string): IFuture<void> {
return (() => {
let resourcesDirPath = path.join(appResourcesDirectoryPath, this.platformData.normalizedPlatformName);
let resourcesDirs = this.$fs.readDirectory(resourcesDirPath).wait();
_.each(resourcesDirs, resourceDir => {
this.$fs.deleteDirectory(path.join(this.platformData.appResourcesDestinationDirectoryPath, resourceDir)).wait();
});
}).future<void>()();
}

private parseProjectProperties(projDir: string, destDir: string): void {
let projProp = path.join(projDir, "project.properties");
Expand Down Expand Up @@ -273,6 +283,10 @@ class AndroidProjectService implements IPlatformProjectService {
public getFrameworkFilesExtensions(): string[] {
return [".jar", ".dat"];
}

public prepareProject(): IFuture<void> {
return (() => { }).future<void>()();
}

private copy(projectRoot: string, frameworkDir: string, files: string, cpArg: string): IFuture<void> {
return (() => {
Expand Down
Loading