diff --git a/.gitignore b/.gitignore index 3181cc2e10..05679ace79 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file +docs/html \ No newline at end of file diff --git a/.npmignore b/.npmignore index 5fa204816d..3d793de8cb 100644 --- a/.npmignore +++ b/.npmignore @@ -21,7 +21,6 @@ lib/**/*.ts lib/**/*.js.map test/ -test-scripts/ .vscode lib/common/test/ coverage/ @@ -29,4 +28,4 @@ scratch/ *.suo .travis.yml docs/html/ -dev/ +dev/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 1e31432536..0000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - // Use IntelliSense to learn about possible Node.js debug attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Launch Program (Node 6+)", - "program": "${workspaceRoot}/lib/nativescript-cli.js", - "cwd": "${workspaceRoot}", - "sourceMaps": true, - // define the arguments that you would like to pass to CLI, for example - // "args": [ "build", "android", "--justlaunch" ] - "args": [ - - ] - }, - - { - // in case you want to debug a single test, modify it's code to be `it.only(...` instead of `it(...` - "type": "node", - "request": "launch", - "name": "Launch Tests (Node 6+)", - "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "cwd": "${workspaceRoot}", - "sourceMaps": true - }, - - { - "type": "node", - "runtimeArgs": [ - "--harmony" - ], - "request": "launch", - "name": "Launch Program (Node 4, Node 5)", - "program": "${workspaceRoot}/lib/nativescript-cli.js", - "cwd": "${workspaceRoot}", - "sourceMaps": true, - // define the arguments that you would like to pass to CLI, for example - // "args": [ "build", "android", "--justlaunch" ] - "args": [ - - ] - }, - - { - // in case you want to debug a single test, modify it's code to be `it.only(...` instead of `it(...` - "type": "node", - "runtimeArgs": [ - "--harmony" - ], - "request": "launch", - "name": "Launch Tests (Node 4, Node 5)", - "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "cwd": "${workspaceRoot}", - "sourceMaps": true - }, - - { - "type": "node", - "request": "attach", - "name": "Attach to Process", - "port": 5858, - "sourceMaps": true - } - - ] -} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 1eaaaade39..1b0adb041c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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"], @@ -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"] } }); diff --git a/bin/nativescript b/bin/nativescript index 67e68db21a..ebdd8eea3c 100755 --- a/bin/nativescript +++ b/bin/nativescript @@ -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" "$@" diff --git a/bin/nativescript.cmd b/bin/nativescript.cmd index 0ecd2c8c87..9074113019 100644 --- a/bin/nativescript.cmd +++ b/bin/nativescript.cmd @@ -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 %* -) \ No newline at end of file +@node %~dp0\nativescript.js %* \ No newline at end of file diff --git a/bin/tns b/bin/tns index 67e68db21a..ebdd8eea3c 100755 --- a/bin/tns +++ b/bin/tns @@ -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" "$@" diff --git a/bin/tns.cmd b/bin/tns.cmd index 0ecd2c8c87..9074113019 100644 --- a/bin/tns.cmd +++ b/bin/tns.cmd @@ -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 %* -) \ No newline at end of file +@node %~dp0\nativescript.js %* \ No newline at end of file diff --git a/lib/common b/lib/common index 3925c26ed8..f6199c1aba 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 3925c26ed8271b43d89da68276b321672d254a33 +Subproject commit f6199c1aba146f269251ef42f551d180869ddf9a diff --git a/lib/declarations.ts b/lib/declarations.ts index bc4fb281a8..b8e3c02119 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -95,6 +95,7 @@ interface IOptions extends ICommonOptions { rebuild: boolean; syncAllFiles: boolean; liveEdit: boolean; + chrome: boolean; } interface IInitService { @@ -225,7 +226,8 @@ interface IAndroidToolsInfoData { } interface ISocketProxyFactory { - createSocketProxy(factory: () => any): IFuture; + createTCPSocketProxy(factory: () => any): any; + createWebSocketProxy(factory: () => any): any; } interface IiOSNotification { diff --git a/lib/definitions/project.d.ts b/lib/definitions/project.d.ts index 960e9875d8..e53b8a8182 100644 --- a/lib/definitions/project.d.ts +++ b/lib/definitions/project.d.ts @@ -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} + */ + mergePodfileHookContent(sectionName: string, pathToPodfile: string): IFuture } diff --git a/lib/device-sockets/ios/socket-proxy-factory.ts b/lib/device-sockets/ios/socket-proxy-factory.ts index 9e98fa51ee..b224bbe699 100644 --- a/lib/device-sockets/ios/socket-proxy-factory.ts +++ b/lib/device-sockets/ios/socket-proxy-factory.ts @@ -1,6 +1,5 @@ import { PacketStream } from "./packet-stream"; import * as net from "net"; -import * as semver from "semver"; import * as ws from "ws"; import temp = require("temp"); import * as helpers from "../../common/helpers"; @@ -12,25 +11,65 @@ export class SocketProxyFactory implements ISocketProxyFactory { private $projectDataService: IProjectDataService, private $options: IOptions) { } - public createSocketProxy(factory: () => net.Socket): IFuture { - return (() => { - let socketFactory = (callback: (_socket: net.Socket) => void) => helpers.connectEventually(factory, callback); + public createTCPSocketProxy(factory: () => net.Socket): any { + let socketFactory = (callback: (_socket: net.Socket) => void) => helpers.connectEventually(factory, callback); - this.$projectDataService.initialize(this.$projectData.projectDir); - let frameworkVersion = this.$projectDataService.getValue("tns-ios").wait().version; - let result: any; + this.$logger.info("\nSetting up proxy...\nPress Ctrl + C to terminate, or disconnect.\n"); - if(semver.gte(frameworkVersion, "1.4.0")) { - result = this.createTcpSocketProxy(socketFactory); - } else { - result = this.createWebSocketProxy(socketFactory); - } + let server = net.createServer({ + allowHalfOpen: true + }); + + server.on("connection", (frontendSocket: net.Socket) => { + this.$logger.info("Frontend client connected."); + + frontendSocket.on("end", () => { + this.$logger.info('Frontend socket closed!'); + if (!(this.$config.debugLivesync && this.$options.watch)) { + process.exit(0); + } + }); - return result; - }).future()(); + socketFactory((backendSocket: net.Socket) => { + this.$logger.info("Backend socket created."); + + backendSocket.on("end", () => { + this.$logger.info("Backend socket closed!"); + if (!(this.$config.debugLivesync && this.$options.watch)) { + process.exit(0); + } + }); + + frontendSocket.on("close", () => { + console.log("frontend socket closed"); + if (!(backendSocket).destroyed) { + backendSocket.destroy(); + } + }); + backendSocket.on("close", () => { + console.log("backend socket closed"); + if (!(frontendSocket).destroyed) { + frontendSocket.destroy(); + } + }); + + backendSocket.pipe(frontendSocket); + frontendSocket.pipe(backendSocket); + frontendSocket.resume(); + }); + }); + + let socketFileLocation = temp.path({ suffix: ".sock" }); + server.listen(socketFileLocation); + if(!this.$options.client) { + this.$logger.info("socket-file-location: " + socketFileLocation); + } + + return server; } - private createWebSocketProxy(socketFactory: (handler: (socket: net.Socket) => void) => void): ws.Server { + public createWebSocketProxy(factory: () => net.Socket): ws.Server { + let socketFactory = (callback: (_socket: net.Socket) => void) => helpers.connectEventually(factory, callback); // NOTE: We will try to provide command line options to select ports, at least on the localhost. let localPort = 8080; @@ -86,58 +125,5 @@ export class SocketProxyFactory implements ISocketProxyFactory { this.$logger.info("Opened localhost " + localPort); return server; } - - private createTcpSocketProxy(socketFactory: (handler: (socket: net.Socket) => void) => void): net.Server { - this.$logger.info("\nSetting up proxy...\nPress Ctrl + C to terminate, or disconnect.\n"); - - let server = net.createServer({ - allowHalfOpen: true - }); - - server.on("connection", (frontendSocket: net.Socket) => { - this.$logger.info("Frontend client connected."); - - frontendSocket.on("end", () => { - this.$logger.info('Frontend socket closed!'); - if (!(this.$config.debugLivesync && this.$options.watch)) { - process.exit(0); - } - }); - - socketFactory((backendSocket: net.Socket) => { - this.$logger.info("Backend socket created."); - - backendSocket.on("end", () => { - this.$logger.info("Backend socket closed!"); - if (!(this.$config.debugLivesync && this.$options.watch)) { - process.exit(0); - } - }); - - frontendSocket.on("close", () => { - if (!(backendSocket).destroyed) { - backendSocket.destroy(); - } - }); - backendSocket.on("close", () => { - if (!(frontendSocket).destroyed) { - frontendSocket.destroy(); - } - }); - - backendSocket.pipe(frontendSocket); - frontendSocket.pipe(backendSocket); - frontendSocket.resume(); - }); - }); - - let socketFileLocation = temp.path({ suffix: ".sock" }); - server.listen(socketFileLocation); - if(!this.$options.client) { - this.$logger.info("socket-file-location: " + socketFileLocation); - } - - return server; - } } $injector.register("socketProxyFactory", SocketProxyFactory); diff --git a/lib/device-sockets/ios/socket-request-executor.ts b/lib/device-sockets/ios/socket-request-executor.ts index 756c18d860..dd46f7090b 100644 --- a/lib/device-sockets/ios/socket-request-executor.ts +++ b/lib/device-sockets/ios/socket-request-executor.ts @@ -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); diff --git a/lib/options.ts b/lib/options.ts index 732f3b9226..37dece04bf 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -40,7 +40,8 @@ export class Options extends commonOptionsLibPath.OptionsBase { teamId: { type: OptionType.String }, rebuild: { type: OptionType.Boolean, default: true }, syncAllFiles: { type: OptionType.Boolean }, - liveEdit: { type: OptionType.Boolean } + liveEdit: { type: OptionType.Boolean }, + chrome: { type: OptionType.Boolean } }, path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"), $errors, $staticConfig); diff --git a/lib/services/cocoapods-service.ts b/lib/services/cocoapods-service.ts index 9bb3383ff4..73fa586ba8 100644 --- a/lib/services/cocoapods-service.ts +++ b/lib/services/cocoapods-service.ts @@ -1,6 +1,13 @@ import {EOL} from "os"; +interface IRubyFunction { + functionName: string; + functionParameters?: string; +} + export class CocoaPodsService implements ICocoaPodsService { + constructor(private $fs: IFileSystem) { } + public getPodfileHeader(targetName: string): string { return `use_frameworks!${EOL}${EOL}target "${targetName}" do${EOL}`; } @@ -8,6 +15,56 @@ export class CocoaPodsService implements ICocoaPodsService { public getPodfileFooter(): string { return `${EOL}end`; } + + public mergePodfileHookContent(hookName: string, pathToPodfile: string): IFuture { + return (() => { + if (!this.$fs.exists(pathToPodfile).wait()) { + throw new Error(`The Podfile ${pathToPodfile} does not exist.`); + } + + let podfileContent = this.$fs.readText(pathToPodfile).wait(); + let hookStart = `${hookName} do`; + + let hookDefinitionRegExp = new RegExp(`${hookStart} *(\\|(\\w+)\\|)?`, "g"); + let newFunctionNameIndex = 1; + let newFunctions: IRubyFunction[] = []; + + let replacedContent = podfileContent.replace(hookDefinitionRegExp, (substring: string, firstGroup: string, secondGroup: string, index: number): string => { + let newFunctionName = `${hookName}${newFunctionNameIndex++}`; + let newDefinition = `def ${newFunctionName}`; + + let rubyFunction: IRubyFunction = { functionName: newFunctionName }; + // firstGroup is the block parameter, secondGroup is the block parameter name. + if (firstGroup && secondGroup) { + newDefinition = `${newDefinition} (${secondGroup})`; + rubyFunction.functionParameters = secondGroup; + } + + newFunctions.push(rubyFunction); + return newDefinition; + }); + + if (newFunctions.length > 1) { + // Execute all methods in the hook and pass the parameter to them. + let blokParameterName = "installer"; + let mergedHookContent = `${hookStart} |${blokParameterName}|${EOL}`; + + _.each(newFunctions, (rubyFunction: IRubyFunction) => { + let functionExecution = rubyFunction.functionName; + if (rubyFunction.functionParameters && rubyFunction.functionParameters.length) { + functionExecution = `${functionExecution} ${blokParameterName}`; + } + + mergedHookContent = `${mergedHookContent} ${functionExecution}${EOL}`; + }); + + mergedHookContent = `${mergedHookContent}end`; + + let newPodfileContent = `${replacedContent}${EOL}${mergedHookContent}`; + this.$fs.writeFile(pathToPodfile, newPodfileContent).wait(); + } + }).future()(); + } } $injector.register("cocoapodsService", CocoaPodsService); diff --git a/lib/services/ios-debug-service.ts b/lib/services/ios-debug-service.ts index 404d0b07a8..ac3d8b9d08 100644 --- a/lib/services/ios-debug-service.ts +++ b/lib/services/ios-debug-service.ts @@ -15,7 +15,7 @@ class IOSDebugService implements IDebugService { private _lldbProcess: ChildProcess; private _sockets: net.Socket[] = []; private _childProcess: ChildProcess; - private _socketProxy: net.Server; + private _socketProxy: any; constructor( private $config: IConfiguration, @@ -31,7 +31,6 @@ class IOSDebugService implements IDebugService { private $injector: IInjector, private $npmInstallationManager: INpmInstallationManager, private $options: IOptions, - private $projectDataService: IProjectDataService, private $utils: IUtils, private $iOSNotification: IiOSNotification, private $iOSSocketRequestExecutor: IiOSSocketRequestExecutor, @@ -195,17 +194,24 @@ class IOSDebugService implements IDebugService { private wireDebuggerClient(device?: Mobile.IiOSDevice): IFuture { return (() => { - this._socketProxy = this.$socketProxyFactory.createSocketProxy(() => { + let factory = () => { let socket = device ? device.connectToPort(inspectorBackendPort) : net.connect(inspectorBackendPort); this._sockets.push(socket); return socket; - }).wait(); + }; + + if (this.$options.chrome) { + this._socketProxy = this.$socketProxyFactory.createWebSocketProxy(factory); - this.openDebuggerClient(this._socketProxy.address()).wait(); + this.$logger.info(`To start debugging, open the following URL in Chrome:\nchrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=localhost:${this._socketProxy.options.port}\n`); + } else { + this._socketProxy = this.$socketProxyFactory.createTCPSocketProxy(factory); + this.openAppInspector(this._socketProxy.address()).wait(); + } }).future()(); } - private openDebuggerClient(fileDescriptor: string): IFuture { + private openAppInspector(fileDescriptor: string): IFuture { if (this.$options.client) { return (() => { let inspectorPath = this.$npmInstallationManager.install(inspectorNpmPackageName, this.$projectData.projectDir).wait(); diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 9af05811fe..38da9f2230 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -269,10 +269,10 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ args = args.concat((buildConfig && buildConfig.architectures) || defaultArchitectures); let xcodeBuildVersion = this.getXcodeVersion(); - if (helpers.versionCompare(xcodeBuildVersion, "8.0")>=0) { + if (helpers.versionCompare(xcodeBuildVersion, "8.0") >= 0) { let teamId = this.getDevelopmentTeam(); if (teamId) { - args = args.concat("DEVELOPMENT_TEAM="+teamId); + args = args.concat("DEVELOPMENT_TEAM=" + teamId); } } } else { @@ -478,10 +478,10 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f try { this.$fs.createDirectory(path.dirname(compatabilityXibPath)).wait(); this.$fs.writeFile(compatabilityXibPath, content).wait(); - } catch(e) { + } catch (e) { this.$logger.warn("We have failed to add compatability LaunchScreen.xib due to: " + e); } - } catch(e) { + } catch (e) { this.$logger.warn("We have failed to check if we need to add a compatability LaunchScreen.xib due to: " + e); } } @@ -687,7 +687,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f let firstPostInstallIndex = projectPodfileContent.indexOf(IOSProjectService.PODFILE_POST_INSTALL_SECTION_NAME); if (firstPostInstallIndex !== -1 && firstPostInstallIndex !== projectPodfileContent.lastIndexOf(IOSProjectService.PODFILE_POST_INSTALL_SECTION_NAME)) { - this.$logger.warn(`Podfile contains more than one post_install sections. You need to open ${this.projectPodFilePath} file and manually resolve this issue.`); + this.$cocoapodsService.mergePodfileHookContent(IOSProjectService.PODFILE_POST_INSTALL_SECTION_NAME, this.projectPodFilePath).wait(); } let xcuserDataPath = path.join(this.xcodeprojPath, "xcuserdata"); @@ -948,7 +948,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f let pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME); let pluginXcconfigFilePath = path.join(pluginPlatformsFolderPath, "build.xcconfig"); if (this.$fs.exists(pluginXcconfigFilePath).wait()) { - this.mergeXcconfigFiles(pluginXcconfigFilePath,this.$options.release ? this.pluginsReleaseXcconfigFilePath : this.pluginsDebugXcconfigFilePath).wait(); + this.mergeXcconfigFiles(pluginXcconfigFilePath, this.$options.release ? this.pluginsReleaseXcconfigFilePath : this.pluginsDebugXcconfigFilePath).wait(); } } @@ -999,7 +999,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f return xcodeBuildVersion; } - private getDevelopmentTeams(): Array<{id:string, name: string}> { + private getDevelopmentTeams(): Array<{ id: string, name: string }> { let dir = path.join(process.env.HOME, "Library/MobileDevice/Provisioning Profiles/"); let files = this.$fs.readDirectory(dir).wait(); let teamIds: any = {}; @@ -1012,18 +1012,18 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f teamIds[teamId] = teamName; } } - let teamIdsArray = new Array<{id:string, name: string}>(); + let teamIdsArray = new Array<{ id: string, name: string }>(); for (let teamId in teamIds) { - teamIdsArray.push({ id:teamId, name:teamIds[teamId] }); + teamIdsArray.push({ id: teamId, name: teamIds[teamId] }); } return teamIdsArray; } private getProvisioningProfileValue(name: string, text: string): string { - let findStr = ""+name+""; + let findStr = "" + name + ""; let index = text.indexOf(findStr); if (index > 0) { - index = text.indexOf("", index+findStr.length); + index = text.indexOf("", index + findStr.length); if (index > 0) { index += "".length; let endIndex = text.indexOf("", index); @@ -1043,7 +1043,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f line = line.replace(/\/(\/)[^\n]*$/, ""); if (line.indexOf("DEVELOPMENT_TEAM") >= 0) { teamId = line.split("=")[1].trim(); - if (teamId[teamId.length-1] === ';') { + if (teamId[teamId.length - 1] === ';') { teamId = teamId.slice(0, -1); } } @@ -1086,7 +1086,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f "Yes, persist the team id in platforms folder.", "No, don't persist this setting." ]; - let choicePersist = this.$prompter.promptForChoice("Do you want to make teamId: "+teamId+" a persistent choice for your app?", choicesPersist).wait(); + let choicePersist = this.$prompter.promptForChoice("Do you want to make teamId: " + teamId + " a persistent choice for your app?", choicesPersist).wait(); switch (choicesPersist.indexOf(choicePersist)) { case 0: let xcconfigFile = path.join(this.$projectData.appResourcesDirectoryPath, this.platformData.normalizedPlatformName, "build.xcconfig"); diff --git a/lib/services/livesync/android-device-livesync-service.ts b/lib/services/livesync/android-device-livesync-service.ts index 9689f9b3c2..c58f101462 100644 --- a/lib/services/livesync/android-device-livesync-service.ts +++ b/lib/services/livesync/android-device-livesync-service.ts @@ -69,7 +69,9 @@ class AndroidLiveSyncService implements IDeviceLiveSyncService { private reloadPage(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture { return (() => { this.device.adb.executeCommand(["forward", `tcp:${AndroidLiveSyncService.BACKEND_PORT.toString()}`, `localabstract:${deviceAppData.appIdentifier}-livesync`]).wait(); - this.sendPageReloadMessage().wait(); + if (!this.sendPageReloadMessage().wait()) { + this.restartApplication(deviceAppData).wait(); + } }).future()(); } @@ -97,15 +99,25 @@ class AndroidLiveSyncService implements IDeviceLiveSyncService { return `/data/local/tmp/${appIdentifier}`; } - private sendPageReloadMessage(): IFuture { - let future = new Future(); + private sendPageReloadMessage(): IFuture { + let future = new Future(); let socket = new net.Socket(); socket.connect(AndroidLiveSyncService.BACKEND_PORT, '127.0.0.1', () => { socket.write(new Buffer([0, 0, 0, 1, 1])); }); socket.on("data", (data: any) => { socket.destroy(); - future.return(); + future.return(true); + }); + socket.on("error", () => { + if (!future.isResolved()) { + future.return(false); + } + }); + socket.on("close", () => { + if (!future.isResolved()) { + future.return(false); + } }); return future; } diff --git a/lib/services/livesync/ios-device-livesync-service.ts b/lib/services/livesync/ios-device-livesync-service.ts index e85adddfc6..17fe58c403 100644 --- a/lib/services/livesync/ios-device-livesync-service.ts +++ b/lib/services/livesync/ios-device-livesync-service.ts @@ -47,8 +47,7 @@ class IOSLiveSyncService implements IDeviceLiveSyncService { try { this.socket = helpers.connectEventuallyUntilTimeout(() => net.connect(IOSLiveSyncService.BACKEND_PORT), 5000).wait(); } catch (e) { - this.$logger.warn(e); - + this.$logger.debug(e); return false; } } else { @@ -82,21 +81,16 @@ class IOSLiveSyncService implements IDeviceLiveSyncService { let otherFiles = _.difference(localToDevicePaths, _.concat(scriptFiles, scriptRelatedFiles)); let shouldRestart = _.some(otherFiles, (localToDevicePath: Mobile.ILocalToDevicePathData) => !this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), deviceAppData.platform)); - if (shouldRestart) { + if (shouldRestart || (!this.$options.liveEdit && scriptFiles.length)) { this.restartApplication(deviceAppData).wait(); - - return; - } - - if (!this.$options.liveEdit && scriptFiles.length) { - this.restartApplication(deviceAppData).wait(); - return; } if (this.setupSocketIfNeeded().wait()) { this.liveEdit(scriptFiles); this.reloadPage(deviceAppData, otherFiles).wait(); + } else { + this.restartApplication(deviceAppData).wait(); } }).future()(); } diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index c08fe88982..11744387f1 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -53,9 +53,7 @@ export class PlatformService implements IPlatformService { private addPlatform(platformParam: string): IFuture { return (() => { - let data = platformParam.split("@"), - platform = data[0], - version = data[1]; + let [platform, version] = platformParam.split("@"); this.validatePlatform(platform); @@ -287,11 +285,11 @@ export class PlatformService implements IPlatformService { return (() => { let platformData = this.$platformsData.getPlatformData(platform); let appDestinationDirectoryPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME); - let appResourcesDestination = platformData.platformProjectService.getAppResourcesDestinationDirectoryPath().wait(); - this.$fs.ensureDirectoryExists(appResourcesDestination).wait(); // Should be deleted let appResourcesDirectoryPath = path.join(appDestinationDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME); if (this.$fs.exists(appResourcesDirectoryPath).wait()) { platformData.platformProjectService.prepareAppResources(appResourcesDirectoryPath).wait(); + let appResourcesDestination = platformData.platformProjectService.getAppResourcesDestinationDirectoryPath().wait(); + this.$fs.ensureDirectoryExists(appResourcesDestination).wait(); shell.cp("-Rf", path.join(appResourcesDirectoryPath, platformData.normalizedPlatformName, "*"), appResourcesDestination); this.$fs.deleteDirectory(appResourcesDirectoryPath).wait(); } @@ -429,10 +427,7 @@ export class PlatformService implements IPlatformService { public updatePlatforms(platforms: string[]): IFuture { 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 { diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index e9c99c665f..d1fc1440e2 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -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(); diff --git a/lib/services/project-templates-service.ts b/lib/services/project-templates-service.ts index d6d842c98f..5d21533644 100644 --- a/lib/services/project-templates-service.ts +++ b/lib/services/project-templates-service.ts @@ -18,10 +18,7 @@ export class ProjectTemplatesService implements IProjectTemplatesService { let templateName = originalTemplateName.toLowerCase(); // support @ 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 { diff --git a/package.json b/package.json index c348ccc425..567d56a0d4 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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", @@ -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", diff --git a/test-scripts/istanbul.js b/test-scripts/istanbul.js deleted file mode 100644 index ce0d201851..0000000000 --- a/test-scripts/istanbul.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -const childProcess = require("child_process"); -const path = require("path"); -const pathToIstanbul = path.join(__dirname, "..", "node_modules", "istanbul", "lib", "cli.js"); -const pathToMocha = path.join(__dirname, "..", "node_modules", "mocha", "bin", "_mocha"); - -const istanbulArgs = [ pathToIstanbul, "cover", pathToMocha ]; - -const nodeArgs = require("../lib/common/test-scripts/node-args").getNodeArgs(); - -const args = nodeArgs.concat(istanbulArgs); - -const nodeProcess = childProcess.spawn("node", args, { stdio: "inherit"}); -nodeProcess.on("close", (code) => { - // We need this handler so if any test fails, we'll exit with same exit code as istanbul. - process.exit(code); -}); \ No newline at end of file diff --git a/test-scripts/mocha.js b/test-scripts/mocha.js deleted file mode 100644 index 87121193bc..0000000000 --- a/test-scripts/mocha.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -const childProcess = require("child_process"); -const path = require("path"); -const pathToMocha = path.join(__dirname, "..", "node_modules", "mocha", "bin", "_mocha"); - -const nodeArgs = require("../lib/common/test-scripts/node-args").getNodeArgs(); - -const args = nodeArgs.concat(pathToMocha); - -const nodeProcess = childProcess.spawn("node", args, { stdio: "inherit"}); -nodeProcess.on("close", (code) => { - // We need this handler so if any test fails, we'll exit with same exit code as mocha. - process.exit(code); -}); diff --git a/test/cocoapods-service.ts b/test/cocoapods-service.ts new file mode 100644 index 0000000000..ce7b6af783 --- /dev/null +++ b/test/cocoapods-service.ts @@ -0,0 +1,178 @@ +import * as yok from "../lib/common/yok"; +import {assert} from "chai"; +import {CocoaPodsService} from "../lib/services/cocoapods-service"; +import {EOL} from "os"; +import Future = require("fibers/future"); + +interface IMergePodfileHooksTestCase { + input: string; + output: string; + testCaseDescription: string; +} + +function createTestInjector(): IInjector { + let testInjector: IInjector = new yok.Yok(); + + testInjector.register("fs", {}); + testInjector.register("cocoapodsService", CocoaPodsService); + + return testInjector; +} + +// The newline characters should be replaced with EOL because on Windows the EOL is \r\n +// but the character which is placed in `` for newline is only \n +// if we do not replace the newline characters the tests will pass only on linux and mac. +function changeNewLineCharacter(input: string): string { + return input ? input.replace(/\r?\n/g, EOL) : input; +} + +describe("Cocoapods service", () => { + describe("merge Podfile hooks", () => { + let testInjector: IInjector; + let cocoapodsService: ICocoaPodsService; + let newPodfileContent: string; + + let mockFileSystem = (injector: IInjector, podfileContent: string): void => { + let fs: IFileSystem = injector.resolve("fs"); + + fs.exists = () => Future.fromResult(true); + fs.readText = () => Future.fromResult(podfileContent); + fs.writeFile = (pathToFile: string, content: any) => { + newPodfileContent = content; + return Future.fromResult(); + }; + }; + + let testCaces: IMergePodfileHooksTestCase[] = [ + { + input: ` +target 'MyApp' do + pod 'GoogleAnalytics', '~> 3.1' + target 'MyAppTests' do + inherit! :search_paths + pod 'OCMock', '~> 2.0.1' + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + puts target.name + end +end +post_install do |installer| + installer.pods_project.targets.each do |target| + puts target.name + end +end +post_install do |installer| + installer.pods_project.targets.each do |target| + puts target.name + end +end`, + output: ` +target 'MyApp' do + pod 'GoogleAnalytics', '~> 3.1' + target 'MyAppTests' do + inherit! :search_paths + pod 'OCMock', '~> 2.0.1' + end +end + +def post_install1 (installer) + installer.pods_project.targets.each do |target| + puts target.name + end +end +def post_install2 (installer) + installer.pods_project.targets.each do |target| + puts target.name + end +end +def post_install3 (installer) + installer.pods_project.targets.each do |target| + puts target.name + end +end +post_install do |installer| + post_install1 installer + post_install2 installer + post_install3 installer +end`, + testCaseDescription: "should merge more than one hooks with block parameter correctly." + }, { + input: ` +target 'MyApp' do + pod 'GoogleAnalytics', '~> 3.1' + target 'MyAppTests' do + inherit! :search_paths + pod 'OCMock', '~> 2.0.1' + end + + post_install do |installer_representation| + installer_representation.pods_project.targets.each do |target| + puts target.name + end + end + post_install do + puts "Hello World!" + end +end`, + output: ` +target 'MyApp' do + pod 'GoogleAnalytics', '~> 3.1' + target 'MyAppTests' do + inherit! :search_paths + pod 'OCMock', '~> 2.0.1' + end + + def post_install1 (installer_representation) + installer_representation.pods_project.targets.each do |target| + puts target.name + end + end + def post_install2 + puts "Hello World!" + end +end +post_install do |installer| + post_install1 installer + post_install2 +end`, + testCaseDescription: "should merge more than one hooks with and without block parameter correctly." + }, { + input: ` +target 'MyApp' do + pod 'GoogleAnalytics', '~> 3.1' + target 'MyAppTests' do + inherit! :search_paths + pod 'OCMock', '~> 2.0.1' + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + puts target.name + end +end`, + output: null, + testCaseDescription: "should not change the Podfile when there is only one hook." + } + ]; + + beforeEach(() => { + testInjector = createTestInjector(); + cocoapodsService = testInjector.resolve("cocoapodsService"); + newPodfileContent = null; + }); + + _.each(testCaces, (testCase: IMergePodfileHooksTestCase) => { + it(testCase.testCaseDescription, () => { + mockFileSystem(testInjector, testCase.input); + + cocoapodsService.mergePodfileHookContent("post_install", "").wait(); + + assert.deepEqual(changeNewLineCharacter(newPodfileContent), changeNewLineCharacter(testCase.output)); + }); + }); + }); +}); diff --git a/test/ios-project-service.ts b/test/ios-project-service.ts index f4c1a5bc8b..c71416a9ca 100644 --- a/test/ios-project-service.ts +++ b/test/ios-project-service.ts @@ -303,7 +303,7 @@ describe("Cocoapods support", () => { let pluginPath = temp.mkdirSync("pluginDirectory"); let pluginPlatformsFolderPath = path.join(pluginPath, "platforms", "ios"); let pluginPodfilePath = path.join(pluginPlatformsFolderPath, "Podfile"); - let pluginPodfileContent = ["source 'https://github.com/CocoaPods/Specs.git'", "platform :ios, '8.1'", "pod 'GoogleMaps'"].join("\n"); + let pluginPodfileContent = ["source 'https://github.com/CocoaPods/Specs.git'", "platform :ios, '8.1'", "pod 'GoogleMaps'"].join("\n"); fs.writeFile(pluginPodfilePath, pluginPodfileContent).wait(); let pluginData = { @@ -373,7 +373,7 @@ describe("Cocoapods support", () => { let pluginPath = temp.mkdirSync("pluginDirectory"); let pluginPlatformsFolderPath = path.join(pluginPath, "platforms", "ios"); let pluginPodfilePath = path.join(pluginPlatformsFolderPath, "Podfile"); - let pluginPodfileContent = ["source 'https://github.com/CocoaPods/Specs.git'", "platform :ios, '8.1'", "pod 'GoogleMaps'"].join("\n"); + let pluginPodfileContent = ["source 'https://github.com/CocoaPods/Specs.git'", "platform :ios, '8.1'", "pod 'GoogleMaps'"].join("\n"); fs.writeFile(pluginPodfilePath, pluginPodfileContent).wait(); let pluginData = { @@ -417,7 +417,7 @@ describe("Static libraries support", () => { let testInjector = createTestInjector(projectPath, projectName); let fs: IFileSystem = testInjector.resolve("fs"); let staticLibraryPath = path.join(path.join(temp.mkdirSync("pluginDirectory"), "platforms", "ios")); - let staticLibraryHeadersPath = path.join(staticLibraryPath,"include", libraryName); + let staticLibraryHeadersPath = path.join(staticLibraryPath, "include", libraryName); it("checks validation of header files", () => { let iOSProjectService = testInjector.resolve("iOSProjectService"); @@ -430,7 +430,7 @@ describe("Static libraries support", () => { let error: any; try { iOSProjectService.validateStaticLibrary(path.join(staticLibraryPath, libraryName + ".a")).wait(); - } catch(err) { + } catch (err) { error = err; } @@ -457,7 +457,7 @@ describe("Static libraries support", () => { let error: any; try { modulemap = fs.readFile(path.join(staticLibraryHeadersPath, "module.modulemap")).wait(); - } catch(err) { + } catch (err) { error = err; } diff --git a/test/platform-service.ts b/test/platform-service.ts index 2a15d16b5b..bceea61989 100644 --- a/test/platform-service.ts +++ b/test/platform-service.ts @@ -226,14 +226,14 @@ describe('Platform Service Tests', () => { } function testPreparePlatform(platformToTest: string, release?: boolean) { - let testDirData = prepareDirStructure(); + let { tempFolder, appFolderPath, app1FolderPath, appDestFolderPath, appResourcesFolderPath } = prepareDirStructure(); // Add platform specific files to app and app1 folders let platformSpecificFiles = [ "test1.ios.js", "test1-ios-js", "test2.android.js", "test2-android-js" ]; - let destinationDirectories = [testDirData.appFolderPath, testDirData.app1FolderPath]; + let destinationDirectories = [appFolderPath, app1FolderPath]; _.each(destinationDirectories, directoryPath => { _.each(platformSpecificFiles, filePath => { @@ -246,10 +246,10 @@ describe('Platform Service Tests', () => { platformsData.platformsNames = ["ios", "android"]; platformsData.getPlatformData = (platform: string) => { return { - appDestinationDirectoryPath: testDirData.appDestFolderPath, - appResourcesDestinationDirectoryPath: testDirData.appResourcesFolderPath, + appDestinationDirectoryPath: appDestFolderPath, + appResourcesDestinationDirectoryPath: appResourcesFolderPath, normalizedPlatformName: platformToTest, - projectRoot: testDirData.tempFolder, + projectRoot: tempFolder, platformProjectService: { prepareProject: () => Future.fromResult(), validate: () => Future.fromResult(), @@ -266,7 +266,7 @@ describe('Platform Service Tests', () => { }; let projectData = testInjector.resolve("projectData"); - projectData.projectDir = testDirData.tempFolder; + projectData.projectDir = tempFolder; platformService = testInjector.resolve("platformService"); let options : IOptions = testInjector.resolve("options"); @@ -277,18 +277,18 @@ describe('Platform Service Tests', () => { let test2FileName = platformToTest.toLowerCase() === "ios" ? "test2.js" : "test1.js"; // Asserts that the files in app folder are process as platform specific - assert.isTrue(fs.exists(path.join(testDirData.appDestFolderPath, "app", test1FileName)).wait()); - assert.isFalse(fs.exists(path.join(testDirData.appDestFolderPath, "app", "test1-js")).wait()); + assert.isTrue(fs.exists(path.join(appDestFolderPath, "app", test1FileName)).wait()); + assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test1-js")).wait()); - assert.isFalse(fs.exists(path.join(testDirData.appDestFolderPath, "app", test2FileName)).wait()); - assert.isFalse(fs.exists(path.join(testDirData.appDestFolderPath, "app", "test2-js")).wait()); + assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", test2FileName)).wait()); + assert.isFalse(fs.exists(path.join(appDestFolderPath, "app", "test2-js")).wait()); // Asserts that the files in app1 folder aren't process as platform specific - assert.isFalse(fs.exists(path.join(testDirData.appDestFolderPath, "app1")).wait(), "Asserts that the files in app1 folder aren't process as platform specific"); + assert.isFalse(fs.exists(path.join(appDestFolderPath, "app1")).wait(), "Asserts that the files in app1 folder aren't process as platform specific"); if (release) { // Asserts that the files in tests folder aren't copied - assert.isFalse(fs.exists(path.join(testDirData.appDestFolderPath, "tests")).wait(), "Asserts that the files in tests folder aren't copied"); + assert.isFalse(fs.exists(path.join(appDestFolderPath, "tests")).wait(), "Asserts that the files in tests folder aren't copied"); } } @@ -310,20 +310,20 @@ describe('Platform Service Tests', () => { it("invalid xml is caught", () => { require("colors"); - let testDirData = prepareDirStructure(); + let { tempFolder, appFolderPath, appDestFolderPath, appResourcesFolderPath } = prepareDirStructure(); // generate invalid xml - let fileFullPath = path.join(testDirData.appFolderPath, "file.xml"); + let fileFullPath = path.join(appFolderPath, "file.xml"); fs.writeFile(fileFullPath, "").wait(); let platformsData = testInjector.resolve("platformsData"); platformsData.platformsNames = ["android"]; platformsData.getPlatformData = (platform: string) => { return { - appDestinationDirectoryPath: testDirData.appDestFolderPath, - appResourcesDestinationDirectoryPath: testDirData.appResourcesFolderPath, + appDestinationDirectoryPath: appDestFolderPath, + appResourcesDestinationDirectoryPath: appResourcesFolderPath, normalizedPlatformName: "Android", - projectRoot: testDirData.tempFolder, + projectRoot: tempFolder, platformProjectService: { prepareProject: () => Future.fromResult(), validate: () => Future.fromResult(), @@ -340,7 +340,7 @@ describe('Platform Service Tests', () => { }; let projectData = testInjector.resolve("projectData"); - projectData.projectDir = testDirData.tempFolder; + projectData.projectDir = tempFolder; platformService = testInjector.resolve("platformService"); let oldLoggerWarner = testInjector.resolve("$logger").warn; diff --git a/tsconfig.json b/tsconfig.json index d4c2f54f5b..b1a8406486 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es6", + "target": "es5", "module": "commonjs", "sourceMap": true, "declaration": false,