mirror of
https://github.com/tiktok/sparo.git
synced 2024-11-14 19:35:12 -05:00
Merge pull request #58 from tiktok/feat-extended-skeleton
Feat extended skeleton
This commit is contained in:
commit
d533982ec3
6 changed files with 44 additions and 1 deletions
|
@ -27,6 +27,12 @@ export interface ILaunchOptions {
|
|||
* It is used to update notification.
|
||||
*/
|
||||
callerPackageJson?: ICallerPackageJson;
|
||||
|
||||
/**
|
||||
* Provide the additional skeleton folders.
|
||||
* @internal
|
||||
*/
|
||||
additionalSkeletonFolders?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@ import { ICommand } from './commands/base';
|
|||
import { ArgvService } from '../services/ArgvService';
|
||||
import { GitVersionCompatibility } from '../logic/GitVersionCompatibility';
|
||||
import { TelemetryService } from '../services/TelemetryService';
|
||||
import { GitSparseCheckoutService } from '../services/GitSparseCheckoutService';
|
||||
import { getCommandName } from './commands/util';
|
||||
import { SparoStartupBanner } from './SparoStartupBanner';
|
||||
import type { ILaunchOptions } from '../api/Sparo';
|
||||
|
@ -28,6 +29,12 @@ export class SparoCICommandLine {
|
|||
callerPackageJson: launchOptions.callerPackageJson
|
||||
});
|
||||
|
||||
if (launchOptions.additionalSkeletonFolders) {
|
||||
const gitSparseCheckoutService: GitSparseCheckoutService =
|
||||
await getFromContainerAsync(GitSparseCheckoutService);
|
||||
gitSparseCheckoutService.setAdditionalSkeletonFolders(launchOptions.additionalSkeletonFolders);
|
||||
}
|
||||
|
||||
const sparoCI: SparoCICommandLine = new SparoCICommandLine();
|
||||
await sparoCI.prepareCommandAsync();
|
||||
await sparoCI.runAsync();
|
||||
|
|
|
@ -7,6 +7,7 @@ import { COMMAND_LIST } from './commands/cmd-list';
|
|||
import { ICommand } from './commands/base';
|
||||
import { GitVersionCompatibility } from '../logic/GitVersionCompatibility';
|
||||
import { TelemetryService } from '../services/TelemetryService';
|
||||
import { GitSparseCheckoutService } from '../services/GitSparseCheckoutService';
|
||||
import { getCommandName } from './commands/util';
|
||||
import { SparoStartupBanner } from './SparoStartupBanner';
|
||||
import type { ILaunchOptions } from '../api/Sparo';
|
||||
|
@ -29,6 +30,12 @@ export class SparoCommandLine {
|
|||
callerPackageJson: launchOptions.callerPackageJson
|
||||
});
|
||||
|
||||
if (launchOptions.additionalSkeletonFolders) {
|
||||
const gitSparseCheckoutService: GitSparseCheckoutService =
|
||||
await getFromContainerAsync(GitSparseCheckoutService);
|
||||
gitSparseCheckoutService.setAdditionalSkeletonFolders(launchOptions.additionalSkeletonFolders);
|
||||
}
|
||||
|
||||
const sparo: SparoCommandLine = new SparoCommandLine();
|
||||
await sparo.prepareCommandAsync();
|
||||
await sparo.runAsync();
|
||||
|
|
|
@ -32,6 +32,7 @@ export class GitSparseCheckoutService {
|
|||
private _packageNames: Set<string> = new Set<string>();
|
||||
private _isSkeletonInitializedAndUpdated: boolean = false;
|
||||
private _finalSkeletonPaths: string[] = [];
|
||||
private _additionalSkeletonFolders: string[] = [];
|
||||
|
||||
public ensureSkeletonExistAndUpdated(): void {
|
||||
/**
|
||||
|
@ -89,6 +90,10 @@ export class GitSparseCheckoutService {
|
|||
await this._rushSparseCheckoutAsync({ checkoutAction: 'purge' });
|
||||
}
|
||||
|
||||
public setAdditionalSkeletonFolders(additionalSkeletonFolders: string[]): void {
|
||||
this._additionalSkeletonFolders = additionalSkeletonFolders;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param options
|
||||
|
@ -284,7 +289,13 @@ export class GitSparseCheckoutService {
|
|||
}
|
||||
|
||||
private _getSkeletonPaths(): string[] {
|
||||
const basicFolders: string[] = ['.vscode', 'common', 'common/sparse-profiles', 'scripts', 'plugins'];
|
||||
const basicFolders: string[] = [
|
||||
'.vscode',
|
||||
'common',
|
||||
'common/sparse-profiles',
|
||||
'scripts',
|
||||
'plugins'
|
||||
].concat(this._additionalSkeletonFolders);
|
||||
this._sparseCheckoutPaths(basicFolders, { action: 'add' });
|
||||
|
||||
const pluginPaths: string[] = this._findRushPluginsPaths();
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"changes": [
|
||||
{
|
||||
"packageName": "sparo",
|
||||
"comment": "Add a new launch option called \"additionalSkeletonFolders\" to add more folders to skeleton",
|
||||
"type": "none"
|
||||
}
|
||||
],
|
||||
"packageName": "sparo"
|
||||
}
|
|
@ -75,6 +75,8 @@ export interface IExecuteGitCommandParams {
|
|||
|
||||
// @public
|
||||
export interface ILaunchOptions {
|
||||
// @internal
|
||||
additionalSkeletonFolders?: string[];
|
||||
// @internal
|
||||
callerPackageJson?: ICallerPackageJson;
|
||||
// @internal
|
||||
|
|
Loading…
Reference in a new issue