-
Notifications
You must be signed in to change notification settings - Fork 1
feat: 🎸 edit project configuration #87
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
base: feature/workspace-settings
Are you sure you want to change the base?
feat: 🎸 edit project configuration #87
Conversation
Nx Cloud ReportCI is running for commit 199e799. 📂 Click to track the progress, see the status, the terminal output, and the build insights. Sent with 💌 from NxCloud. |
1a43871
to
d260f16
Compare
libs/configuration/src/lib/configuration/configuration.component.html
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
libs/configuration/src/lib/configuration/configuration.component.ts
Outdated
Show resolved
Hide resolved
15949c3
to
ca3783a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I resolved what you fixed and reviewed again, please see my previous review comments
@@ -18,6 +18,7 @@ | |||
"noImplicitOverride": true, | |||
"noPropertyAccessFromIndexSignature": true, | |||
"noImplicitReturns": true, | |||
"noFallthroughCasesInSwitch": true | |||
"noFallthroughCasesInSwitch": true, | |||
"resolveJsonModule": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it needed? I didnt see that you import json anywhere, if its for jest, move it to tsconfig.spec.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im importing angular.json file.
this.workspaceSettingsService | ||
.updateWorkspaceProjectConfiguration( | ||
this.projectName, | ||
this.form.value as Project | ||
) | ||
.subscribe(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.workspaceSettingsService | |
.updateWorkspaceProjectConfiguration( | |
this.projectName, | |
this.form.value as Project | |
) | |
.subscribe(); | |
this.projectName$.pipe( | |
take(1), | |
switchMap(projectName => | |
this.workspaceSettingsService | |
.updateWorkspaceProjectConfiguration( | |
projectName, | |
this.form.value as Project | |
) | |
) | |
).subscribe(); |
then you can remove this.projectName
and the tap that assigns its value
readonly formly$: Observable<{ | ||
formData: JsonObject; | ||
formFields: FormlyFieldConfig[]; | ||
}> = combineLatest([this.formData$, this.formFields$]).pipe( | ||
map(([formData, formFields]) => ({ formFields, formData })) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readonly formly$: Observable<{ | |
formData: JsonObject; | |
formFields: FormlyFieldConfig[]; | |
}> = combineLatest([this.formData$, this.formFields$]).pipe( | |
map(([formData, formFields]) => ({ formFields, formData })) | |
); | |
readonly formly$: Observable<{ | |
formData: JsonObject; | |
formFields: FormlyFieldConfig[]; | |
}> = combineLatest([this.projectConfiguration$, this.workspaceProject$]).pipe( | |
map(([formFields, formData]) => ({ formFields, formData })) | |
); |
then you can remove formFields$
and formData$
subjects and ngOnInit
completely
private readonly workspaceProject$ = this.projectName$.pipe( | ||
switchMap((currentProjectName: string) => | ||
this.workspaceSettingsService.readWorkspaceProject(currentProjectName) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
), | |
distinctUntilChanged() |
.readWorkspaceProjectNames() | ||
.pipe( | ||
map((names) => names[0]), | ||
tap((projectName) => (this.projectName = projectName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tap((projectName) => (this.projectName = projectName)) | |
distinctUntilChanged() |
}) | ||
export class ConfigurationComponent {} | ||
export class ConfigurationComponent implements OnInit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if observables are being subscribed in more than once place you should also add shareReplay({ bufferSize: 1, refCount: true })
operator at the end, in order to avoid multiple subscriptions to the source
ca3783a
to
019dd07
Compare
✅ Closes: 15
019dd07
to
199e799
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just a small question - have we decided to go with Formly? why not plain reactive-forms?
@@ -15,10 +15,14 @@ import { | |||
Logger, | |||
NotFoundException, | |||
} from '@nestjs/common'; | |||
import { JSONSchema7 } from 'json-schema'; | |||
import { Draft07 } from 'json-schema-library'; | |||
import * as angularSchema from 'node_modules/@angular/cli/lib/config/schema.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this import is from 'node_modules' and not from @angular/cli like the others?
@@ -15,10 +15,14 @@ import { | |||
Logger, | |||
NotFoundException, | |||
} from '@nestjs/common'; | |||
import { JSONSchema7 } from 'json-schema'; | |||
import { Draft07 } from 'json-schema-library'; | |||
import * as angularSchema from 'node_modules/@angular/cli/lib/config/schema.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be read in runtime. Currently you're bundling & reading our installed angular pkg, instead you need to read the installed angular pkg in the currently active user's workspace by using node's fs module (readFile, readFileSync).
After this change you can revert the changes you made in the tsconfig file
✅ Closes: 15
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: 15
What is the new behavior?
Edit project configuration
Does this PR introduce a breaking change?
Other information