-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate to semantic-release 24
- Loading branch information
1 parent
a57ef3b
commit 3bd491b
Showing
19 changed files
with
6,746 additions
and
2,396 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
# . "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit "$1" |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# require meeting the Node version restriction strictly | ||
# defined in package.json -> engines section | ||
engine-strict=true |
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
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,44 +1,47 @@ | ||
#!/usr/bin/env node | ||
|
||
const utils = require('../utils'); | ||
const path = require('path'); | ||
const validateConfig = require('../validateConfig'); | ||
const config = require(path.resolve('package.json')); | ||
const branch = process.env.TRAVIS_BRANCH || process.env.GIT_LOCAL_BRANCH || utils.ghActionsBranch(process.env); | ||
import { ghActionsBranch } from '../utils.js'; | ||
import validateConfig from '../validateConfig.js'; | ||
import config from 'package.json'; | ||
import { exec } from 'child_process'; | ||
const branch = process.env.TRAVIS_BRANCH || process.env.GIT_LOCAL_BRANCH || ghActionsBranch(process.env); | ||
const branchTags = config.release && config.release.branchTags; | ||
const tag = branchTags && branchTags[branch]; | ||
const dryRun = process.argv.find(arg => /^(--dry-run|-n)$/.test(arg)); | ||
const publicPackage = process.argv.find(arg => /^(--public)$/.test(arg)); | ||
const validate = process.argv.find(arg => /^(--validate|-v)$/.test(arg)); | ||
const command = [ 'npm', 'publish' ]; | ||
const command = ['npm', 'publish']; | ||
|
||
if (validate) { | ||
function semanticRelease() { | ||
if (validate) { | ||
validateConfig(config); | ||
return; | ||
} | ||
|
||
if (tag) { | ||
command.push('--tag', tag); | ||
} | ||
} | ||
// } else { | ||
if (tag) { | ||
command.push('--tag', tag); | ||
} | ||
|
||
if (publicPackage) { | ||
command.push('--access=public'); | ||
} | ||
if (publicPackage) { | ||
command.push('--access=public'); | ||
} | ||
|
||
if (!branchTags) { | ||
console.warn('[WARN] No branch tag configuration'); | ||
} | ||
if (!branchTags) { | ||
console.warn('[WARN] No branch tag configuration'); | ||
} | ||
|
||
if (dryRun) { | ||
console.log(command.join(' ')); | ||
} else { | ||
const exec = require('child_process').exec; | ||
exec(command.join(' '), function(error, stdout, stderr) { | ||
console.log(stdout); | ||
if (dryRun) { | ||
console.log(command.join(' ')); | ||
} else { | ||
exec(command.join(' '), function (error, stdout, stderr) { | ||
console.log(stdout); | ||
|
||
if (error) { | ||
console.error(`[ERROR] npm publish: ${stderr}`); | ||
process.exit(1); | ||
} | ||
}); | ||
if (error) { | ||
console.error(`[ERROR] npm publish: ${stderr}`); | ||
process.exit(1); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
semanticRelease(); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
extends: ["@commitlint/config-conventional"], | ||
}; |
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,16 +1,16 @@ | ||
const changelog = require('conventional-changelog') | ||
const parseUrl = require('github-url-from-git') | ||
const lastTag = require('./lastTag'); | ||
import conventionalChangelog from 'conventional-changelog'; | ||
import parseUrl from 'github-url-from-git'; | ||
import { lastTag } from './lastTag.js'; | ||
|
||
module.exports = function (pluginConfig, {pkg}, cb) { | ||
export default function (pluginConfig, {pkg}, cb) { | ||
console.log("============================= generate notes"); | ||
const repository = pkg.repository ? parseUrl(pkg.repository.url) : null | ||
const from = lastTag(); | ||
|
||
changelog({ | ||
conventionalChangelog({ | ||
version: pkg.version, | ||
repository: repository, | ||
from: from, | ||
file: false | ||
}, cb) | ||
}; | ||
|
||
} |
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,10 +1,8 @@ | ||
const execSync = require('child_process').execSync; | ||
import { execSync } from 'child_process'; | ||
|
||
const lastTag = ({ branch = 'origin/master', dev = true } = {}) => { | ||
export const lastTag = ({ branch = 'origin/master', dev = true } = {}) => { | ||
const exclude = dev ? ' --exclude="*dev*"' : ''; | ||
return execSync(`git describe --tags --match "v[0-9]*" ${exclude} --abbrev=0 ${branch} || true`, | ||
{ encoding: 'utf8' } | ||
).trim(); | ||
}; | ||
|
||
module.exports = lastTag; | ||
} |
Oops, something went wrong.