Skip to content

feat:v1.0.5 #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"autoGenerate": true
},
"git": {

"commitMessage": "feat: v${version}",
"tagName": "cli-v${version}",
"tag": true,
Expand All @@ -15,7 +16,7 @@
"publish": false
},
"hooks": {
"after:bump": "echo 更新版本成功"
"after:bump": "git add CHANGELOG.md && git commit -m 'chore: update changelog' && echo 更新版本成功!添加changelog的commit成功!"
},
"plugins": {
"@release-it/bumper": {
Expand Down
121 changes: 120 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,125 @@
## 1.0.5 (2024-03-11)

### Bug Fixes

- add break before default ([08094b4](https://github.com/wh131462/leetcode-practice/commit/08094b4389a3fd1e442615dd687a55a08bd5ac62))
- change ([1eb6e3c](https://github.com/wh131462/leetcode-practice/commit/1eb6e3c5ba35b22d7d3ef6893b6ace2d80050d6e))
- change ([0801a1d](https://github.com/wh131462/leetcode-practice/commit/0801a1d6c63fef76d570ed7d943bd0d6f85c70e6))
- change template ([872e867](https://github.com/wh131462/leetcode-practice/commit/872e867021c347e1fe4236e94cbd67aed47010a9))
- console table text length verflow dislocation error ([3a563a2](https://github.com/wh131462/leetcode-practice/commit/3a563a2169bae2dd0ef26fb16e9bdedce21c8be2))
- correct packageManager's format (fix [#7](https://github.com/wh131462/leetcode-practice/issues/7)) ([faa2280](https://github.com/wh131462/leetcode-practice/commit/faa2280746facefd2bd11d45d85cc70026821c0c))
- delete src ([a932ce4](https://github.com/wh131462/leetcode-practice/commit/a932ce42227a8fab5d83d8bbe7a2add78c0d26a6))
- delete src file ([2a53e63](https://github.com/wh131462/leetcode-practice/commit/2a53e634bbb7da7f0bf9df129901bb4c7839ba57))
- find question by keyword error ([69da517](https://github.com/wh131462/leetcode-practice/commit/69da51740ff7f78a89c05ea534f80cc56f588d7f))
- find question list ([6f78bfa](https://github.com/wh131462/leetcode-practice/commit/6f78bfa8fbab5d375f48d541c1b50bbfec55f9aa))
- fix all lint error ([e99e76b](https://github.com/wh131462/leetcode-practice/commit/e99e76b2e1c7c9d387ab658a4c1f4057bf1a60da))
- format readme form ([f002d77](https://github.com/wh131462/leetcode-practice/commit/f002d77f6e3f9e9a1259de2a5fee4b1858768620))
- format readme form ([df5e45c](https://github.com/wh131462/leetcode-practice/commit/df5e45c9d55fc98dbe6bbc5b7fc80d6716d5bd34))
- format readme form ([2f182ca](https://github.com/wh131462/leetcode-practice/commit/2f182ca85575fa8d2963fc0e657ee425b2215153))
- format readme lint ([85b97f6](https://github.com/wh131462/leetcode-practice/commit/85b97f64258eadf4dcf1b29747e0ed0c3d161440))
- getTestCase ([4ac7f65](https://github.com/wh131462/leetcode-practice/commit/4ac7f6505a47ab60d4ea74c659bb49c0d19667e6))
- **headers:** remove useless header configuration ([105c841](https://github.com/wh131462/leetcode-practice/commit/105c84141206dfcf11d6a4ea46775f7546150acd))
- **headers:** remove useless header configuration ([3ba1a98](https://github.com/wh131462/leetcode-practice/commit/3ba1a982a5e1d4c3b29d09af40df910f9d9dd3a5))
- ignore lint ([46a9135](https://github.com/wh131462/leetcode-practice/commit/46a91358376a387b1e395e99424012685c21e09b))
- ignore lint ([d376299](https://github.com/wh131462/leetcode-practice/commit/d376299a7f7e20453aaee978bba4178079b1e931))
- lint ([cc63e57](https://github.com/wh131462/leetcode-practice/commit/cc63e572de4afa50b82791e1e896234b8d6b8ee4))
- listnode check ([b8b3b47](https://github.com/wh131462/leetcode-practice/commit/b8b3b475637647035ac3eb9bfc5b27b61bde9a49))
- log ([bd1d01b](https://github.com/wh131462/leetcode-practice/commit/bd1d01b4a440f8f80dfc67b04180dde29bac9da9))
- memory calc error ([c09b344](https://github.com/wh131462/leetcode-practice/commit/c09b3440f81d0a3d6bf740aec06b320e00574b2c))
- perfect version for cli install ([5a257f4](https://github.com/wh131462/leetcode-practice/commit/5a257f43fe897be40dd64a8ff8532387290a15fa))
- readme_cn ([63dab20](https://github.com/wh131462/leetcode-practice/commit/63dab20f3956ae5f2abbc5df721c4ccc61d90bd2))
- rename README ([2b8c294](https://github.com/wh131462/leetcode-practice/commit/2b8c294b0259d3476285ca985b8ad1e3fb2c6c2b))
- rewrite log ([53d15b4](https://github.com/wh131462/leetcode-practice/commit/53d15b491c57d9e36a6fd6c36193517edb915425))
- search ([5bb93dd](https://github.com/wh131462/leetcode-practice/commit/5bb93dd323c0786a17b1a4e4eae1ae3e1ba9625b))
- **store:** fix the bug for create dir outside ([7254f29](https://github.com/wh131462/leetcode-practice/commit/7254f2988a656c28c0e7fbc685e16ff85cc1cbe6))
- **store:** fix the bug for create dir outside ([1c66484](https://github.com/wh131462/leetcode-practice/commit/1c664846431448410ce3ddfc68ca29161c8e2683))
- **tempate:** 修复空格导致字符串匹配失效问题 ([07bdbdc](https://github.com/wh131462/leetcode-practice/commit/07bdbdc88b1e50c781a65863dd1ba45c98eb5d79))
- **test:** 修复挂掉的测试用例 ([4593058](https://github.com/wh131462/leetcode-practice/commit/4593058a065accc9e55e916352013de7bc6d4533))
- update view for cli ([0b8ecf0](https://github.com/wh131462/leetcode-practice/commit/0b8ecf0ac7b2567168e35a6513308825aa514070))
- 优化代码 ([da6aa6d](https://github.com/wh131462/leetcode-practice/commit/da6aa6d5ab87c4ecb626f1762033062a9ac432e4))
- 修复原始创建不中止问题 ([ddb0ea1](https://github.com/wh131462/leetcode-practice/commit/ddb0ea11ca02abe73ee80ec8b0130466efbce457))
- 模版文件路径错误 ([e46c94c](https://github.com/wh131462/leetcode-practice/commit/e46c94c85583b367d831326e4e873512b6ccf504))

### Code Refactoring

- directory refactor ([7a3a948](https://github.com/wh131462/leetcode-practice/commit/7a3a94806a1843e1c4bb86ece65d4e19ef9817fa))

- cli finish basically (#5) ([5af52e3](https://github.com/wh131462/leetcode-practice/commit/5af52e31b466517d2fdea9443376d27bff646bdf)), closes [#5](https://github.com/wh131462/leetcode-practice/issues/5)

### Features

- add ([fb3fadc](https://github.com/wh131462/leetcode-practice/commit/fb3fadc7fca166be0eefe51a817899466ab48b27))
- add cz plugin ([4fd5af1](https://github.com/wh131462/leetcode-practice/commit/4fd5af151ac32d3daabcdc862505962fcd32f129))
- add eslint ([be523ea](https://github.com/wh131462/leetcode-practice/commit/be523ea0f3085e003a2e0b5fb1c568b65cc21714))
- add get question ([e5572b6](https://github.com/wh131462/leetcode-practice/commit/e5572b6357c8c056aa32eab53476736561261ebe))
- add get question by keyword function ([097302a](https://github.com/wh131462/leetcode-practice/commit/097302afe095ad70d1c58942dc8ac8fb516e1eed))
- add getQuestionChineseName function to get chinese name ([9520e75](https://github.com/wh131462/leetcode-practice/commit/9520e757741ff008439affd20db582458a37b674))
- add getQuestionCode ([dbdb255](https://github.com/wh131462/leetcode-practice/commit/dbdb2553a2c47c9ee40fada33bfec7458ae4ccb6))
- add memory calculate ([e6c315a](https://github.com/wh131462/leetcode-practice/commit/e6c315ab1524327697278e3b41c622fb22928896))
- add memory demo ([8065924](https://github.com/wh131462/leetcode-practice/commit/8065924ca451e043f80644a31eb5d9543946f026))
- add open process ([80dc9f5](https://github.com/wh131462/leetcode-practice/commit/80dc9f530eaae98e5449b3ebdf5c9e69ec452a17))
- add prettier and commitlint ([608f4df](https://github.com/wh131462/leetcode-practice/commit/608f4dfdc4c0aebb9ead3e46abcde71fcc962b39))
- change git push rules ([ee3e558](https://github.com/wh131462/leetcode-practice/commit/ee3e558496ef72f2daee071b88e79ddd06503e7c))
- **cli:** 简化命令 使得命令可以在任何路径下运行 ([26fcffb](https://github.com/wh131462/leetcode-practice/commit/26fcffb8daa0e0a70e78c47772ef5059c1c825d1))
- **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))
- **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))
- **create:** can log file path and func start line number after create ([3b1365c](https://github.com/wh131462/leetcode-practice/commit/3b1365cbf9e86d4c0959817cbb845dd3495a12ab))
- eslint忽略文件 ([f91889c](https://github.com/wh131462/leetcode-practice/commit/f91889c8348766a63136ada6fcd49e79a0e54378))
- finish the view create & check ([9e96e0a](https://github.com/wh131462/leetcode-practice/commit/9e96e0a24f0232827196ce2bdb6c3d04966f42bd))
- get js code ([b1fd6bb](https://github.com/wh131462/leetcode-practice/commit/b1fd6bb8d85d080c1f89a53cd99416c84e3abd10))
- hot100合并代码 ([3ddd7c6](https://github.com/wh131462/leetcode-practice/commit/3ddd7c6237bd43655c4e3d0e490bd997afb1df5a))
- node vm执行index.js脚本 ([f894e30](https://github.com/wh131462/leetcode-practice/commit/f894e3096c15d9939e0b93688f37c4272775d300))
- publish config & build config ([1affd2a](https://github.com/wh131462/leetcode-practice/commit/1affd2ab7b1e1ad942d5dc3fbe5c300b5a92f240))
- sucess log with green and fail log with red ([1eccefb](https://github.com/wh131462/leetcode-practice/commit/1eccefb023d28ca734c1886e0dc64a576d03f860))
- update function basic ([a01c873](https://github.com/wh131462/leetcode-practice/commit/a01c8738aa060221421f2f17158c92a9069929a0))
- update project using github ([a879d29](https://github.com/wh131462/leetcode-practice/commit/a879d29f9686f5c71d02bfe5c9122bc6fc90dc81))
- version 1.0.2 ([4afe55e](https://github.com/wh131462/leetcode-practice/commit/4afe55e35ecea82dedbba3e6a3d9a2738365aa79))
- **忽略测试覆盖率文件:** 忽略测试覆盖率文件 ([b05e380](https://github.com/wh131462/leetcode-practice/commit/b05e380ef84384f5f1ebbfb64628bd689933f755))
- 新增填充markdown功能 ([1b8324d](https://github.com/wh131462/leetcode-practice/commit/1b8324d212898e8d0b7b2edc15244da31157a3c9))
- 新增无向连通图数据结构 parse toArray实现,补充测试用例等 fix: 优化了转换逻辑 ([08f3787](https://github.com/wh131462/leetcode-practice/commit/08f3787f70de41d82610c1ce940f35c878dbf0d1))
- 新增测试覆盖率 ([2627ecd](https://github.com/wh131462/leetcode-practice/commit/2627ecd00105d4af59e5c2fa59608da1144f17a8))
- 测试用例中补充树和链表的数据结构以及转换逻辑,新增单元测试模块 ([ac9ccd1](https://github.com/wh131462/leetcode-practice/commit/ac9ccd155358306f667e9ffaa0aac9f16d58988a))
- 统一数据结构 ([f15a8da](https://github.com/wh131462/leetcode-practice/commit/f15a8dad2500cef476e1340b93053be48364bf3e))

### Performance Improvements

- better scripts and easy mode to create question in project ([ffd9e29](https://github.com/wh131462/leetcode-practice/commit/ffd9e29ca35d9f4b8b6b2f8b94516e8f053261a5))
- http dir structure and functions modify ([553ad58](https://github.com/wh131462/leetcode-practice/commit/553ad5861aa67423c1092f798f39b2bd4faf68f6))

### BREAKING CHANGES

- srcipts即将废弃,视图交互性代码完善1/3

- feat: finish the view create & check

- feat:完成lc&lk指令

- fix: 优化代码

- feat: add getQuestionChineseName function to get chinese name

- chore: del scripts and .vscode files & ignore .vscode

- docs: update todo & achive

- perf: better scripts and easy mode to create question in project

- feat: publish config & build config

## [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)
- chore: del src

- fix: perfect version for cli install

- fix:指令打包完善

- fix:easy mode script

- docs:todo 拆分成单独文件

- chore:路径调整成全局路径

- docs: add CHANGELOG and TO-DO
- srcipts即将废弃,视图交互性代码完善1/3

## [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)

Expand Down
4 changes: 3 additions & 1 deletion common/utils/create-check/createUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { setQuestion } from '#common/utils/store/controller/question.js'
import { getQuestionChineseName } from '#common/utils/question-handler/getQuestionChineseName.js'
import { getQuestionById } from '#common/utils/question-getter/getQuestionById.js'
import { getQuestionIdBySlug } from '#common/utils/question-handler/getQuestionIdBySlug.js'
import { getLineNumberByContent } from '#common/utils/file/getLineNumberByContent.js'

export function create(mode, question, baseDir) {
console.log(`MODE: ${mode}`)
Expand All @@ -14,8 +15,9 @@ export function create(mode, question, baseDir) {
const questionDir = path.join(baseDir, getQuestionFileName(question))
createQuestion(question, questionDir).then(async (path) => {
if (!path) path = await createQuestionCopy(question, questionDir)
const line = (await getLineNumberByContent(path, '@QUESTION_START')) + 1
console.log(
`题目[${getQuestionChineseName(question)}]获取成功!\n题目文件地址为:${path}`
`题目[${getQuestionChineseName(question)}]获取成功!\n题目文件地址为:file://${path}:${line}`
)
resolve(true)
})
Expand Down
36 changes: 36 additions & 0 deletions common/utils/file/getLineNumberByContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import fs from 'node:fs'

/**
* 通过给入的文件地址和内容 给出对应的行号
* @param filePath
* @param searchString
* @returns {Promise<unknown>}
*/
export function getLineNumberByContent(filePath, searchString) {
return new Promise((resolve) => {
let lineNumber = 0
const readStream = fs.createReadStream(filePath, { encoding: 'utf-8' })

readStream.on('data', (chunk) => {
const lines = chunk.split('\n')
for (const line of lines) {
lineNumber++
if (line.includes(searchString)) {
readStream.close()
resolve(lineNumber)
return
}
}
})

readStream.on('end', () => {
console.warn(`"${searchString}" not found in file: ${filePath}`)
resolve(0)
})

readStream.on('error', () => {
console.warn(`"${searchString}" not found in file: ${filePath}`)
resolve(0)
})
})
}
2 changes: 2 additions & 0 deletions common/utils/update/updateByEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export function updateCli() {
* @returns {Promise<void>}
*/
export async function updateProject() {
console.log('脚本升级中,请等待后续版本更新...')
return
// todo 更新项目
// 0. 询问是否存在自己修改过的内容
// 0.1 如果有过更改,终止更新脚本,并给出提示建议
Expand Down
4 changes: 2 additions & 2 deletions common/view/finder.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export async function easyFinderView(baseDir = process.cwd()) {
name: 'hot 100列表查询',
value: 'hot',
description: '最受欢迎的100道题目'
},
{ name: '筛选模式', value: 'select', description: '筛选题目' }
}
// { name: '筛选模式', value: 'select', description: '筛选题目' }
]

const modeQuestion = {
Expand Down
2 changes: 1 addition & 1 deletion common/view/update.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function easyUpdateView() {
break
case 'cli':
isUpdate = isCliUpdate
version = remoteVersion
version = npmVersion
break
default:
console.log('未知环境:', choseEnv)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "leetcode-practice",
"type": "module",
"version": "1.0.5-beta.0",
"version": "1.0.5",
"packageManager": "yarn@1.22.0",
"description": "A powerful practice platform for leetcode.Using any way you want to create questions.",
"author": {
Expand Down