From 9af720c3c017f83e93dd9c46678396843f4defb6 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Sun, 10 May 2020 20:49:06 +0200 Subject: [PATCH] Use webpack for distribution and bump version to 0.1.2 --- .gitignore | 1 + .vscode/launch.json | 4 +-- .vscodeignore | 9 ++--- GodotDebugSession/GodotDebugSession.csproj | 3 +- Makefile | 22 +++++++----- package.json | 16 +++++---- webpack.config.js | 41 ++++++++++++++++++++++ 7 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore index 27c0b6f..0692f98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ out +dist node_modules .vscode-test/ *.vsix diff --git a/.vscode/launch.json b/.vscode/launch.json index f8c04c0..3fa7569 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,9 +10,9 @@ "--extensionDevelopmentPath=${workspaceFolder}" ], "outFiles": [ - "${workspaceFolder}/out/**/*.js" + "${workspaceFolder}/dist/**/*.js" ], - "preLaunchTask": "npm: compile-tsc" + "preLaunchTask": "npm: compile-tsc-debug" } ] } diff --git a/.vscodeignore b/.vscodeignore index 3f853af..abbea0b 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,6 +1,8 @@ +.gitmodules +.gitignore .vscode/** .vscode-test/** -out/test/** +out/** src/** .gitignore vsc-extension-quickstart.md @@ -9,9 +11,8 @@ vsc-extension-quickstart.md **/*.map **/*.ts node_modules/** +webpack.config.js thirdparty/** GodotDebugSession/** !GodotDebugSession/bin/Release/* -!node_modules/vscode-debugprotocol/**/* -!node_modules/promise-socket/**/* -!node_modules/chokidar/**/* \ No newline at end of file +!dist/** \ No newline at end of file diff --git a/GodotDebugSession/GodotDebugSession.csproj b/GodotDebugSession/GodotDebugSession.csproj index 4fd0e96..22f2d75 100644 --- a/GodotDebugSession/GodotDebugSession.csproj +++ b/GodotDebugSession/GodotDebugSession.csproj @@ -11,13 +11,13 @@ GodotDebugSession v4.7.2 512 + ..\dist\GodotDebugSession\ AnyCPU true full false - bin\Debug\ DEBUG;TRACE prompt 4 @@ -26,7 +26,6 @@ AnyCPU pdbonly true - bin\Release\ TRACE prompt 4 diff --git a/Makefile b/Makefile index c534b40..b2ceb8c 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,34 @@ -SOLUTION_DIR = "./GodotDebugSession/" +SOLUTION_DIR="./GodotDebugSession/" -GODOT_DEBUG_SESSION_RELEASE = "$(SOLUTION_DIR)/bin/Release/GodotDebugSession.exe" -GODOT_DEBUG_SESSION_DEBUG = "$(SOLUTION_DIR)/bin/Debug/GodotDebugSession.exe" +GODOT_DEBUG_SESSION="./dist/GodotDebugSession/GodotDebugSession.exe" -all: vsix +all: package @echo "vsix created" -vsix: build +package: build ./node_modules/.bin/vsce package publish: build ./node_modules/.bin/vsce publish -build: $(GODOT_DEBUG_SESSION_RELEASE) tsc +build: $(GODOT_DEBUG_SESSION) tsc @echo "build finished" -build-debug: $(GODOT_DEBUG_SESSION_DEBUG) tsc +build-debug: $(GODOT_DEBUG_SESSION)-debug tsc-debug @echo "build finished" tsc: node_modules/.bin/tsc -p ./ + webpack --mode production -$(GODOT_DEBUG_SESSION_RELEASE): +tsc-debug: + node_modules/.bin/tsc -p ./ + webpack --mode development + +$(GODOT_DEBUG_SESSION): msbuild /p:Configuration=Release $(SOLUTION_DIR)/GodotDebugSession.sln -$(GODOT_DEBUG_SESSION_DEBUG): +$(GODOT_DEBUG_SESSION)-debug: msbuild /p:Configuration=Debug $(SOLUTION_DIR)/GodotDebugSession.sln clean: diff --git a/package.json b/package.json index 7ed0ffd..9230aea 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "C# Tools for Godot", "description": "Debugger and utilities for working with Godot C# projects", "icon": "icon.png", - "version": "0.1.1", + "version": "0.1.2", "publisher": "neikeq", "license": "MIT", "repository": { @@ -21,11 +21,12 @@ "workspaceContains:project.godot", "onDebugResolve:godot" ], - "main": "./out/extension.js", + "main": "./dist/extension.bundled.js", "scripts": { "vscode:prepublish": "make build", "compile": "make build", "compile-tsc": "make tsc", + "compile-tsc-debug": "make tsc-debug", "watch": "tsc -watch -p ./" }, "dependencies": { @@ -43,11 +44,14 @@ "@types/node": "^10.12.21", "@types/vscode": "^1.28.0", "glob": "^7.1.4", + "make": "^0.8.1", "mocha": "^6.1.4", - "typescript": "^3.3.1", + "ts-loader": "^7.0.3", "tslint": "^5.12.1", + "typescript": "^3.3.1", "vsce": "^1.20.0", - "make": "^0.8.1" + "webpack": "^4.43.0", + "webpack-cli": "^3.3.11" }, "breakpoints": [ { @@ -68,7 +72,7 @@ "fsharp" ] }, - "program": "./GodotDebugSession/bin/Release/GodotDebugSession.exe", + "program": "./dist/GodotDebugSession/GodotDebugSession.exe", "osx": { "runtime": "mono" }, @@ -154,4 +158,4 @@ } ] } -} \ No newline at end of file +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..0e0f81e --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,41 @@ +//@ts-check + +'use strict'; + +const path = require('path'); + +/**@type {import('webpack').Configuration}*/ +const config = { + target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ + + entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ + output: { + // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ + path: path.resolve(__dirname, 'dist'), + filename: 'extension.bundled.js', + libraryTarget: 'commonjs2', + devtoolModuleFilenameTemplate: '../[resource-path]' + }, + devtool: 'source-map', + externals: { + vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ + }, + resolve: { + // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader + extensions: ['.ts', '.js'] + }, + module: { + rules: [ + { + test: /\.ts$/, + exclude: /node_modules/, + use: [ + { + loader: 'ts-loader' + } + ] + } + ] + } +}; +module.exports = config;