Skip to content

Transpile to ES6 #2282

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

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ results
scratch/
.idea/
.settings/
.vscode/**
!.vscode/launch.json
.vscode/
test-reports.xml

npm-debug.log
node_modules
docs/html

!test-scripts/*.js
docs/html
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ lib/**/*.ts
lib/**/*.js.map

test/
test-scripts/
.vscode
lib/common/test/
coverage/
scratch/
*.suo
.travis.yml
docs/html/
dev/
dev/
70 changes: 0 additions & 70 deletions .vscode/launch.json

This file was deleted.

22 changes: 10 additions & 12 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ module.exports = function(grunt) {

pkg: grunt.file.readJSON("package.json"),
ts: {
options: grunt.file.readJSON("tsconfig.json").compilerOptions,
options: {
target: 'es5',
module: 'commonjs',
sourceMap: true,
declaration: false,
removeComments: false,
noImplicitAny: true,
experimentalDecorators: true
},

devlib: {
src: ["lib/**/*.ts", "!lib/common/node_modules/**/*.ts"],
Expand Down Expand Up @@ -123,17 +131,7 @@ module.exports = function(grunt) {
},

clean: {
src: ["test/**/*.js*",
"lib/**/*.js*",
"!test-scripts/**/*",
"!lib/common/vendor/*.js",
"!lib/common/**/*.json",
"!lib/common/Gruntfile.js",
"!lib/common/node_modules/**/*",
"!lib/common/hooks/**/*.js",
"!lib/common/bin/*.js",
"!lib/common/test-scripts/**/*",
"*.tgz"]
src: ["test/**/*.js*", "lib/**/*.js*", "!lib/common/vendor/*.js", "!lib/common/**/*.json", "!lib/common/Gruntfile.js", "!lib/common/node_modules/**/*", "!lib/common/hooks/**/*.js", "!lib/common/bin/*.js", "*.tgz"]
}
});

Expand Down
17 changes: 1 addition & 16 deletions bin/nativescript
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
#!/bin/sh

AB_DIR="`dirname \"$0\"`"
NODE_VERSION=`node --version`
NODE4_VERSION_PREFIX="v4."
NODE5_VERSION_PREFIX="v5."

# check if Node.js version is 4.x.x or 5.x.x - both of them do not support some of required features
# so we have to pass --harmony flag for them in order to enable spread opearator usage
# Use POSIX substring parameter expansion, so the code will work on all shells.

if [ "${NODE_VERSION#$NODE4_VERSION_PREFIX*}" != "$NODE_VERSION" -o "${NODE_VERSION#$NODE5_VERSION_PREFIX*}" != "$NODE_VERSION" ]
then
# Node is 4.x.x or 5.x.x
node --harmony "$AB_DIR/nativescript.js" "$@"
else
# Node is NOT 4.x.x or 5.x.x
node "$AB_DIR/nativescript.js" "$@"
fi
node "$AB_DIR/nativescript.js" "$@"
19 changes: 1 addition & 18 deletions bin/nativescript.cmd
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
@for /F "delims=" %%i IN ('@node --version') DO @set node_ver=%%i

@echo %node_ver% | @findstr /b /c:"v4."
@set is_node_4=%errorlevel%

@echo %node_ver% | @findstr /b /c:"v5."
@set is_node_5=%errorlevel%

@set use_harmony_flag=0

@if %is_node_4% == 0 @set use_harmony_flag=1
@if %is_node_5% == 0 @set use_harmony_flag=1

@if %use_harmony_flag% == 1 (
return @node --harmony %~dp0\nativescript.js %*
) else (
@node %~dp0\nativescript.js %*
)
@node %~dp0\nativescript.js %*
17 changes: 1 addition & 16 deletions bin/tns
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
#!/bin/sh

AB_DIR="`dirname \"$0\"`"
NODE_VERSION=`node --version`
NODE4_VERSION_PREFIX="v4."
NODE5_VERSION_PREFIX="v5."

# check if Node.js version is 4.x.x or 5.x.x - both of them do not support some of required features
# so we have to pass --harmony flag for them in order to enable spread opearator usage
# Use POSIX substring parameter expansion, so the code will work on all shells.

if [ "${NODE_VERSION#$NODE4_VERSION_PREFIX*}" != "$NODE_VERSION" -o "${NODE_VERSION#$NODE5_VERSION_PREFIX*}" != "$NODE_VERSION" ]
then
# Node is 4.x.x or 5.x.x
node --harmony "$AB_DIR/nativescript.js" "$@"
else
# Node is NOT 4.x.x or 5.x.x
node "$AB_DIR/nativescript.js" "$@"
fi
node "$AB_DIR/nativescript.js" "$@"
19 changes: 1 addition & 18 deletions bin/tns.cmd
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
@for /F "delims=" %%i IN ('@node --version') DO @set node_ver=%%i

@echo %node_ver% | @findstr /b /c:"v4."
@set is_node_4=%errorlevel%

@echo %node_ver% | @findstr /b /c:"v5."
@set is_node_5=%errorlevel%

@set use_harmony_flag=0

@if %is_node_4% == 0 @set use_harmony_flag=1
@if %is_node_5% == 0 @set use_harmony_flag=1

@if %use_harmony_flag% == 1 (
return @node --harmony %~dp0\nativescript.js %*
) else (
@node %~dp0\nativescript.js %*
)
@node %~dp0\nativescript.js %*
4 changes: 3 additions & 1 deletion lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ interface IOptions extends ICommonOptions {
rebuild: boolean;
syncAllFiles: boolean;
liveEdit: boolean;
chrome: boolean;
}

interface IInitService {
Expand Down Expand Up @@ -225,7 +226,8 @@ interface IAndroidToolsInfoData {
}

interface ISocketProxyFactory {
createSocketProxy(factory: () => any): IFuture<any>;
createTCPSocketProxy(factory: () => any): any;
createWebSocketProxy(factory: () => any): any;
}

interface IiOSNotification {
Expand Down
8 changes: 8 additions & 0 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,12 @@ interface ICocoaPodsService {
* @return {string} The footer which needs to be placed at the end of a Podfile.
*/
getPodfileFooter(): string;

/**
* Merges the content of hooks with the provided name if there are more than one hooks with this name in the Podfile.
* @param {string} hookName The name of the hook.
* @param {string} pathToPodfile The path to the Podfile.
* @return {IFuture<void>}
*/
mergePodfileHookContent(sectionName: string, pathToPodfile: string): IFuture<void>
}
Loading