-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix: CLI code generation in ng11.1+ NS-only projects #314
Conversation
…lar dependencies @schematics/angular v11.1+ induced a regression where @schematics/angular/utility/config has been removed. getWorkespace method is instead at @schematics/angular/utility/workespace and is async now. Using it requires a major codebase migration. Forcing this version (~11.0.0) via regular dependencies allows to continue using @nativescript/schematics with NG11.1 and NG11.2 projects
… projects All NS NG templates come with SCSS configured by default. Adding these lines to angular.json file avoid having to specify --style=scss option every time during component creation.
This is amazing to see @agonper - we will bump a version update out here today with this. |
Edit: TL;DRSee next comment Hi @NathanWalker, thanks for giving priority to this. I've just tested the new version and sadly it doesn't work. I'm seeing the following error when trying to generate components and modules: FindingsI know that error is not very informative. So I've entered the rabbit hole and these are my findings: In the case of the module generation it happens while calling the function In the case of the component generation it happens while calling the function The later So I've checked the And finally the error is thrown here, in the It seems that the
However its grand parent has it ¯_(ツ)_/¯ GuessesIt seems to be a TypeScript problem. I've checked in the Hope all this information helps. Proposal
|
Ok, so I've found why I couldn't reproduce the moment when it worked. It seems it was I had the schematics project linked to my project locally to be able to debug the code a bit better and that was generating conflicts with the different TypeScript versions. If I install The only issue I've found is that default style sheet extension configuration seems to be broken now, but I found why. I'm going to try to fix it and I'll open a PR with the changes. So, in summary, people with NG11 projects will have to use TypeScript 4.1 instead of 4.0 |
Everything should be fixed now at #315 😃 |
11.2.0 published now. Thanks again, let us know if see anything else in the final. |
Works like a charm. Many thanks for the release @NathanWalker! |
PR Checklist
What is the current behavior?
@schematics/angular
v11.1+ has introduced a breaking change where@schematics/angular/utility/config
has been removed.@angular/cli
v11.1+ seems automatically install these new versions. In v11.1+ version of@schematics/angular
, getWorkespace method is instead at@schematics/angular/utility/workespace
and is async now as pointed out at Can't use Angular CLI with fresh nativescript installation #311 by @avif. Using it requires a major codebase migration. Forcing this version (~11.0.0) via regular dependencies allows to continue using@nativescript/schematics
with NG11.1 and NG11.2 projects, but further action should be taken before NG12 arrives.isWeb()
utility function was considering the existence of anativescript.config.ts
file as a sign of a shared project configuration, when now every NS project has this file. Instead now this decision is driven by the existence of a main.tns.ts file inside the src folder..tns
extension in all NG NS components during their generation, independently of the kind of project (shared or NS only). This extension should be used in NS component files inside shared projects only.What is the new behavior?
isWeb()
utility function has been refactored to detect the existence of amain.tns.ts
file instead.getExtensions()
utility function returns different extensions for NS and web components, otherwise it returns blank extension prefixes for NS-only projects.Fixes/Implements/Closes #311, #309 and #307.
BREAKING CHANGES:
None, to the best of my knowledge.
Migration steps:
None, since by merging this changes it will be possible to use @nativescript/schematics with NG11.1+ projects as expected by just following setup instructions (with no extra steps or workaround like manually installing
@schematics/angular@~11.0.0
).