Skip to content

Revert "Transpile to ES6" #2281

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 1 commit into from
Nov 30, 2016
Merged
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 %*
7 changes: 2 additions & 5 deletions lib/device-sockets/ios/socket-request-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ export class IOSSocketRequestExecutor implements IiOSSocketRequestExecutor {
return (() => {
let npc = new iOSProxyServices.NotificationProxyClient(device, this.$injector);

let data = [this.$iOSNotification.alreadyConnected, this.$iOSNotification.readyForAttach, this.$iOSNotification.attachAvailable]
.map((notification) => this.$iOSNotificationService.awaitNotification(npc, notification, timeout)),
alreadyConnected = data[0],
readyForAttach = data[1],
attachAvailable = data[2];
let [alreadyConnected, readyForAttach, attachAvailable] = [this.$iOSNotification.alreadyConnected, this.$iOSNotification.readyForAttach, this.$iOSNotification.attachAvailable]
.map((notification) => this.$iOSNotificationService.awaitNotification(npc, notification, timeout));

npc.postNotificationAndAttachForData(this.$iOSNotification.attachAvailabilityQuery);

Expand Down
9 changes: 2 additions & 7 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ export class PlatformService implements IPlatformService {

private addPlatform(platformParam: string): IFuture<void> {
return (() => {
let data = platformParam.split("@"),
platform = data[0],
version = data[1];
let [platform, version] = platformParam.split("@");

this.validatePlatform(platform);

Expand Down Expand Up @@ -429,10 +427,7 @@ export class PlatformService implements IPlatformService {
public updatePlatforms(platforms: string[]): IFuture<void> {
return (() => {
_.each(platforms, platformParam => {
let data = platformParam.split("@"),
platform = data[0],
version = data[1];

let [platform, version] = platformParam.split("@");
if (this.isPlatformInstalled(platform).wait()) {
this.updatePlatform(platform, version).wait();
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/services/plugins-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class PluginsService implements IPluginsService {
.filter(dependencyName => _.startsWith(dependencyName, "@"))
.each(scopedDependencyDir => {
let contents = this.$fs.readDirectory(path.join(this.nodeModulesPath, scopedDependencyDir)).wait();
installedDependencies = installedDependencies.concat(contents.map(dependencyName => `${scopedDependencyDir}/${dependencyName}`));
installedDependencies = installedDependencies.concat(...contents.map(dependencyName => `${scopedDependencyDir}/${dependencyName}`));
});

let packageJsonContent = this.$fs.readJson(this.getPackageJsonFilePath()).wait();
Expand Down
5 changes: 1 addition & 4 deletions lib/services/project-templates-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ export class ProjectTemplatesService implements IProjectTemplatesService {
let templateName = originalTemplateName.toLowerCase();

// support <reserved_name>@<version> syntax
let data = templateName.split("@"),
name = data[0],
version = data[1];

let [name, version] = templateName.split("@");
if(constants.RESERVED_TEMPLATE_NAMES[name]) {
realTemplatePath = this.prepareNativeScriptTemplate(constants.RESERVED_TEMPLATE_NAMES[name], version, projectDir).wait();
} else {
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
},
"main": "./lib/nativescript-cli.js",
"scripts": {
"test": "node test-scripts/istanbul.js",
"test": "node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha",
"postinstall": "node postinstall.js",
"preuninstall": "node preuninstall.js",
"mocha": "node test-scripts/mocha.js",
"mocha": "mocha",
"tsc": "tsc",
"test-watch": "node ./dev/tsc-to-mocha-watch.js"
},
Expand All @@ -27,6 +27,7 @@
"mobile"
],
"dependencies": {
"bluebird": "2.9.34",
"bplist-parser": "0.1.0",
"bufferpack": "0.0.6",
"bufferutil": "https://github.com/telerik/bufferutil/tarball/v1.0.1.4",
Expand Down Expand Up @@ -89,7 +90,7 @@
"grunt-ts": "6.0.0-beta.3",
"grunt-tslint": "3.3.0",
"istanbul": "0.4.5",
"mocha": "3.1.2",
"mocha": "2.5.3",
"mocha-fibers": "https://github.com/NativeScript/mocha-fibers.git",
"mocha-typescript": "^1.0.4",
"should": "7.0.2",
Expand Down
18 changes: 0 additions & 18 deletions test-scripts/istanbul.js

This file was deleted.

15 changes: 0 additions & 15 deletions test-scripts/mocha.js

This file was deleted.

Loading