Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
Update composer-common & make extension debugging work (#53)
Browse files Browse the repository at this point in the history
* Update composer-common & make extention debugging work

Signed-off-by: m-g-k <[email protected]>

* Fix build break

Signed-off-by: m-g-k <[email protected]>
  • Loading branch information
m-g-k authored and mbwhite committed Dec 15, 2017
1 parent 8f5725d commit e65bd3d
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 58 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm-debug.log
4 changes: 2 additions & 2 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
47 changes: 39 additions & 8 deletions client/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}
64 changes: 40 additions & 24 deletions client/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
}
]
}
9 changes: 5 additions & 4 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 8 additions & 4 deletions server/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
}
52 changes: 40 additions & 12 deletions server/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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": []
}
]
}
7 changes: 4 additions & 3 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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 ."
}
}
1 change: 1 addition & 0 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"noImplicitReturns": true,
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
Expand Down

0 comments on commit e65bd3d

Please sign in to comment.