Skip to content

Commit 1289fda

Browse files
committed
fix: update
1 parent 1b5b615 commit 1289fda

File tree

6 files changed

+47
-42
lines changed

6 files changed

+47
-42
lines changed

.github/workflows/contributors.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: gen-org-contributors
22

33
on:
44
schedule:
5-
- cron: "0 0 * * *"
5+
- cron: '0 0 * * *'
66
workflow_dispatch:
77

88
jobs:
@@ -16,5 +16,5 @@ jobs:
1616
png_path: images/contributors.png
1717
json_path: contributors.json
1818
branch: svg
19-
commit_message: "chore: update contributors"
20-
excludes_list: "ImgBotApp,github-actions[bot],actions-user,imgbot[bot],dependabot[bot]"
19+
commit_message: 'chore: update contributors'
20+
excludes_list: 'ImgBotApp,github-actions[bot],actions-user,imgbot[bot],dependabot[bot]'

.github/workflows/pr-add-label.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
with:
2121
github_token: ${{ secrets.ACTION_TOKEN }}
2222
pr_number: ${{ env.PR_NUMBER }}
23-
organize_name: "EternalHeartTeam"
24-
team_name: "eternalheartteam"
23+
organize_name: EternalHeartTeam
24+
team_name: eternalheartteam

.github/workflows/release-cli.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11-
if: github.repository == 'doocs/md'
11+
if: github.repository == 'EternalHeartTeam/leetcode-practice'
1212
steps:
1313
- uses: actions/checkout@v3
1414
# Setup .npmrc file to publish to npm
@@ -18,7 +18,6 @@ jobs:
1818
registry-url: 'https://registry.npmjs.org'
1919
- run: npm install
2020
- run: npm run build-cli
21-
- run: cd md-cli && npm ci && npm publish
21+
- run: npm ci && npm publish
2222
env:
2323
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
24-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,4 +499,4 @@ If you encounter any `issues` or have some `great suggestions`, feel free to joi
499499
500500
## Star History
501501
502-
[![Star History Chart](https://api.star-history.com/svg?repos=EternalHeartTeam/leetcode-practice&type=Date)](https://star-history.com/#EternalHeartTeam/leetcode-practice&Date)
502+
[![Star History Chart](https://api.star-history.com/svg?repos=EternalHeartTeam/leetcode-practice&type=Date)](https://star-history.com/#EternalHeartTeam/leetcode-practice&Date)

bin/release.js

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
import fs from 'node:fs'
2-
import { fileURLToPath } from 'url';
3-
import path, { dirname } from 'node:path';
2+
import { fileURLToPath } from 'node:url'
3+
import path, { dirname } from 'node:path'
44
import * as child_process from 'node:child_process'
5-
import packageJson from '../package.json' assert { type: "json" };
6-
const __filename = fileURLToPath(import.meta.url);
7-
const __dirname = dirname(__filename);
8-
(async function () {
5+
import packageJson from '../package.json' assert { type: 'json' }
6+
7+
const __filename = fileURLToPath(import.meta.url)
8+
const __dirname = dirname(__filename)
9+
;(async function () {
910
// 自动更新版本
1011
// version可以传递如 6.1.1 | patch | minor | major
11-
const execCommand = arr => (Array.isArray(arr) ? arr : [arr]).forEach(c => {
12-
try {
13-
console.log(`start: ${c}...`)
14-
console.log(child_process.execSync(c).toString('utf8'))
15-
} catch (error) {
16-
console.log('\x1B[31m%s\x1B[0m', error.stdout.toString())
17-
process.exit(1)
18-
}
19-
})
12+
const execCommand = (arr) =>
13+
(Array.isArray(arr) ? arr : [arr]).forEach((c) => {
14+
try {
15+
console.log(`start: ${c}...`)
16+
console.log(child_process.execSync(c).toString('utf8'))
17+
} catch (error) {
18+
console.log('\x1B[31m%s\x1B[0m', error.stdout.toString())
19+
process.exit(1)
20+
}
21+
})
2022
const getNewVersion = (oldVersion, version = 'patch') => {
2123
// [<newversion> | major | minor | patch]
2224
if (/^([0-9]+\.*)+$/.test(version)) return version
@@ -25,23 +27,26 @@ const __dirname = dirname(__filename);
2527
if (index >= 0) {
2628
const versionArr = oldVersion.split('.')
2729
versionArr[index] = Number(versionArr[index]) + 1
28-
return versionArr.map((e, i) => i > index ? 0 : e).join('.')
30+
return versionArr.map((e, i) => (i > index ? 0 : e)).join('.')
2931
}
3032
return getNewVersion(oldVersion)
31-
}
32-
const newVersionObj = {
33-
version: getNewVersion(packageJson.version, process.argv[2]),
34-
};
35-
fs.writeFileSync(
36-
path.resolve(__dirname, '../package.json'),
37-
JSON.stringify(Object.assign({}, packageJson, newVersionObj), null, 2) +
38-
'\n'
39-
);
40-
console.log(newVersionObj);
41-
execCommand([
42-
`git commit -a -m 'chore: update version cli-v${newVersionObj.version}'`,
43-
`git tag cli-v${newVersionObj.version}`,
44-
'git push && git push --tags',
45-
])
46-
console.log('\x1B[32m%s\x1B[0m', '发布完成,请关注github CI构建')
47-
}())
33+
}
34+
const newVersionObj = {
35+
version: getNewVersion(packageJson.version, process.argv[2])
36+
}
37+
fs.writeFileSync(
38+
path.resolve(__dirname, '../package.json'),
39+
`${JSON.stringify(
40+
Object.assign({}, packageJson, newVersionObj),
41+
null,
42+
2
43+
)}\n`
44+
)
45+
console.log(newVersionObj)
46+
execCommand([
47+
`git commit -a -m 'chore: update version cli-v${newVersionObj.version}'`,
48+
`git tag cli-v${newVersionObj.version}`,
49+
'git push && git push --tags'
50+
])
51+
console.log('\x1B[32m%s\x1B[0m', '发布完成,请关注github CI构建')
52+
})()

common/utils/file/getRootPath.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'node:path'
22
import { __dirname } from '#common/utils/file/getDirname.js'
33
import { currentEnv } from '#common/utils/etc/checkEnv.js'
4+
45
// 在cli环境下 执行目录为 bin 目录 根目录就是上一层目录
56
export const rootPath =
67
currentEnv() === 'project'

0 commit comments

Comments
 (0)