Skip to content

Commit faedb01

Browse files
committed
add missing deploy script
1 parent 40ba22c commit faedb01

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"out": true // set this to false to include "out" folder in search results
88
},
99
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10-
"typescript.tsc.autoDetect": "off"
10+
"typescript.tsc.autoDetect": "off",
11+
"cmake.configureOnOpen": false
1112
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"watch": "tsc -watch -p ./",
5555
"pretest": "npm run compile && npm run lint",
5656
"lint": "eslint src --ext ts",
57-
"test": "node ./out/test/runTest.js"
57+
"test": "node ./out/test/runTest.js",
58+
"deploy": "npx vsce publish"
5859
},
5960
"devDependencies": {
6061
"@types/vscode": "^1.77.0",

src/utils/fs.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as vscode from "vscode";
2+
import { storageFileName } from "../config";
3+
4+
/**
5+
* check for existance of the storge folder with store file if not exist create it
6+
*/
7+
export async function initStorge(
8+
workspaceFs: vscode.FileSystem,
9+
uri: vscode.Uri
10+
) {
11+
try {
12+
const content = await workspaceFs.stat(uri);
13+
console.log(
14+
"🪵 [fsUtils.ts:6] ~ token ~ \x1b[0;32mcontent\x1b[0m = ",
15+
content
16+
);
17+
} catch (err) {
18+
if (
19+
err instanceof vscode.FileSystemError &&
20+
err.code === "FileNotFound"
21+
) {
22+
console.log(err.code);
23+
// create storge
24+
await workspaceFs.createDirectory(uri);
25+
await workspaceFs.writeFile(
26+
vscode.Uri.joinPath(uri, storageFileName),
27+
new Uint8Array([1, 2])
28+
);
29+
console.log(
30+
"storge was not found and created folder for it, and file for storage called",
31+
storageFileName
32+
);
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)