Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
saqqdy committed Aug 10, 2022
2 parents 1703b34 + 068d796 commit 1a375aa
Show file tree
Hide file tree
Showing 18 changed files with 803 additions and 706 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Npm publish
on:
release:
types: [created]
# push:
# branches: [master, dev]
# push:
# branches: [master]

jobs:
publish-gpr:
Expand Down Expand Up @@ -38,13 +38,19 @@ jobs:
# - run: git config --global user.email "[email protected]"
# - run: git config --global user.name "saqqdy"

- run: pnpm build
- run: pnpm dist
env:
NODE_OPTIONS: --max-old-space-size=6144

- name: Gen .npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc

- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./packages/core/.npmrc
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./packages/gitmars/.npmrc
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./packages/server/.npmrc
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./packages/ui/.npmrc
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./packages/docs/.npmrc

- run: pnpm pub
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
"minify",
"msg",
"namespace",
"npmjs",
"npmrc",
"num",
"nvm",
"onwarn",
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 更新日志

## 2022.08.07 v3.3.0 更新日志
## 2022.08.09 v3.3.0 更新日志

1. `combine`指令增加合并判断,不需要合并时不再合并
1. `combine` `update` `admin`指令增加合并判断,不需要合并时不再合并
2. 升级依赖包版本

## 2022.07.19 v3.2.0 更新日志
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@gitmars/monorepo",
"description": "这是一个git工作流工具",
"version": "3.3.0-beta.1",
"version": "3.3.0-beta.5",
"packageManager": "[email protected]",
"main": "index.js",
"files": [
Expand Down Expand Up @@ -46,8 +46,8 @@
"typings": "typings"
},
"dependencies": {
"chalk": "^5.0.1",
"inquirer": "^9.1.0",
"chalk": "^4.1.2",
"inquirer": "^8.2.4",
"js-cool": "^2.3.2",
"morgan": "^1.10.0"
},
Expand All @@ -62,7 +62,7 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/gulp": "^4.0.9",
"@types/inquirer": "^9.0.0",
"@types/inquirer": "^8.2.2",
"@types/node": "^18.6.4",
"@types/rollup-plugin-css-only": "^3.1.0",
"@vitejs/plugin-vue": "^3.0.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@gitmars/core",
"description": "gitmars核心程序",
"version": "3.3.0-beta.1",
"version": "3.3.0-beta.5",
"private": false,
"main": "./lib/index.js",
"module": "./lib/index.mjs",
Expand Down Expand Up @@ -40,15 +40,15 @@
},
"dependencies": {
"@jssj/request": "^1.0.0-alpha.8",
"chalk": "^5.0.1",
"chalk": "^4.1.2",
"ci-info": "^3.3.2",
"columnify": "^1.6.0",
"commander": "^9.4.0",
"cosmiconfig": "^7.0.1",
"cross-spawn": "^7.0.3",
"dayjs": "^1.11.4",
"debug": "^4.3.4",
"inquirer": "^9.1.0",
"inquirer": "^8.2.4",
"js-cool": "^2.3.2",
"node-apollo": "^1.2.1",
"ora": "^5.4.1",
Expand All @@ -59,7 +59,7 @@
"@eslint-sets/eslint-config-simple-ts": "^3.0.4",
"@saqqdy/prettier-config": "^1.1.2",
"@types/cross-spawn": "^6.0.2",
"@types/inquirer": "^9.0.0",
"@types/inquirer": "^8.2.2",
"@types/node": "^18.6.4",
"@types/shelljs": "^0.8.11",
"cron-parser": "^4.6.0",
Expand Down
48 changes: 39 additions & 9 deletions packages/core/src/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import chalk from 'chalk'
import type {
CommandMessageType,
CommandType,
CommandTypeCmd,
QueueReturnsType
} from '../typings'
import { setCommandCache } from './cache/commandCache'
Expand Down Expand Up @@ -57,7 +58,7 @@ export function queue(
// 处理脚本执行成功
function onSuccess(
msg: CommandMessageType,
cfg: CommandType['config'],
cfg: CommandTypeCmd['config'],
cb?: WaitCallback
) {
const _message = cfg.success || msg.success || '处理完成'
Expand All @@ -70,10 +71,10 @@ export function queue(
// 处理脚本执行错误
function onError(
list: Array<CommandType | string>,
cmd: CommandType['cmd'],
cmd: CommandTypeCmd['cmd'],
err: any,
msg: CommandMessageType,
cfg: CommandType['config'],
cfg: CommandTypeCmd['config'],
cb?: WaitCallback
) {
if (cfg.kill) {
Expand Down Expand Up @@ -123,21 +124,50 @@ export function queue(
wait(
list,
async (command?: CommandType | string, cb?: WaitCallback) => {
let cfg = {
let cfg: CommandTypeCmd['config'] = {
stdio: 'ignore',
postmsg: false,
kill: true,
again: false // 指令执行中断之后是否需要重新执行,类似冲突解决之后的指令,不再需要重复执行
} as CommandType['config'],
cmd: CommandType['cmd']
},
cmd,
message
// 传入对象形式:{ cmd: '', config: {} }
if (command instanceof Object) {
cfg = Object.assign(cfg, command.config || {})
cmd = command.cmd
if ('message' in command) {
// message优先,输出消息
message = command.message
} else {
cfg = Object.assign(cfg, command.config || {})
cmd = command.cmd
}
} else {
cmd = command!
}
if (!cmd) {
/**
* 三种场景
*
* 1. { message: '消息' }
* 2. { cmd: 'git status', config: {} }
* 3. { cmd: { module: '', entry: '', options: {} }, config: {} }
*/
if (message) {
spinner.start(chalk.green(message))
returns.push({
status: 0,
stdout: '',
stderr: '',
cfg,
cmd: ''
})
onSuccess(
{
success: message
},
cfg,
cb
)
} else if (!cmd) {
spinner.stop()
// 只有一条指令,不需返回数组形式
resolve(returns)
Expand Down
33 changes: 10 additions & 23 deletions packages/core/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export type GitmarsBranchType = 'feature' | 'bugfix' | 'support'
// 127和128是git个别场景的执行结果值
export type ShellCode = 0 | 1 | 127 | 128

export type PackageVersionTag =
| 'alpha'
| 'lite'
| 'beta'
| 'release'
| 'latest'
| 'next'

export type GitLogKeysType =
| '%H'
| '%h'
Expand Down Expand Up @@ -215,11 +207,17 @@ export interface ModuleCommandType {
options?: unknown
}

export interface CommandType {
export interface CommandTypeCmd {
cmd: string | ModuleCommandType
config: QueueConfigType
}

export interface CommandTypeMessage {
message: string
}

export type CommandType = CommandTypeCmd | CommandTypeMessage

export interface FetchDataType {
token: string // gitlab上生成的access_token
level: 1 | 2 | 3 | 4 // 1=超级管理员 2=管理员 3=审核员 4=开发者
Expand Down Expand Up @@ -249,17 +247,6 @@ export interface QueueReturnsType
cmd: string | ModuleCommandType
}

export interface InitInquirerPromptType {
type: string
name: string
message: string
default?(): string
transformer?(val: any, answers: any, flags: any): any
validate?(val: any): string | boolean
when?(val: any): string | boolean
choices?: any
}

export interface GitmarsLogType
extends Partial<
Pick<SpawnSyncReturns<string>, 'stdout' | 'stderr' | 'status'>
Expand All @@ -268,9 +255,9 @@ export interface GitmarsLogType
}

export interface CommandMessageType {
processing: string
success: string
fail: string
processing?: string
success?: string
fail?: string
}

export interface RevertCacheType {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@gitmars/docs",
"description": "gitmars文档库",
"version": "3.3.0-beta.1",
"version": "3.3.0-beta.5",
"private": false,
"files": [
"dist",
Expand Down
8 changes: 4 additions & 4 deletions packages/gitmars/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gitmars",
"description": "这是一个git工作流工具",
"version": "3.3.0-beta.1",
"version": "3.3.0-beta.5",
"private": false,
"bin": {
"gitm": "lib/gitm.js"
Expand Down Expand Up @@ -38,15 +38,15 @@
"dependencies": {
"@gitmars/core": "workspace:*",
"@jssj/request": "^1.0.0-alpha.8",
"chalk": "^5.0.1",
"chalk": "^4.1.2",
"ci-info": "^3.3.2",
"columnify": "^1.6.0",
"commander": "^9.4.0",
"cosmiconfig": "^7.0.1",
"cross-spawn": "^7.0.3",
"dayjs": "^1.11.4",
"debug": "^4.3.4",
"inquirer": "^9.1.0",
"inquirer": "^8.2.4",
"js-cool": "^2.3.2",
"node-apollo": "^1.2.1",
"ora": "^5.4.1",
Expand All @@ -57,7 +57,7 @@
"@eslint-sets/eslint-config-simple-ts": "^3.0.4",
"@saqqdy/prettier-config": "^1.1.2",
"@types/cross-spawn": "^6.0.2",
"@types/inquirer": "^9.0.0",
"@types/inquirer": "^8.2.2",
"@types/node": "^18.6.4",
"@types/shelljs": "^0.8.11",
"cron-parser": "^4.6.0",
Expand Down
Loading

0 comments on commit 1a375aa

Please sign in to comment.