Skip to content

feat: release UI beta #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ module.exports = {
'/node_modules/',
'/src/cli.ts',
'/src/command-line-arguments.ts',
'/src/interactive-ui.ts',
'/src/dirname.ts',
],

// Indicates which provider should be used to instrument code for coverage
Expand Down Expand Up @@ -217,7 +219,7 @@ module.exports = {

// A map from regular expressions to paths to transformers
transform: {
"\\.[jt]sx?$": "babel-jest"
'\\.[jt]sx?$': 'babel-jest',
},

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,28 @@
"dist/"
],
"scripts": {
"build": "tsc --project tsconfig.build.json",
"build": "tsc --project tsconfig.build.json && npm run build:ui-static",
"build:clean": "rimraf dist && yarn build",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
"prepack": "./scripts/prepack.sh",
"test": "jest && jest-it-up --config jest.config.cjs",
"test:watch": "jest --watch"
"test:watch": "jest --watch",
"build:ui-static": "cp src/ui/index.html dist/ui"
},
"dependencies": {
"@metamask/action-utils": "^1.0.0",
"@metamask/auto-changelog": "^4.0.0",
"@metamask/utils": "^9.0.0",
"debug": "^4.3.4",
"execa": "^8.0.1",
"express": "^4.21.2",
"pony-cause": "^2.1.9",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-markdown": "^9.0.3",
"semver": "^7.5.4",
"validate-npm-package-name": "^5.0.0",
"which": "^3.0.0",
Expand All @@ -48,10 +53,13 @@
"@metamask/eslint-config-nodejs": "^10.0.0",
"@metamask/eslint-config-typescript": "^10.0.0",
"@types/debug": "^4.1.7",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.10",
"@types/jest-when": "^3.5.2",
"@types/node": "^17.0.23",
"@types/prettier": "^2.7.3",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@types/rimraf": "^4.0.5",
"@types/validate-npm-package-name": "^4.0.2",
"@types/which": "^3.0.0",
Expand Down
15 changes: 15 additions & 0 deletions src/command-line-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export type CommandLineArguments = {
reset: boolean;
backport: boolean;
defaultBranch: string;
interactive: boolean;
port: number;
};

/**
Expand Down Expand Up @@ -51,6 +53,19 @@ export async function readCommandLineArguments(
default: 'main',
type: 'string',
})
.option('interactive', {
alias: 'i',
describe:
'Start an interactive web UI for selecting package versions to release',
type: 'boolean',
default: false,
})
.option('port', {
describe:
'Port to run the interactive web UI server (only used with --interactive)',
type: 'number',
default: 3000,
})
.help()
.strict()
.parse();
Expand Down
14 changes: 14 additions & 0 deletions src/dirname.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

/**
* Get the current directory path.
*
* @returns The current directory path.
*/
export function getCurrentDirectoryPath() {
return __dirname;
}
18 changes: 18 additions & 0 deletions src/initial-parameters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ describe('initial-parameters', () => {
reset: true,
backport: false,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand All @@ -56,6 +58,8 @@ describe('initial-parameters', () => {
reset: true,
releaseType: 'ordinary',
defaultBranch: 'main',
interactive: false,
port: 3000,
});
});

Expand All @@ -72,6 +76,8 @@ describe('initial-parameters', () => {
reset: true,
backport: false,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -102,6 +108,8 @@ describe('initial-parameters', () => {
reset: true,
backport: false,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -132,6 +140,8 @@ describe('initial-parameters', () => {
reset: true,
backport: false,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -162,6 +172,8 @@ describe('initial-parameters', () => {
reset: true,
backport: false,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -190,6 +202,8 @@ describe('initial-parameters', () => {
reset: false,
backport: false,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -218,6 +232,8 @@ describe('initial-parameters', () => {
reset: false,
backport: true,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down Expand Up @@ -246,6 +262,8 @@ describe('initial-parameters', () => {
reset: false,
backport: false,
defaultBranch: 'main',
interactive: false,
port: 3000,
});
jest
.spyOn(envModule, 'getEnvironmentVariables')
Expand Down
4 changes: 4 additions & 0 deletions src/initial-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type InitialParameters = {
reset: boolean;
releaseType: ReleaseType;
defaultBranch: string;
interactive: boolean;
port: number;
};

/**
Expand Down Expand Up @@ -61,5 +63,7 @@ export async function determineInitialParameters({
reset: args.reset,
defaultBranch: args.defaultBranch,
releaseType: args.backport ? 'backport' : 'ordinary',
interactive: args.interactive,
port: args.port,
};
}
Loading
Loading