Skip to content

Commit 3136820

Browse files
authored
Merge pull request #2281 from NativeScript/revert-2268-vladimirov/es6
Revert "Transpile to ES6"
2 parents 60f842b + 16a280b commit 3136820

18 files changed

+47
-230
lines changed

.gitignore

+2-5
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ results
2929
scratch/
3030
.idea/
3131
.settings/
32-
.vscode/**
33-
!.vscode/launch.json
32+
.vscode/
3433
test-reports.xml
3534

3635
npm-debug.log
3736
node_modules
38-
docs/html
39-
40-
!test-scripts/*.js
37+
docs/html

.npmignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ lib/**/*.ts
2121
lib/**/*.js.map
2222

2323
test/
24-
test-scripts/
2524
.vscode
2625
lib/common/test/
2726
coverage/
2827
scratch/
2928
*.suo
3029
.travis.yml
3130
docs/html/
32-
dev/
31+
dev/

.vscode/launch.json

-70
This file was deleted.

Gruntfile.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ module.exports = function(grunt) {
2828

2929
pkg: grunt.file.readJSON("package.json"),
3030
ts: {
31-
options: grunt.file.readJSON("tsconfig.json").compilerOptions,
31+
options: {
32+
target: 'es5',
33+
module: 'commonjs',
34+
sourceMap: true,
35+
declaration: false,
36+
removeComments: false,
37+
noImplicitAny: true,
38+
experimentalDecorators: true
39+
},
3240

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

125133
clean: {
126-
src: ["test/**/*.js*",
127-
"lib/**/*.js*",
128-
"!test-scripts/**/*",
129-
"!lib/common/vendor/*.js",
130-
"!lib/common/**/*.json",
131-
"!lib/common/Gruntfile.js",
132-
"!lib/common/node_modules/**/*",
133-
"!lib/common/hooks/**/*.js",
134-
"!lib/common/bin/*.js",
135-
"!lib/common/test-scripts/**/*",
136-
"*.tgz"]
134+
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"]
137135
}
138136
});
139137

bin/nativescript

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
#!/bin/sh
22

33
AB_DIR="`dirname \"$0\"`"
4-
NODE_VERSION=`node --version`
5-
NODE4_VERSION_PREFIX="v4."
6-
NODE5_VERSION_PREFIX="v5."
7-
8-
# check if Node.js version is 4.x.x or 5.x.x - both of them do not support some of required features
9-
# so we have to pass --harmony flag for them in order to enable spread opearator usage
10-
# Use POSIX substring parameter expansion, so the code will work on all shells.
11-
12-
if [ "${NODE_VERSION#$NODE4_VERSION_PREFIX*}" != "$NODE_VERSION" -o "${NODE_VERSION#$NODE5_VERSION_PREFIX*}" != "$NODE_VERSION" ]
13-
then
14-
# Node is 4.x.x or 5.x.x
15-
node --harmony "$AB_DIR/nativescript.js" "$@"
16-
else
17-
# Node is NOT 4.x.x or 5.x.x
18-
node "$AB_DIR/nativescript.js" "$@"
19-
fi
4+
node "$AB_DIR/nativescript.js" "$@"

bin/nativescript.cmd

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
@for /F "delims=" %%i IN ('@node --version') DO @set node_ver=%%i
2-
3-
@echo %node_ver% | @findstr /b /c:"v4."
4-
@set is_node_4=%errorlevel%
5-
6-
@echo %node_ver% | @findstr /b /c:"v5."
7-
@set is_node_5=%errorlevel%
8-
9-
@set use_harmony_flag=0
10-
11-
@if %is_node_4% == 0 @set use_harmony_flag=1
12-
@if %is_node_5% == 0 @set use_harmony_flag=1
13-
14-
@if %use_harmony_flag% == 1 (
15-
return @node --harmony %~dp0\nativescript.js %*
16-
) else (
17-
@node %~dp0\nativescript.js %*
18-
)
1+
@node %~dp0\nativescript.js %*

bin/tns

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
#!/bin/sh
22

33
AB_DIR="`dirname \"$0\"`"
4-
NODE_VERSION=`node --version`
5-
NODE4_VERSION_PREFIX="v4."
6-
NODE5_VERSION_PREFIX="v5."
7-
8-
# check if Node.js version is 4.x.x or 5.x.x - both of them do not support some of required features
9-
# so we have to pass --harmony flag for them in order to enable spread opearator usage
10-
# Use POSIX substring parameter expansion, so the code will work on all shells.
11-
12-
if [ "${NODE_VERSION#$NODE4_VERSION_PREFIX*}" != "$NODE_VERSION" -o "${NODE_VERSION#$NODE5_VERSION_PREFIX*}" != "$NODE_VERSION" ]
13-
then
14-
# Node is 4.x.x or 5.x.x
15-
node --harmony "$AB_DIR/nativescript.js" "$@"
16-
else
17-
# Node is NOT 4.x.x or 5.x.x
18-
node "$AB_DIR/nativescript.js" "$@"
19-
fi
4+
node "$AB_DIR/nativescript.js" "$@"

bin/tns.cmd

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
@for /F "delims=" %%i IN ('@node --version') DO @set node_ver=%%i
2-
3-
@echo %node_ver% | @findstr /b /c:"v4."
4-
@set is_node_4=%errorlevel%
5-
6-
@echo %node_ver% | @findstr /b /c:"v5."
7-
@set is_node_5=%errorlevel%
8-
9-
@set use_harmony_flag=0
10-
11-
@if %is_node_4% == 0 @set use_harmony_flag=1
12-
@if %is_node_5% == 0 @set use_harmony_flag=1
13-
14-
@if %use_harmony_flag% == 1 (
15-
return @node --harmony %~dp0\nativescript.js %*
16-
) else (
17-
@node %~dp0\nativescript.js %*
18-
)
1+
@node %~dp0\nativescript.js %*

lib/device-sockets/ios/socket-request-executor.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ export class IOSSocketRequestExecutor implements IiOSSocketRequestExecutor {
1313
return (() => {
1414
let npc = new iOSProxyServices.NotificationProxyClient(device, this.$injector);
1515

16-
let data = [this.$iOSNotification.alreadyConnected, this.$iOSNotification.readyForAttach, this.$iOSNotification.attachAvailable]
17-
.map((notification) => this.$iOSNotificationService.awaitNotification(npc, notification, timeout)),
18-
alreadyConnected = data[0],
19-
readyForAttach = data[1],
20-
attachAvailable = data[2];
16+
let [alreadyConnected, readyForAttach, attachAvailable] = [this.$iOSNotification.alreadyConnected, this.$iOSNotification.readyForAttach, this.$iOSNotification.attachAvailable]
17+
.map((notification) => this.$iOSNotificationService.awaitNotification(npc, notification, timeout));
2118

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

lib/services/platform-service.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ export class PlatformService implements IPlatformService {
5353

5454
private addPlatform(platformParam: string): IFuture<void> {
5555
return (() => {
56-
let data = platformParam.split("@"),
57-
platform = data[0],
58-
version = data[1];
56+
let [platform, version] = platformParam.split("@");
5957

6058
this.validatePlatform(platform);
6159

@@ -429,10 +427,7 @@ export class PlatformService implements IPlatformService {
429427
public updatePlatforms(platforms: string[]): IFuture<void> {
430428
return (() => {
431429
_.each(platforms, platformParam => {
432-
let data = platformParam.split("@"),
433-
platform = data[0],
434-
version = data[1];
435-
430+
let [platform, version] = platformParam.split("@");
436431
if (this.isPlatformInstalled(platform).wait()) {
437432
this.updatePlatform(platform, version).wait();
438433
} else {

lib/services/plugins-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class PluginsService implements IPluginsService {
163163
.filter(dependencyName => _.startsWith(dependencyName, "@"))
164164
.each(scopedDependencyDir => {
165165
let contents = this.$fs.readDirectory(path.join(this.nodeModulesPath, scopedDependencyDir)).wait();
166-
installedDependencies = installedDependencies.concat(contents.map(dependencyName => `${scopedDependencyDir}/${dependencyName}`));
166+
installedDependencies = installedDependencies.concat(...contents.map(dependencyName => `${scopedDependencyDir}/${dependencyName}`));
167167
});
168168

169169
let packageJsonContent = this.$fs.readJson(this.getPackageJsonFilePath()).wait();

lib/services/project-templates-service.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ export class ProjectTemplatesService implements IProjectTemplatesService {
1818
let templateName = originalTemplateName.toLowerCase();
1919

2020
// support <reserved_name>@<version> syntax
21-
let data = templateName.split("@"),
22-
name = data[0],
23-
version = data[1];
24-
21+
let [name, version] = templateName.split("@");
2522
if(constants.RESERVED_TEMPLATE_NAMES[name]) {
2623
realTemplatePath = this.prepareNativeScriptTemplate(constants.RESERVED_TEMPLATE_NAMES[name], version, projectDir).wait();
2724
} else {

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
},
1111
"main": "./lib/nativescript-cli.js",
1212
"scripts": {
13-
"test": "node test-scripts/istanbul.js",
13+
"test": "node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha",
1414
"postinstall": "node postinstall.js",
1515
"preuninstall": "node preuninstall.js",
16-
"mocha": "node test-scripts/mocha.js",
16+
"mocha": "mocha",
1717
"tsc": "tsc",
1818
"test-watch": "node ./dev/tsc-to-mocha-watch.js"
1919
},
@@ -27,6 +27,7 @@
2727
"mobile"
2828
],
2929
"dependencies": {
30+
"bluebird": "2.9.34",
3031
"bplist-parser": "0.1.0",
3132
"bufferpack": "0.0.6",
3233
"bufferutil": "https://github.com/telerik/bufferutil/tarball/v1.0.1.4",
@@ -89,7 +90,7 @@
8990
"grunt-ts": "6.0.0-beta.3",
9091
"grunt-tslint": "3.3.0",
9192
"istanbul": "0.4.5",
92-
"mocha": "3.1.2",
93+
"mocha": "2.5.3",
9394
"mocha-fibers": "https://github.com/NativeScript/mocha-fibers.git",
9495
"mocha-typescript": "^1.0.4",
9596
"should": "7.0.2",

test-scripts/istanbul.js

-18
This file was deleted.

test-scripts/mocha.js

-15
This file was deleted.

0 commit comments

Comments
 (0)