From 009cb43c76c33491b4aefa69866b5dbe843dc80c Mon Sep 17 00:00:00 2001 From: Fatme Date: Mon, 30 Jun 2014 15:52:47 +0300 Subject: [PATCH 1/6] package.json --- .gitattributes | 4 +++ .gitignore | 50 ++++++++++++++++++++------------- .gitmodules | 3 ++ .idea/.name | 1 + .idea/encodings.xml | 5 ++++ .idea/misc.xml | 5 ++++ .idea/modules.xml | 9 ++++++ .idea/nativescript-cli.iml | 9 ++++++ .idea/scopes/scope_settings.xml | 5 ++++ .idea/vcs.xml | 7 +++++ package.json | 19 +++++++++++++ 11 files changed, 98 insertions(+), 19 deletions(-) create mode 100644 .gitattributes create mode 100644 .gitmodules create mode 100644 .idea/.name create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/nativescript-cli.iml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml create mode 100644 package.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..f7e554ce10 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Ensure that the shebang of our start script can be correctly interpreted + +bin/appbuilder.js eol=lf + diff --git a/.gitignore b/.gitignore index da23d0d4ba..69dce8499d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,37 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed +*.js +!/*.js +!bin/nativescript.js +!vendor/*.js +*.js.map -# Directory for instrumented libs generated by jscoverage/JSCover lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.tgz +*.tmp +*.sublime-workspace +tscommand*.tmp.txt +.tscache/ +/lib/.d.ts -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt +pids +logs +results +scratch/ +.idea/workspace.xml +.idea/tasks.xml +.idea/watcherTasks.xml -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release +test-reports.xml -# Dependency directory -# Deployed apps should consider commenting this line out: -# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git +npm-debug.log node_modules +resources/App_Resources +resources/Cordova +resources/ItemTemplates +resources/ProjectTemplates diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..aa2f2323d9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/common"] + path = lib/common + url = /c/work/mobile-cli-lib.git diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000000..a3bf33e13a --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +nativescript-cli \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000..e206d70d85 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..1162f43828 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..4b29c89c25 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/nativescript-cli.iml b/.idea/nativescript-cli.iml new file mode 100644 index 0000000000..6b8184f8ef --- /dev/null +++ b/.idea/nativescript-cli.iml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000000..922003b843 --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..c80f2198b5 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000000..034f190695 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "nativescript-cli", + "version": "0.1.0", + "description": "Command-line interface for building NativeScript projects", + "main": "bin/nativescript.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/NativeScript/nativescript-cli.git" + }, + "author": "Telerik", + "license": "Apache2.0", + "bugs": { + "url": "https://github.com/NativeScript/nativescript-cli/issues" + }, + "homepage": "https://github.com/NativeScript/nativescript-cli" +} From 5d530a095b499d0c48b82cad5817a974c530923c Mon Sep 17 00:00:00 2001 From: Fatme Date: Wed, 2 Jul 2014 15:38:22 +0300 Subject: [PATCH 2/6] Add package.json --- .gitmodules | 2 +- lib/common | 1 + package.json | 44 +++++++++++++++++++++++++++----------------- 3 files changed, 29 insertions(+), 18 deletions(-) create mode 160000 lib/common diff --git a/.gitmodules b/.gitmodules index aa2f2323d9..386ca6c4fb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "lib/common"] path = lib/common - url = /c/work/mobile-cli-lib.git + url = git@github.com:telerik/mobile-cli-lib.git diff --git a/lib/common b/lib/common new file mode 160000 index 0000000000..a4294787f9 --- /dev/null +++ b/lib/common @@ -0,0 +1 @@ +Subproject commit a4294787f9ce49b5de608ed02cfc08124594ab32 diff --git a/package.json b/package.json index 034f190695..88138e7d0c 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,29 @@ { - "name": "nativescript-cli", - "version": "0.1.0", - "description": "Command-line interface for building NativeScript projects", - "main": "bin/nativescript.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "https://github.com/NativeScript/nativescript-cli.git" - }, - "author": "Telerik", - "license": "Apache2.0", - "bugs": { - "url": "https://github.com/NativeScript/nativescript-cli/issues" - }, - "homepage": "https://github.com/NativeScript/nativescript-cli" + "name": "nativescript-cli", + "version": "0.1.0", + "author": "Telerik ", + "description": "Command-line interface for building NativeScript projects", + "bin": { + "nativescript": "./bin/nativescript.js" + }, + "main": "./lib/nativescript-cli.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/NativeScript/nativescript-cli.git" + }, + "keywords": [ + "nativescript", + "appbuilder", + "telerik", + "mobile" + ], + "license": "Apache2.0", + "analyze": true, + "license": "Apache-2.0", + "engines": { + "node": "~0.10.22" + } } From ea579b5bc4d0478957ae53eac763b20182894868 Mon Sep 17 00:00:00 2001 From: Fatme Date: Wed, 2 Jul 2014 15:51:53 +0300 Subject: [PATCH 3/6] Add Gruntfile --- Gruntfile.js | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 16 ++++++ 2 files changed, 153 insertions(+) create mode 100644 Gruntfile.js diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000000..da8a5d1de0 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,137 @@ +var util = require("util"); + +var now = new Date().toISOString(); + +function shallowCopy(obj) { + var result = {}; + Object.keys(obj).forEach(function(key) { + result[key] = obj[key]; + }); + return result; +} + +module.exports = function(grunt) { + grunt.initConfig({ + copyPackageTo: "\\\\telerik.com\\Resources\\BlackDragon\\Builds\\nativescript-cli", + + deploymentEnvironment: process.env["DeploymentEnvironment"] || "local", + jobName: process.env["JOB_NAME"] || "local", + buildNumber: process.env["BUILD_NUMBER"] || "non-ci", + dateString: now.substr(0, now.indexOf("T")), + + pkg: grunt.file.readJSON("package.json"), + + ts: { + options: { + target: 'es5', + module: 'commonjs', + sourceMap: true, + declaration: false, + removeComments: false + }, + + devlib: { + src: ["lib/**/*.ts"], + reference: "lib/.d.ts" + }, + + devall: { + src: ["lib/**/*.ts", "test/**/*.ts"], + reference: "lib/.d.ts" + }, + + release_build: { + src: ["lib/**/*.ts", "test/**/*.ts"], + reference: "lib/.d.ts", + options: { + sourceMap: false, + removeComments: true + } + } + }, + + watch: { + devall: { + files: ["lib/**/*.ts", 'test/**/*.ts'], + tasks: ['ts:devall'], + options: { + atBegin: true, + interrupt: true + } + } + }, + + shell: { + options: { + stdout: true, + stderr: true + }, + + build_package: { + command: "npm pack", + options: { + execOptions: { + env: (function() { + var env = shallowCopy(process.env); + env["NATIVESCRIPT_SKIP_POSTINSTALL_TASKS"] = "1"; + return env; + })() + } + } + } + }, + + copy: { + package_to_drop_folder: { + src: "*.tgz", + dest: "<%= copyPackageTo %>/<%= jobName %>/<%= deploymentEnvironment %>/<%= dateString %> #<%= buildNumber %>/" + }, + package_to_qa_drop_folder: { + src: "*.tgz", + dest: "<%= copyPackageTo %>/<%= jobName %>/<%= deploymentEnvironment %>/nativescript.tgz" + } + }, + + clean: { + src: ["test/**/*.js*", "lib/**/*.js*", "*.tgz"] + } + }); + + grunt.loadNpmTasks("grunt-contrib-clean"); + grunt.loadNpmTasks("grunt-contrib-copy"); + grunt.loadNpmTasks("grunt-contrib-watch"); + grunt.loadNpmTasks("grunt-shell"); + grunt.loadNpmTasks("grunt-ts"); + + grunt.registerTask("set_package_version", function(version) { + var fs = require("fs"); + var buildVersion = version !== undefined ? version : process.env["BUILD_NUMBER"]; + if (process.env["BUILD_CAUSE_GHPRBCAUSE"]) { + buildVersion = "PR" + buildVersion; + } + + var packageJson = grunt.file.readJSON("package.json"); + var versionParts = packageJson.version.split("-"); + versionParts[1] = buildVersion; + packageJson.version = versionParts.join("-"); + grunt.file.write("package.json", JSON.stringify(packageJson, null, " ")); + }); + + grunt.registerTask("test", ["ts:devall", "shell:npm_test"]); + grunt.registerTask("pack", [ + "clean", + "ts:release_build", + "shell:prepare_resources", + + "shell:apply_deployment_environment", + "shell:ci_unit_tests", + + "set_package_version", + "shell:build_package", + + "copy:package_to_drop_folder", + "copy:package_to_qa_drop_folder" + ]); + + grunt.registerTask("default", "ts:devlib"); +}; diff --git a/package.json b/package.json index 88138e7d0c..1d5163808d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,23 @@ "mobile" ], "license": "Apache2.0", + "dependencies": { + "fibers": "https://github.com/icenium/node-fibers/tarball/master", + "log4js": "0.6.9", + "tabtab": "https://github.com/tailsu/node-tabtab/tarball/master", + "underscore": "1.5.2", + "unzip": "0.1.9", + "yargs": "1.2.2" + }, "analyze": true, + "devDependencies": { + "grunt": "0.4.2", + "grunt-ts": "1.11.2", + "grunt-contrib-clean": "0.5.0", + "grunt-contrib-watch": "0.5.3", + "grunt-shell": "0.6.4", + "grunt-contrib-copy": "0.5.0" + }, "license": "Apache-2.0", "engines": { "node": "~0.10.22" From 03483718c0062c46fe1079cbd24bc6a886eb0cb1 Mon Sep 17 00:00:00 2001 From: Fatme Date: Wed, 2 Jul 2014 16:05:59 +0300 Subject: [PATCH 4/6] Add Webstorm scope for the Typescript --- .idea/scopes/Nativescript_CLI_TypeScript.xml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .idea/scopes/Nativescript_CLI_TypeScript.xml diff --git a/.idea/scopes/Nativescript_CLI_TypeScript.xml b/.idea/scopes/Nativescript_CLI_TypeScript.xml new file mode 100644 index 0000000000..efb2748f34 --- /dev/null +++ b/.idea/scopes/Nativescript_CLI_TypeScript.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file From faf5b30d606a518cb1cb7881d23277bdf740fa0c Mon Sep 17 00:00:00 2001 From: Fatme Date: Wed, 2 Jul 2014 17:27:40 +0300 Subject: [PATCH 5/6] Add bin folder and entry point for cli --- bin/nativescript | 4 ++++ bin/nativescript.cmd | 1 + bin/nativescript.js | 3 +++ lib/nativescript-cli.ts | 2 ++ 4 files changed, 10 insertions(+) create mode 100644 bin/nativescript create mode 100644 bin/nativescript.cmd create mode 100644 bin/nativescript.js create mode 100644 lib/nativescript-cli.ts diff --git a/bin/nativescript b/bin/nativescript new file mode 100644 index 0000000000..8876dd94d6 --- /dev/null +++ b/bin/nativescript @@ -0,0 +1,4 @@ +#!/bin/sh + +AB_DIR="`dirname \"$0\"`" +node "$AB_DIR/nativescript.js" $@ diff --git a/bin/nativescript.cmd b/bin/nativescript.cmd new file mode 100644 index 0000000000..9074113019 --- /dev/null +++ b/bin/nativescript.cmd @@ -0,0 +1 @@ +@node %~dp0\nativescript.js %* \ No newline at end of file diff --git a/bin/nativescript.js b/bin/nativescript.js new file mode 100644 index 0000000000..f44316be67 --- /dev/null +++ b/bin/nativescript.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require("../lib/nativescript-cli.js"); \ No newline at end of file diff --git a/lib/nativescript-cli.ts b/lib/nativescript-cli.ts new file mode 100644 index 0000000000..1c4d0c264d --- /dev/null +++ b/lib/nativescript-cli.ts @@ -0,0 +1,2 @@ +/// + From c0ac1751609c1412078cd72200d64ab5ba55507b Mon Sep 17 00:00:00 2001 From: Fatme Date: Thu, 3 Jul 2014 11:44:25 +0300 Subject: [PATCH 6/6] Add bootstrap --- lib/bootstrap.ts | 4 ++++ lib/nativescript-cli.ts | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 lib/bootstrap.ts diff --git a/lib/bootstrap.ts b/lib/bootstrap.ts new file mode 100644 index 0000000000..e7a290a099 --- /dev/null +++ b/lib/bootstrap.ts @@ -0,0 +1,4 @@ +global._ = require("underscore"); +global.$injector = require("./common/lib/yok").injector; + +$injector.require("nativescript-cli", "./nativescript-cli"); diff --git a/lib/nativescript-cli.ts b/lib/nativescript-cli.ts index 1c4d0c264d..bbb1df0206 100644 --- a/lib/nativescript-cli.ts +++ b/lib/nativescript-cli.ts @@ -1,2 +1,10 @@ /// +import Fiber = require("fibers"); + +require("./bootstrap"); + +var fiber = Fiber(() => { +}); +global.__main_fiber__ = fiber; // leak fiber to prevent it from being GC'd and thus corrupting V8 +fiber.run(); \ No newline at end of file