Skip to content

Commit

Permalink
Merge pull request #103 from LISTENAI/master_v2
Browse files Browse the repository at this point in the history
v2.0.0 publish
  • Loading branch information
chh7872 authored Oct 27, 2023
2 parents 5527265 + 7e1ca7b commit b40e71a
Show file tree
Hide file tree
Showing 11 changed files with 1,682 additions and 1,565 deletions.
168 changes: 84 additions & 84 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
{
"name": "@lisa-plugin/zephyr",
"version": "1.7.3-beta.1",
"description": "LISA plugin for Zephyr",
"main": "./lib/main.js",
"engines": {
"node": ">=16",
"git": ">=2"
},
"scripts": {
"build": "tsc -p . && node prebuild",
"watch": "nodemon --exec npm run build -w ./src -e ts",
"prepublishOnly": "npm run build",
"postinstall": "lisa zep install",
"test": "cross-env NODE_ENV=test jest --verbose --testTimeout=1200000"
},
"lisa": {
"friendlyName": "zep",
"taskPath": "./lib/tasks",
"completion": "./lib/completion.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LISTENAI/lisa-plugin-zephyr.git"
},
"author": "LISTENAI",
"maintainers": [
"lpmadmin <[email protected]>",
"xychen <[email protected]>",
"zbzhao <[email protected]>",
"ywang <[email protected]>"
],
"license": "UNLICENSED",
"files": [
"lib",
"scripts",
"vscode",
"plugin"
],
"bugs": {
"url": "https://github.com/LISTENAI/lisa-plugin-zephyr/issues"
},
"homepage": "https://github.com/LISTENAI/lisa-plugin-zephyr#readme",
"dependencies": {
"7zip-bin": "^5.2.0",
"@binary/cmake": "^1.1.3-3.25.3",
"@binary/dtc": "^1.1.2-1.6.0",
"@binary/gperf": "^1.0.1-3.1",
"@binary/mklfs": "^1.0.1-1.0.0",
"@binary/ninja": "^1.1.2-1.11.1",
"@binary/protoc": "^1.0.0-3.19.1",
"@binary/python-3.9": "^2.0.2-3.9.7",
"@binary/type": "^1.0.4",
"@binary/xz": "^1.1.1-5.2.5",
"@lisa-env/type": "^1.2.0",
"@listenai/lisa_core": "^2.0.5",
"@sentry/node": "5.20.0",
"@tool/lpk": "1.1.0",
"@types/jest": "^27.4.1",
"cross-env": "^7.0.3",
"glob": "^7.2.0",
"ini": "^2.0.0",
"inquirer": "^8.1.0",
"inquirer-file-tree-selection-prompt": "^1.0.19",
"jest": "^27.5.1",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"simple-git": "^2.48.0",
"ts-jest": "^27.1.4"
},
"devDependencies": {
"@types/glob": "^7.2.0",
"@types/ini": "^1.3.31",
"@types/inquirer": "^8.2.1",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.177",
"@types/minimist": "^1.2.2",
"@types/node": "^16.11.1",
"@types/tabtab": "^3.0.2",
"nodemon": "^2.0.13",
"tabtab": "^3.0.2",
"typescript": "^4.4.4"
}
}
{
"name": "@lisa-plugin/zephyr",
"version": "2.0.0",
"description": "LISA plugin for Zephyr",
"main": "./lib/main.js",
"engines": {
"node": ">=16",
"git": ">=2"
},
"scripts": {
"build": "tsc -p . && node prebuild",
"watch": "nodemon --exec npm run build -w ./src -e ts",
"prepublishOnly": "npm run build",
"postinstall": "lisa zep install",
"test": "cross-env NODE_ENV=test jest --verbose --testTimeout=1200000"
},
"lisa": {
"friendlyName": "zep",
"taskPath": "./lib/tasks",
"completion": "./lib/completion.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LISTENAI/lisa-plugin-zephyr.git"
},
"author": "LISTENAI",
"maintainers": [
"lpmadmin <[email protected]>",
"xychen <[email protected]>",
"zbzhao <[email protected]>",
"ywang <[email protected]>"
],
"license": "UNLICENSED",
"files": [
"lib",
"scripts",
"vscode",
"plugin"
],
"bugs": {
"url": "https://github.com/LISTENAI/lisa-plugin-zephyr/issues"
},
"homepage": "https://github.com/LISTENAI/lisa-plugin-zephyr#readme",
"dependencies": {
"7zip-bin": "^5.2.0",
"@binary/cmake": "^1.1.3-3.25.3",
"@binary/dtc": "^1.1.2-1.6.0",
"@binary/gperf": "^1.0.1-3.1",
"@binary/mklfs": "^1.0.1-1.0.0",
"@binary/ninja": "^1.1.2-1.11.1",
"@binary/protoc": "^1.0.0-3.19.1",
"@binary/python-3.9": "^2.0.2-3.9.7",
"@binary/type": "^1.0.4",
"@binary/xz": "^1.1.1-5.2.5",
"@lisa-env/type": "^1.2.0",
"@listenai/lisa_core": "^2.0.5",
"@sentry/node": "5.20.0",
"@tool/lpk": "1.1.0",
"@types/jest": "^27.4.1",
"cross-env": "^7.0.3",
"glob": "^7.2.0",
"ini": "^2.0.0",
"inquirer": "^8.1.0",
"inquirer-file-tree-selection-prompt": "^1.0.19",
"jest": "^27.5.1",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"simple-git": "^2.48.0",
"ts-jest": "^27.1.4"
},
"devDependencies": {
"@types/glob": "^7.2.0",
"@types/ini": "^1.3.31",
"@types/inquirer": "^8.2.1",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.177",
"@types/minimist": "^1.2.2",
"@types/node": "^16.11.1",
"@types/tabtab": "^3.0.2",
"nodemon": "^2.0.13",
"tabtab": "^3.0.2",
"typescript": "^4.4.4"
}
}
56 changes: 28 additions & 28 deletions src/env/config.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { pathExists, readJson, writeJson } from 'fs-extra';
import { join } from 'path';
import { homedir } from 'os';
export const PLUGIN_HOME = (process.env.LISA_HOME && join( process.env.LISA_HOME, 'lisa-zephyr')) || join(homedir(), '.listenai', 'lisa-zephyr');
const CONFIG_FILE = join(PLUGIN_HOME, 'config.json');
interface IPluginConfig {
env?: string[];
sdk?: string;
}

async function load<T>(): Promise<T | null> {
if (!(await pathExists(CONFIG_FILE))) return null;
return await readJson(CONFIG_FILE);
}

export async function get<K extends keyof IPluginConfig>(key: K): Promise<IPluginConfig[K]> {
const config = await load<IPluginConfig>();
if (config && typeof config.env == 'string') {
config.env = [config.env]; // 向后兼容
}
return config ? config[key] : undefined;
}

export async function set<K extends keyof IPluginConfig>(key: K, val: IPluginConfig[K]): Promise<void> {
const config = await load<IPluginConfig>() || {};
config[key] = val;
await writeJson(CONFIG_FILE, config);
}
import { pathExists, readJson, writeJson } from 'fs-extra';
import { join } from 'path';
import { homedir } from 'os';
export const PLUGIN_HOME = (process.env.LISA_HOME && join( process.env.LISA_HOME, 'lisa-zephyr')) || join(homedir(), '.listenai', 'lisa-zephyr');
const CONFIG_FILE = join(PLUGIN_HOME, 'config.json');
interface IPluginConfig {
env?: string[];
sdk?: string;
}

async function load<T>(): Promise<T | null> {
if (!(await pathExists(CONFIG_FILE))) return null;
return await readJson(CONFIG_FILE);
}

export async function get<K extends keyof IPluginConfig>(key: K): Promise<IPluginConfig[K]> {
const config = await load<IPluginConfig>();
if (config && typeof config.env == 'string') {
config.env = [config.env]; // 向后兼容
}
return config ? config[key] : undefined;
}

export async function set<K extends keyof IPluginConfig>(key: K, val: IPluginConfig[K]): Promise<void> {
const config = await load<IPluginConfig>() || {};
config[key] = val;
await writeJson(CONFIG_FILE, config);
}
Loading

0 comments on commit b40e71a

Please sign in to comment.