-
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
8af4a66
commit b7f9676
Showing
22 changed files
with
1,967 additions
and
1,341 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"airbnb-base" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
env: { | ||
browser: false, | ||
commonjs: true, | ||
es2021: true | ||
}, | ||
extends: 'standard', | ||
overrides: [ | ||
{ | ||
env: { | ||
node: true | ||
}, | ||
files: [ | ||
'.eslintrc.{js,cjs}' | ||
], | ||
parserOptions: { | ||
sourceType: 'script' | ||
} | ||
} | ||
}; | ||
], | ||
parserOptions: { | ||
ecmaVersion: 'latest' | ||
}, | ||
rules: { | ||
} | ||
} |
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,11 +1,11 @@ | ||
#!/usr/bin/env node | ||
const yargs = require('yargs'); | ||
const yargs = require('yargs') | ||
const { argv } = yargs | ||
.usage('Utilizzo: node $0 <command> [options]') | ||
.command(require('./commands/init')) | ||
.command(require('./commands/explore')) | ||
.command(require('./commands/generate')) | ||
.demandCommand() | ||
.argv; | ||
.argv | ||
|
||
module.exports = argv; | ||
module.exports = argv |
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,41 +1,50 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const path = require('path') | ||
const fs = require('fs') | ||
const { loadDefaultsFromFile } = require('../../helpers/defaults') | ||
|
||
const argvBuilder = function argvBuilder(yargs) { | ||
const COMMAND_DEFAULTS = { | ||
input: path.resolve(process.cwd(), './CHANGELOG.md'), | ||
output: 'console' | ||
} | ||
|
||
const argvBuilder = function argvBuilder (yargs) { | ||
const defaults = loadDefaultsFromFile('explore', COMMAND_DEFAULTS) | ||
yargs | ||
.example( | ||
'$0 explore --range 1.2.4~3.2.1', | ||
'Generate CHANGELOG summary from version 1.2.4 (exclusive) to version 3.2.1', | ||
'Generate CHANGELOG summary from version 1.2.4 (exclusive) to version 3.2.1' | ||
) | ||
.example( | ||
'$0 explore --range 1.2.4', | ||
'Generate CHANGELOG summary from version 1.2.4 (exclusive) to the latest', | ||
'Generate CHANGELOG summary from version 1.2.4 (exclusive) to the latest' | ||
) | ||
.string('range') | ||
.alias('range', 'r') | ||
.describe('range', 'Range of versions in a format like X.Y.Z ~ A.B.C') | ||
.demandOption('range', 'Should provide a range!') | ||
.default('range', defaults.range) | ||
.string('output') | ||
.alias('output', 'o') | ||
.default('output', 'console') | ||
.default('output', defaults.output) | ||
.describe('output', 'Output path') | ||
.string('input') | ||
.alias('input', 'i') | ||
.default('input', path.resolve(process.cwd(), './CHANGELOG.md')) | ||
.default('input', defaults.input) | ||
.describe('input', 'Input CHANGELOG for explore diffs') | ||
.check((args) => { | ||
const { range, output } = args; | ||
const { range, output } = args | ||
if (!range) { | ||
throw new Error('Should provide a range!'); | ||
throw new Error('Should provide a range!') | ||
} | ||
|
||
if (output !== 'console' && !fs.lstatSync(output).isDirectory()) { | ||
throw new Error('You must provide a folder, not a file path!'); | ||
throw new Error('You must provide a folder as --output, not a file path!') | ||
} | ||
return true; // tell Yargs that the arguments passed the check | ||
|
||
return true // tell Yargs that the arguments passed the check | ||
}) | ||
.help(); | ||
}; | ||
.help() | ||
} | ||
|
||
module.exports = { | ||
argvBuilder, | ||
}; | ||
argvBuilder | ||
} |
Oops, something went wrong.