Commit a24d0ad0 authored by Timon Stampfli's avatar Timon Stampfli

adding webpack bundling

parent 35641bbe
out
dist
node_modules
.vscode-test/
*.vsix
......
......@@ -34,12 +34,12 @@ build-helper:
variables:
GO111MODULE: "on"
script:
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./out/helper-linux-amd64 ./helper
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./out/helper-windows-amd64.exe ./helper
- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./out/helper-darwin-amd64 ./helper
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./dist/helper-linux-amd64 ./helper
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./dist/helper-windows-amd64.exe ./helper
- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./dist/helper-darwin-amd64 ./helper
artifacts:
untracked: false
paths:
- out/helper*
- dist/helper*
expire_in: 1 day
......@@ -8,3 +8,5 @@ tsconfig.json
vsc-extension-quickstart.md
tslint.json
helper/**
out
node_modules
This diff is collapsed.
......@@ -24,7 +24,7 @@
"onView:soicode-samples",
"workspaceContains:soiworkspace.json"
],
"main": "./out/extension",
"main": "./dist/extension",
"repository": {
"type": "git",
"url": "https://git.dolansoft.org/timon/soicode.git"
......@@ -259,13 +259,14 @@
"icon": "images/soilogo.png",
"homepage": "https://soi.ch",
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile",
"build-package": "vsce package",
"test": "node ./out/test/runTest.js",
"validateGitTag": "if [ $npm_package_version != $CI_COMMIT_TAG ]; then exit 1; fi"
"validateGitTag": "if [ $npm_package_version != $CI_COMMIT_TAG ]; then exit 1; fi",
"vscode:prepublish": "webpack --mode production",
"webpack": "webpack --mode production"
},
"devDependencies": {
"@types/fs-extra": "^5.0.4",
......@@ -275,10 +276,13 @@
"@types/vscode": "^1.33.0",
"glob": "^7.1.4",
"mocha": "^6.1.4",
"ts-loader": "^6.2.0",
"tslint": "^5.12.1",
"typescript": "^3.3.1",
"vsce": "^1.67.1",
"vscode-test": "^1.2.0"
"vscode-test": "^1.2.0",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9"
},
"dependencies": {
"fs-extra": "^7.0.0",
......
'use strict';
"use strict";
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as path from 'path';
import * as vscode from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient';
import * as path from "path";
import * as vscode from "vscode";
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind
} from "vscode-languageclient";
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
// The server is implemented in node
let serverModule = context.asAbsolutePath(path.join('out', 'better-stoml', 'server', 'tomlServerMain.js'));
// The server is implemented in node
let serverModule = context.asAbsolutePath(
path.join("dist", "better-stoml", "server", "tomlServerMain.js")
);
// The debug options for the server
let debugOptions = { execArgv: ["--nolazy", "--inspect=6004"] };
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
let serverOptions: ServerOptions = {
run : { module: serverModule, transport: TransportKind.ipc },
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
run: { module: serverModule, transport: TransportKind.ipc },
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions
}
};
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: ['stoml'],
documentSelector: ["stoml"],
synchronize: {
// Synchronize the setting section 'toml' and 'http' to the server
configurationSection: ['stoml.schemas', 'http.proxy', 'http.proxyStrictSSL'],
configurationSection: [
"stoml.schemas",
"http.proxy",
"http.proxyStrictSSL"
],
// Notify the server about file changes to '.toml files contain in the workspace
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.soitask')
fileEvents: vscode.workspace.createFileSystemWatcher("**/*.soitask")
}
};
// Create the language client and start the client.
let disposable = new LanguageClient('STOML Language Server', serverOptions, clientOptions).start();
// Push the disposable to the context's subscriptions so that the
let disposable = new LanguageClient(
"STOML Language Server",
serverOptions,
clientOptions
).start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable);
}
// this method is called when your extension is deactivated
export function deactivate() {
}
\ No newline at end of file
export function deactivate() {}
......@@ -7,7 +7,7 @@ import { determinePlatform, executableFileEnding } from "./util";
export function getHelperPath(store: Store): string {
return path.join(
store.soicodeExtensionOutPath,
store.soicodeExtensionDistPath,
`helper-${determinePlatform()}${executableFileEnding()}`
);
}
......
......@@ -22,7 +22,7 @@ export class Store {
workspace: WorkspaceState;
soicodeExtensionDataPath: string;
soicodeExtensionImagePath: string;
soicodeExtensionOutPath: string;
soicodeExtensionDistPath: string;
fileChangeSubscribers: (() => void)[];
allSampleChangeSubscribers: (() => void)[];
sampleUpdateSubscriber: ((s: string) => void)[];
......@@ -30,7 +30,7 @@ export class Store {
constructor(context: vscode.ExtensionContext) {
this.soicodeExtensionDataPath = context.globalStoragePath;
this.soicodeExtensionImagePath = context.asAbsolutePath("images");
this.soicodeExtensionOutPath = context.asAbsolutePath("out");
this.soicodeExtensionDistPath = context.asAbsolutePath("dist");
this.evaluations = new Map();
this.workspace = emptyWorkspaceState;
this.samples = new Map();
......
//@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.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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment