- use codicons instead of svgs and remove them
- consolidate node and browser tasks into single webpack task
- use browser end point
- exclude unwanted files in .gitignore and .vscdeignore
- fix task and launch configs
This commit is contained in:
Sandeep Somavarapu 2020-08-28 22:14:01 +02:00
Родитель 3be9c272ac
Коммит 29ddc9c2eb
15 изменённых файлов: 70 добавлений и 98 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
out
dist
node_modules
.vscode-test/
*.vsix

2
.vscode/launch.json поставляемый
Просмотреть файл

@ -13,7 +13,7 @@
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: watch"
},

32
.vscode/tasks.json поставляемый
Просмотреть файл

@ -6,15 +6,31 @@
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"runOptions": {
"runOn": "folderOpen"
},
"isBackground": true,
},
{
"type": "npm",
"script": "ts-compile",
"problemMatcher": "$tsc",
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
}

Просмотреть файл

@ -1,8 +1,10 @@
.tours/**
.vscode/**
node_modules/**
src/**
.gitignore
**/tsconfig.json
**/tslint.json
**/*.map
**/*.ts
.space
package.lock.json
tsconfig.json
webpack.config.js
**/*.vsix

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" ?>
<svg height="30px" version="1.1" viewBox="0 0 30 30" width="30px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink">
<g fill="none" fill-rule="evenodd" id="arrow" stroke="none" stroke-width="20">
<g fill="#CCCCCC" id="arrow_130-next-forward-onward-direction-right" transform="translate(-90.000000, -765.000000)">
<path d="M117,779.5 C117,772.596441 111.403559,767 104.5,767 C97.5964406,767 92,772.596441 92,779.5 C92,786.403559 97.5964406,792 104.5,792 C111.403559,792 117,786.403559 117,779.5 Z M93,779.5 C93,773.148725 98.1487254,768 104.5,768 C110.851275,768 116,773.148725 116,779.5 C116,785.851275 110.851275,791 104.5,791 C98.1487254,791 93,785.851275 93,779.5 Z M100.747564,785.934509 C100.674574,785.976185 100.590068,786 100.5,786 C100.223858,786 100,785.776142 100,785.5 L100,773.5 C100,773.223858 100.223858,773 100.5,773 C100.590068,773 100.674574,773.023815 100.747564,773.065491 L111.733004,779.057549 C111.817317,779.101851 111.88992,779.170689 111.938948,779.260574 C112.071179,779.502998 111.98185,779.806716 111.739426,779.938948 L100.747564,785.934509 Z M101,784.657729 L110.455836,779.5 L101,774.342271 L101,784.657729 Z"/>
</g>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Layer_23">
<line fill="none" stroke="#CCCCCC" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" x1="16" x2="16" y1="24" y2="29"/>
<line fill="none" stroke="#CCCCCC" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" x1="11" x2="21" y1="29" y2="29"/>
<path d=" M21,16c0,2.762-2.238,5-5,5l0,0c-2.762,0-5-2.238-5-5V8c0-2.762,2.238-5,5-5l0,0c2.762,0,5,2.238,5,5V16z" fill="none" stroke="#CCCCCC" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/>
<path d=" M24,14v2c0,4.418-3.582,8-8,8l0,0c-4.418,0-8-3.582-8-8v-2h3" fill="none" stroke="#CCCCCC" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -1,7 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg height="16px" style="enable-background:new 0 0 16 16;" version="1.1" viewBox="0 0 16 16" width="16px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="_x33_2-location_-_pin_map" style="enable-background:new ;" fill="#CCCCCC">
<path d="M8,3C6.343,3,5,4.343,5,6c0,1.656,1.343,3,3,3c1.656,0,3-1.344,3-3C11,4.343,9.656,3,8,3z M8,8C6.896,8,6,7.104,6,6 s0.896-2,2-2c1.105,0,2,0.896,2,2S9.105,8,8,8z M8,0C4.686,0,2,2.686,2,6c0,3.313,6,10,6,10s6-6.687,6-10C14,2.686,11.314,0,8,0z M3,6c0-2.762,2.239-5,5-5c2.762,0,5,2.238,5,5c0,2.761-5,8.5-5,8.5S3,8.761,3,6z"/>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 775 B

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" ?>
<svg height="30px" version="1.1" viewBox="0 0 30 30" width="30px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink">
<g fill="none" fill-rule="evenodd" id="arrow" stroke="none" stroke-width="1">
<g fill="#616161" id="arrow_130-next-forward-onward-direction-right" transform="translate(-90.000000, -765.000000)">
<path d="M117,779.5 C117,772.596441 111.403559,767 104.5,767 C97.5964406,767 92,772.596441 92,779.5 C92,786.403559 97.5964406,792 104.5,792 C111.403559,792 117,786.403559 117,779.5 Z M93,779.5 C93,773.148725 98.1487254,768 104.5,768 C110.851275,768 116,773.148725 116,779.5 C116,785.851275 110.851275,791 104.5,791 C98.1487254,791 93,785.851275 93,779.5 Z M100.747564,785.934509 C100.674574,785.976185 100.590068,786 100.5,786 C100.223858,786 100,785.776142 100,785.5 L100,773.5 C100,773.223858 100.223858,773 100.5,773 C100.590068,773 100.674574,773.023815 100.747564,773.065491 L111.733004,779.057549 C111.817317,779.101851 111.88992,779.170689 111.938948,779.260574 C112.071179,779.502998 111.98185,779.806716 111.739426,779.938948 L100.747564,785.934509 Z M101,784.657729 L110.455836,779.5 L101,774.342271 L101,784.657729 Z"/>
</g>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg enable-background="new 0 0 32 32" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Layer_23">
<line fill="none" stroke="#616161" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" x1="16" x2="16" y1="24" y2="29"/>
<line fill="none" stroke="#616161" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" x1="11" x2="21" y1="29" y2="29"/>
<path d=" M21,16c0,2.762-2.238,5-5,5l0,0c-2.762,0-5-2.238-5-5V8c0-2.762,2.238-5,5-5l0,0c2.762,0,5,2.238,5,5V16z" fill="none" stroke="#616161" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/>
<path d=" M24,14v2c0,4.418-3.582,8-8,8l0,0c-4.418,0-8-3.582-8-8v-2h3" fill="none" stroke="#616161" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -1,7 +0,0 @@
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg height="16px" style="enable-background:new 0 0 16 16;" version="1.1" viewBox="0 0 16 16" width="16px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="_x33_2-location_-_pin_map" style="enable-background:new ;" fill="#616161">
<path d="M8,3C6.343,3,5,4.343,5,6c0,1.656,1.343,3,3,3c1.656,0,3-1.344,3-3C11,4.343,9.656,3,8,3z M8,8C6.896,8,6,7.104,6,6 s0.896-2,2-2c1.105,0,2,0.896,2,2S9.105,8,8,8z M8,0C4.686,0,2,2.686,2,6c0,3.313,6,10,6,10s6-6.687,6-10C14,2.686,11.314,0,8,0z M3,6c0-2.762,2.239-5,5-5c2.762,0,5,2.238,5,5c0,2.761-5,8.5-5,8.5S3,8.761,3,6z"/>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 775 B

Просмотреть файл

@ -15,7 +15,7 @@
"license": "ISC",
"icon": "images/icon.png",
"engines": {
"vscode": "^1.40.0"
"vscode": "^1.48.0"
},
"categories": [
"Other"
@ -25,12 +25,14 @@
"Sharing"
],
"extensionKind": [
"web",
"workspace"
],
"activationEvents": [
"*"
],
"main": "./out/extension.js",
"main": "./dist/extension-node.js",
"browser": "./dist/extension-web.js",
"contributes": {
"configuration": {
"type": "object",
@ -581,11 +583,9 @@
"webpack-merge": "^4.2.2"
},
"scripts": {
"build": "webpack --config webpack.config.js",
"build:web": "webpack --config webpack.web.js",
"build": "webpack --mode production",
"vscode:prepublish": "npm run build",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"watch": "webpack --mode development --watch",
"postinstall": "node ./node_modules/vscode/bin/install",
"package": "vsce package"
},

Просмотреть файл

@ -14,8 +14,8 @@ import { CodeTourNode, CodeTourStepNode } from "./nodes";
class CodeTourTreeProvider implements TreeDataProvider<TreeItem>, Disposable {
private _disposables: Disposable[] = [];
private _onDidChangeTreeData = new EventEmitter<TreeItem>();
public readonly onDidChangeTreeData: Event<TreeItem> = this
private _onDidChangeTreeData = new EventEmitter<TreeItem | undefined>();
public readonly onDidChangeTreeData: Event<TreeItem | undefined> = this
._onDidChangeTreeData.event;
constructor(private extensionPath: string) {
@ -36,7 +36,7 @@ class CodeTourTreeProvider implements TreeDataProvider<TreeItem>, Disposable {
: null
],
() => {
this._onDidChangeTreeData.fire();
this._onDidChangeTreeData.fire(undefined);
}
);
}

Просмотреть файл

@ -1,4 +1,3 @@
import * as path from "path";
import { ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from "vscode";
import { CONTENT_URI, EXTENSION_NAME, FS_SCHEME } from "../constants";
import { CodeTour, store } from "../store";
@ -43,16 +42,11 @@ export class CodeTourNode extends TreeItem {
this.contextValue = contextValues.join(".");
const icon = isRecording(tour)
? "tour-recording"
this.iconPath = isRecording(tour)
? new ThemeIcon("record")
: isActive
? "tour-active"
: "tour";
this.iconPath = {
dark: path.join(extensionPath, `images/dark/${icon}.svg`),
light: path.join(extensionPath, `images/light/${icon}.svg`)
};
? new ThemeIcon("play-circle")
: new ThemeIcon("location");
}
}

Просмотреть файл

@ -1,16 +1,8 @@
const path = require("path");
const webpack = require("webpack");
module.exports = {
mode: "production",
target: "node",
const config = {
entry: "./src/extension.ts",
output: {
path: path.resolve(__dirname, "out"),
filename: "extension.js",
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]"
},
devtool: "source-map",
externals: {
vscode: "commonjs vscode"
@ -44,3 +36,27 @@ module.exports = {
})
]
};
const nodeConfig = {
...config,
target: 'node',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'extension-node.js',
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]",
}
};
const webConfig = {
...config,
target: 'webworker',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'extension-web.js',
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]",
}
};
module.exports = [nodeConfig, webConfig];

Просмотреть файл

@ -1,6 +0,0 @@
const devConfig = require("./webpack.config.js");
const merge = require("webpack-merge");
module.exports = merge(devConfig, {
target: "webworker"
});