Skip to content

Commit b40e71a

Browse files
authored
Merge pull request #103 from LISTENAI/master_v2
v2.0.0 publish
2 parents 5527265 + 7e1ca7b commit b40e71a

File tree

11 files changed

+1682
-1565
lines changed

11 files changed

+1682
-1565
lines changed

package.json

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
{
2-
"name": "@lisa-plugin/zephyr",
3-
"version": "1.7.3-beta.1",
4-
"description": "LISA plugin for Zephyr",
5-
"main": "./lib/main.js",
6-
"engines": {
7-
"node": ">=16",
8-
"git": ">=2"
9-
},
10-
"scripts": {
11-
"build": "tsc -p . && node prebuild",
12-
"watch": "nodemon --exec npm run build -w ./src -e ts",
13-
"prepublishOnly": "npm run build",
14-
"postinstall": "lisa zep install",
15-
"test": "cross-env NODE_ENV=test jest --verbose --testTimeout=1200000"
16-
},
17-
"lisa": {
18-
"friendlyName": "zep",
19-
"taskPath": "./lib/tasks",
20-
"completion": "./lib/completion.js"
21-
},
22-
"repository": {
23-
"type": "git",
24-
"url": "git+https://github.com/LISTENAI/lisa-plugin-zephyr.git"
25-
},
26-
"author": "LISTENAI",
27-
"maintainers": [
28-
"lpmadmin <[email protected]>",
29-
"xychen <[email protected]>",
30-
"zbzhao <[email protected]>",
31-
32-
],
33-
"license": "UNLICENSED",
34-
"files": [
35-
"lib",
36-
"scripts",
37-
"vscode",
38-
"plugin"
39-
],
40-
"bugs": {
41-
"url": "https://github.com/LISTENAI/lisa-plugin-zephyr/issues"
42-
},
43-
"homepage": "https://github.com/LISTENAI/lisa-plugin-zephyr#readme",
44-
"dependencies": {
45-
"7zip-bin": "^5.2.0",
46-
"@binary/cmake": "^1.1.3-3.25.3",
47-
"@binary/dtc": "^1.1.2-1.6.0",
48-
"@binary/gperf": "^1.0.1-3.1",
49-
"@binary/mklfs": "^1.0.1-1.0.0",
50-
"@binary/ninja": "^1.1.2-1.11.1",
51-
"@binary/protoc": "^1.0.0-3.19.1",
52-
"@binary/python-3.9": "^2.0.2-3.9.7",
53-
"@binary/type": "^1.0.4",
54-
"@binary/xz": "^1.1.1-5.2.5",
55-
"@lisa-env/type": "^1.2.0",
56-
"@listenai/lisa_core": "^2.0.5",
57-
"@sentry/node": "5.20.0",
58-
"@tool/lpk": "1.1.0",
59-
"@types/jest": "^27.4.1",
60-
"cross-env": "^7.0.3",
61-
"glob": "^7.2.0",
62-
"ini": "^2.0.0",
63-
"inquirer": "^8.1.0",
64-
"inquirer-file-tree-selection-prompt": "^1.0.19",
65-
"jest": "^27.5.1",
66-
"js-yaml": "^4.1.0",
67-
"lodash": "^4.17.21",
68-
"simple-git": "^2.48.0",
69-
"ts-jest": "^27.1.4"
70-
},
71-
"devDependencies": {
72-
"@types/glob": "^7.2.0",
73-
"@types/ini": "^1.3.31",
74-
"@types/inquirer": "^8.2.1",
75-
"@types/js-yaml": "^4.0.5",
76-
"@types/lodash": "^4.14.177",
77-
"@types/minimist": "^1.2.2",
78-
"@types/node": "^16.11.1",
79-
"@types/tabtab": "^3.0.2",
80-
"nodemon": "^2.0.13",
81-
"tabtab": "^3.0.2",
82-
"typescript": "^4.4.4"
83-
}
84-
}
1+
{
2+
"name": "@lisa-plugin/zephyr",
3+
"version": "2.0.0",
4+
"description": "LISA plugin for Zephyr",
5+
"main": "./lib/main.js",
6+
"engines": {
7+
"node": ">=16",
8+
"git": ">=2"
9+
},
10+
"scripts": {
11+
"build": "tsc -p . && node prebuild",
12+
"watch": "nodemon --exec npm run build -w ./src -e ts",
13+
"prepublishOnly": "npm run build",
14+
"postinstall": "lisa zep install",
15+
"test": "cross-env NODE_ENV=test jest --verbose --testTimeout=1200000"
16+
},
17+
"lisa": {
18+
"friendlyName": "zep",
19+
"taskPath": "./lib/tasks",
20+
"completion": "./lib/completion.js"
21+
},
22+
"repository": {
23+
"type": "git",
24+
"url": "git+https://github.com/LISTENAI/lisa-plugin-zephyr.git"
25+
},
26+
"author": "LISTENAI",
27+
"maintainers": [
28+
"lpmadmin <[email protected]>",
29+
"xychen <[email protected]>",
30+
"zbzhao <[email protected]>",
31+
32+
],
33+
"license": "UNLICENSED",
34+
"files": [
35+
"lib",
36+
"scripts",
37+
"vscode",
38+
"plugin"
39+
],
40+
"bugs": {
41+
"url": "https://github.com/LISTENAI/lisa-plugin-zephyr/issues"
42+
},
43+
"homepage": "https://github.com/LISTENAI/lisa-plugin-zephyr#readme",
44+
"dependencies": {
45+
"7zip-bin": "^5.2.0",
46+
"@binary/cmake": "^1.1.3-3.25.3",
47+
"@binary/dtc": "^1.1.2-1.6.0",
48+
"@binary/gperf": "^1.0.1-3.1",
49+
"@binary/mklfs": "^1.0.1-1.0.0",
50+
"@binary/ninja": "^1.1.2-1.11.1",
51+
"@binary/protoc": "^1.0.0-3.19.1",
52+
"@binary/python-3.9": "^2.0.2-3.9.7",
53+
"@binary/type": "^1.0.4",
54+
"@binary/xz": "^1.1.1-5.2.5",
55+
"@lisa-env/type": "^1.2.0",
56+
"@listenai/lisa_core": "^2.0.5",
57+
"@sentry/node": "5.20.0",
58+
"@tool/lpk": "1.1.0",
59+
"@types/jest": "^27.4.1",
60+
"cross-env": "^7.0.3",
61+
"glob": "^7.2.0",
62+
"ini": "^2.0.0",
63+
"inquirer": "^8.1.0",
64+
"inquirer-file-tree-selection-prompt": "^1.0.19",
65+
"jest": "^27.5.1",
66+
"js-yaml": "^4.1.0",
67+
"lodash": "^4.17.21",
68+
"simple-git": "^2.48.0",
69+
"ts-jest": "^27.1.4"
70+
},
71+
"devDependencies": {
72+
"@types/glob": "^7.2.0",
73+
"@types/ini": "^1.3.31",
74+
"@types/inquirer": "^8.2.1",
75+
"@types/js-yaml": "^4.0.5",
76+
"@types/lodash": "^4.14.177",
77+
"@types/minimist": "^1.2.2",
78+
"@types/node": "^16.11.1",
79+
"@types/tabtab": "^3.0.2",
80+
"nodemon": "^2.0.13",
81+
"tabtab": "^3.0.2",
82+
"typescript": "^4.4.4"
83+
}
84+
}

src/env/config.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import { pathExists, readJson, writeJson } from 'fs-extra';
2-
import { join } from 'path';
3-
import { homedir } from 'os';
4-
export const PLUGIN_HOME = (process.env.LISA_HOME && join( process.env.LISA_HOME, 'lisa-zephyr')) || join(homedir(), '.listenai', 'lisa-zephyr');
5-
const CONFIG_FILE = join(PLUGIN_HOME, 'config.json');
6-
interface IPluginConfig {
7-
env?: string[];
8-
sdk?: string;
9-
}
10-
11-
async function load<T>(): Promise<T | null> {
12-
if (!(await pathExists(CONFIG_FILE))) return null;
13-
return await readJson(CONFIG_FILE);
14-
}
15-
16-
export async function get<K extends keyof IPluginConfig>(key: K): Promise<IPluginConfig[K]> {
17-
const config = await load<IPluginConfig>();
18-
if (config && typeof config.env == 'string') {
19-
config.env = [config.env]; // 向后兼容
20-
}
21-
return config ? config[key] : undefined;
22-
}
23-
24-
export async function set<K extends keyof IPluginConfig>(key: K, val: IPluginConfig[K]): Promise<void> {
25-
const config = await load<IPluginConfig>() || {};
26-
config[key] = val;
27-
await writeJson(CONFIG_FILE, config);
28-
}
1+
import { pathExists, readJson, writeJson } from 'fs-extra';
2+
import { join } from 'path';
3+
import { homedir } from 'os';
4+
export const PLUGIN_HOME = (process.env.LISA_HOME && join( process.env.LISA_HOME, 'lisa-zephyr')) || join(homedir(), '.listenai', 'lisa-zephyr');
5+
const CONFIG_FILE = join(PLUGIN_HOME, 'config.json');
6+
interface IPluginConfig {
7+
env?: string[];
8+
sdk?: string;
9+
}
10+
11+
async function load<T>(): Promise<T | null> {
12+
if (!(await pathExists(CONFIG_FILE))) return null;
13+
return await readJson(CONFIG_FILE);
14+
}
15+
16+
export async function get<K extends keyof IPluginConfig>(key: K): Promise<IPluginConfig[K]> {
17+
const config = await load<IPluginConfig>();
18+
if (config && typeof config.env == 'string') {
19+
config.env = [config.env]; // 向后兼容
20+
}
21+
return config ? config[key] : undefined;
22+
}
23+
24+
export async function set<K extends keyof IPluginConfig>(key: K, val: IPluginConfig[K]): Promise<void> {
25+
const config = await load<IPluginConfig>() || {};
26+
config[key] = val;
27+
await writeJson(CONFIG_FILE, config);
28+
}

0 commit comments

Comments
 (0)