ono-cli 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +6 -47
- package/bin/commands/config.js +1 -1
- package/bin/commands/create.js +1 -1
- package/bin/commands/update.js +1 -1
- package/bin/common/index.js +1 -1
- package/bin/common/infoConfig.js +1 -1
- package/bin/common/project.js +1 -1
- package/bin/index.js +1 -1
- package/bin/pkg.js +1 -1
- package/bin/utils/execPromisified.js +1 -0
- package/bin/utils/getConfig.js +1 -0
- package/bin/utils/index.js +1 -1
- package/bin/utils/loading.js +1 -1
- package/bin/utils/processExit.js +1 -1
- package/package.json +2 -2
- package/bin/utils/getAllConfig.js +0 -1
- /package/bin/{constants.js → common/constants.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 ono
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ono
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -14,28 +14,10 @@ npm install -g ono-cli
|
|
|
14
14
|
|
|
15
15
|
在使用脚手架前,需要先配置仓库源、组织和访问令牌:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
**交互式设置配置项:**
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
ono-cli config -
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**配置组织名称:**
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
ono-cli config -s organization <YOUR ORGANIZATION NAME>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**配置访问令牌:**
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
ono-cli config -s access_token <YOUR ACCESS TOKEN>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**选择使用模式:**
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
ono-cli config -m
|
|
20
|
+
ono-cli config -s
|
|
39
21
|
```
|
|
40
22
|
|
|
41
23
|
> **提示:** 一般选择`模板选择模式`,如果选择`依赖性选择模式`,则需要将仓库中的模板名称改成与选项相对应的名称。
|
|
@@ -56,30 +38,6 @@ ono-cli create [YOUR PROJECT NAME]
|
|
|
56
38
|
|
|
57
39
|
如果需要查看当前的配置信息,可以使用以下命令:
|
|
58
40
|
|
|
59
|
-
**查看组织配置:**
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
ono-cli config -g organization
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**查看访问令牌:**
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
ono-cli config -g access_token
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**查看仓库源:**
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
ono-cli config -g repo
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**查看使用模式:**
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
ono-cli config -g mode
|
|
81
|
-
```
|
|
82
|
-
|
|
83
41
|
**交互式查看配置项:**
|
|
84
42
|
|
|
85
43
|
```bash
|
|
@@ -156,8 +114,8 @@ ono-cli update [version]
|
|
|
156
114
|
5. 点击 "Generate new token" 按钮
|
|
157
115
|
6. 输入令牌描述(Note)
|
|
158
116
|
7. 设置过期时间(Expiration)
|
|
159
|
-
8.
|
|
160
|
-
- 对于访问私有仓库,至少需要
|
|
117
|
+
8. 为令牌分配权限:
|
|
118
|
+
- 对于访问私有仓库,至少需要 `repo` 权限
|
|
161
119
|
- 如果要访问组织仓库,还需要 `admin:org` 或 `read:org` 权限
|
|
162
120
|
- 如果访问的是私有仓库,还需要 `read:org` 权限
|
|
163
121
|
9. 点击 "Generate token" 按钮
|
|
@@ -193,6 +151,7 @@ ono-cli update [version]
|
|
|
193
151
|
|
|
194
152
|
- 直接从可用的模板列表中选择一个模板
|
|
195
153
|
- 适合对模板有明确选择的场景
|
|
154
|
+
- 可选择分支(branch)或标签(tag)进行克隆
|
|
196
155
|
|
|
197
156
|
### 依赖性选择模式
|
|
198
157
|
|
|
@@ -211,4 +170,4 @@ ono-cli update [version]
|
|
|
211
170
|
|
|
212
171
|
## 📄 许可证
|
|
213
172
|
|
|
214
|
-
MIT
|
|
173
|
+
MIT
|
package/bin/commands/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))(function(o,i){function m(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(m,s)}c((n=n.apply(e,t||[])).next())})};import t from"chalk";import{writeFileSync as a}from"fs";import{encode as n}from"ini";import o from"inquirer";import{repoInfo as i}from"../common/index.js";import{baseConfig as m,getConfig as s,processExit as c}from"../utils/index.js";const r=e=>"repo"===e?{name:"value",type:"list",message:"选择仓库源",choices:Object.keys(i).map(e=>({name:e,value:e}))}:"mode"===e?{name:"value",type:"list",message:"选择模式",choices:[{name:"模板选择模式",value:"template"},{name:"依赖性选择模式",value:"dependencies"}]}:{name:"value",type:"input",default:"",message:"请输入"+("username"===e?"用户名称":"organization"===e?"组织名称":"访问令牌")};export default i=>e(void 0,void 0,void 0,function*(){const{config:e,configPath:l}=s(),u=Object.keys(i)[0],p=(t,o)=>{e[t]=o,a(l,n(e)),c()};try{switch(u){case"get":{const{item:t}=yield o.prompt([{name:"item",type:"list",message:"选择想要查看的配置项",choices:[{name:"组织名称",value:"organization"},{name:"访问令牌",value:"access_token"},{name:"代码托管平台",value:"repo"},{name:"模式",value:"mode"}]}]);return void c(e[t])}case"set":{const{key:e}=yield o.prompt([{name:"key",type:"list",message:"选择想要查看的配置项",choices:[{name:"组织名称",value:"organization"},{name:"访问令牌",value:"access_token"},{name:"代码托管平台",value:"repo"},{name:"模式",value:"mode"}]}]),{value:t}=yield o.prompt([r(e)]);p(e,t)}case"delete":{const{item:e}=yield o.prompt([{name:"item",type:"list",message:"选择想要删除的配置项",choices:[{name:"组织名称",value:"organization"},{name:"访问令牌",value:"access_token"}]}]);return void p(e,"")}case"clear":return a(l,n(m)),void c(t.greenBright("配置文件已清空"))}}catch(e){c()}});
|
package/bin/commands/create.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=this&&this.__awaiter||function(e,a,t,n){return new(t||(t=Promise))(function(s,i){function o(e){try{m(n.next(e))}catch(e){i(e)}}function c(e){try{m(n.throw(e))}catch(e){i(e)}}function m(e){var a;e.done?s(e.value):(a=e.value,a instanceof t?a:new t(function(e){e(a)})).then(o,c)}m((n=n.apply(e,a||[])).next())})};import a from"chalk";import{existsSync as t}from"fs";import n from"inquirer";import s from"path";import i from"process";import{cloneCodeDeps as o,cloneCodeTemplate as c,frameworkDependenciesConfig as m,getOrganizationProjects as l,getProjectBranches as r,getProjectTags as p}from"../common/index.js";import{getConfig as u,processExit as h}from"../utils/index.js";const{mode:g}=u().config,f=(e,a)=>e.length<=1?a.length>0?[{name:"tag",value:"tag"},{name:"none",value:""}]:[]:a.length<0?[{name:"branch",value:"branch"},{name:"none",value:""}]:[{name:"branch",value:"branch"},{name:"tag",value:"tag"},{name:"none",value:""}],y=e=>""===e?[]:[{name:"router",type:"list",message:"选择路由",choices:m[e].router},{name:"store",type:"list",message:"选择状态管理仓库",choices:m[e].store}];export default(m,u)=>e(void 0,void 0,void 0,function*(){try{const e={name:"",path:"",isOverwrite:!1};if(m)e.name=m.trim();else{const{projectName:a}=yield n.prompt([{name:"projectName",type:"input",default:"my-project",message:"项目名称"}]);e.name=a?a.trim():"my-project"}const h=i.cwd(),d=s.join(h,e.name);if(t(d))if(u.force)e.isOverwrite=!0,e.path=d;else{const{action:a}=yield n.prompt([{name:"action",type:"list",message:`目录${e.name}已存在,是否覆盖?`,choices:[{name:"覆盖",value:"overwrite"},{name:"取消",value:"cancel"}]}]);switch(a){case"overwrite":e.isOverwrite=!0,e.path=d;break;case"cancel":return console.log(`取消创建目录${e.name}`)}}if("template"===g){const a=a=>c(a,s,e),t=yield l(),{projectName:s}=yield n.prompt([{name:"projectName",type:"list",message:"选择模板",choices:t}]),i=yield r(s),o=yield p(s),m=f(i,o);if(0===m.length)return a(i[0]);const{mode:u}=yield n.prompt([{name:"mode",type:"list",message:"请选择branch或tag",choices:m}]);if("branch"===u)if(i.length>1){const{branch:e}=yield n.prompt([{name:"branch",type:"list",message:"请选择branch",choices:i}]);a(e)}else a(i[0]);else if("tag"===u)if(o.length>0){const{tag:e}=yield n.prompt([{name:"tag",type:"list",message:"请选择tag",choices:o}]);a(e)}else a(o[0]);else a(i[0])}else if("dependencies"===g){const t=yield n.prompt([{name:"framework",type:"list",message:"选择框架",choices:[{name:a.hex("#42b883")("Vue"),value:"vue"},{name:a.hex("#58c4dc")("React"),value:"react"},{name:a.hex("#fecf05")("Vanilla"),value:""}]}]),{language:s,eslint:i}=yield n.prompt([{name:"language",type:"confirm",message:"是否使用TypeScript?"},{name:"eslint",type:"confirm",message:"是否使用Eslint?"}]),c=yield n.prompt([...y(t.framework),{name:"atomStyle",type:"list",message:"选择原子化样式库",choices:[{name:a.hex("#38bdf8")("Tailwind CSS"),value:"tailwindcss"},{name:a.hex("#4d9375")("Uno CSS"),value:"unocss"},{name:"none",value:""}]},{name:"stylePrecompiler",type:"list",message:"选择预编译器",choices:[{name:a.hex("#cc6699")("Sass"),value:"sass"},{name:a.hex("#1d365d")("Less"),value:"less"},{name:a.hex("#89ba1b")("Stylus"),value:"stylus"},{name:"none",value:""}]}]);Object.assign(e,t,{lanuage:s?"ts":"js"},{eslint:i?"eslint":""},c),o(e)}}catch(e){e.config&&e.config.url&&console.log(a.red("tags"===e.config.url.split("/").slice(-1)[0]&&"该项目没有tag")),h()}});
|
package/bin/commands/update.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n=this&&this.__awaiter||function(n,t,i,o){return new(i||(i=Promise))(function(e,c){function r(n){try{u(o.next(n))}catch(n){c(n)}}function a(n){try{u(o.throw(n))}catch(n){c(n)}}function u(n){var t;n.done?e(n.value):(t=n.value,t instanceof i?t:new i(function(n){n(t)})).then(r,a)}u((o=o.apply(n,t||[])).next())})};import t from"chalk";import{execPromisified as i,processExit as o,wrapLoading as e}from"../utils/index.js";export default c=>n(void 0,void 0,void 0,function*(){let r="npm install -g ";return c?c.includes("@")?r+=c:r+=`ono-cli@${c}`:r+="ono-cli@latest",e(t.green("📦 更新中..."),()=>n(void 0,void 0,void 0,function*(){try{yield i(r),o("\n\n🚀 更新成功!\n\n")}catch(n){o(t.red(`\n\n❌ 更新失败: ${n.message}\n\n`))}}))});
|
package/bin/common/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./infoConfig.js";export*from"./project.js";
|
|
1
|
+
export*from"./constants.js";export*from"./infoConfig.js";export*from"./project.js";
|
package/bin/common/infoConfig.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"chalk";export const repoInfo={github:{personal:{private:"",public:"https://api.github.com/users/{username}/repos?type=all"},organization:"https://api.github.com/orgs/{organization}/repos?type=all",branch:"https://api.github.com/repos/{organization}/{repositories}/branches",tag:"https://api.github.com/repos/{organization}/{repositories}/tags",clone:"git clone --branch {branchOrTag} --depth 1 https://{repo}.com/{organization}/{projectName}.git {name}",authorization:"token {access_token}"},gitee:{personal:{private:"https://gitee.com/api/v5/user/repos?per_page=100",public:"https://gitee.com/api/v5/users/{username}/repos?per_page=100"},organization:"https://gitee.com/api/v5/orgs/{organization}/repos",branch:"https://gitee.com/api/v5/repos/{organization}/{repositories}/branches",tag:"https://gitee.com/api/v5/repos/{organization}/{repositories}/tags",clone:"git clone --branch {branchOrTag} --depth 1 https://{repo}.com/{organization}/{projectName}.git {name}",authorization:"Bearer {access_token}"}};export const frameworkDependenciesConfig={vue:{router:[{name:e.hex("#425d11")("Vue Router"),value:"vue-router"},{name:e.hex("#00bc7d")("TanStack Router"),value:"tanStack-router"},{name:"none",value:""}],store:[{name:e.hex("#425d11")("Pinia"),value:"pinia"},{name:e.hex("#3eaf7c")("Vuex"),value:"vuex"},{name:"none",value:""}]},react:{router:[{name:e.hex("#3451b2")("React Router"),value:"react-router"},{name:e.hex("#00bc7d")("TanStack Router"),value:"tanStack-router"},{name:"none",value:""}],store:[{name:e.hex("#764abc")("Redux"),value:"redux"},{name:e.hex("#1c16df")("Zustand"),value:"zustand"},{name:"none",value:""}]}};
|
package/bin/common/project.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function c(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,c)}l((o=o.apply(e,t||[])).next())})},t=this&&this.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};import n from"chalk";import{rmSync as o}from"fs";import r from"ono-fetch";import{execPromisified as i,getConfig as a,processExit as c,wrapLoading as l}from"../utils/index.js";import{repoInfo as s}from"./infoConfig.js";const{organization:d,access_token:p,repo:f}=a().config,g=()=>p?{headers:{Authorization:s[f].authorization.replace("{access_token}",p)}}:{};export const getOrganizationProjects=()=>e(void 0,void 0,void 0,function*(){try{return(yield r.get(s[f].organization.replace("{organization}",d),g())).data.map(e=>e.name)}catch(e){c(n.red(`🔍 没有找到组织项目!${n.white(`请使用 ${n.hex("#89ba1b")("ono-cli config -s")} 设置正确的 ${n.hex("#1c16df")("organization")} 和 ${n.hex("#1c16df")("access_token")} !`)}`))}});export const getProjectBranches=t=>e(void 0,void 0,void 0,function*(){const e=yield r.get(s[f].branch.replace("{organization}",d).replace("{repositories}",t),g());return e.data.length>0?e.data.map(e=>e.name):[]});export const getProjectTags=t=>e(void 0,void 0,void 0,function*(){const e=yield r.get(s[f].tag.replace("{organization}",d).replace("{repositories}",t),g());return e.data.length>0?e.data.map(e=>e.name):[]});export const cloneCodeTemplate=(t,r,a)=>e(void 0,void 0,void 0,function*(){return a.isOverwrite&&l(n.yellowBright("🚚 删除旧项目..."),()=>e(void 0,void 0,void 0,function*(){return o(a.path,{recursive:!0})})),l(n.greenBright(`📦 创建项目 ${a.name}...`),()=>e(void 0,void 0,void 0,function*(){try{yield i(s[f].clone.replace("{branchOrTag}",t).replace("{repo}",f).replace("{organization}",d).replace("{projectName}",r).replace("{name}",a.name)),o(`${a.name}/.git`,{recursive:!0,force:!0}),c(`\n\n🚀 创建项目成功!\n ${n.greenBright(`cd ${a.name}`)}\n ${n.greenBright("code .")}\n ${n.greenBright("npm install")}\n`)}catch(e){c(n.red("\n\n❌ 拉取项目失败!请检查网络连接状态、仓库权限或配置信息!\n"))}}))});export const cloneCodeDeps=o=>e(void 0,void 0,void 0,function*(){const{name:e,path:r,isOverwrite:i}=o,a=t(o,["name","path","isOverwrite"]),l=Object.values(a).filter(Boolean),s=yield getOrganizationProjects();if(!s)return;const d=s.reduce((e,t)=>(e[t]=0,e),{});for(let e=0;e<s.length;e++)for(let t=0;t<l.length;t++)s[e].includes(l[t])&&d[s[e]]++;const p=Object.keys(d).find(e=>d[e]===l.length);p||c(n.red("❌ 没有找到匹配的项目模板!"));const f=yield getProjectBranches(p);cloneCodeTemplate(f[0],p,o)});
|
package/bin/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var o=this&&this.__awaiter||function(o,e,n,t){return new(n||(n=Promise))(function(a,i){function c(o){try{m(t.next(o))}catch(o){i(o)}}function r(o){try{m(t.throw(o))}catch(o){i(o)}}function m(o){var e;o.done?a(o.value):(e=o.value,e instanceof n?e:new n(function(o){o(e)})).then(c,r)}m((t=t.apply(o,e||[])).next())})};import e from"chalk";import{program as n}from"commander";import t from"./pkg.js";const a=(e,n)=>o(void 0,void 0,void 0,function*(){return(yield import(e)).default(...n)});n.name("ono-cli").usage("<command> [option]"),n.version(t.version),n.command("create [project-name]").description("创建新项目").option("-f, --force","强制创建").action((o,e)=>a("./commands/create.js",[o,e])),n.command("config [value]").description("配置信息").option("-g, --get","get value").option("-s, --set","set value").option("-d, --delete","delete value").option("-c, --clear","clear value").action((o,e)=>a("./commands/config.js",[e])),n.command("update [version]").description("update ono-cli").action((o,e)=>a("./commands/update.js",[o,e])),n.addHelpText("after",`Run ${e.blueBright("ono-cli <command> --help")} for detailed usage of given command.`),n.parse(process.argv);
|
package/bin/pkg.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire}from"module";import{dirname,join}from"path";import{fileURLToPath}from"url";const
|
|
1
|
+
import{createRequire as o}from"module";import{dirname as r,join as m}from"path";import{fileURLToPath as t}from"url";const p=r(t(import.meta.url)),a=o(import.meta.url);export default a(m(p,"../package.json"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{exec as i}from"child_process";import o from"util";export const execPromisified=o.promisify(i);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as o,readFileSync as t,writeFileSync as e}from"fs";import{decode as n,encode as i}from"ini";import{configPath as s}from"../common/index.js";export const baseConfig={username:"",organization:"",access_token:"",repo:"github",mode:"template"};export const getConfig=()=>{const r=Object.assign({},baseConfig);if(o(s)){const o=n(t(s,"utf-8"));Object.assign(r,o)}else e(s,i(r));return{config:r,configPath:s}};
|
package/bin/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./
|
|
1
|
+
export*from"./execPromisified.js";export*from"./getConfig.js";export*from"./loading.js";export*from"./processExit.js";
|
package/bin/utils/loading.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=this&&this.__awaiter||function(t,n,o,i){return new(o||(o=Promise))(function(r,c){function e(t){try{u(i.next(t))}catch(t){c(t)}}function a(t){try{u(i.throw(t))}catch(t){c(t)}}function u(t){var n;t.done?r(t.value):(n=t.value,n instanceof o?n:new o(function(t){t(n)})).then(e,a)}u((i=i.apply(t,n||[])).next())})};import n from"ora";export const wrapLoading=(o,i)=>t(void 0,void 0,void 0,function*(){const t=n(o);t.start();const r=yield i();return t.stop(),t.clear(),r});
|
package/bin/utils/processExit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const processExit=o=>{o&&console.log(o),process.exit()};
|
|
1
|
+
export const processExit=o=>{o&&console.log(o),process.exit(0)};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ono-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A CLI tool for ono template",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": "./bin/index.js",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"template"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"axios": "^1.7.7",
|
|
25
24
|
"chalk": "^5.3.0",
|
|
26
25
|
"commander": "^12.0.0",
|
|
27
26
|
"figlet": "^1.7.0",
|
|
@@ -29,6 +28,7 @@
|
|
|
29
28
|
"git-clone": "^0.2.0",
|
|
30
29
|
"ini": "^5.0.0",
|
|
31
30
|
"inquirer": "^11.0.2",
|
|
31
|
+
"ono-fetch": "^0.1.1",
|
|
32
32
|
"ora": "^8.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{existsSync,readFileSync,writeFileSync}from"fs";import{decode,encode}from"ini";import{configPath}from"../constants.js";export const getAllConfig=()=>{const e={organization:"",access_token:"",repo:"github",mode:"template"};if(existsSync(configPath)){const o=decode(readFileSync(configPath,"utf-8"));Object.assign(e,o)}else writeFileSync(configPath,encode(e));return{config:e,configPath:configPath}};
|
|
File without changes
|