Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@metamask/action-utils": "^1.0.0",
"@metamask/auto-changelog": "^4.0.0",
"@metamask/auto-changelog": "^6.1.0",
"@metamask/utils": "^9.0.0",
"debug": "^4.3.4",
"execa": "^8.0.1",
Expand Down Expand Up @@ -93,8 +93,17 @@
"vite": "^6.2.0"
},
"peerDependencies": {
"oxfmt": "^0.45.0",
"prettier": ">=3.0.0"
},
"peerDependenciesMeta": {
"oxfmt": {
"optional": true
},
"prettier": {
"optional": true
}
},
"packageManager": "yarn@3.2.1",
"engines": {
"node": "^18.18 || >=20"
Expand Down
6 changes: 6 additions & 0 deletions src/command-line-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type CommandLineArguments = {
defaultBranch: string;
interactive: boolean;
port: number;
formatter: string;
};

/**
Expand Down Expand Up @@ -66,6 +67,11 @@ export async function readCommandLineArguments(
type: 'number',
default: 3000,
})
.option('formatter', {
describe: 'The formatter to use for changelog formatting.',
choices: ['oxfmt', 'prettier'],
default: 'prettier',
})
.help()
.strict()
.parse();
Expand Down
9 changes: 9 additions & 0 deletions src/initial-parameters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand All @@ -60,6 +61,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
});

Expand All @@ -78,6 +80,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -110,6 +113,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -142,6 +146,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -174,6 +179,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -204,6 +210,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -234,6 +241,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -264,6 +272,7 @@ describe('initial-parameters', () => {
defaultBranch: 'main',
interactive: false,
port: 3000,
formatter: 'prettier',
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down
7 changes: 7 additions & 0 deletions src/initial-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import { readProject, Project } from './project.js';
*/
export type ReleaseType = 'ordinary' | 'backport';

/**
* The name of the formatter to use for formatting the changelog.
*/
export type Formatter = 'oxfmt' | 'prettier';

type InitialParameters = {
project: Project;
tempDirectoryPath: string;
Expand All @@ -23,6 +28,7 @@ type InitialParameters = {
defaultBranch: string;
interactive: boolean;
port: number;
formatter: Formatter;
};

/**
Expand Down Expand Up @@ -65,5 +71,6 @@ export async function determineInitialParameters({
releaseType: args.backport ? 'backport' : 'ordinary',
interactive: args.interactive,
port: args.port,
formatter: args.formatter as Formatter,
};
}
5 changes: 5 additions & 0 deletions src/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('main', () => {
releaseType: 'backport',
interactive: false,
port: 3000,
formatter: 'prettier',
});
const followMonorepoWorkflowSpy = jest
.spyOn(monorepoWorkflowOperations, 'followMonorepoWorkflow')
Expand All @@ -50,6 +51,7 @@ describe('main', () => {
firstRemovingExistingReleaseSpecification: true,
releaseType: 'backport',
defaultBranch: 'main',
formatter: 'prettier',
stdout,
stderr,
});
Expand All @@ -69,6 +71,7 @@ describe('main', () => {
releaseType: 'backport',
interactive: true,
port: 3000,
formatter: 'prettier',
});
const startUISpy = jest.spyOn(ui, 'startUI').mockResolvedValue();

Expand All @@ -84,6 +87,7 @@ describe('main', () => {
releaseType: 'backport',
defaultBranch: 'main',
port: 3000,
formatter: 'prettier',
stdout,
stderr,
});
Expand All @@ -103,6 +107,7 @@ describe('main', () => {
releaseType: 'backport',
interactive: false,
port: 3000,
formatter: 'prettier',
});
const followMonorepoWorkflowSpy = jest
.spyOn(monorepoWorkflowOperations, 'followMonorepoWorkflow')
Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function main({
defaultBranch,
interactive,
port,
formatter,
Comment thread
cursor[bot] marked this conversation as resolved.
} = await determineInitialParameters({ argv, cwd, stderr });

if (project.isMonorepo) {
Expand All @@ -47,6 +48,7 @@ export async function main({
releaseType,
defaultBranch,
port,
formatter,
stdout,
stderr,
});
Expand All @@ -57,6 +59,7 @@ export async function main({
firstRemovingExistingReleaseSpecification: reset,
releaseType,
defaultBranch,
formatter,
stdout,
stderr,
});
Expand Down
Loading
Loading