Skip to content

Commit 54c632b

Browse files
committed
fix(generate): run in current directory
fixes #3441
1 parent 7c2f18d commit 54c632b

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

packages/@ionic/cli-utils/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ export async function generateIonicEnvironment(ctx: IonicContext, pargv: string[
125125
const shell = new Shell({ log }, { alterPath: p => projectDir ? prependNodeModulesBinToPath(projectDir, p) : p });
126126
const client = new Client(config);
127127
const session = new ProSession({ config, client });
128-
const deps = { client, config, log, prompt, session, shell, tasks };
129-
const ienv = new Environment({ flags, getInfo, ctx, ...deps });
128+
const deps = { client, config, ctx, log, prompt, session, shell, tasks };
129+
const ienv = new Environment({ flags, getInfo, ...deps });
130130

131131
ienv.open();
132132

packages/@ionic/cli-utils/src/lib/generate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { PromptModule } from '@ionic/cli-framework';
22

3-
import { CommandLineInputs, CommandLineOptions, CommandMetadata, GenerateOptions, IConfig, ILogger, IProject, IShell, Runner } from '../definitions';
3+
import { CommandLineInputs, CommandLineOptions, CommandMetadata, GenerateOptions, IConfig, ILogger, IProject, IShell, IonicContext, Runner } from '../definitions';
44

55
export interface GenerateRunnerDeps {
66
readonly config: IConfig;
7+
readonly ctx: IonicContext;
78
readonly log: ILogger;
89
readonly project: IProject;
910
readonly prompt: PromptModule;

packages/@ionic/cli-utils/src/lib/project/angular/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ To test a generator before file modifications are made, use the ${chalk.green('-
147147

148148
private async generateComponent(type: string, name: string, options: { [key: string]: string | boolean; }) {
149149
const ngArgs = unparseArgs({ _: ['generate', type, name], ...options }, {});
150-
const shellOptions = { cwd: this.e.project.directory };
150+
const shellOptions = { cwd: this.e.ctx.execPath };
151151

152152
await this.e.shell.run('ng', ngArgs, shellOptions);
153153
}

packages/@ionic/cli-utils/src/lib/project/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as lodash from 'lodash';
88
import * as path from 'path';
99

1010
import { MULTI_PROJECT_TYPES, PROJECT_FILE, PROJECT_TYPES } from '../../constants';
11-
import { IAilmentRegistry, IClient, IConfig, IIntegration, ILogger, IProject, IProjectConfig, ISession, IShell, InfoItem, IntegrationName, PackageJson, ProjectIntegration, ProjectPersonalizationDetails, ProjectType } from '../../definitions';
11+
import { IAilmentRegistry, IClient, IConfig, IIntegration, ILogger, IProject, IProjectConfig, ISession, IShell, InfoItem, IntegrationName, IonicContext, PackageJson, ProjectIntegration, ProjectPersonalizationDetails, ProjectType } from '../../definitions';
1212
import { isMultiProjectConfig, isProjectConfig } from '../../guards';
1313
import * as ζbuild from '../build';
1414
import { FatalException, IntegrationNotFoundException, RunnerNotFoundException } from '../errors';
@@ -134,6 +134,7 @@ export interface ProjectDeps {
134134
readonly session: ISession;
135135
readonly shell: IShell;
136136
readonly tasks: TaskChain;
137+
readonly ctx: IonicContext;
137138
}
138139

139140
export abstract class Project implements IProject {

0 commit comments

Comments
 (0)