Skip to content

Commit

Permalink
fix(semantic-release-plugin): Remove code to avoid semantic release b…
Browse files Browse the repository at this point in the history
…uilt-in plugins
  • Loading branch information
sullivanpj committed Nov 1, 2023
1 parent 91cdf56 commit 6a7263b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 38 deletions.
2 changes: 1 addition & 1 deletion packages/git-tools/src/release/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export async function runProjectRelease(
pluginPath = join(workspaceDir, pluginPath);
}

const plugins = resolvePlugins(config, workspaceDir, pluginPath);
const plugins = resolvePlugins(config, workspaceDir);
const tagFormat = config.tagFormat
? parseTag(config.tagFormat)
: config.tagFormat;
Expand Down
40 changes: 17 additions & 23 deletions packages/git-tools/src/release/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ const getNpmPlugin = (options: ReleaseConfig) => {

export const resolvePlugins = (
options: ReleaseConfig,
workspaceRoot: string,
pluginPath: string
workspaceRoot: string
) => {
if (!options.packageJsonDir) {
return [];
Expand All @@ -53,34 +52,29 @@ export const resolvePlugins = (

const emptyArray: never[] = [];
const defaultPlugins = [
...(options.changelog
? [
[
"@semantic-release/changelog",
{
changelogFile: options.changelogFile
}
]
]
: emptyArray),
...(options.npm ? getNpmPlugin(options) : emptyArray),
...(options.plugins ?? [])
];

if (pluginPath) {
defaultPlugins.unshift([
pluginPath,
[
"@semantic-release/commit-analyzer",
{
parserOpts: options.parserOpts,
releaseRules: options.releaseRules,
preset: options.preset,
presetConfig: options.presetConfig,
presetConfig: options.presetConfig
}
],
[
"@semantic-release/release-notes-generator",
{
linkCompare: options.linkCompare,
linkReferences: options.linkReferences,
writerOpts: options.writerOpts
parserOpts: options.parserOpts,
writerOpts: options.writerOpts,
preset: options.preset,
presetConfig: options.presetConfig
}
]);
}
],
...(options.npm ? getNpmPlugin(options) : emptyArray),
...(options.plugins ?? [])
];

if (options.git) {
defaultPlugins.push([
Expand Down
2 changes: 2 additions & 0 deletions packages/semantic-release-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"main": "./index.js",
"dependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^11.0.0",
"@semantic-release/release-notes-generator": "^12.0.0",
"conventional-changelog-writer": "^7.0.1",
"conventional-commits-filter": "^4.0.0",
"conventional-commits-parser": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ export const getCommitsForProject =
(verbose?: boolean) =>
(plugin: PluginFn) =>
async (config: unknown, context: any) => {
console.log("getCommitsForProject");
console.log(config);
console.log(context);

if (!config) {
throw new Error("Release context is missing.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { wrapStep } from "semantic-release-plugin-decorators";
import { analyzeCommitsForProject } from "./analyze-commits";
import { getCommitsForProject } from "./get-commits-for-project";
import { generateReleaseNotes } from "./release-notes-generator";

const wrapperName = "storm-semantic-release";

const analyzeCommits = wrapStep(
"analyzeCommits",
analyzeCommitsForProject(true),
{
wrapperName
}
);
const analyzeCommits = wrapStep("analyzeCommits", getCommitsForProject(true), {
wrapperName
});

const generateNotes = wrapStep("generateNotes", generateReleaseNotes(false), {
const generateNotes = wrapStep("generateNotes", getCommitsForProject(false), {
wrapperName
});

Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6a7263b

Please sign in to comment.