Skip to content

chore: Update formatting #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"extends": ["standard", "plugin:mocha/recommended"],
"plugins": [
"mocha",
"@fintechstudios/eslint-plugin-chai-as-promised",
],
"extends": ["prettier", "eslint:recommended", "plugin:mocha/recommended"],
"env": { "node": true, "es6": true },
"parserOptions": { "ecmaVersion": 2023 },
"plugins": ["mocha", "@fintechstudios/eslint-plugin-chai-as-promised"],
"rules": {
"no-var": "error",
"no-unused-vars": ["error", { "argsIgnorePattern": "_.*" }],
"mocha/max-top-level-suites": "off",
"mocha/no-setup-in-describe": "off",
"@fintechstudios/chai-as-promised/no-unhandled-promises": "error",
"@fintechstudios/chai-as-promised/no-await-in-condition": "error"
}
}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.ts text eol=lf
*.js text eol=lf
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
12 changes: 6 additions & 6 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
/* istanbul ignore if */
if (process.version.match(/v(\d+)\./)[1] < 6) {
console.error(
'commit-and-tag-version: Node v6 or greater is required. `commit-and-tag-version` did not run.'
)
'commit-and-tag-version: Node v6 or greater is required. `commit-and-tag-version` did not run.',
);
} else {
const standardVersion = require('../index')
const cmdParser = require('../command')
const standardVersion = require('../index');
const cmdParser = require('../command');
standardVersion(cmdParser.argv).catch(() => {
process.exit(1)
})
process.exit(1);
});
}
75 changes: 38 additions & 37 deletions command.js
Original file line number Diff line number Diff line change
@@ -1,160 +1,161 @@
const spec = require('conventional-changelog-config-spec')
const { getConfiguration } = require('./lib/configuration')
const defaults = require('./defaults')
const spec = require('conventional-changelog-config-spec');
const { getConfiguration } = require('./lib/configuration');
const defaults = require('./defaults');

const yargs = require('yargs')
.usage('Usage: $0 [options]')
.option('packageFiles', {
default: defaults.packageFiles,
array: true
array: true,
})
.option('bumpFiles', {
default: defaults.bumpFiles,
array: true
array: true,
})
.option('release-as', {
alias: 'r',
describe:
'Specify the release type manually (like npm version <major|minor|patch>)',
requiresArg: true,
string: true
string: true,
})
.option('prerelease', {
alias: 'p',
describe:
'make a pre-release with optional option value to specify a tag id',
string: true
string: true,
})
.option('infile', {
alias: 'i',
describe: 'Read the CHANGELOG from this file',
default: defaults.infile
default: defaults.infile,
})
.option('message', {
alias: ['m'],
describe:
'[DEPRECATED] Commit message, replaces %s with new version.\nThis option will be removed in the next major version, please use --releaseCommitMessageFormat.',
type: 'string'
type: 'string',
})
.option('first-release', {
alias: 'f',
describe: 'Is this the first release?',
type: 'boolean',
default: defaults.firstRelease
default: defaults.firstRelease,
})
.option('sign', {
alias: 's',
describe: 'Should the git commit and tag be signed?',
type: 'boolean',
default: defaults.sign
default: defaults.sign,
})
.option('no-verify', {
alias: 'n',
describe:
'Bypass pre-commit or commit-msg git hooks during the commit phase',
type: 'boolean',
default: defaults.noVerify
default: defaults.noVerify,
})
.option('commit-all', {
alias: 'a',
describe:
'Commit all staged changes, not just files affected by commit-and-tag-version',
type: 'boolean',
default: defaults.commitAll
default: defaults.commitAll,
})
.option('silent', {
describe: "Don't print logs and errors",
type: 'boolean',
default: defaults.silent
default: defaults.silent,
})
.option('tag-prefix', {
alias: 't',
describe: 'Set a custom prefix for the git tag to be created',
type: 'string',
default: defaults.tagPrefix
default: defaults.tagPrefix,
})
.option('release-count', {
describe: 'How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to 0 to regenerate all.',
describe:
'How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to 0 to regenerate all.',
type: 'number',
default: defaults.releaseCount
default: defaults.releaseCount,
})
.option('tag-force', {
describe: 'Allow tag replacement',
type: 'boolean',
default: defaults.tagForce
default: defaults.tagForce,
})
.option('scripts', {
describe:
'Provide scripts to execute for lifecycle events (prebump, precommit, etc.,)',
default: defaults.scripts
default: defaults.scripts,
})
.option('skip', {
describe: 'Map of steps in the release process that should be skipped',
default: defaults.skip
default: defaults.skip,
})
.option('dry-run', {
type: 'boolean',
default: defaults.dryRun,
describe: 'See the commands that running commit-and-tag-version would run'
describe: 'See the commands that running commit-and-tag-version would run',
})
.option('git-tag-fallback', {
type: 'boolean',
default: defaults.gitTagFallback,
describe:
'fallback to git tags for version, if no meta-information file is found (e.g., package.json)'
'fallback to git tags for version, if no meta-information file is found (e.g., package.json)',
})
.option('path', {
type: 'string',
describe: 'Only populate commits made under this path'
describe: 'Only populate commits made under this path',
})
.option('changelogHeader', {
type: 'string',
describe:
'[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.'
'[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.',
})
.option('preset', {
type: 'string',
default: defaults.preset,
describe: 'Commit message guideline preset'
describe: 'Commit message guideline preset',
})
.option('lerna-package', {
type: 'string',
describe: 'Name of the package from which the tags will be extracted'
describe: 'Name of the package from which the tags will be extracted',
})
.option('npmPublishHint', {
type: 'string',
default: defaults.npmPublishHint,
describe: 'Customized publishing hint'
describe: 'Customized publishing hint',
})
.check((argv) => {
if (typeof argv.scripts !== 'object' || Array.isArray(argv.scripts)) {
throw Error('scripts must be an object')
throw Error('scripts must be an object');
} else if (typeof argv.skip !== 'object' || Array.isArray(argv.skip)) {
throw Error('skip must be an object')
throw Error('skip must be an object');
} else {
return true
return true;
}
})
.alias('version', 'v')
.alias('help', 'h')
.example('$0', 'Update changelog and tag release')
.example(
'$0 -m "%s: see changelog for details"',
'Update changelog and tag release with custom commit message'
'Update changelog and tag release with custom commit message',
)
.pkgConf('standard-version')
.pkgConf('commit-and-tag-version')
.config(getConfiguration())
.wrap(97)
.wrap(97);

Object.keys(spec.properties).forEach((propertyKey) => {
const property = spec.properties[propertyKey]
const property = spec.properties[propertyKey];
yargs.option(propertyKey, {
type: property.type,
describe: property.description,
default: defaults[propertyKey] ? defaults[propertyKey] : property.default,
group: 'Preset Configuration:'
})
})
group: 'Preset Configuration:',
});
});

module.exports = yargs
module.exports = yargs;
22 changes: 11 additions & 11 deletions defaults.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const spec = require('conventional-changelog-config-spec')
const spec = require('conventional-changelog-config-spec');

const defaults = {
infile: 'CHANGELOG.md',
Expand All @@ -15,29 +15,29 @@ const defaults = {
tagForce: false,
gitTagFallback: true,
preset: require.resolve('conventional-changelog-conventionalcommits'),
npmPublishHint: undefined
}
npmPublishHint: undefined,
};

/**
* Merge in defaults provided by the spec
*/
Object.keys(spec.properties).forEach((propertyKey) => {
const property = spec.properties[propertyKey]
defaults[propertyKey] = property.default
})
const property = spec.properties[propertyKey];
defaults[propertyKey] = property.default;
});

/**
* Sets the default for `header` (provided by the spec) for backwards
* compatibility. This should be removed in the next major version.
*/
defaults.header =
'# Changelog\n\nAll notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.\n'
'# Changelog\n\nAll notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.\n';

defaults.packageFiles = ['package.json', 'bower.json', 'manifest.json']
defaults.packageFiles = ['package.json', 'bower.json', 'manifest.json'];

defaults.bumpFiles = defaults.packageFiles.concat([
'package-lock.json',
'npm-shrinkwrap.json'
])
'npm-shrinkwrap.json',
]);

module.exports = defaults
module.exports = defaults;
Loading