Comments (6)
I think think this is a bit less maintainable. the new method appears to require you to fix a version with the dependency. In most cases I don't want to specify a version and jsut let the most recent version be installed.
I'm also having a bit of trouble actually getting it to update package.json
. In the debug logs, I can see something resolving packages from npm, but the package dependencies are never added
from generator.
See https://github.com/yeoman/generator/releases/tag/v5.0.0.
I will keep open, so if the new approach is not enough, we can revert and include install mixin by default.
from generator.
What was the reasoning for deprecating this behavior?
from generator.
What was the reasoning for deprecating this behavior?
@esatterwhite see #1067 (comment).
npmInstall should work for simple generators (easy to load the deprecated mixin too).
But it's not friendly when composing with multiples generators.
- package manager conflicts (each generator executes it's preferred package manager).
- multiples install executions when generating (each generator trigger it's own install).
- not integrated with package.json changes (the install/end priority may have an outdated package.json in memory, since install was executed directly in the disk).
I think think this is a bit less maintainable. the new method appears to require you to fix a version with the dependency. In most cases I don't want to specify a version and jsut let the most recent version be installed.
Should be fixed, when the version is empty, it should add latest version to package.json.
I should address this problem soon, but feel free to open an issue for it.
I'm also having a bit of trouble actually getting it to update
package.json
. In the debug logs, I can see something resolving packages from npm, but the package dependencies are never added
If so, it's a bug, please open a new issue detailing the behavior.
from generator.
It doesn't look like the new methods have a way to specify a working directory and its always updating the package.json in the process cwd.
I maybe missing something too, is there away to modify package.json in a different directory?
from generator.
It updates package.json relative to the generator destinationPath().
- Api could be improved by passing a storage instead of always using this.packageJson storage.
this.addDependencies({foo: ''}, this.createStorage('packages/my-project/package.json');
- Taking a mono-repo as examples.
The correct approach is to have a generator for the mono-repo called workspaces.
And another generator for the workspace (project).
Each project generator should be composed by passing destinationRoot.
Eg: from workspaces generator:
composeWith('workspace', {destinationRoot: this.destinationPath('packages/my-project'});
So package.json will be relative to 'packages/my-project'.
Detail: composeWith forwards the current destinationRoot to it's child by default, so it's chained.
from generator.
Related Issues (20)
- Minimist CVE HOT 1
- "Which type of client-side component to create?" is missing "Extension" HOT 1
- Introduce a flag to use config in proxymode HOT 1
- Is this project abandoned? HOT 1
- Dependent library tui-jsdoc-template has high severity vulnerabilities HOT 1
- Value from option defined in a composed generator is only available on generator triggered HOT 2
- "Invoke validation failed. User forbidden to perform action" when trigger "More details" button of message extension sample HOT 2
- Cannot Remove Default Add-In HOT 2
- [deps] Check for breaking changes in Dependabot's PRs HOT 1
- Can't install 6.0.1 using npm HOT 5
- Improve readability of fs.test.ts; correct TS problems in it.
- Migrate tests to vitest and add node 20 to ci
- Replace jsdoc with typescript based documentation generator
- Dependency Conflict on `mem-fs` for yeoman-generator 7.x HOT 9
- yeoman-generator should declare an ordinary dependency on 'mem-fs' HOT 3
- Documentation is out of date HOT 2
- yeoman-generator wants conflicting transitive dependencies on mem-fs HOT 3
- How to compose generators in our own ESM-based generator HOT 8
- different document HOT 1
- issue with spawnCommandSync and (linux) mount during generator run HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator.