Skip to content
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

refactor(angular-query): build with tsup and remove devtools component #8284

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/angular/pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.60.0",
"typescript": "5.3.3"
}
}
5 changes: 2 additions & 3 deletions examples/angular/pagination/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'
import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
import { ExampleComponent } from './components/example.component'

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'app-root',
standalone: true,
template: `<example /><angular-query-devtools initialIsOpen />`,
imports: [AngularQueryDevtools, ExampleComponent],
template: `<example />`,
imports: [ExampleComponent],
})
export class AppComponent {}
3 changes: 2 additions & 1 deletion examples/angular/pagination/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import {
import {
QueryClient,
provideTanStackQuery,
withDevtools,
} from '@tanstack/angular-query-experimental'
import { projectsMockInterceptor } from './api/projects-mock.interceptor'
import type { ApplicationConfig } from '@angular/core'

export const appConfig: ApplicationConfig = {
providers: [
provideHttpClient(withInterceptors([projectsMockInterceptor]), withFetch()),
provideTanStackQuery(new QueryClient()),
provideTanStackQuery(new QueryClient(), withDevtools()),
],
}
1 change: 0 additions & 1 deletion examples/angular/query-options-from-a-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.60.0",
"typescript": "5.3.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
sequences)
</strong>
</p>
<angular-query-devtools initialIsOpen />
<router-outlet />
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Component } from '@angular/core'
import { RouterOutlet } from '@angular/router'
import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'

@Component({
selector: 'app-root',
standalone: true,
imports: [AngularQueryDevtools, RouterOutlet],
imports: [RouterOutlet],
templateUrl: './app.component.html',
styles: [],
})
Expand Down
2 changes: 0 additions & 2 deletions examples/angular/rxjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"watch": "ng build --watch --configuration development"
},
"dependencies": {
"@angular/cdk": "17.3.10",
"@angular/common": "^17.3.12",
"@angular/compiler": "^17.3.12",
"@angular/core": "^17.3.12",
Expand All @@ -25,7 +24,6 @@
"@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "^5.60.0",
"typescript": "5.3.3"
}
}
5 changes: 2 additions & 3 deletions examples/angular/rxjs/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'
import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
import { ExampleComponent } from './components/example.component'

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'app-root',
standalone: true,
template: `<example /><angular-query-devtools initialIsOpen />`,
imports: [AngularQueryDevtools, ExampleComponent],
template: `<example />`,
imports: [ExampleComponent],
})
export class AppComponent {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'
import { toSignal } from '@angular/core/rxjs-interop'
import { NonNullableFormBuilder, ReactiveFormsModule } from '@angular/forms'
import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
import {
injectQuery,
keepPreviousData,
Expand All @@ -14,7 +13,7 @@ import { AutocompleteService } from '../services/autocomplete-service'
selector: 'example',
standalone: true,
templateUrl: './example.component.html',
imports: [AngularQueryDevtools, ReactiveFormsModule],
imports: [ReactiveFormsModule],
})
export class ExampleComponent {
#autocompleteService = inject(AutocompleteService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Response {
})
export class AutocompleteService {
#http = inject(HttpClient)
getSuggestions = (term: string) =>
getSuggestions = (term: string = '') =>
term.trim() === ''
? of({ suggestions: [] })
: this.#http.get<Response>(`/api/autocomplete?term=${term}`)
Expand Down
1 change: 0 additions & 1 deletion examples/angular/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@angular/core": "^17.3.12",
"@angular/platform-browser": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@angular/router": "^17.3.12",
"@tanstack/angular-query-experimental": "^5.60.0",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
Expand Down
1 change: 0 additions & 1 deletion integrations/angular-cli-17/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@angular/common": "^17.3.12",
"@angular/core": "^17.3.12",
"@angular/platform-browser": "^17.3.12",
"@tanstack/angular-query-devtools-experimental": "workspace:*",
"@tanstack/angular-query-experimental": "workspace:*",
"rxjs": "^7.8.1",
"tslib": "^2.6.3",
Expand Down
4 changes: 1 addition & 3 deletions integrations/angular-cli-17/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'
import { ChangeDetectionStrategy, Component } from '@angular/core'
import { CommonModule } from '@angular/common'
import { injectQuery } from '@tanstack/angular-query-experimental'
Expand All @@ -13,9 +12,8 @@ import { injectQuery } from '@tanstack/angular-query-experimental'
<div *ngIf="query.data()">
{{ query.data() }}
</div>
<angular-query-devtools initialIsOpen />
`,
imports: [AngularQueryDevtools, CommonModule],
imports: [CommonModule],
})
export class AppComponent {
/**
Expand Down
Empty file.
6 changes: 5 additions & 1 deletion packages/angular-query-devtools-experimental/.attw.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"ignoreRules": ["cjs-resolves-to-esm", "internal-resolution-error"]
"ignoreRules": [
"cjs-resolves-to-esm",
"internal-resolution-error",
"no-resolution"
]
}
9 changes: 0 additions & 9 deletions packages/angular-query-devtools-experimental/ng-package.json

This file was deleted.

24 changes: 12 additions & 12 deletions packages/angular-query-devtools-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,39 @@
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
"test:types:ts53": "tsc",
"test:build": "publint --strict && attw --pack",
"build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./build/package.json"
"build": "pnpm build:tsup",
"build:tsup": "tsup"
},
"type": "module",
"types": "build/index.d.ts",
"module": "build/fesm2022/tanstack-angular-query-devtools-experimental.mjs",
"module": "build/index.js",
"exports": {
".": {
"types": "./build/index.d.ts",
"esm2022": "./build/esm2022/tanstack-angular-query-devtools-experimental.mjs",
"esm": "./build/esm2022/tanstack-angular-query-devtools-experimental.mjs",
"default": "./build/fesm2022/tanstack-angular-query-devtools-experimental.mjs"
"import": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
}
},
"./package.json": {
"default": "./package.json"
}
},
"sideEffects": false,
"files": [
"build"
"build",
"src",
"!src/__tests__"
],
"dependencies": {
"@tanstack/query-devtools": "workspace:*",
"tslib": "^2.6.3"
"@tanstack/query-devtools": "workspace:*"
},
"devDependencies": {
"@analogjs/vite-plugin-angular": "^1.6.4",
"@angular/common": "^17.3.12",
"@angular/compiler-cli": "^17.3.12",
"@angular/core": "^17.3.12",
"@angular/platform-browser-dynamic": "^17.3.12",
"@tanstack/angular-query-experimental": "workspace:*",
"eslint-plugin-jsdoc": "^50.2.2",
"ng-packagr": "^17.3.0",
"tsup": "8.0.2",
"typescript": "5.3.3"
},
"peerDependencies": {
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion packages/angular-query-devtools-experimental/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './angular-query-devtools.component'
export * from './inject-devtools-panel'
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export function injectDevtoolsPanel(
} = options()

untracked(() => {
if (!client) throw new Error('No QueryClient found')
if (!devtools && hostElement) {
devtools = new TanstackQueryDevtoolsPanel({
client,
Expand Down
Loading
Loading