提交 062084c0 编写于 作者: R Rachel Macfarlane

Refactoring

上级 9acfd66a
......@@ -122,12 +122,17 @@
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./"
"compile": "tsc -watch -p ./",
"watch": "npm run build-preview && npm run compile",
"build-preview": "webpack --mode development"
},
"devDependencies": {
"@types/lodash": "^4.14.106",
"@types/node": "*",
"typescript": "^2.1.4"
"typescript": "^2.1.4",
"webpack": "^4.1.0",
"webpack-cli": "^2.0.10",
"ts-loader": "^4.0.1"
},
"dependencies": {
"@octokit/rest": "^15.2.6",
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare var acquireVsCodeApi: any;
const vscode = acquireVsCodeApi();
window.addEventListener('message', event => {
const message = event.data; // The json data that the extension sent
switch (message.command) {
case 'refactor':
console.log('hahah');
break;
default:
break;
}
});
\ No newline at end of file
{
"compilerOptions": {
"outDir": "./dist/",
"module": "commonjs",
"target": "es6",
"jsx": "react",
"sourceMap": true,
"strict": true,
"noImplicitAny": true,
"noUnusedLocals": true
}
}
\ No newline at end of file
......@@ -53,11 +53,31 @@ export function registerCommands(context: vscode.ExtensionContext) {
);
}
panel.webview.html = await getWebviewContent(pr);
panel.webview.html = getHtmlForWebview(); //await getWebviewContent(pr);
}));
let md = new MarkdownIt();
function getHtmlForWebview() {
const scriptPathOnDisk = vscode.Uri.file(path.join(this._extensionPath, 'media', 'index.js'));
const scriptUri = scriptPathOnDisk.with({ scheme: 'vscode-resource' });
const nonce = new Date().getTime() + '' + new Date().getMilliseconds();
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src vscode-resource: https:; script-src 'nonce-${nonce}';">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cat Coding</title>
</head>
<body>
<script nonce="${nonce}" src="${scriptUri}"></script>
</body>
</html>`;
}
async function getWebviewContent(pr: PullRequestModel) {
const timelineEvents = await pr.getTimelineEvents();
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const path = require('path');
module.exports = {
entry: {
index: './preview-src/index.ts'
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
devtool: 'inline-source-map',
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'media')
}
};
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册