fix(aio): clean up non-public previews
The previous clean-up code for PR directories on the preview server assumed that all directories were named after the PR number. With the changes introduced in #17640 it is possible to have PR directories that do not follow that naming convention (e.g. "non-public" directories). This PR ensures that both public and non-public directories are removed when cleaning up.
This commit is contained in:

committed by
Matias Niemelä

parent
96b17034e1
commit
3c4eef99be
@ -4,15 +4,13 @@ import {EventEmitter} from 'events';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as shell from 'shelljs';
|
||||
import {HIDDEN_DIR_PREFIX} from '../common/constants';
|
||||
import {assertNotMissingOrEmpty} from '../common/utils';
|
||||
import {ChangedPrVisibilityEvent, CreatedBuildEvent} from './build-events';
|
||||
import {UploadError} from './upload-error';
|
||||
|
||||
// Classes
|
||||
export class BuildCreator extends EventEmitter {
|
||||
// Properties - Public, Static
|
||||
public static HIDDEN_DIR_PREFIX = 'hidden--';
|
||||
|
||||
// Constructor
|
||||
constructor(protected buildsDir: string) {
|
||||
super();
|
||||
@ -114,7 +112,7 @@ export class BuildCreator extends EventEmitter {
|
||||
}
|
||||
|
||||
protected getCandidatePrDirs(pr: string, isPublic: boolean) {
|
||||
const hiddenPrDir = path.join(this.buildsDir, BuildCreator.HIDDEN_DIR_PREFIX + pr);
|
||||
const hiddenPrDir = path.join(this.buildsDir, HIDDEN_DIR_PREFIX + pr);
|
||||
const publicPrDir = path.join(this.buildsDir, pr);
|
||||
|
||||
const oldPrDir = isPublic ? hiddenPrDir : publicPrDir;
|
||||
|
Reference in New Issue
Block a user