Skip to content

Commit

Permalink
fix: 使用cjs模块
Browse files Browse the repository at this point in the history
  • Loading branch information
StreakingMan committed Feb 22, 2022
1 parent 4014a9f commit 4b4899c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion actions/check-git.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
const {execSync} = require('child_process')
export const checkGit = (propName) => {
const checkGit = (propName) => {
if (!propName || propName === 'username') {
console.log(`git config user.name ${execSync('git config user.name')}`)
}
if (!propName || propName === 'email') {
console.log(`git config user.email ${execSync('git config user.email')}`)
}
}

module.exports = {
checkGit
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import {checkGit} from "./actions/check-git";
const {checkGit} = require('./actions/check-git');

const {program} = require('commander');
const fs = require('fs')
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"version": "1.0.0",
"description": "常用命令行",
"main": "index.js",
"bin": "index.js",
"bin": {
"skm": "index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"release": "standard-version"
"release": "standard-version",
"release&publish": "npm run release && npm publish"
},
"author": "",
"license": "ISC",
Expand Down

0 comments on commit 4b4899c

Please sign in to comment.