-
Notifications
You must be signed in to change notification settings - Fork 12k
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
externalSchematics
should install packages locally when they are no present in the node_modules
#19301
Comments
Hi @d-koppenhagen, Thanks for opening this feature request. I don’t think that
In most cases when having a schematic that depends on an external schematic, the author should add the package that contains the external schematic as a direct dependency. This also ensures that the correct version of the external schematic is installed as otherwise you might end up with a broken behaviour when the API of the dependent schematic is changed. If having it as a direct dependency is not possible, running a separate install task prior of running |
Hey @alan-agius4 , I unserstand. const options = {};
const installOptions = {
type: NodeDependencyType.Dev, // enum with all dependency types, if not defined, it won't be added as dependency to the package.json file
version: '~2.27.0', // use 'latest' by default when not defined
overwrite: true, // use 'false' and log an error by default
packageManager: PackageManager.Npm // or yarn or pnpn. If not defined: take the default that's defined in `angular.json`
registry: 'https://...' // use "normal" NPM registry by default (or assume that it's already define in .npmrc file (locally or globally)
};
externalSchematic('my-schematic-package', 'my-schematic-name', options, installOptions);
// only install when installOptions object is present |
Mind sharing the use-case of not having the external dependency as a direct dependency of the schematic package? I still think that the installation of the package should be a separate task and not part of |
it might just be relevant when I want to combine external schematics and want to make use of them only once. |
@d-koppenhagen Since Angular got rid of a built-in linting configuration, I'm trying to |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage. We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package. You can find more details about the feature request process in our documentation. |
It's kind of sad that the bot closes the voting process after 20 days while the documentation says:
Anyway, my interpretation is that Schematics is basically dead atm. (Which is really disappointing since it is the one thing which really would've separated Angular from every other frontend framework/library.) |
So sad to see this feature dead |
🚀 Feature request
Command (mark with an
x
)Description
when creating own schematics, they can make use of other schematics by calling the
externalSchematic
function provided by the@angular-devkit/schematics
collection.To call an external schematic, the function can be used like this:
But to execute an external schematic package it has to be part of the
node_modules
. Internally the CLI uses the function for example for calling the PWA schematic. This won't be problematic as is already installed as part of the@angular/schematics
package and in fact it's part of thenode_modules
.Once you'll try to install an external schematic which isn't already available in the
node_modules
the schematic fails.A workaround is to manually integrate an installation procedure first and then call the function like this:
Describe the solution you'd like
It would be great to integrate the installation process for a package that's not present in the
node_modules
in theexternalSchematic
function.Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: