-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CakmLexi
committed
Jul 8, 2024
1 parent
afe270b
commit b78219e
Showing
9 changed files
with
387 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
name: 提交Bug / Submit Bug | ||
about: 向我们报告一个Bug以帮助我们改进 | ||
title: 'Bug: ' | ||
labels: bug | ||
--- | ||
|
||
警告: 在进一步操作之前,请检查下列选项。如果您忽视此模板或者没有提供关键信息,您的 Issue 将直接被关闭 | ||
|
||
- 确保您使用的是最新版本的`Karin` | ||
- 确保您的问题尚未在 Issues 列表中提出. | ||
- 确保您的问题不是由于您的代码错误导致的. | ||
|
||
## 描述问题 | ||
|
||
简要描述遇到的问题。 | ||
|
||
## 复现步骤 | ||
|
||
详细描述如何复现该问题: | ||
|
||
1. 第一步 | ||
2. 第二步 | ||
3. ... | ||
|
||
## 预期行为 | ||
|
||
预期应该发生什么? | ||
|
||
## 实际行为 | ||
|
||
实际发生了什么? | ||
|
||
## 环境信息 | ||
|
||
- 操作系统: | ||
- Node.js 版本: | ||
- 项目版本: | ||
|
||
## 附加信息 | ||
|
||
任何额外的上下文或截图。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
name: 功能请求 / Feature Request | ||
about: 向我们提交一个新功能的请求 | ||
title: 'Feat: ' | ||
labels: enhancement | ||
--- | ||
|
||
警告: 在进一步操作之前,请检查下列选项。如果您忽视此模板或者没有提供关键信息,您的 Issue 将直接被关闭 | ||
|
||
- 确保您使用的是 最新版本的`Karin` | ||
- 确保您的功能请求尚未在 Issues 列表中提出. | ||
- 确保您的功能请求是与 `Karin` 相关的,且可以实现. | ||
|
||
## 描述功能 | ||
|
||
请清晰地描述您想要的功能,并提供相关的信息。 | ||
|
||
## 动机 | ||
|
||
为什么需要这个功能?它将如何改进项目? | ||
|
||
## 实现方法 | ||
|
||
请提供您认为可以实现此功能的方法,如果您不知道如何实现,可以留空。 | ||
当然,如果您有兴趣,也可以自己实现并向我们提交 Pull Request。 | ||
|
||
## 功能描述 | ||
|
||
简要描述你希望增加的功能。 | ||
|
||
## 替代方案 | ||
|
||
是否有其他可行的替代方案? | ||
|
||
## 附加信息 | ||
|
||
任何额外的上下文或截图。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env node | ||
|
||
import { select } from '@inquirer/prompts' | ||
import { KarinInit } from 'karin/utils/init' | ||
|
||
async function main () { | ||
/** 捕获错误 打印日志 */ | ||
process.on('uncaughtException', err => console.error(err)) | ||
process.on('unhandledRejection', err => console.error(err)) | ||
|
||
const init = new KarinInit() | ||
init.init() | ||
|
||
const prompt = await select({ | ||
message: '请选择npm源 中国大陆服务器一定要更换!!!', | ||
choices: [ | ||
{ name: '淘宝源(推荐)', value: 'https://registry.npmmirror.com' }, | ||
{ name: '官方源', value: 'https://registry.npmjs.org' }, | ||
], | ||
}) | ||
|
||
/** 结果 */ | ||
await init.changeRegistry(prompt) | ||
|
||
const pkg = await select({ | ||
message: '请选择包管理器 如果不知道怎么选 请选pnpm', | ||
choices: [ | ||
{ name: 'pnpm', value: 'pnpm' }, | ||
{ name: 'yarn', value: 'yarn' }, | ||
], | ||
}) as 'pnpm' | 'yarn' | ||
|
||
/** 结果 */ | ||
await init.install(pkg) | ||
} | ||
main().then(() => process.exit(0)).catch(() => process.exit(0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env node | ||
|
||
import fs from 'fs' | ||
import yaml from 'yaml' | ||
import path from 'path' | ||
import { spawn } from 'child_process' | ||
|
||
const cwd = process.cwd() | ||
const _path = path.resolve(cwd + '/config/config/pm2.yaml') | ||
const data = yaml.parse(fs.readFileSync(_path, 'utf8')) | ||
|
||
const name = data.apps[0].name | ||
const lines = data.lines || 1000 | ||
const cmd = process.platform === 'win32' ? 'pm2.cmd' : 'pm2' | ||
spawn(cmd, ['logs', '--lines', lines, name], { stdio: 'inherit', shell: true, cwd }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env node | ||
|
||
import fs from 'fs' | ||
import { KarinInit } from 'karin/utils/init' | ||
|
||
async function main () { | ||
/** 捕获错误 打印日志 */ | ||
process.on('uncaughtException', err => console.error(err)) | ||
process.on('unhandledRejection', err => console.error(err)) | ||
|
||
/** 在src目录说明为开发环境 不执行任何初始化操作 */ | ||
if (fs.existsSync('./src')) return | ||
|
||
const init = new KarinInit() | ||
init.init() | ||
|
||
/** 判断锁文件 优先度: pnpm > yarn > cnpm > npm */ | ||
let pkg: 'pnpm' | 'yarn' | 'cnpm' | 'npm' | ||
if (fs.existsSync('pnpm-lock.yaml')) { | ||
pkg = 'pnpm' | ||
} else if (fs.existsSync('yarn.lock')) { | ||
pkg = 'yarn' | ||
} else if (fs.existsSync('cnpm-lock.yaml')) { | ||
pkg = 'cnpm' | ||
} else { | ||
pkg = 'npm' | ||
} | ||
|
||
await init.install(pkg) | ||
} | ||
main().then(() => process.exit(0)).catch(() => process.exit(0)) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.