fix(build): add vscode:prepublish script to ensure compilation before vsce package
This commit is contained in:
1
extension/LICENSE
Normal file
1
extension/LICENSE
Normal file
@@ -0,0 +1 @@
|
||||
MIT License
|
||||
@@ -105,16 +105,19 @@ function detectProjectName() {
|
||||
if (folders && folders.length > 0) {
|
||||
const cwd = folders[0].uri.fsPath;
|
||||
try {
|
||||
const remoteUrl = cp.execSync('git remote get-url origin', {
|
||||
cwd, encoding: 'utf-8', timeout: 2000, windowsHide: true, stdio: ['ignore', 'pipe', 'ignore']
|
||||
}).toString().trim();
|
||||
const match = remoteUrl.match(/\/([^\/]+?)(?:\.git)?$/);
|
||||
if (match && match[1]) {
|
||||
return match[1].toLowerCase().replace(/[\s\-]+/g, '_');
|
||||
const gitConfig = path.join(cwd, '.git', 'config');
|
||||
if (fs.existsSync(gitConfig)) {
|
||||
const cfg = fs.readFileSync(gitConfig, 'utf-8');
|
||||
const match = cfg.match(/url\s*=\s*(.*?)\n/);
|
||||
if (match && match[1]) {
|
||||
const repo = match[1].trim().match(/\/([^\/]+?)(?:\.git)?$/);
|
||||
if (repo && repo[1])
|
||||
return repo[1].toLowerCase().replace(/[\s]+/g, '_');
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return path.basename(cwd).toLowerCase().replace(/[\s\-]+/g, '_');
|
||||
return path.basename(cwd).toLowerCase().replace(/[\s]+/g, '_');
|
||||
}
|
||||
return 'default';
|
||||
}
|
||||
@@ -265,7 +268,7 @@ async function fixLSConnection() {
|
||||
// Generate the workspace hint the same way SDK does, but we'll match case-insensitively
|
||||
const folder = folders[0].uri.fsPath;
|
||||
const parts = folder.replace(/\\/g, '/').split('/');
|
||||
const hint = parts.slice(-2).join('_').replace(/[-.\s]/g, '_').toLowerCase();
|
||||
const hint = parts.slice(-2).join('_').replace(/[^a-z0-9]/gi, '').toLowerCase();
|
||||
if (!hint) {
|
||||
logToFile('[LS-FIX] skipped: empty hint');
|
||||
return false;
|
||||
@@ -300,7 +303,7 @@ async function fixLSConnection() {
|
||||
// Match workspace_id arg against our hint
|
||||
const wsMatch = line.match(/--workspace_id[= ](\S+)/i);
|
||||
if (wsMatch) {
|
||||
const wsid = wsMatch[1].toLowerCase();
|
||||
const wsid = wsMatch[1].replace(/[^a-z0-9]/gi, '').toLowerCase();
|
||||
if (wsid.includes(hint)) {
|
||||
matchedLine = line;
|
||||
break;
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
extension/package-lock.json
generated
4
extension/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "gravity-bridge",
|
||||
"version": "0.5.15",
|
||||
"version": "0.5.17",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gravity-bridge",
|
||||
"version": "0.5.15",
|
||||
"version": "0.5.17",
|
||||
"dependencies": {
|
||||
"ws": "^8.19.0"
|
||||
},
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"name": "gravity-bridge",
|
||||
"displayName": "Gravity Bridge",
|
||||
"description": "Antigravity ↔ Discord 브리지 연동 확장",
|
||||
"version": "0.5.16",
|
||||
"version": "0.5.17",
|
||||
"publisher": "variet",
|
||||
"repository": {"type": "git", "url": "https://github.com/dummy"},
|
||||
"engines": {
|
||||
"vscode": "^1.100.0"
|
||||
},
|
||||
@@ -16,6 +17,7 @@
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./ && node -e \"const fs=require('fs'),p=require('path');const s=p.join('src','sdk'),d=p.join('out','sdk');if(fs.existsSync(s)){fs.mkdirSync(d,{recursive:true});fs.readdirSync(s).forEach(f=>fs.copyFileSync(p.join(s,f),p.join(d,f)));console.log('SDK copied to out/sdk')};\"",
|
||||
"watch": "tsc -watch -p ./"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user