From 9a7a18543ae6237fba2b758ee9032501bf15f109 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Thu, 13 Jul 2023 22:28:34 -0400 Subject: [PATCH 1/2] Move eslint `env` config to .eslintrc --- .eslintrc => .eslintrc.yaml | 27 ++++++++++++--------------- gulpfile.js | 3 --- 2 files changed, 12 insertions(+), 18 deletions(-) rename .eslintrc => .eslintrc.yaml (79%) diff --git a/.eslintrc b/.eslintrc.yaml similarity index 79% rename from .eslintrc rename to .eslintrc.yaml index a8dfaf97..7c2c3538 100644 --- a/.eslintrc +++ b/.eslintrc.yaml @@ -1,5 +1,7 @@ parser: babel-eslint env: + node: true + mocha: true es6: true parserOptions: ecmaVersion: 6 @@ -21,8 +23,7 @@ rules: indent: - error - 4 - - - SwitchCase: 1 + - SwitchCase: 1 space-before-function-paren: - error - never @@ -33,9 +34,8 @@ rules: consistent-return: error no-multiple-empty-lines: - error - - - max: 1 - maxBOF: 0 + - max: 1 + maxBOF: 0 no-lonely-if: error new-parens: error eol-last: error @@ -45,20 +45,17 @@ rules: - as-needed prefer-arrow-callback: - error - - - allowNamedFunctions: true + - allowNamedFunctions: true prefer-destructuring: - error - - - object: true - array: false + - object: true + array: false prefer-spread: error prefer-rest-params: error prefer-promise-reject-errors: 0 valid-typeof: 0 overrides: - - - files: - - "*.spec.js" - env: - mocha: true + - files: + - "*.spec.js" + env: + mocha: true diff --git a/gulpfile.js b/gulpfile.js index 25f777b7..5e3923bf 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -27,9 +27,6 @@ gulp.task('lint', () => { .pipe( eslint({ fix: true, - envs: [ - 'node' - ] }) ) .pipe(eslint.format()) From de1d921273fbbeae741ec467a813ee1eb1300146 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Thu, 13 Jul 2023 23:26:10 -0400 Subject: [PATCH 2/2] Use current branch as default branch --- lib/src/Gren.js | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/Gren.js b/lib/src/Gren.js index 46a8e2d9..2e0fa155 100644 --- a/lib/src/Gren.js +++ b/lib/src/Gren.js @@ -7,6 +7,7 @@ import templateConfig from './templates.js'; import ObjectAssign from 'object-assign-deep'; import cmp from 'semver-compare'; import fs from 'fs'; +import { execSync } from 'child_process'; const defaults = { tags: [], @@ -46,6 +47,13 @@ class Gren { ignoreTagsWith } = this.options; + this.options.head = this.options.head || execSync('git symbolic-ref --short HEAD', { encoding: 'utf-8' }); + try { + execSync('git rev-parse --abbrev-ref --symbolic-full-name @{u}'); + } catch { + this.options.head = execSync("git remote show origin | grep 'HEAD branch' | cut -d' ' -f5", { encoding: 'utf-8' }); + } + this.options.head = this.options.head.trim(); this.options.tags = utils.convertStringToArray(tags); this.options.ignoreLabels = utils.convertStringToArray(ignoreLabels); this.options.ignoreIssuesWith = utils.convertStringToArray(ignoreIssuesWith); diff --git a/package.json b/package.json index 1e2f9508..c1b6091e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Create a release from a tag and uses issues or commits to creating the release notes. It also can generate a CHANGELOG.md file based on the release notes (or generate a brand new).", "main": "./github-release-notes.js", "scripts": { - "changelog": "node bin/gren.js changelog --override --generate --head master", + "changelog": "node bin/gren.js changelog --override --generate", "build": "gulp build", "prerelease": "git clean -xfd && npm ci && npm test && npm run build", "release": "release-it",