Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonbcampos/b972d9c6d0255b2649c6b40714f19ce6 to your computer and use it in GitHub Desktop.
Save jonbcampos/b972d9c6d0255b2649c6b40714f19ce6 to your computer and use it in GitHub Desktop.
import {getWorkspace} from '@schematics/angular/utility/config';
import {buildDefaultPath} from '@schematics/angular/utility/project';
import {parseName} from '@schematics/angular/utility/parse-name';
import {Tree} from '@angular-devkit/schematics';
export function setupOptions(host: Tree, options: any): Tree {
const workspace = getWorkspace(host);
if (!options.project) {
options.project = Object.keys(workspace.projects)[0];
}
const project = workspace.projects[options.project];
if (options.path === undefined) {
options.path = buildDefaultPath(project);
}
const parsedPath = parseName(options.path, options.name);
options.name = parsedPath.name;
options.path = parsedPath.path;
return host;
}
@soleotech
Copy link

Argument of type 'WorkspaceProject' is not assignable to parameter of type 'WorkspaceProject<ProjectType.Application>'.   Type 'ProjectType' is not assignable to type 'ProjectType.Application'.

@trytocatcharg
Copy link

for everyone that want to use this code, this worked for me with version (@schematics/angular@9.1.0)
in your command line:

npm uninstall @schematics/angular
npm install @schematics/angular@9.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment