Skip to content

Support angular workspace for ng-add #60

@aboudard

Description

@aboudard

Hello,

When running in an angular workspace, the ng-add command can recognize the proper project for the modifications of the angular.json file.
But for the env.d.ts file, this is only a use of src folder, which makes that you have to move the file.

The following move function could use the project path :

export default function (options: any): Rule {
  return chain([
    mergeWith(apply(url("./template"), [move(normalize("./src"))])),
    builder(options),
  ]);
}

This can be helpful when we want to call the schematics from another schematics with externalSchematic method, giving the project as argument :

function addNgxEnvBuilder(): Rule {
	return (tree: Tree, context: SchematicContext) => {
		context.logger.log('info', `🛠 Adding ngx-env builder...`);
		return externalSchematic('@ngx-env/builder', 'ng-add', {
			project: 'sandbox'    //or options.project for example
		})(tree, context);
	}
}

Cheers !

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions