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

Fix typescript import paths #35

Merged
merged 2 commits into from
May 5, 2023
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
48 changes: 47 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ import { KubernetesAuthorizerService } from '@ccremer/kubernetes-client-angular'

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
template: '<p>Kubernetes Client for Angular in Action</p>',
styles: [],
})
export class AppComponent implements OnInit {
constructor(private configMapService: ConfigMapService, authorizer: KubernetesAuthorizerService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ npm install @ccremer/kubernetes-client @ccremer/kubernetes-client-angular

Setup the module with `@ngrx/data` in `app.module.ts`:
```typescript
{% include "projects/kubernetes-client-angular/examples/module.ts" -%}
{% include "projects/kubernetes-client-angular/examples/app.module.ts" -%}
```

Optional but highly recommended: Create an extendable Service for each entity in `config-map.service.ts`:
```typescript
{% include "projects/kubernetes-client-angular/examples/service.ts" -%}
{% include "projects/kubernetes-client-angular/examples/config-map.service.ts" -%}
```

Configure and consume the service in a component like `app.component.ts`:
```typescript
{% include "projects/kubernetes-client-angular/examples/component.ts" -%}
{% include "projects/kubernetes-client-angular/examples/app.component.ts" -%}
```

## Accessing Kubernetes API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { KubernetesAuthorizerService } from '@ccremer/kubernetes-client-angular'

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
template: '<p>Kubernetes Client for Angular in Action</p>',
styles: [],
})
export class AppComponent implements OnInit {
constructor(private configMapService: ConfigMapService, authorizer: KubernetesAuthorizerService) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../../tsconfig",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@ccremer/kubernetes-client/*": ["../../../../kubernetes-client/dist/*"],
"@ccremer/kubernetes-client-angular": ["../../../dist"]
}
}
}

This file was deleted.

3 changes: 2 additions & 1 deletion packages/kubernetes-client-angular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"paths": {
"kubernetes-client-angular": ["dist/kubernetes-client-angular"]
"kubernetes-client-angular": ["dist"],
"@ccremer/kubernetes-client/*": ["../kubernetes-client/dist/*"]
},
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
Expand Down
7 changes: 4 additions & 3 deletions packages/kubernetes-client-example-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
"@types/bootstrap": "5.2.6",
"@types/node": "18.16.3",
"dotenv": "16.0.3",
"eslint-config-custom": "*",
"sass": "1.62.1",
"vite": "4.3.3",
"eslint-config-custom": "*"
"vite-tsconfig-paths": "4.2.0"
},
"type": "module",
"dependencies": {
"bootstrap": "5.2.3",
"@ccremer/kubernetes-client": "*"
"@ccremer/kubernetes-client": "*",
"bootstrap": "5.2.3"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 5 additions & 1 deletion packages/kubernetes-client-example-fetch/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
"outDir": "./dist",
"baseUrl": ".",
"paths": {
"@ccremer/kubernetes-client/*": ["../kubernetes-client/dist/*"]
}
},
"include": ["src/**/*"],
"exclude": ["src/**/*.spec.ts"]
Expand Down
2 changes: 2 additions & 0 deletions packages/kubernetes-client-example-fetch/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { defineConfig } from 'vite'
import 'dotenv/config'
import * as path from 'path'
import tsconfigPaths from 'vite-tsconfig-paths'

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
if (mode !== 'production' && !process.env.VITE_KUBERNETES_API_URL) {
console.log('⚠️ WARNING ⚠️ :environment variable VITE_KUBERNETES_API_URL is not defined. API may not be working!')
}
return {
plugins: [tsconfigPaths()],
root: path.resolve(__dirname, 'src'),
resolve: {
alias: {
Expand Down
4 changes: 0 additions & 4 deletions packages/kubernetes-client/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
/types/
/api/
/fetch/
/index.*
node_modules/
/dist/
4 changes: 0 additions & 4 deletions packages/kubernetes-client/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
index.*
/api
/fetch
/types
/dist
6 changes: 1 addition & 5 deletions packages/kubernetes-client/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Ignore artifacts

/api/
/fetch/
/types/
/index.*
/playwright-report/
/dist/
package-lock.json
9 changes: 9 additions & 0 deletions packages/kubernetes-client/examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../../tsconfig",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@ccremer/kubernetes-client/*": ["../dist/*"]
}
}
}
5 changes: 2 additions & 3 deletions packages/kubernetes-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"prelint": "npm run format",
"test": "vitest run",
"clean": "rm -rf types fetch api index.*",
"build": "tsc",
"ignore:publishVersion": "yq e -i '. += {\"version\": load(\"package.json\").version}' dist/package.json -o json",
"prepack": "tsc --outDir ./dist && cp package.json README.md dist/"
"build": "rm -rf dist && tsc",
"prepack": "cp package.json README.md dist/"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/kubernetes-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "./",
"outDir": "./dist",
"declaration": true
},
"include": ["src/**/*"],
Expand Down