Skip to content

Commit

Permalink
feat(init), introduce "--name" flag to set the workspace name (#8919)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfirst authored May 28, 2024
1 parent a5ca751 commit 1c47134
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions scopes/harmony/config/workspace-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type ComponentScopeDirMapEntry = {
export type ComponentScopeDirMap = Array<ComponentScopeDirMapEntry>;

export type WorkspaceExtensionProps = {
name?: string;
defaultScope?: string;
defaultDirectory?: string;
components?: ComponentScopeDirMap;
Expand Down
3 changes: 3 additions & 0 deletions scopes/harmony/host-initializer/init-cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class InitCmd implements Command {
alias = '';
loadAspects = false;
options = [
['n', 'name <workspace-name>', 'name of the workspace'],
[
'T',
'standalone',
Expand Down Expand Up @@ -57,6 +58,7 @@ export class InitCmd implements Command {

async report([path]: [string], flags: Record<string, any>) {
const {
name,
bare,
shared,
standalone,
Expand Down Expand Up @@ -84,6 +86,7 @@ export class InitCmd implements Command {
const workspaceExtensionProps: WorkspaceExtensionProps = {
defaultDirectory: defaultDirectory ?? getSync(CFG_INIT_DEFAULT_DIRECTORY),
defaultScope: defaultScope ?? getSync(CFG_INIT_DEFAULT_SCOPE),
name,
};
const { created } = await HostInitializerMain.init(
path,
Expand Down
13 changes: 0 additions & 13 deletions src/consumer/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,6 @@ export default class Consumer {
fs.writeJSONSync(packageJsonPath, jsonContent, { spaces: 2 });
}

// /**
// * if resetHard, delete consumer-files: bitMap and workspace.jsonc and also the local scope (.bit dir).
// * otherwise, delete the consumer-files only when they are corrupted
// */
// static async reset(projectPath: PathOsBasedAbsolute, resetHard: boolean, noGit = false): Promise<void> {
// const resolvedScopePath = Consumer._getScopePath(projectPath, noGit);
// BitMap.reset(projectPath, resetHard);
// const scopeP = Scope.reset(resolvedScopePath, resetHard);
// const configP = WorkspaceConfig.reset(projectPath, resolvedScopePath, resetHard);
// const packageJsonP = PackageJsonFile.reset(projectPath);
// await Promise.all([scopeP, configP, packageJsonP]);
// }

async resetNew() {
this.bitMap.resetToNewComponents();
await Scope.reset(this.scope.path, true);
Expand Down

0 comments on commit 1c47134

Please sign in to comment.