Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support angular workspace for ng-add #60

Open
aboudard opened this issue Oct 16, 2023 · 0 comments
Open

Support angular workspace for ng-add #60

aboudard opened this issue Oct 16, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@aboudard
Copy link

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 !

@chihab chihab added the enhancement New feature or request label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants