Comments (8)
nx graph --file="/tmp/output.json"
will export a json file you can use instead of workspace.json
perhaps it should be cached and invalidated only if the file structure has changed.
Since nx is a solution for mono-repos we can make an assumption that the directory is managed with git so cache invalidation will take place only when git shows that something has changed
from nx-completion.
Hi there, I added support for the optional workspace.json file. Try it and let me know if you have any issues.
from nx-completion.
Now that the workspace definition file (workspace.json) is optional, how can we list all the projects, do we have to recursively traverse folders and look for project.json? I need to investigate because this solution is not viable.
from nx-completion.
I think globbing for ./*/project.json
and ./*/*/project.json
might be the only way besides manually keeping track of what exists in a cache file.
Here's a dry-run for creating a new app:
$ npx nx g @nrwl/node:app asdf-app --dry-run
> NX Generating @nrwl/node:application
CREATE apps/asdf-app/src/app/.gitkeep
CREATE apps/asdf-app/src/assets/.gitkeep
CREATE apps/asdf-app/src/environments/environment.prod.ts
CREATE apps/asdf-app/src/environments/environment.ts
CREATE apps/asdf-app/src/main.ts
CREATE apps/asdf-app/tsconfig.app.json
CREATE apps/asdf-app/tsconfig.json
CREATE apps/asdf-app/project.json
CREATE apps/asdf-app/.eslintrc.json
CREATE apps/asdf-app/jest.config.ts
CREATE apps/asdf-app/tsconfig.spec.json
NOTE: The "dryRun" flag means no changes were made.
Notice how nothing is touched outside of the new apps/asdf-app
dir.
Creating a lib updates the root tsconfig.base.json:
$ npx nx g @nrwl/js:lib asdf-lib --dry-run
> NX Generating @nrwl/js:library
CREATE libs/asdf-lib/README.md
CREATE libs/asdf-lib/package.json
CREATE libs/asdf-lib/src/index.ts
CREATE libs/asdf-lib/src/lib/asdf-lib.spec.ts
CREATE libs/asdf-lib/src/lib/asdf-lib.ts
CREATE libs/asdf-lib/tsconfig.json
CREATE libs/asdf-lib/tsconfig.lib.json
CREATE libs/asdf-lib/project.json
UPDATE tsconfig.base.json
CREATE libs/asdf-lib/.eslintrc.json
CREATE libs/asdf-lib/jest.config.ts
CREATE libs/asdf-lib/tsconfig.spec.json
And that's to set a reference to the lib in the tsconfig paths obj, which probably cant be trusted, since the user can edit it to add their own custom ones too:
"paths": {
"asdf-lib": ["libs/asdf-lib/src/index.ts"],
}
from nx-completion.
@ryangrahamnc good point, using base tsconfig is not reliable, we have to look for nested project.json, but what if there's no project.json? this file is optional so we have to look for both package.json and project.json, that's much more complex than before (considering that doing this with Zsh will be a nightmare).
from nx-completion.
@edbzn, note with new release of nx, workspace.json
is now deprecated
Here is v15.7.0
migrations.json
file https://github.com/nrwl/nx/blob/8165459568e5bdfadf3f11ab7fe5e7eb044be06c/packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project.ts#L33 which removes workspace.json
from repo https://github.com/nrwl/nx/blob/8165459568e5bdfadf3f11ab7fe5e7eb044be06c/packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project.ts#L33
So, this issue becomes critical now, IMO
And here is console output after upgrade
> NX workspace.json is ignored
Nx no longer reads configuration from workspace.json.
Run "nx g @nrwl/workspace:fix-configuration" to split workspace.json into individual project.json files
from nx-completion.
Great work - thanks!
from nx-completion.
Thanks. It works. It feels a bit slower now, though. Also, even if I would keep workspace.json
in root of the project just to make nx-completion
use it and be faster – nx-completion
seems to ignore it. Not a big problem though.
from nx-completion.
Related Issues (16)
- Feature Request: Work with local Nx CLI installation HOT 1
- Support for workspace definition v2 format
- Support for standalone project definition
- Format arguments to camel-case HOT 9
- Update arguments to stick to nx 12.x.x
- Support for npx and other ways to use `nx` without having it installed globally HOT 5
- This plugin breaks globalias HOT 1
- 'nx g' does not complete
- Feature: dynamically grab target definition and build completion out of it HOT 3
- Bug: cache works only for `nx` root command
- > NX Running global Nx CLI with PNPM may have issues. HOT 5
- Is md5sha1sum also a dependency?
- zsh-snap load HOT 1
- Breaks on plugins that cannot be found
- nx lint doesn't autocomplete project names
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 nx-completion.