Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat(esm): convert to esm (#2569)
for #2543 BREAKING CHANGE: semantic-release is now ESM-only. since it is used through its own executable, the impact on consuming projects should be minimal BREAKING CHANGE: references to plugin files in configs need to include the file extension because of executing in an ESM context
- Loading branch information
Showing
67 changed files
with
3,026 additions
and
1,786 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
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
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,24 +1,22 @@ | ||
const {isNil, uniqBy} = require('lodash'); | ||
const semver = require('semver'); | ||
const {isMaintenanceRange} = require('../utils'); | ||
import {isNil, uniqBy} from 'lodash-es'; | ||
import semver from 'semver'; | ||
import {isMaintenanceRange} from '../utils.js'; | ||
|
||
const maintenance = { | ||
export const maintenance = { | ||
filter: ({name, range}) => (!isNil(range) && range !== false) || isMaintenanceRange(name), | ||
branchValidator: ({range}) => (isNil(range) ? true : isMaintenanceRange(range)), | ||
branchesValidator: (branches) => uniqBy(branches, ({range}) => semver.validRange(range)).length === branches.length, | ||
}; | ||
|
||
const prerelease = { | ||
export const prerelease = { | ||
filter: ({prerelease}) => !isNil(prerelease) && prerelease !== false, | ||
branchValidator: ({name, prerelease}) => | ||
Boolean(prerelease) && Boolean(semver.valid(`1.0.0-${prerelease === true ? name : prerelease}.1`)), | ||
branchesValidator: (branches) => uniqBy(branches, 'prerelease').length === branches.length, | ||
}; | ||
|
||
const release = { | ||
export const release = { | ||
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator | ||
filter: (branch) => !maintenance.filter(branch) && !prerelease.filter(branch), | ||
branchesValidator: (branches) => branches.length <= 3 && branches.length > 0, | ||
}; | ||
|
||
module.exports = {maintenance, prerelease, release}; |
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,29 +1,17 @@ | ||
const RELEASE_TYPE = ['patch', 'minor', 'major']; | ||
export const RELEASE_TYPE = ['patch', 'minor', 'major']; | ||
|
||
const FIRST_RELEASE = '1.0.0'; | ||
export const FIRST_RELEASE = '1.0.0'; | ||
|
||
const FIRSTPRERELEASE = '1'; | ||
export const FIRSTPRERELEASE = '1'; | ||
|
||
const COMMIT_NAME = 'semantic-release-bot'; | ||
export const COMMIT_NAME = 'semantic-release-bot'; | ||
|
||
const COMMIT_EMAIL = 'semantic-release-bot@martynus.net'; | ||
export const COMMIT_EMAIL = 'semantic-release-bot@martynus.net'; | ||
|
||
const RELEASE_NOTES_SEPARATOR = '\n\n'; | ||
export const RELEASE_NOTES_SEPARATOR = '\n\n'; | ||
|
||
const SECRET_REPLACEMENT = '[secure]'; | ||
export const SECRET_REPLACEMENT = '[secure]'; | ||
|
||
const SECRET_MIN_SIZE = 5; | ||
export const SECRET_MIN_SIZE = 5; | ||
|
||
const GIT_NOTE_REF = 'semantic-release'; | ||
|
||
module.exports = { | ||
RELEASE_TYPE, | ||
FIRST_RELEASE, | ||
FIRSTPRERELEASE, | ||
COMMIT_NAME, | ||
COMMIT_EMAIL, | ||
RELEASE_NOTES_SEPARATOR, | ||
SECRET_REPLACEMENT, | ||
SECRET_MIN_SIZE, | ||
GIT_NOTE_REF, | ||
}; | ||
export const GIT_NOTE_REF = 'semantic-release'; |
Oops, something went wrong.