Commit f077e999 by liguokang

feat: 🎨

parent bca69f4e
......@@ -2,30 +2,31 @@
* @Author: liguokang
* @Date: 2021-07-28 14:33:40
* @LastEditors: liguokang
* @LastEditTime: 2021-07-28 21:11:00
* @LastEditTime: 2021-07-29 14:03:28
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
/**
* feat:新增功能
* fix:bug 修复
* docs:文档更新
* style:不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)
* refactor:重构代码(既没有新增功能,也没有修复 bug)
* perf:性能, 体验优化
* test:新增测试用例或是更新现有测试
* build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交
* ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle等)的提交
* chore:不属于以上类型的其他类型,比如构建流程, 依赖管理
* revert:回滚某个更早之前的提交
*/
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', ['feat', 'feat1', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'revert']],
'subject-full-stop': [0, 'never'],
'subject-case': [0, 'never'],
'type-enum': [
1,
'always',
[
'build', // 构建
'ci', // ci
'chore', // Other changes that don't modify src or test files. 改变构建流程、或者增加依赖库、工具等
'docs', // Adds or alters documentation. 仅仅修改了文档,比如README, CHANGELOG, CONTRIBUTE等等
'feat', // Adds a new feature. 新增feature
'fix', // Solves a bug. 修复bug
'perf', // Improves performance. 优化相关,比如提升性能、体验
'refactor', // Rewrites code without feature, performance or bug changes. 代码重构,没有加新功能或者修复bug
'revert', // Reverts a previous commit. 回滚到上一个版本
'style', // Improves formatting, white-space. 仅仅修改了空格、格式缩进、逗号等等,不改变代码逻辑
'test', // Adds or modifies tests. 测试用例,包括单元测试、集成测试等
],
],
'header-min-length': [2, 'always', 10],
'header-max-length': [2, 'always', 30],
},
};
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
node hooks/commit-msg.js
yarn commitlint --edit $1
......@@ -4,16 +4,17 @@
* @Author: 吴文洁
* @Date: 2020-06-05 14:59:14
* @LastEditors: liguokang
* @LastEditTime: 2021-07-28 11:30:15
* @LastEditTime: 2021-07-29 13:37:55
* @Description:
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
const fs = require('fs')
console.log(process);
const [
messageFile,
commitType,
] = process.env.HUSKY_GIT_PARAMS.split(' ');
] = process.env.$1.split(' ');
if (commitType == null) {
const currentMessage = fs.readFileSync(messageFile, 'utf8');
......
> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --get commit.template
process {
version: 'v14.17.0',
versions: {
node: '14.17.0',
v8: '8.4.371.23-node.63',
uv: '1.41.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.17.1',
modules: '83',
nghttp2: '1.42.0',
napi: '8',
llhttp: '2.1.3',
openssl: '1.1.1k',
cldr: '38.1',
icu: '68.2',
tz: '2020d',
unicode: '13.0'
},
arch: 'x64',
platform: 'win32',
release: {
name: 'node',
lts: 'Fermium',
sourceUrl: 'https://nodejs.org/download/release/v14.17.0/node-v14.17.0.tar.gz',
headersUrl: 'https://nodejs.org/download/release/v14.17.0/node-v14.17.0-headers.tar.gz',
libUrl: 'https://nodejs.org/download/release/v14.17.0/win-x64/node.lib'
},
_rawDebug: [Function: _rawDebug],
moduleLoadList: [
'Internal Binding native_module',
'Internal Binding errors',
'NativeModule internal/errors',
'Internal Binding config',
'Internal Binding constants',
'Internal Binding util',
'Internal Binding types',
'NativeModule internal/util',
'NativeModule internal/util/types',
'NativeModule internal/assert',
'Internal Binding icu',
'NativeModule internal/util/inspect',
'NativeModule internal/validators',
'NativeModule events',
'Internal Binding buffer',
'Internal Binding string_decoder',
'NativeModule internal/buffer',
'NativeModule buffer',
'Internal Binding symbols',
'Internal Binding messaging',
'NativeModule internal/worker/js_transferable',
'NativeModule internal/process/per_thread',
'Internal Binding process_methods',
'Internal Binding credentials',
'Internal Binding async_wrap',
'Internal Binding task_queue',
'NativeModule internal/async_hooks',
'NativeModule internal/process/promises',
'NativeModule internal/fixed_queue',
'NativeModule async_hooks',
'NativeModule internal/process/task_queues',
'Internal Binding trace_events',
'NativeModule internal/constants',
'NativeModule internal/console/constructor',
'NativeModule internal/console/global',
'NativeModule internal/util/inspector',
'Internal Binding inspector',
'NativeModule internal/querystring',
'NativeModule path',
'Internal Binding url',
'NativeModule internal/url',
'NativeModule internal/encoding',
'Internal Binding timers',
'NativeModule internal/linkedlist',
'NativeModule internal/priority_queue',
'NativeModule internal/util/debuglog',
'NativeModule internal/timers',
'NativeModule timers',
'NativeModule internal/process/execution',
'NativeModule internal/process/warning',
'NativeModule internal/process/signal',
'Internal Binding options',
'NativeModule internal/options',
'NativeModule internal/bootstrap/pre_execution',
'NativeModule internal/inspector_async_hook',
'Internal Binding report',
'NativeModule internal/process/report',
'Internal Binding fs',
'NativeModule internal/fs/utils',
'Internal Binding fs_dir',
'NativeModule internal/fs/dir',
'NativeModule fs',
'NativeModule internal/idna',
'NativeModule url',
'NativeModule internal/modules/cjs/helpers',
'NativeModule internal/source_map/source_map_cache',
'Internal Binding contextify',
'NativeModule vm',
'NativeModule internal/modules/package_json_reader',
'Internal Binding module_wrap',
'NativeModule internal/modules/esm/module_job',
'NativeModule internal/modules/esm/module_map',
'NativeModule internal/modules/esm/resolve',
'NativeModule internal/modules/esm/get_format',
'NativeModule internal/fs/rimraf',
'NativeModule internal/fs/promises',
'NativeModule internal/modules/esm/get_source',
'NativeModule internal/modules/esm/transform_source',
'NativeModule internal/modules/esm/create_dynamic_module',
'NativeModule internal/modules/esm/translators',
'NativeModule internal/modules/esm/loader',
'NativeModule internal/vm/module',
'NativeModule internal/process/esm_loader',
'NativeModule internal/modules/cjs/loader',
'NativeModule internal/modules/run_main',
'NativeModule internal/streams/destroy',
'NativeModule internal/streams/pipeline',
'NativeModule internal/streams/end-of-stream',
'NativeModule internal/streams/legacy',
'NativeModule internal/streams/buffer_list',
'NativeModule internal/streams/state',
'NativeModule internal/streams/readable',
'NativeModule internal/streams/writable',
'NativeModule internal/streams/duplex',
'NativeModule internal/streams/transform',
'NativeModule internal/streams/passthrough',
'NativeModule stream',
'NativeModule internal/fs/streams',
'NativeModule internal/net',
'Internal Binding uv',
... 7 more items
],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_events: [Object: null prototype] {
newListener: [Function: startListeningIfSignal],
removeListener: [Function: stopListeningIfSignal],
warning: [Function: onWarning]
},
_eventsCount: 3,
_maxListeners: undefined,
domain: null,
_exiting: false,
config: {
target_defaults: {
cflags: [],
default_configuration: 'Release',
defines: [],
include_dirs: [],
libraries: []
},
variables: {
asan: 0,
build_v8_with_gn: false,
coverage: false,
dcheck_always_on: 0,
debug_nghttp2: false,
debug_node: false,
enable_lto: false,
enable_pgo_generate: false,
enable_pgo_use: false,
error_on_warn: false,
force_dynamic_crt: 0,
host_arch: 'x64',
icu_data_in: '..\\..\\deps\\icu-tmp\\icudt68l.dat',
icu_endianness: 'l',
icu_gyp_path: 'tools/icu/icu-generic.gyp',
icu_path: 'deps/icu-small',
icu_small: false,
icu_ver_major: '68',
is_debug: 0,
napi_build_version: '8',
nasm_version: '2.14',
node_byteorder: 'little',
node_debug_lib: false,
node_enable_d8: false,
node_install_npm: true,
node_module_version: 83,
node_no_browser_globals: false,
node_prefix: '/usr/local',
node_release_urlbase: 'https://nodejs.org/download/release/',
node_shared: false,
node_shared_brotli: false,
node_shared_cares: false,
node_shared_http_parser: false,
node_shared_libuv: false,
node_shared_nghttp2: false,
node_shared_openssl: false,
node_shared_zlib: false,
node_tag: '',
node_target_type: 'executable',
node_use_bundled_v8: true,
node_use_dtrace: false,
node_use_etw: true,
node_use_node_code_cache: true,
node_use_node_snapshot: true,
node_use_openssl: true,
node_use_v8_platform: true,
node_with_ltcg: true,
node_without_node_options: false,
openssl_fips: '',
openssl_is_fips: false,
ossfuzz: false,
shlib_suffix: 'so.83',
target_arch: 'x64',
v8_enable_31bit_smis_on_64bit_arch: 0,
v8_enable_gdbjit: 0,
v8_enable_i18n_support: 1,
v8_enable_inspector: 1,
v8_enable_lite_mode: 0,
v8_enable_object_print: 1,
v8_enable_pointer_compression: 0,
v8_no_strict_aliasing: 1,
v8_optimized_debug: 1,
v8_promise_internal_field_count: 1,
v8_random_seed: 0,
v8_trace_maps: 0,
v8_use_siphash: 1,
want_separate_host_toolset: 0
}
},
dlopen: [Function: dlopen],
uptime: [Function: uptime],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
reallyExit: [Function: reallyExit],
_kill: [Function: _kill],
hrtime: [Function: hrtime] { bigint: [Function: hrtimeBigInt] },
cpuUsage: [Function: cpuUsage],
resourceUsage: [Function: resourceUsage],
memoryUsage: [Function: memoryUsage],
kill: [Function: kill],
exit: [Function: exit],
openStdin: [Function (anonymous)],
allowedNodeEnvironmentFlags: [Getter/Setter],
assert: [Function: deprecated],
features: {
inspector: true,
debug: false,
uv: true,
ipv6: true,
tls_alpn: true,
tls_sni: true,
tls_ocsp: true,
tls: true,
cached_builtins: true
},
_fatalException: [Function (anonymous)],
setUncaughtExceptionCaptureCallback: [Function: setUncaughtExceptionCaptureCallback],
hasUncaughtExceptionCaptureCallback: [Function: hasUncaughtExceptionCaptureCallback],
emitWarning: [Function: emitWarning],
nextTick: [Function: nextTick],
_tickCallback: [Function: runNextTicks],
_debugProcess: [Function: _debugProcess],
_debugEnd: [Function: _debugEnd],
_startProfilerIdleNotifier: [Function (anonymous)],
_stopProfilerIdleNotifier: [Function (anonymous)],
stdout: [Getter],
stdin: [Getter],
stderr: [Getter],
abort: [Function: abort],
umask: [Function: wrappedUmask],
chdir: [Function: wrappedChdir],
cwd: [Function: wrappedCwd],
env: {
ALLUSERSPROFILE: 'C:\\ProgramData',
APPDATA: 'C:\\Users\\Administrator\\AppData\\Roaming',
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL: 'true',
CHROME_CRASHPAD_PIPE_NAME: '\\\\.\\pipe\\crashpad_24492_JOMADULOFGRQJNUF',
COMMONPROGRAMFILES: 'C:\\Program Files\\Common Files',
COMPUTERNAME: 'XM',
COMSPEC: 'C:\\WINDOWS\\system32\\cmd.exe',
'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files',
CommonProgramW6432: 'C:\\Program Files\\Common Files',
DataGrip: 'D:\\softs\\JetBrains\\bin;',
'DevEco Studio': 'D:\\softs\\DevEco Studio 2.1.0.501\\bin;',
DriverData: 'C:\\Windows\\System32\\Drivers\\DriverData',
ELECTRON_RUN_AS_NODE: '1',
FLUTTER_HOME: 'D:\\softs\\flutters\\',
FLUTTER_STORAGE_BASE_UR: 'https://storage.flutter-io.cn',
GIT_ASKPASS: 'd:\\Vscode\\Microsoft VS Code\\resources\\app\\extensions\\git\\dist\\askpass.sh',
GIT_AUTHOR_DATE: '@1627537081 +0800',
GIT_AUTHOR_EMAIL: 'liguokang@xiaomai5.com',
GIT_AUTHOR_NAME: 'liguokang',
GIT_CONFIG_PARAMETERS: "'user.useConfigOnly'='true'",
GIT_EDITOR: ':',
GIT_EXEC_PATH: 'C:/Program Files/Git/mingw64/libexec/git-core',
GIT_INDEX_FILE: '.git/index',
GIT_PAGER: 'cat',
GIT_PREFIX: '',
HOME: 'C:\\Users\\Administrator',
HOMEDRIVE: 'C:',
HOMEPATH: '\\Users\\Administrator',
'IntelliJ IDEA': 'D:\\softs\\IntelliJ IDEA 2021.1.2\\bin;',
LANG: 'en_US.UTF-8',
LC_ALL: 'en_US.UTF-8',
LOCALAPPDATA: 'C:\\Users\\Administrator\\AppData\\Local',
LOGONSERVER: '\\\\XM',
MSYSTEM: 'MINGW64',
NUMBER_OF_PROCESSORS: '12',
ORIGINAL_XDG_CURRENT_DESKTOP: 'undefined',
OS: 'Windows_NT',
OneDrive: 'C:\\Users\\Administrator\\OneDrive',
OneDriveConsumer: 'C:\\Users\\Administrator\\OneDrive',
PATH: 'C:\\Program Files\\Git\\mingw64\\libexec\\git-core;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Users\\Administrator\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;C:\\WINDOWS\\System32\\OpenSSH;C:\\Program Files\\nodejs;C:\\Program Files\\Git\\cmd;D:\\softs\\flutters\\bin;D:\\softs\\flutters\\bin\\cache\\dart-sdk;C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Administrator\\AppData\\Roaming\\npm;D:\\Vscode\\Microsoft VS Code\\bin;D:\\softs\\JetBrains\\bin;C:\\Program Files\\Bandizip;D:\\softs\\IntelliJ IDEA 2021.1.2\\bin;D:\\softs\\DevEco Studio 2.1.0.501\\bin',
PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
PLINK_PROTOCOL: 'ssh',
PROCESSOR_ARCHITECTURE: 'AMD64',
PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 158 Stepping 10, GenuineIntel',
PROCESSOR_LEVEL: '6',
PROCESSOR_REVISION: '9e0a',
PROGRAMFILES: 'C:\\Program Files',
PSModulePath: 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules',
PUBLIC: 'C:\\Users\\Public',
PUB_HOSTED_URL: 'https://pub.flutter-io.cn',
PWD: 'E:/workspace/xiaomai-website-ssr-template',
ProgramData: 'C:\\ProgramData',
'ProgramFiles(x86)': 'C:\\Program Files (x86)',
ProgramW6432: 'C:\\Program Files',
SESSIONNAME: 'Console',
SHLVL: '2',
SYSTEMDRIVE: 'C:',
SYSTEMROOT: 'C:\\WINDOWS',
TEMP: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp',
TERM: 'cygwin',
TMP: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp',
TMPDIR: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp',
USERDOMAIN: 'XM',
USERDOMAIN_ROAMINGPROFILE: 'XM',
USERNAME: 'Administrator',
USERPROFILE: 'C:\\Users\\Administrator',
VSCODE_AMD_ENTRYPOINT: 'vs/workbench/services/extensions/node/extensionHostProcess',
VSCODE_BROWSER_CODE_LOADING: 'bypassHeatCheck',
VSCODE_CODE_CACHE_PATH: 'C:\\Users\\Administrator\\AppData\\Roaming\\Code\\CachedData\\c3f126316369cd610563c75b1b1725e0679adfb3',
VSCODE_CWD: 'E:\\workspace\\xiaomai-website-ssr-template',
VSCODE_GIT_ASKPASS_MAIN: 'd:\\Vscode\\Microsoft VS Code\\resources\\app\\extensions\\git\\dist\\askpass-main.js',
VSCODE_GIT_ASKPASS_NODE: 'D:\\Vscode\\Microsoft VS Code\\Code.exe',
VSCODE_GIT_COMMAND: '-c',
VSCODE_GIT_IPC_HANDLE: '\\\\.\\pipe\\vscode-git-4e1e1d73c0-sock',
VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true',
VSCODE_IPC_HOOK: '\\\\.\\pipe\\9e7283c68e6159fd1e9872b65f264be5-1.58.2-main-sock',
VSCODE_IPC_HOOK_EXTHOST: '\\\\.\\pipe\\vscode-ipc-42a0645d-3d6d-4156-bde6-010116cc0405-sock',
VSCODE_LOG_NATIVE: 'false',
VSCODE_LOG_STACK: 'false',
VSCODE_NLS_CONFIG: '{"locale":"zh-cn","availableLanguages":{"*":"zh-cn"},"_languagePackId":"fa871dcc52f689d5c3b8a42d026c7d06.zh-cn","_translationsConfigFile":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Roaming\\\\Code\\\\clp\\\\fa871dcc52f689d5c3b8a42d026c7d06.zh-cn\\\\tcf.json","_cacheRoot":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Roaming\\\\Code\\\\clp\\\\fa871dcc52f689d5c3b8a42d026c7d06.zh-cn","_resolvedLanguagePackCoreLocation":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Roaming\\\\Code\\\\clp\\\\fa871dcc52f689d5c3b8a42d026c7d06.zh-cn\\\\c3f126316369cd610563c75b1b1725e0679adfb3","_corruptedFile":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Roaming\\\\Code\\\\clp\\\\fa871dcc52f689d5c3b8a42d026c7d06.zh-cn\\\\corrupted.info","_languagePackSupport":true}',
VSCODE_PID: '24492',
VSCODE_PIPE_LOGGING: 'true',
VSCODE_VERBOSE_LOGGING: 'true',
WINDIR: 'C:\\WINDOWS',
WXDRIVE_START_ARGS: '--wxdrive-setting=0 --disable-gpu --disable-software-rasterizer --enable-features=NetworkServiceInProcess',
_: 'C:/Program Files/nodejs/node',
husky_skip_init: '1'
},
title: 'C:\\Program Files\\Git\\cmd\\git.exe',
argv: [
'C:\\Program Files\\nodejs\\node.exe',
'E:\\workspace\\xiaomai-website-ssr-template\\hooks\\commit-msg.js'
],
execArgv: [],
pid: 7748,
ppid: 4172,
execPath: 'C:\\Program Files\\nodejs\\node.exe',
debugPort: 9229,
argv0: 'C:\\Program Files\\nodejs\\node.exe',
_preload_modules: [],
mainModule: Module {
id: '.',
path: 'E:\\workspace\\xiaomai-website-ssr-template\\hooks',
exports: {},
parent: null,
filename: 'E:\\workspace\\xiaomai-website-ssr-template\\hooks\\commit-msg.js',
loaded: false,
children: [],
paths: [
'E:\\workspace\\xiaomai-website-ssr-template\\hooks\\node_modules',
'E:\\workspace\\xiaomai-website-ssr-template\\node_modules',
'E:\\workspace\\node_modules',
'E:\\node_modules'
]
},
[Symbol(kCapture)]: false
}
E:\workspace\xiaomai-website-ssr-template\hooks\commit-msg.js:17
] = process.env.$1.split(' ');
^
TypeError: Cannot read property 'split' of undefined
at Object.<anonymous> (E:\workspace\xiaomai-website-ssr-template\hooks\commit-msg.js:17:20)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
husky - pre-commit hook exited with code 1 (error)
> git config --get-all user.name
> git config --get-all user.email
> git ls-tree -l HEAD -- E:\workspace\xiaomai-website-ssr-template\hooks\commit-msg.js
> git ls-files --stage -- E:\workspace\xiaomai-website-ssr-template\hooks\commit-msg.js
> git show --textconv HEAD:hooks/commit-msg.js
> git cat-file -s 2f367681fca10254b64f81f1589ab3e55e0f9cdb
> git show --textconv :hooks/commit-msg.js
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --get commit.template
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment