forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangeManager.ts
More file actions
39 lines (36 loc) · 1.43 KB
/
ChangeManager.ts
File metadata and controls
39 lines (36 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { RushConfiguration } from './RushConfiguration';
import { RushConfigurationProject } from './RushConfigurationProject';
import { ChangeFile } from './ChangeFile';
import { IChangeFile } from './ChangeManagement';
/**
* A class that helps with programatically interacting with Rush's change files.
* @public
*/
export class ChangeManager {
/**
* Creates a change file that has a 'none' type.
* @param rushConfiguration - The rush configuration we are working with
* @param projectName - The name of the project for which to create a change file
* @param emailAddress - The email address which should be associated with this change
* @returns the path to the file that was created, or undefined if no file was written
*/
public static createEmptyChangeFiles(
rushConfiguration: RushConfiguration,
projectName: string,
emailAddress: string): string | undefined {
const projectInfo: RushConfigurationProject | undefined = rushConfiguration.getProjectByName(projectName);
if (projectInfo && projectInfo.shouldPublish) {
const changefile: IChangeFile = { // eslint-disable-line @typescript-eslint/no-explicit-any
'changes': [{
comment: '',
packageName: projectName,
type: 'none'
}],
'packageName': projectName,
'email': emailAddress
};
return new ChangeFile(changefile, rushConfiguration).writeSync();
}
return undefined;
}
}