Skip to content

Commit 6a1e060

Browse files
authored
feat:v1.0.5 (#24)
* perf:prefer template showLogs performance * chore(finder.view): modify code to apply prettier * feat(commit): finish set question range tag in file and get code in file by range tag * chore(commit): some modified files changes on last commit * fix(store): fix the bug for create dir outside * feat(create): can log file path and func start line number after create * chore: modify code * chore: modify changelog * chore: hide lf filter entry and hide update project * feat: v1.0.5 * chore: add hook to update changelog and update changelog
1 parent 83be063 commit 6a1e060

File tree

8 files changed

+167
-7
lines changed

8 files changed

+167
-7
lines changed

.release-it.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"autoGenerate": true
66
},
77
"git": {
8+
89
"commitMessage": "feat: v${version}",
910
"tagName": "cli-v${version}",
1011
"tag": true,
@@ -15,7 +16,7 @@
1516
"publish": false
1617
},
1718
"hooks": {
18-
"after:bump": "echo 更新版本成功"
19+
"after:bump": "git add CHANGELOG.md && git commit -m 'chore: update changelog' && echo 更新版本成功!添加changelog的commit成功!"
1920
},
2021
"plugins": {
2122
"@release-it/bumper": {

CHANGELOG.md

+120-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,125 @@
1+
## 1.0.5 (2024-03-11)
12

3+
### Bug Fixes
4+
5+
- add break before default ([08094b4](https://github.com/wh131462/leetcode-practice/commit/08094b4389a3fd1e442615dd687a55a08bd5ac62))
6+
- change ([1eb6e3c](https://github.com/wh131462/leetcode-practice/commit/1eb6e3c5ba35b22d7d3ef6893b6ace2d80050d6e))
7+
- change ([0801a1d](https://github.com/wh131462/leetcode-practice/commit/0801a1d6c63fef76d570ed7d943bd0d6f85c70e6))
8+
- change template ([872e867](https://github.com/wh131462/leetcode-practice/commit/872e867021c347e1fe4236e94cbd67aed47010a9))
9+
- console table text length verflow dislocation error ([3a563a2](https://github.com/wh131462/leetcode-practice/commit/3a563a2169bae2dd0ef26fb16e9bdedce21c8be2))
10+
- correct packageManager's format (fix [#7](https://github.com/wh131462/leetcode-practice/issues/7)) ([faa2280](https://github.com/wh131462/leetcode-practice/commit/faa2280746facefd2bd11d45d85cc70026821c0c))
11+
- delete src ([a932ce4](https://github.com/wh131462/leetcode-practice/commit/a932ce42227a8fab5d83d8bbe7a2add78c0d26a6))
12+
- delete src file ([2a53e63](https://github.com/wh131462/leetcode-practice/commit/2a53e634bbb7da7f0bf9df129901bb4c7839ba57))
13+
- find question by keyword error ([69da517](https://github.com/wh131462/leetcode-practice/commit/69da51740ff7f78a89c05ea534f80cc56f588d7f))
14+
- find question list ([6f78bfa](https://github.com/wh131462/leetcode-practice/commit/6f78bfa8fbab5d375f48d541c1b50bbfec55f9aa))
15+
- fix all lint error ([e99e76b](https://github.com/wh131462/leetcode-practice/commit/e99e76b2e1c7c9d387ab658a4c1f4057bf1a60da))
16+
- format readme form ([f002d77](https://github.com/wh131462/leetcode-practice/commit/f002d77f6e3f9e9a1259de2a5fee4b1858768620))
17+
- format readme form ([df5e45c](https://github.com/wh131462/leetcode-practice/commit/df5e45c9d55fc98dbe6bbc5b7fc80d6716d5bd34))
18+
- format readme form ([2f182ca](https://github.com/wh131462/leetcode-practice/commit/2f182ca85575fa8d2963fc0e657ee425b2215153))
19+
- format readme lint ([85b97f6](https://github.com/wh131462/leetcode-practice/commit/85b97f64258eadf4dcf1b29747e0ed0c3d161440))
20+
- getTestCase ([4ac7f65](https://github.com/wh131462/leetcode-practice/commit/4ac7f6505a47ab60d4ea74c659bb49c0d19667e6))
21+
- **headers:** remove useless header configuration ([105c841](https://github.com/wh131462/leetcode-practice/commit/105c84141206dfcf11d6a4ea46775f7546150acd))
22+
- **headers:** remove useless header configuration ([3ba1a98](https://github.com/wh131462/leetcode-practice/commit/3ba1a982a5e1d4c3b29d09af40df910f9d9dd3a5))
23+
- ignore lint ([46a9135](https://github.com/wh131462/leetcode-practice/commit/46a91358376a387b1e395e99424012685c21e09b))
24+
- ignore lint ([d376299](https://github.com/wh131462/leetcode-practice/commit/d376299a7f7e20453aaee978bba4178079b1e931))
25+
- lint ([cc63e57](https://github.com/wh131462/leetcode-practice/commit/cc63e572de4afa50b82791e1e896234b8d6b8ee4))
26+
- listnode check ([b8b3b47](https://github.com/wh131462/leetcode-practice/commit/b8b3b475637647035ac3eb9bfc5b27b61bde9a49))
27+
- log ([bd1d01b](https://github.com/wh131462/leetcode-practice/commit/bd1d01b4a440f8f80dfc67b04180dde29bac9da9))
28+
- memory calc error ([c09b344](https://github.com/wh131462/leetcode-practice/commit/c09b3440f81d0a3d6bf740aec06b320e00574b2c))
29+
- perfect version for cli install ([5a257f4](https://github.com/wh131462/leetcode-practice/commit/5a257f43fe897be40dd64a8ff8532387290a15fa))
30+
- readme_cn ([63dab20](https://github.com/wh131462/leetcode-practice/commit/63dab20f3956ae5f2abbc5df721c4ccc61d90bd2))
31+
- rename README ([2b8c294](https://github.com/wh131462/leetcode-practice/commit/2b8c294b0259d3476285ca985b8ad1e3fb2c6c2b))
32+
- rewrite log ([53d15b4](https://github.com/wh131462/leetcode-practice/commit/53d15b491c57d9e36a6fd6c36193517edb915425))
33+
- search ([5bb93dd](https://github.com/wh131462/leetcode-practice/commit/5bb93dd323c0786a17b1a4e4eae1ae3e1ba9625b))
34+
- **store:** fix the bug for create dir outside ([7254f29](https://github.com/wh131462/leetcode-practice/commit/7254f2988a656c28c0e7fbc685e16ff85cc1cbe6))
35+
- **store:** fix the bug for create dir outside ([1c66484](https://github.com/wh131462/leetcode-practice/commit/1c664846431448410ce3ddfc68ca29161c8e2683))
36+
- **tempate:** 修复空格导致字符串匹配失效问题 ([07bdbdc](https://github.com/wh131462/leetcode-practice/commit/07bdbdc88b1e50c781a65863dd1ba45c98eb5d79))
37+
- **test:** 修复挂掉的测试用例 ([4593058](https://github.com/wh131462/leetcode-practice/commit/4593058a065accc9e55e916352013de7bc6d4533))
38+
- update view for cli ([0b8ecf0](https://github.com/wh131462/leetcode-practice/commit/0b8ecf0ac7b2567168e35a6513308825aa514070))
39+
- 优化代码 ([da6aa6d](https://github.com/wh131462/leetcode-practice/commit/da6aa6d5ab87c4ecb626f1762033062a9ac432e4))
40+
- 修复原始创建不中止问题 ([ddb0ea1](https://github.com/wh131462/leetcode-practice/commit/ddb0ea11ca02abe73ee80ec8b0130466efbce457))
41+
- 模版文件路径错误 ([e46c94c](https://github.com/wh131462/leetcode-practice/commit/e46c94c85583b367d831326e4e873512b6ccf504))
42+
43+
### Code Refactoring
44+
45+
- directory refactor ([7a3a948](https://github.com/wh131462/leetcode-practice/commit/7a3a94806a1843e1c4bb86ece65d4e19ef9817fa))
46+
47+
- cli finish basically (#5) ([5af52e3](https://github.com/wh131462/leetcode-practice/commit/5af52e31b466517d2fdea9443376d27bff646bdf)), closes [#5](https://github.com/wh131462/leetcode-practice/issues/5)
48+
49+
### Features
50+
51+
- add ([fb3fadc](https://github.com/wh131462/leetcode-practice/commit/fb3fadc7fca166be0eefe51a817899466ab48b27))
52+
- add cz plugin ([4fd5af1](https://github.com/wh131462/leetcode-practice/commit/4fd5af151ac32d3daabcdc862505962fcd32f129))
53+
- add eslint ([be523ea](https://github.com/wh131462/leetcode-practice/commit/be523ea0f3085e003a2e0b5fb1c568b65cc21714))
54+
- add get question ([e5572b6](https://github.com/wh131462/leetcode-practice/commit/e5572b6357c8c056aa32eab53476736561261ebe))
55+
- add get question by keyword function ([097302a](https://github.com/wh131462/leetcode-practice/commit/097302afe095ad70d1c58942dc8ac8fb516e1eed))
56+
- add getQuestionChineseName function to get chinese name ([9520e75](https://github.com/wh131462/leetcode-practice/commit/9520e757741ff008439affd20db582458a37b674))
57+
- add getQuestionCode ([dbdb255](https://github.com/wh131462/leetcode-practice/commit/dbdb2553a2c47c9ee40fada33bfec7458ae4ccb6))
58+
- add memory calculate ([e6c315a](https://github.com/wh131462/leetcode-practice/commit/e6c315ab1524327697278e3b41c622fb22928896))
59+
- add memory demo ([8065924](https://github.com/wh131462/leetcode-practice/commit/8065924ca451e043f80644a31eb5d9543946f026))
60+
- add open process ([80dc9f5](https://github.com/wh131462/leetcode-practice/commit/80dc9f530eaae98e5449b3ebdf5c9e69ec452a17))
61+
- add prettier and commitlint ([608f4df](https://github.com/wh131462/leetcode-practice/commit/608f4dfdc4c0aebb9ead3e46abcde71fcc962b39))
62+
- change git push rules ([ee3e558](https://github.com/wh131462/leetcode-practice/commit/ee3e558496ef72f2daee071b88e79ddd06503e7c))
63+
- **cli:** 简化命令 使得命令可以在任何路径下运行 ([26fcffb](https://github.com/wh131462/leetcode-practice/commit/26fcffb8daa0e0a70e78c47772ef5059c1c825d1))
64+
- **commit:** finish set question range tag in file and get code in file by range tag ([61e2924](https://github.com/wh131462/leetcode-practice/commit/61e2924d2607e96bbd37947f05e718a10ac9edd6))
65+
- **commit:** finish set question range tag in file and get code in file by range tag ([b7eccdd](https://github.com/wh131462/leetcode-practice/commit/b7eccddb725ef460d04e8574ce5e02db533ccfd9))
66+
- **create:** can log file path and func start line number after create ([3b1365c](https://github.com/wh131462/leetcode-practice/commit/3b1365cbf9e86d4c0959817cbb845dd3495a12ab))
67+
- eslint忽略文件 ([f91889c](https://github.com/wh131462/leetcode-practice/commit/f91889c8348766a63136ada6fcd49e79a0e54378))
68+
- finish the view create & check ([9e96e0a](https://github.com/wh131462/leetcode-practice/commit/9e96e0a24f0232827196ce2bdb6c3d04966f42bd))
69+
- get js code ([b1fd6bb](https://github.com/wh131462/leetcode-practice/commit/b1fd6bb8d85d080c1f89a53cd99416c84e3abd10))
70+
- hot100合并代码 ([3ddd7c6](https://github.com/wh131462/leetcode-practice/commit/3ddd7c6237bd43655c4e3d0e490bd997afb1df5a))
71+
- node vm执行index.js脚本 ([f894e30](https://github.com/wh131462/leetcode-practice/commit/f894e3096c15d9939e0b93688f37c4272775d300))
72+
- publish config & build config ([1affd2a](https://github.com/wh131462/leetcode-practice/commit/1affd2ab7b1e1ad942d5dc3fbe5c300b5a92f240))
73+
- sucess log with green and fail log with red ([1eccefb](https://github.com/wh131462/leetcode-practice/commit/1eccefb023d28ca734c1886e0dc64a576d03f860))
74+
- update function basic ([a01c873](https://github.com/wh131462/leetcode-practice/commit/a01c8738aa060221421f2f17158c92a9069929a0))
75+
- update project using github ([a879d29](https://github.com/wh131462/leetcode-practice/commit/a879d29f9686f5c71d02bfe5c9122bc6fc90dc81))
76+
- version 1.0.2 ([4afe55e](https://github.com/wh131462/leetcode-practice/commit/4afe55e35ecea82dedbba3e6a3d9a2738365aa79))
77+
- **忽略测试覆盖率文件:** 忽略测试覆盖率文件 ([b05e380](https://github.com/wh131462/leetcode-practice/commit/b05e380ef84384f5f1ebbfb64628bd689933f755))
78+
- 新增填充markdown功能 ([1b8324d](https://github.com/wh131462/leetcode-practice/commit/1b8324d212898e8d0b7b2edc15244da31157a3c9))
79+
- 新增无向连通图数据结构 parse toArray实现,补充测试用例等 fix: 优化了转换逻辑 ([08f3787](https://github.com/wh131462/leetcode-practice/commit/08f3787f70de41d82610c1ce940f35c878dbf0d1))
80+
- 新增测试覆盖率 ([2627ecd](https://github.com/wh131462/leetcode-practice/commit/2627ecd00105d4af59e5c2fa59608da1144f17a8))
81+
- 测试用例中补充树和链表的数据结构以及转换逻辑,新增单元测试模块 ([ac9ccd1](https://github.com/wh131462/leetcode-practice/commit/ac9ccd155358306f667e9ffaa0aac9f16d58988a))
82+
- 统一数据结构 ([f15a8da](https://github.com/wh131462/leetcode-practice/commit/f15a8dad2500cef476e1340b93053be48364bf3e))
83+
84+
### Performance Improvements
85+
86+
- better scripts and easy mode to create question in project ([ffd9e29](https://github.com/wh131462/leetcode-practice/commit/ffd9e29ca35d9f4b8b6b2f8b94516e8f053261a5))
87+
- http dir structure and functions modify ([553ad58](https://github.com/wh131462/leetcode-practice/commit/553ad5861aa67423c1092f798f39b2bd4faf68f6))
88+
89+
### BREAKING CHANGES
90+
91+
- srcipts即将废弃,视图交互性代码完善1/3
92+
93+
- feat: finish the view create & check
94+
95+
- feat:完成lc&lk指令
96+
97+
- fix: 优化代码
98+
99+
- feat: add getQuestionChineseName function to get chinese name
100+
101+
- chore: del scripts and .vscode files & ignore .vscode
102+
103+
- docs: update todo & achive
104+
105+
- perf: better scripts and easy mode to create question in project
106+
107+
- feat: publish config & build config
2108

3-
## [1.0.5-beta.0](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.5-bera.0...cli-v1.0.5-beta.0) (2024-03-11)
109+
- chore: del src
110+
111+
- fix: perfect version for cli install
112+
113+
- fix:指令打包完善
114+
115+
- fix:easy mode script
116+
117+
- docs:todo 拆分成单独文件
118+
119+
- chore:路径调整成全局路径
120+
121+
- docs: add CHANGELOG and TO-DO
122+
- srcipts即将废弃,视图交互性代码完善1/3
4123

5124
## [1.0.5-bera.0](https://github.com/wh131462/leetcode-practice/compare/cli-v1.0.4-beta...cli-v1.0.5-bera.0) (2024-03-11)
6125

common/utils/create-check/createUtil.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { setQuestion } from '#common/utils/store/controller/question.js'
66
import { getQuestionChineseName } from '#common/utils/question-handler/getQuestionChineseName.js'
77
import { getQuestionById } from '#common/utils/question-getter/getQuestionById.js'
88
import { getQuestionIdBySlug } from '#common/utils/question-handler/getQuestionIdBySlug.js'
9+
import { getLineNumberByContent } from '#common/utils/file/getLineNumberByContent.js'
910

1011
export function create(mode, question, baseDir) {
1112
console.log(`MODE: ${mode}`)
@@ -14,8 +15,9 @@ export function create(mode, question, baseDir) {
1415
const questionDir = path.join(baseDir, getQuestionFileName(question))
1516
createQuestion(question, questionDir).then(async (path) => {
1617
if (!path) path = await createQuestionCopy(question, questionDir)
18+
const line = (await getLineNumberByContent(path, '@QUESTION_START')) + 1
1719
console.log(
18-
`题目[${getQuestionChineseName(question)}]获取成功!\n题目文件地址为:${path}`
20+
`题目[${getQuestionChineseName(question)}]获取成功!\n题目文件地址为:file://${path}:${line}`
1921
)
2022
resolve(true)
2123
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import fs from 'node:fs'
2+
3+
/**
4+
* 通过给入的文件地址和内容 给出对应的行号
5+
* @param filePath
6+
* @param searchString
7+
* @returns {Promise<unknown>}
8+
*/
9+
export function getLineNumberByContent(filePath, searchString) {
10+
return new Promise((resolve) => {
11+
let lineNumber = 0
12+
const readStream = fs.createReadStream(filePath, { encoding: 'utf-8' })
13+
14+
readStream.on('data', (chunk) => {
15+
const lines = chunk.split('\n')
16+
for (const line of lines) {
17+
lineNumber++
18+
if (line.includes(searchString)) {
19+
readStream.close()
20+
resolve(lineNumber)
21+
return
22+
}
23+
}
24+
})
25+
26+
readStream.on('end', () => {
27+
console.warn(`"${searchString}" not found in file: ${filePath}`)
28+
resolve(0)
29+
})
30+
31+
readStream.on('error', () => {
32+
console.warn(`"${searchString}" not found in file: ${filePath}`)
33+
resolve(0)
34+
})
35+
})
36+
}

common/utils/update/updateByEnv.js

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export function updateCli() {
3737
* @returns {Promise<void>}
3838
*/
3939
export async function updateProject() {
40+
console.log('脚本升级中,请等待后续版本更新...')
41+
return
4042
// todo 更新项目
4143
// 0. 询问是否存在自己修改过的内容
4244
// 0.1 如果有过更改,终止更新脚本,并给出提示建议

common/view/finder.view.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ export async function easyFinderView(baseDir = process.cwd()) {
6565
name: 'hot 100列表查询',
6666
value: 'hot',
6767
description: '最受欢迎的100道题目'
68-
},
69-
{ name: '筛选模式', value: 'select', description: '筛选题目' }
68+
}
69+
// { name: '筛选模式', value: 'select', description: '筛选题目' }
7070
]
7171

7272
const modeQuestion = {

common/view/update.view.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function easyUpdateView() {
3535
break
3636
case 'cli':
3737
isUpdate = isCliUpdate
38-
version = remoteVersion
38+
version = npmVersion
3939
break
4040
default:
4141
console.log('未知环境:', choseEnv)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "leetcode-practice",
33
"type": "module",
4-
"version": "1.0.5-beta.0",
4+
"version": "1.0.5",
55
"packageManager": "yarn@1.22.0",
66
"description": "A powerful practice platform for leetcode.Using any way you want to create questions.",
77
"author": {

0 commit comments

Comments
 (0)