Skip to content

Commit

Permalink
fix: 🐛 release comment
Browse files Browse the repository at this point in the history
merge comments

fix #1
  • Loading branch information
bubkoo committed Nov 3, 2020
1 parent 9281cbe commit 5e305e7
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 54 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"detect-newline": "^3.1.0",
"get-stream": "^6.0.0",
"git-log-parser": "^1.2.0",
"lodash.clonedeep": "^4.5.0",
"lodash.identity": "^3.0.0",
"promise-events": "^0.2.0",
"semantic-release": "^17.2.2",
Expand All @@ -60,6 +61,7 @@
"@commitlint/config-conventional": "^11.0.0",
"@types/bash-glob": "^2.0.0",
"@types/debug": "^4.1.5",
"@types/lodash.clonedeep": "^4.5.6",
"@types/lodash.identity": "^3.0.6",
"@types/node": "^14.0.27",
"@types/semantic-release": "^17.2.0",
Expand Down
9 changes: 0 additions & 9 deletions packages/a/CHANGELOG.md

This file was deleted.

9 changes: 0 additions & 9 deletions packages/b/CHANGELOG.md

This file was deleted.

11 changes: 0 additions & 11 deletions packages/c/CHANGELOG.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/d/CHANGELOG.md

This file was deleted.

22 changes: 4 additions & 18 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export namespace Plugin {
const releases: SemanticRelease.Release[] = []

return function create(pkg: Package) {
const { deps, plugins, dir, path, name } = pkg
const { deps, plugins, plugins2, dir, path, name } = pkg
let filteredCommits: Commits.Commit[]
let oldCommits: Commits.Commit[]

Expand Down Expand Up @@ -243,27 +243,13 @@ export namespace Plugin {
releases.push(...ctx.releases)
}

if (successExeCount < packages.length) {
const options = context.options
if (options) {
const plugins = options.plugins
plugins.forEach((plugin) => {
if (Array.isArray(plugin)) {
const [name, args] = plugin
if (name === '@semantic-release/github') {
args.successComment = false
}
}
})
}
}

if (successExeCount === packages.length) {
ctx.releases = releases
await plugins.success(context)
} else {
await plugins2.success(context)
}

await plugins.success(context)

debug('succeed: %s', pkg.name)
}

Expand Down
27 changes: 21 additions & 6 deletions src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Signale } from 'signale'
import { WritableStreamBuffer } from 'stream-buffers'
import SemanticRelease from 'semantic-release'
import semanticGetConfig from 'semantic-release/lib/get-config'
import cloneDeep from 'lodash.clonedeep'
import { Util } from './util'
import { check } from './blork'
import { Logger } from './logger'
Expand Down Expand Up @@ -92,26 +93,40 @@ export namespace Release {
const pkgOptions = await Util.getConfig(dir)
const finalOptions = Object.assign({}, globalOptions, pkgOptions)
const logger = { error() {}, log() {} }
const forkOptions = cloneDeep(finalOptions)
if (forkOptions.plugins) {
forkOptions.plugins.forEach((plugin) => {
if (Array.isArray(plugin)) {
const [name, config] = plugin
if (name === '@semantic-release/github') {
if (config) {
config.successComment = false
}
}
}
})
}

const context = { env, stdout, stderr, logger: logger as any, cwd: dir }

// Use semantic-release's internal config with the final options (now we
// have the right `options.plugins` setting) to get the plugins object and
// the options including defaults.
// We need this so we can call e.g. plugins.analyzeCommit() to be able to
// affect the input and output of the whole set of plugins.
const { options, plugins } = await loadSemanticRelease(
{ env, stdout, stderr, logger: logger as any, cwd: dir },
finalOptions,
)
const instance1 = await loadSemanticRelease(context, finalOptions)
const instance2 = await loadSemanticRelease(context, forkOptions)

return {
path,
dir,
name,
manifest,
deps,
options,
plugins,
logger,
options: instance1.options,
plugins: instance1.plugins,
plugins2: instance2.plugins,
localDeps: [],
}
}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Package {
manifest: { [name: string]: any }
deps: string[]
plugins: any
plugins2: any
logger: Logger
options: SemanticRelease.Options
localDeps: Package[]
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,13 @@
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0"
integrity sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==

"@types/lodash.clonedeep@^4.5.6":
version "4.5.6"
resolved "https://registry.npmjs.org/@types/lodash.clonedeep/-/lodash.clonedeep-4.5.6.tgz#3b6c40a0affe0799a2ce823b440a6cf33571d32b"
integrity sha512-cE1jYr2dEg1wBImvXlNtp0xDoS79rfEdGozQVgliDZj1uERH4k+rmEMTudP9b4VQ8O6nRb5gPqft0QzEQGMQgA==
dependencies:
"@types/lodash" "*"

"@types/lodash.identity@^3.0.6":
version "3.0.6"
resolved "https://registry.npmjs.org/@types/lodash.identity/-/lodash.identity-3.0.6.tgz#55e1858a9e51c9963c63190ac88eb427c8b5015b"
Expand Down

0 comments on commit 5e305e7

Please sign in to comment.