-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
c16c99d
commit 18f66c8
Showing
8 changed files
with
143 additions
and
42 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
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 @@ | ||
- 发布脚本 |
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
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 |
---|---|---|
@@ -1,40 +1,41 @@ | ||
{ | ||
"name": "cli", | ||
"type": "module", | ||
"version": "0.0.1", | ||
"private": false, | ||
"scripts": { | ||
"update-dep": "npm-check-updates && ncu -u && pnpm i", | ||
"commit": "git add . && git cz", | ||
"lint": "git add . && lint-staged", | ||
"husky-lint": "git add . && lint-staged", | ||
"prepare": "husky", | ||
"log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^3.8.0", | ||
"@commitlint/cli": "^19.5.0", | ||
"@commitlint/config-conventional": "^19.5.0", | ||
"@eslint/eslintrc": "^3.1.0", | ||
"cz-git": "^1.10.1", | ||
"eslint": "^9.13.0", | ||
"eslint-plugin-format": "^0.1.2", | ||
"husky": "^9.1.6", | ||
"lint-staged": "^15.2.10", | ||
"publish": "git " | ||
}, | ||
"resolutions": { | ||
"bin-wrapper": "npm:bin-wrapper-china" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "node_modules/cz-git" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts,vue}": [ | ||
"eslint --fix" | ||
] | ||
} | ||
} | ||
"name": "cli", | ||
"type": "module", | ||
"version": "0.1.2", | ||
"private": false, | ||
"scripts": { | ||
"update-dep": "npm-check-updates && ncu -u && pnpm i", | ||
"commit": "git add . && git cz", | ||
"lint": "git add . && lint-staged", | ||
"husky-lint": "git add . && lint-staged", | ||
"prepare": "husky", | ||
"log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", | ||
"publish": "node ./script/publish.js" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^3.8.0", | ||
"@commitlint/cli": "^19.5.0", | ||
"@commitlint/config-conventional": "^19.5.0", | ||
"@eslint/eslintrc": "^3.1.0", | ||
"cz-git": "^1.10.1", | ||
"eslint": "^9.13.0", | ||
"eslint-plugin-format": "^0.1.2", | ||
"fs-extra": "^11.2.0", | ||
"husky": "^9.1.6", | ||
"lint-staged": "^15.2.10" | ||
}, | ||
"resolutions": { | ||
"bin-wrapper": "npm:bin-wrapper-china" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "node_modules/cz-git" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts,vue}": [ | ||
"eslint --fix" | ||
] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import child_process from 'node:child_process' | ||
import path from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import fsExtra from 'fs-extra' | ||
import getObjectFromJson from './utils/getObjectFromJson.js' | ||
|
||
const __dirname = fileURLToPath(import.meta.url) | ||
|
||
/** | ||
* 4、提交package.json和changelog.md | ||
* 5、创建tag | ||
* 6、提交tag | ||
*/ | ||
|
||
// 读取版本 | ||
function getVersion() { | ||
const package_path = path.resolve(__dirname, `../../cli/package.json`) | ||
const _config = getObjectFromJson(package_path) | ||
return _config.version | ||
} | ||
|
||
function publish() { | ||
// 修改package.json版本号 | ||
const _path = `../../package.json` | ||
const package_path = path.resolve(__dirname, _path) | ||
const _config = getObjectFromJson(package_path) | ||
_config.version = getVersion() | ||
|
||
const fileStr = JSON.stringify(_config, '', '\t') | ||
fsExtra.outputFile( | ||
package_path, | ||
fileStr, | ||
'utf-8', | ||
) | ||
|
||
// 生成changelog.md | ||
child_process.exec('pnpm log', (error) => { | ||
if (!error) { | ||
// 成功 | ||
child_process.exec('git add .', (error) => { | ||
console.log('error1', error) | ||
|
||
child_process.exec('git cz', (error) => { | ||
console.log('error2', error) | ||
}) | ||
}) | ||
} else { | ||
console.log('生成changelog.md失败', error) | ||
} | ||
}) | ||
} | ||
|
||
publish() |
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,6 @@ | ||
import { readFileSync } from 'node:fs' | ||
|
||
export default function (path) { | ||
const data = readFileSync(path) | ||
return JSON.parse(data) | ||
} |