Skip to content

Commit 803ad00

Browse files
committed
Reorganize src/
It's hard to tell how the UI code is using the code that was originally added for the CLI. This commit splits out common code into a `core/` directory while keeping the code unique to the CLI and UI in separate `cli/` and `ui/` directories.
1 parent 725a34a commit 803ad00

57 files changed

Lines changed: 257 additions & 262 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/create-release-branch.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env node
22

3-
// Three things:
4-
// - This file doesn't export anything, as it's a script.
5-
// - We are using a `.js` extension because that's what appears in `dist/`.
6-
// - This file will only exist after running `yarn build`. We don't want
7-
// developers or CI to receive a lint error if the script has not been run.
8-
// (A warning will appear if the script *has* been run, but that is okay.)
9-
// eslint-disable-next-line import-x/no-unassigned-import, import-x/extensions, import-x/no-unresolved
10-
import '../dist/cli.js';
3+
// This file will only exist after running `yarn build`, and it will get a `.js`
4+
// extension.
5+
//
6+
// We don't want developers or CI to receive a lint error if the script has not
7+
// been run. (A warning will appear if the script *has* been run, but that is
8+
// okay.)
9+
//
10+
// eslint-disable-next-line import-x/extensions, import-x/no-unassigned-import
11+
import '../dist/scripts/cli.js';

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const config = createConfig([
106106

107107
{
108108
files: ['**/*.js', '**/*.cjs', '**/*.ts', '**/*.test.ts', '**/*.test.js'],
109-
ignores: ['src/ui/**'],
109+
ignores: ['src/ui/app/**'],
110110
extends: nodejs,
111111
},
112112

jest.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = {
6161
'/src/command-line-arguments.ts',
6262
'/src/ui.ts',
6363
'/src/ui/types.ts',
64-
'/src/dirname.ts',
64+
'/src/get-source-directory-path.ts',
6565
],
6666

6767
// Indicates which provider should be used to instrument code for coverage

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@types/express": "^5.0.0",
5656
"@types/jest": "^29.5.10",
5757
"@types/jest-when": "^3.5.2",
58-
"@types/node": "^17.0.23",
58+
"@types/node": "^22.0.0",
5959
"@types/prettier": "^2.7.3",
6060
"@types/react": "^19.0.8",
6161
"@types/react-dom": "^19.0.3",

src/cli.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import path from 'path';
55
import * as commandLineArgumentsModule from './command-line-arguments.js';
66
import * as envModule from './env.js';
77
import { determineInitialParameters } from './initial-parameters.js';
8-
import * as projectModule from './project.js';
98
import {
109
buildMockProject,
1110
buildMockPackage,
1211
createNoopWriteStream,
13-
} from '../tests/unit/helpers.js';
12+
} from '../../tests/unit/helpers.js';
13+
import * as projectModule from '../core/project.js';
1414

15+
jest.mock('../core/project');
1516
jest.mock('./command-line-arguments');
1617
jest.mock('./env');
17-
jest.mock('./project');
1818

1919
describe('initial-parameters', () => {
2020
describe('determineInitialParameters', () => {
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,9 @@ import os from 'os';
22
import path from 'path';
33

44
import { readCommandLineArguments } from './command-line-arguments.js';
5-
import { WriteStreamLike } from './fs.js';
6-
import { readProject, Project } from './project.js';
7-
8-
/**
9-
* The type of release being created as determined by the parent release.
10-
*
11-
* - An *ordinary* release includes features or fixes applied against the latest
12-
* release and is designated by bumping the first part of that release's
13-
* version string.
14-
* - A *backport* release includes fixes applied against a previous release and
15-
* is designated by bumping the second part of that release's version string.
16-
*/
17-
export type ReleaseType = 'ordinary' | 'backport';
5+
import { WriteStreamLike } from '../core/fs.js';
6+
import { readProject, Project } from '../core/project.js';
7+
import { ReleaseType } from '../core/types.js';
188

199
/**
2010
* Various pieces of information that the tool uses to run, derived from

0 commit comments

Comments
 (0)