#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/**
test/**
.gitignore
.git
.yarnrc
vsc-extension-quickstart.md
**/jsconfig.json
@ -10,6 +11,7 @@ vsc-extension-quickstart.md
dist/**/*.map
webpack.config.js
node_modules
src/**
out1/**
vsixmake.js
script
CHANGELOG.md

10718
package-lock.json generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,17 +1,26 @@
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const hdlFile = require('./src/hdlFs/file');
const hdlPath = require('./src/hdlFs/path');
const fspath = require('path');
const PACKAGE_PATH = './package.json';
const SAVE_FOLDER = 'dist';
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) {
const packageJS = hdlFile.pullJsonInfo(PACKAGE_PATH);
const packageJS = readJSON(PACKAGE_PATH);
packageJS.main = path;
hdlFile.pushJsonInfo(PACKAGE_PATH, packageJS);
writeJSON(PACKAGE_PATH, packageJS);
}
function findVsix() {
@ -35,10 +44,11 @@ changeMain('./src/extension');
execSync('code --uninstall-extension sterben.digital-ide');
const vsix = findVsix();
const targetPath = path.join(SAVE_FOLDER, vsix);
hdlFile.moveFile(vsix, targetPath, true);
hdlPath.deleteFolder(WEBPACK_OUT_FOLDER);
const targetPath = fspath.join(SAVE_FOLDER, vsix);
fs.copyFileSync(vsix, targetPath);
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
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;
};