From e65bd3dae07dbd56f0144e5d41386a0b4391897f Mon Sep 17 00:00:00 2001 From: m-g-k Date: Fri, 15 Dec 2017 16:29:49 +0000 Subject: [PATCH] Update composer-common & make extension debugging work (#53) * Update composer-common & make extention debugging work Signed-off-by: m-g-k * Fix build break Signed-off-by: m-g-k --- .gitignore | 1 + .travis/script.sh | 4 +-- client/.vscode/launch.json | 47 +++++++++++++++++++++++----- client/.vscode/tasks.json | 64 ++++++++++++++++++++++++-------------- client/package.json | 9 +++--- client/src/extension.ts | 2 +- client/tsconfig.json | 5 +++ server/.vscode/launch.json | 12 ++++--- server/.vscode/tasks.json | 52 ++++++++++++++++++++++++------- server/package.json | 7 +++-- server/tsconfig.json | 1 + 11 files changed, 146 insertions(+), 58 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6cdee2f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +npm-debug.log diff --git a/.travis/script.sh b/.travis/script.sh index 658c262..7843f77 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -5,11 +5,11 @@ set -ev set -o pipefail cd ./server -npm run compile +npm run compile:server cd ../client -npm run package +npm run package:vsix npm install -g vsce npm test 2>&1 | tee diff --git a/client/.vscode/launch.json b/client/.vscode/launch.json index 02d1d9e..8308223 100755 --- a/client/.vscode/launch.json +++ b/client/.vscode/launch.json @@ -1,28 +1,59 @@ // A launch configuration that compiles the extension and then opens it inside a new window { - "version": "0.1.0", + "version": "0.2.0", "configurations": [ { - "name": "Launch Extension", + "name": "Launch Client Extension", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", - "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], + "args": [ + "--extensionDevelopmentPath=${workspaceRoot}" + ], "stopOnEntry": false, "sourceMaps": true, - "outFiles": [ "${workspaceRoot}/out/src/**/*.js" ], - "preLaunchTask": "npm" + "outFiles": [ + "${workspaceRoot}/client/out/src/**/*.js" + ], + "preLaunchTask": "watch:client" }, { "name": "Launch Tests", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", - "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], + "args": [ + "--extensionDevelopmentPath=${workspaceRoot}", + "--extensionTestsPath=${workspaceRoot}/out/test" + ], "stopOnEntry": false, "sourceMaps": true, - "outFiles": [ "${workspaceRoot}/out/test/**/*.js" ], - "preLaunchTask": "npm" + "outFiles": [ + "${workspaceRoot}/out/test/**/*.js" + ], + "preLaunchTask": "watch:client" + }, + { + //here for the compound launch option + "name": "Attach to Server", + "type": "node", + "request": "attach", + "protocol": "inspector", + "port": 6009, + "sourceMaps": true, + "outFiles": [ + "${workspaceRoot}/client/server/**/*.js" + ] + } + ], + "compounds": [ + { + //helpful if extention configured to auto open cto files + "name": "Launch Client & Attach to Server", + "configurations": [ + "Launch Client Extension", + "Attach to Server" + ] } ] } \ No newline at end of file diff --git a/client/.vscode/tasks.json b/client/.vscode/tasks.json index acff7f5..84c249e 100755 --- a/client/.vscode/tasks.json +++ b/client/.vscode/tasks.json @@ -5,31 +5,47 @@ // ${fileDirname}: the current opened file's dirname // ${fileExtname}: the current opened file's extension // ${cwd}: the current working directory of the spawned process - // A task runner that calls a custom npm script that compiles the extension. { "version": "2.0.0", - - // we want to run npm - "command": "npm", - - // we run the custom script "compile" as defined in package.json - "args": ["run", "compile", "--loglevel", "silent"], - - // The tsc compiler is started in watching mode - "isBackground": true, - - // use the standard tsc in watch mode problem matcher to find compile problems in the output. - "problemMatcher": "$tsc-watch", - - // show the output window only if unrecognized errors occur. - "presentation": { - "echo": true, - "reveal": "silent", - "focus": false, - "panel": "shared" - }, - - // the command is a shell script - "type": "shell" + "tasks": [ + { + "label": "compile:client", + "type": "npm", + "script": "compile:client", + "group": "build", + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": [ + "$tsc" + ] + }, + { + "label": "watch:client", + "type": "npm", + "script": "watch:client", + "isBackground": true, + "group": "build", + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": [ + "$tsc-watch" + ] + }, + { + "label": "package:vsix", + "group": "build", + "type": "npm", + "script": "package:vsix", + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": [] + } + ] } \ No newline at end of file diff --git a/client/package.json b/client/package.json index 15c0eb6..c6cd756 100755 --- a/client/package.json +++ b/client/package.json @@ -11,7 +11,7 @@ ], "homepage": "https://hyperledger.github.io/composer/", "license": "Apache-2.0", - "version": "0.15.1", + "version": "0.16.2", "publisher": "HyperledgerComposer", "icon": "icon.png", "engines": { @@ -247,11 +247,12 @@ ] }, "scripts": { - "vscode:prepublish": "tsc -p ./", - "compile": "tsc -watch -p ./", + "compile:client": "tsc -p ./", + "watch:client": "tsc -w -p ./", "update-vscode": "node ./node_modules/vscode/bin/install", "postinstall": "node ./node_modules/vscode/bin/install", - "package": "node ./node_modules/vsce/out/vsce package", + "package:vsix": "node ./node_modules/vsce/out/vsce package", + "prepublish": "tsc -p ./", "test": "" }, "devDependencies": { diff --git a/client/src/extension.ts b/client/src/extension.ts index e062a2a..eb2b82c 100755 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -27,7 +27,7 @@ export function activate(context: ExtensionContext) { let serverModule = context.asAbsolutePath(path.join('server', 'server.js')); // The debug options for the server - let debugOptions = { execArgv: ["--nolazy", "--debug=6009"] }; + let debugOptions = { execArgv: ["--nolazy", "--inspect=6009"] }; // If the extension is launched in debug mode then the debug server options are used // Otherwise the run options are used diff --git a/client/tsconfig.json b/client/tsconfig.json index 7d7667e..aafa13d 100755 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -1,8 +1,13 @@ { "compilerOptions": { + //"noUnusedLocals": true, + //"noUnusedParameters": true, + //"noImplicitAny": true, + //"noImplicitReturns": true, "target": "es6", "module": "commonjs", "moduleResolution": "node", + "rootDir": ".", "outDir": "out", "lib": [ "es2016" ], "sourceMap": true diff --git a/server/.vscode/launch.json b/server/.vscode/launch.json index 65cc085..20979d1 100755 --- a/server/.vscode/launch.json +++ b/server/.vscode/launch.json @@ -3,13 +3,17 @@ // List of configurations. Add new configurations or edit existing ones. "configurations": [ { - "name": "Attach", + "name": "Attach to Server", "type": "node", "request": "attach", + "protocol": "inspector", "port": 6009, "sourceMaps": true, - "outFiles": [ "${workspaceRoot}/../client/server/**/*.js" ], - "protocol": "legacy" + "outFiles": [ + "${workspaceRoot}/client/server/**/*.js" + ], + "preLaunchTask": "watch:server" + //"trace": "all" } ] -} +} \ No newline at end of file diff --git a/server/.vscode/tasks.json b/server/.vscode/tasks.json index 1a6ea1c..90baa33 100755 --- a/server/.vscode/tasks.json +++ b/server/.vscode/tasks.json @@ -1,15 +1,43 @@ { "version": "2.0.0", - "command": "npm", - "args": ["run", "watch"], - "isBackground": true, - "problemMatcher": "$tsc-watch", - "presentation": { - "echo": true, - "reveal": "silent", - "focus": false, - "panel": "shared" - }, - "type": "shell" - + "tasks": [ + { + "label": "compile:server", + "type": "npm", + "script": "compile:server", + "group": "build", + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": [ + "$tsc" + ] + }, + { + "label": "watch:server", + "type": "npm", + "script": "watch:server", + "isBackground": true, + "group": "build", + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": [ + "$tsc-watch" + ] + }, + { + "label": "install:server", + "group": "build", + "type": "npm", + "script": "install:server", + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": [] + } + ] } \ No newline at end of file diff --git a/server/package.json b/server/package.json index e665189..a481efb 100755 --- a/server/package.json +++ b/server/package.json @@ -1,7 +1,7 @@ { "name": "composer-support-server", "description": "HyperledgerComposer server", - "version": "0.15.1", + "version": "0.16.2", "author": "Hyperledger Composer", "publisher": "HyperledgerComposer", "license": "Apache-2.0", @@ -22,7 +22,8 @@ "typescript": "^2.1.5" }, "scripts": { - "compile": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc -p .", - "watch": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc --watch -p ." + "install:server": "installServerIntoExtension ../client ./package.json ./tsconfig.json", + "compile:server": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc -p .", + "watch:server": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc -w -p ." } } diff --git a/server/tsconfig.json b/server/tsconfig.json index 6032b82..55f57fa 100755 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "noImplicitReturns": true, "target": "es6", "module": "commonjs", "moduleResolution": "node",