Skip to content

Commit 38f2352

Browse files
feat: add command
1 parent 0c748ff commit 38f2352

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

__tests__/utils/misc.test.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ describe('getBuildCommands', () => {
177177
});
178178

179179
it('should get build commands 2', () => {
180+
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test4'))).toEqual([
181+
'yarn install',
182+
'yarn build', // build command of package.json
183+
'yarn install --production',
184+
'rm -rdf .github',
185+
]);
186+
});
187+
188+
it('should get build commands 3', () => {
180189
process.env.INPUT_BUILD_COMMAND = 'yarn build';
181190
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test4'))).toEqual([
182191
'yarn install',
@@ -185,15 +194,15 @@ describe('getBuildCommands', () => {
185194
]);
186195
});
187196

188-
it('should get build commands 3', () => {
197+
it('should get build commands 4', () => {
189198
process.env.INPUT_BUILD_COMMAND = 'yarn install && yarn build';
190199
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test4'))).toEqual([
191200
'yarn install',
192201
'yarn build',
193202
]);
194203
});
195204

196-
it('should get build commands 4', () => {
205+
it('should get build commands 5', () => {
197206
process.env.INPUT_BUILD_COMMAND = 'test';
198207
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test1'))).toEqual([
199208
'yarn install',
@@ -202,9 +211,10 @@ describe('getBuildCommands', () => {
202211
]);
203212
});
204213

205-
it('should get build commands 5', () => {
214+
it('should get build commands 6', () => {
206215
expect(getBuildCommands(path.resolve(__dirname, '..', 'fixtures', 'test1'))).toEqual([
207216
'yarn install --production',
217+
'rm -rdf .github',
208218
]);
209219
});
210220
});

src/utils/misc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export const getBuildCommands = (dir: string): string[] => {
3636
commands.push('yarn install --production');
3737
}
3838

39+
if ('' === command) {
40+
commands.push('rm -rdf .github');
41+
}
42+
3943
return commands;
4044
};
4145

0 commit comments

Comments
 (0)