#modify package.json

This commit is contained in:
锦恢 2023-07-16 01:59:45 +08:00
parent 4083925e6d
commit ca4786ce41
6 changed files with 6319 additions and 6262 deletions

View File

@ -2,6 +2,7 @@
.vscode-test/** .vscode-test/**
test/** test/**
.gitignore .gitignore
.git
.yarnrc .yarnrc
vsc-extension-quickstart.md vsc-extension-quickstart.md
**/jsconfig.json **/jsconfig.json
@ -10,6 +11,7 @@ vsc-extension-quickstart.md
dist/**/*.map dist/**/*.map
webpack.config.js webpack.config.js
node_modules node_modules
src/** out1/**
vsixmake.js vsixmake.js
script script
CHANGELOG.md

2
package-lock.json generated
View File

@ -21,7 +21,7 @@
"@types/mocha": "^10.0.0", "@types/mocha": "^10.0.0",
"@types/node": "16.x", "@types/node": "16.x",
"@types/showdown": "^2.0.0", "@types/showdown": "^2.0.0",
"@types/vscode": "^1.74.0", "@types/vscode": "^1.72.0",
"@typescript-eslint/eslint-plugin": "^5.42.0", "@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0", "@typescript-eslint/parser": "^5.42.0",
"@vscode/test-electron": "^2.2.0", "@vscode/test-electron": "^2.2.0",

View File

@ -1,12 +1,32 @@
{ {
"name": "digital-ide", "name": "digital-ide",
"displayName": "digital-ide", "displayName": "Digital IDE",
"description": "all in one vscode plugin for Verilog/VHDL development", "description": "all in one vscode plugin for Verilog/VHDL development",
"publisher": "sterben",
"homepage": "https://digital-eda.github.io/DIDE-doc-Cn",
"version": "0.3.0", "version": "0.3.0",
"main": "./out1/extension",
"icon": "images/DIDE.png",
"engines": { "engines": {
"vscode": "^1.72.0" "vscode": "^1.72.0"
}, },
"main": "./out/extension.js", "keywords": [
"FPGA Develop Support",
"FPGA",
"ASIC",
"IC",
"Digital",
"HDL",
"Systemverilog",
"Verilog",
"VHDL",
"Vivado",
"Xilinx"
],
"repository": {
"type": "git",
"url": "https://github.com/Digital-EDA/Digital-IDE"
},
"categories": [ "categories": [
"Extension Packs", "Extension Packs",
"Programming Languages", "Programming Languages",
@ -914,7 +934,7 @@
} }
}, },
"scripts": { "scripts": {
"vscode:prepublish": "npm run compile", "vscode:prepublish": "webpack --mode production",
"compile": "tsc -p ./", "compile": "tsc -p ./",
"watch": "tsc -watch -p ./", "watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint", "pretest": "npm run compile && npm run lint",
@ -926,7 +946,7 @@
"@types/mocha": "^10.0.0", "@types/mocha": "^10.0.0",
"@types/node": "16.x", "@types/node": "16.x",
"@types/showdown": "^2.0.0", "@types/showdown": "^2.0.0",
"@types/vscode": "^1.74.0", "@types/vscode": "^1.72.0",
"@typescript-eslint/eslint-plugin": "^5.42.0", "@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0", "@typescript-eslint/parser": "^5.42.0",
"@vscode/test-electron": "^2.2.0", "@vscode/test-electron": "^2.2.0",

View File

@ -2,7 +2,7 @@
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "commonjs",
"target": "ES2020", "target": "ES2020",
"outDir": "out", "outDir": "out1",
"skipLibCheck": true, "skipLibCheck": true,
"lib": [ "lib": [
"ES2020" "ES2020"

View File

@ -1,17 +1,26 @@
const { execSync } = require('child_process'); const { execSync } = require('child_process');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const fspath = require('path');
const hdlFile = require('./src/hdlFs/file');
const hdlPath = require('./src/hdlFs/path');
const PACKAGE_PATH = './package.json'; const PACKAGE_PATH = './package.json';
const SAVE_FOLDER = 'dist'; const SAVE_FOLDER = 'dist';
const WEBPACK_OUT_FOLDER = 'out'; const WEBPACK_OUT_FOLDER = 'out';
function readJSON(path) {
const context = fs.readFileSync(path, 'utf-8');
return JSON.parse(context);
}
function writeJSON(path, obj) {
const jsonString = JSON.stringify(obj, null, '\t');
fs.writeFileSync(path, jsonString);
}
function changeMain(path) { function changeMain(path) {
const packageJS = hdlFile.pullJsonInfo(PACKAGE_PATH); const packageJS = readJSON(PACKAGE_PATH);
packageJS.main = path; packageJS.main = path;
hdlFile.pushJsonInfo(PACKAGE_PATH, packageJS); writeJSON(PACKAGE_PATH, packageJS);
} }
function findVsix() { function findVsix() {
@ -35,10 +44,11 @@ changeMain('./src/extension');
execSync('code --uninstall-extension sterben.digital-ide'); execSync('code --uninstall-extension sterben.digital-ide');
const vsix = findVsix(); const vsix = findVsix();
const targetPath = path.join(SAVE_FOLDER, vsix); const targetPath = fspath.join(SAVE_FOLDER, vsix);
hdlFile.moveFile(vsix, targetPath, true); fs.copyFileSync(vsix, targetPath);
hdlPath.deleteFolder(WEBPACK_OUT_FOLDER); fs.unlinkSync(vsix);
fs.rm(WEBPACK_OUT_FOLDER, { recursive: true, force: true }, () => {});
const vsixPath = hdlPath.join(SAVE_FOLDER, vsix); const vsixPath = fspath.join(SAVE_FOLDER, vsix);
// install new one // install new one
execSync('code --install-extension ' + vsixPath); execSync('code --install-extension ' + vsixPath);

25
webpack.config.js Normal file
View File

@ -0,0 +1,25 @@
const path = require('path');
const config = {
target: 'node',
entry: './out1/extension.js',
output: {
path: path.resolve(__dirname, 'out'),
filename: 'extension.js',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]',
},
externals: {
vscode: 'commonjs vscode'
},
resolve: {
extensions: ['.ts', '.js'],
},
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {
config.devtool = 'source-map';
}
return config;
};