-
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.
feat(edit tools setup): edit tools setup
edit tools setup
- Loading branch information
Showing
2 changed files
with
22 additions
and
37 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 |
---|---|---|
@@ -1,54 +1,39 @@ | ||
const path = require("path") | ||
const { fork } = require("child_process") | ||
const colors = require("colors") | ||
const path = require('path') | ||
const { fork } = require('child_process') | ||
const colors = require('colors') | ||
|
||
const { readFileSync, writeFileSync } = require("fs") | ||
const pkg = JSON.parse( | ||
readFileSync(path.resolve(__dirname, "..", "package.json")) | ||
) | ||
const { readFileSync, writeFileSync } = require('fs') | ||
const pkg = JSON.parse(readFileSync(path.resolve(__dirname, '..', 'package.json'))) | ||
|
||
pkg.scripts.prepush = "npm run test:prod && npm run build" | ||
pkg.scripts.commitmsg = "commitlint -E HUSKY_GIT_PARAMS" | ||
pkg.scripts.prepush = 'npm run test:prod && npm run build' | ||
pkg.scripts.commitmsg = 'commitlint -E HUSKY_GIT_PARAMS' | ||
|
||
writeFileSync( | ||
path.resolve(__dirname, "..", "package.json"), | ||
JSON.stringify(pkg, null, 2) | ||
) | ||
writeFileSync(path.resolve(__dirname, '..', 'package.json'), JSON.stringify(pkg, null, 2)) | ||
|
||
// Call husky to set up the hooks | ||
fork(path.resolve(__dirname, "..", "node_modules", "husky", "lib", "installer", 'bin'), ['install']) | ||
fork(path.resolve(__dirname, '..', 'node_modules', 'husky', 'lib', 'installer', 'bin'), ['install']) | ||
|
||
console.log() | ||
console.log(colors.green("Done!!")) | ||
console.log(colors.green('Done!!')) | ||
console.log() | ||
|
||
if (pkg.repository.url.trim()) { | ||
console.log(colors.cyan("Now run:")) | ||
console.log(colors.cyan(" npm install -g semantic-release-cli")) | ||
console.log(colors.cyan(" semantic-release-cli setup")) | ||
console.log(colors.cyan('Now run:')) | ||
console.log(colors.cyan(' npm install -g semantic-release-cli')) | ||
console.log(colors.cyan(' semantic-release-cli setup')) | ||
console.log() | ||
console.log( | ||
colors.cyan('Important! Answer NO to "Generate travis.yml" question') | ||
) | ||
console.log(colors.cyan('Important! Answer NO to "Generate travis.yml" question')) | ||
console.log() | ||
console.log( | ||
colors.gray( | ||
'Note: Make sure "repository.url" in your package.json is correct before' | ||
) | ||
colors.gray('Note: Make sure "repository.url" in your package.json is correct before') | ||
) | ||
} else { | ||
console.log( | ||
colors.red( | ||
'First you need to set the "repository.url" property in package.json' | ||
) | ||
) | ||
console.log(colors.cyan("Then run:")) | ||
console.log(colors.cyan(" npm install -g semantic-release-cli")) | ||
console.log(colors.cyan(" semantic-release-cli setup")) | ||
console.log(colors.red('First you need to set the "repository.url" property in package.json')) | ||
console.log(colors.cyan('Then run:')) | ||
console.log(colors.cyan(' npm install -g semantic-release-cli')) | ||
console.log(colors.cyan(' semantic-release-cli setup')) | ||
console.log() | ||
console.log( | ||
colors.cyan('Important! Answer NO to "Generate travis.yml" question') | ||
) | ||
console.log(colors.cyan('Important! Answer NO to "Generate travis.yml" question')) | ||
} | ||
|
||
console.log() |