ag-schematics 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/adr/files/__number__-__slug__.md.template +19 -0
- package/dist/adr/index.d.ts +8 -0
- package/dist/adr/index.js +19 -0
- package/dist/adr/index.js.map +1 -0
- package/dist/adr/schema.json +24 -0
- package/dist/collection.json +56 -0
- package/dist/components/header/index.d.ts +6 -0
- package/dist/components/header/index.js +17 -0
- package/dist/components/header/index.js.map +1 -0
- package/dist/docker-config/files/Dockerfile.template +15 -0
- package/dist/docker-config/files/compose.yaml.template +10 -0
- package/dist/docker-config/files/nginx.conf.template +35 -0
- package/dist/docker-config/index.d.ts +8 -0
- package/dist/docker-config/index.js +16 -0
- package/dist/docker-config/index.js.map +1 -0
- package/dist/docker-config/schema.json +24 -0
- package/dist/gitignore-config/files/.gitignore.template +42 -0
- package/dist/gitignore-config/index.d.ts +5 -0
- package/dist/gitignore-config/index.js +16 -0
- package/dist/gitignore-config/index.js.map +1 -0
- package/dist/gitignore-config/schema.json +8 -0
- package/dist/k8s-config/files/k8s/deployment.yaml.template +22 -0
- package/dist/k8s-config/files/k8s/ingress.yaml.template +17 -0
- package/dist/k8s-config/files/k8s/service.yaml.template +14 -0
- package/dist/k8s-config/index.d.ts +10 -0
- package/dist/k8s-config/index.js +21 -0
- package/dist/k8s-config/index.js.map +1 -0
- package/dist/k8s-config/schema.json +34 -0
- package/dist/lint-config/files/.editorconfig.template +17 -0
- package/dist/lint-config/files/.eslintignore.template +2 -0
- package/dist/lint-config/files/.eslintrc.json.template +61 -0
- package/dist/lint-config/files/.prettierignore.template +47 -0
- package/dist/lint-config/files/.prettierrc.json.template +11 -0
- package/dist/lint-config/index.d.ts +5 -0
- package/dist/lint-config/index.js +90 -0
- package/dist/lint-config/index.js.map +1 -0
- package/dist/lint-config/schema.json +8 -0
- package/dist/npm-config/files/.nvmrc.template +1 -0
- package/dist/npm-config/index.d.ts +5 -0
- package/dist/npm-config/index.js +16 -0
- package/dist/npm-config/index.js.map +1 -0
- package/dist/npm-config/schema.json +8 -0
- package/dist/orval-config/files/openapi.yaml.template +0 -0
- package/dist/orval-config/files/orval.config.ts.template +24 -0
- package/dist/orval-config/index.d.ts +5 -0
- package/dist/orval-config/index.js +23 -0
- package/dist/orval-config/index.js.map +1 -0
- package/dist/orval-config/schema.json +8 -0
- package/dist/otel-config/files/otel-config.yaml.template +16 -0
- package/dist/otel-config/index.d.ts +5 -0
- package/dist/otel-config/index.js +98 -0
- package/dist/otel-config/index.js.map +1 -0
- package/dist/otel-config/schema.json +8 -0
- package/dist/sonar-config/files/sonar-project.properties.template +7 -0
- package/dist/sonar-config/index.d.ts +8 -0
- package/dist/sonar-config/index.js +16 -0
- package/dist/sonar-config/index.js.map +1 -0
- package/dist/sonar-config/schema.json +24 -0
- package/dist/utils/dependency-shortcuts.d.ts +2 -0
- package/dist/utils/dependency-shortcuts.js +20 -0
- package/dist/utils/dependency-shortcuts.js.map +1 -0
- package/dist/utils/dependency.d.ts +142 -0
- package/dist/utils/dependency.js +213 -0
- package/dist/utils/dependency.js.map +1 -0
- package/dist/utils/eol.d.ts +8 -0
- package/dist/utils/eol.js +23 -0
- package/dist/utils/eol.js.map +1 -0
- package/dist/utils/json-file.d.ts +24 -0
- package/dist/utils/json-file.js +78 -0
- package/dist/utils/json-file.js.map +1 -0
- package/dist/utils/script.d.ts +2 -0
- package/dist/utils/script.js +17 -0
- package/dist/utils/script.js.map +1 -0
- package/dist/versions.d.ts +6 -0
- package/dist/versions.js +10 -0
- package/dist/versions.js.map +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# ag-schematics
|
|
2
|
+
|
|
3
|
+
An Angular schematics library built with `@angular-devkit/schematics`.
|
|
4
|
+
|
|
5
|
+
## Schematics
|
|
6
|
+
|
|
7
|
+
| Name | Description |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| `ag-schematics` | A blank schematic. |
|
|
10
|
+
| `test-component` | A blank schematic. |
|
|
11
|
+
|
|
12
|
+
## Development
|
|
13
|
+
|
|
14
|
+
### Install dependencies
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Build
|
|
21
|
+
|
|
22
|
+
Compiles TypeScript to `dist/` (spec files excluded). The `dist/` folder is the publishable artifact.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm run build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Output:
|
|
29
|
+
```
|
|
30
|
+
dist/
|
|
31
|
+
collection.json
|
|
32
|
+
ag-schematics/
|
|
33
|
+
index.js
|
|
34
|
+
index.d.ts
|
|
35
|
+
test-component/
|
|
36
|
+
index.js
|
|
37
|
+
index.d.ts
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Test
|
|
41
|
+
|
|
42
|
+
Compiles everything (including spec files) to `out/` and runs the Jasmine test suite.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm test
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Project structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
src/
|
|
52
|
+
collection.json # Schematic collection manifest
|
|
53
|
+
ag-schematics/
|
|
54
|
+
index.ts # Schematic implementation
|
|
55
|
+
index_spec.ts # Tests
|
|
56
|
+
test-component/
|
|
57
|
+
index.ts # Schematic implementation
|
|
58
|
+
index_spec.ts # Tests
|
|
59
|
+
tsconfig.json # Base compiler config (used by npm test → out/)
|
|
60
|
+
tsconfig.lib.json # Lib build config (used by npm run build → dist/)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Using the schematics
|
|
64
|
+
|
|
65
|
+
After building, link or publish the package and run a schematic with the Angular CLI:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
ng generate ag-schematics:ag-schematics
|
|
69
|
+
ng generate ag-schematics:test-component
|
|
70
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# <%= number %>. <%= title %>
|
|
2
|
+
|
|
3
|
+
Date: <%= date %>
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Proposed
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
<!-- What is the issue that is motivating this decision or change? -->
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
<!-- What is the change that we are proposing and/or doing? -->
|
|
16
|
+
|
|
17
|
+
## Consequences
|
|
18
|
+
|
|
19
|
+
<!-- What becomes easier or more difficult to do because of this change? -->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adr = adr;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
function adr(options) {
|
|
7
|
+
return (tree, _context) => {
|
|
8
|
+
const slug = core_1.strings.dasherize(options.title);
|
|
9
|
+
const date = new Date().toISOString().split('T')[0];
|
|
10
|
+
const sourceTemplates = (0, schematics_1.url)('./files');
|
|
11
|
+
const sourceParametrizedTemplates = (0, schematics_1.apply)(sourceTemplates, [
|
|
12
|
+
(0, schematics_1.applyTemplates)(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { slug,
|
|
13
|
+
date })),
|
|
14
|
+
(0, schematics_1.move)(options.directory),
|
|
15
|
+
]);
|
|
16
|
+
return (0, schematics_1.mergeWith)(sourceParametrizedTemplates)(tree, _context);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adr/index.ts"],"names":[],"mappings":";;AAkBA,kBAiBC;AAnCD,+CAA+C;AAC/C,2DASoC;AAQpC,SAAgB,GAAG,CAAC,OAAmB;IACrC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,IAAI,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpD,MAAM,eAAe,GAAG,IAAA,gBAAG,EAAC,SAAS,CAAC,CAAC;QACvC,MAAM,2BAA2B,GAAG,IAAA,kBAAK,EAAC,eAAe,EAAE;YACzD,IAAA,2BAAc,gDACT,cAAO,GACP,OAAO,KACV,IAAI;gBACJ,IAAI,IACJ;YACF,IAAA,iBAAI,EAAC,OAAO,CAAC,SAAS,CAAC;SACxB,CAAC,CAAC;QACH,OAAO,IAAA,sBAAS,EAAC,2BAA2B,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "adr",
|
|
4
|
+
"title": "ADR",
|
|
5
|
+
"description": "Generates an Architecture Decision Record (ADR) markdown file",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"title": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The title of the ADR",
|
|
11
|
+
"default": "My Decision"
|
|
12
|
+
},
|
|
13
|
+
"number": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The ADR number (e.g. 0001)",
|
|
16
|
+
"default": "0001"
|
|
17
|
+
},
|
|
18
|
+
"directory": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "The directory to place the ADR file in",
|
|
21
|
+
"default": "adr"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
|
|
5
|
+
"header": {
|
|
6
|
+
"description": "Creates an Angular component with a header.",
|
|
7
|
+
"factory": "./components/header/index#header",
|
|
8
|
+
"schema": "./components/header/schema.json"
|
|
9
|
+
},
|
|
10
|
+
"orval-config": {
|
|
11
|
+
"description": "Adds orval to the project, create a config file and an empty openapi spec file",
|
|
12
|
+
"factory": "./orval-config/index#orvalConfig",
|
|
13
|
+
"schema": "./orval-config/schema.json"
|
|
14
|
+
},
|
|
15
|
+
"docker-config": {
|
|
16
|
+
"description": "Adds a Dockerfile and docker-compose.yaml to the project",
|
|
17
|
+
"factory": "./docker-config/index#dockerConfig",
|
|
18
|
+
"schema": "./docker-config/schema.json"
|
|
19
|
+
},
|
|
20
|
+
"sonar-config": {
|
|
21
|
+
"description": "Adds SonarQube configuration to the project",
|
|
22
|
+
"factory": "./sonar-config/index#sonarConfig",
|
|
23
|
+
"schema": "./sonar-config/schema.json"
|
|
24
|
+
},
|
|
25
|
+
"npm-config": {
|
|
26
|
+
"description": "Adds NPM configuration files (.npmrc and .nvmrc) to the project",
|
|
27
|
+
"factory": "./npm-config/index#npmConfig",
|
|
28
|
+
"schema": "./npm-config/schema.json"
|
|
29
|
+
},
|
|
30
|
+
"lint-config": {
|
|
31
|
+
"description": "Adds ESLint, Prettier, and EditorConfig configuration files to the project",
|
|
32
|
+
"factory": "./lint-config/index#lintConfig",
|
|
33
|
+
"schema": "./lint-config/schema.json"
|
|
34
|
+
},
|
|
35
|
+
"otel-config": {
|
|
36
|
+
"description": "Adds OpenTelemetry Collector configuration and configures nginx to proxy OTLP exports",
|
|
37
|
+
"factory": "./otel-config/index#otelConfig",
|
|
38
|
+
"schema": "./otel-config/schema.json"
|
|
39
|
+
},
|
|
40
|
+
"gitignore-config": {
|
|
41
|
+
"description": "Adds a .gitignore file to the project",
|
|
42
|
+
"factory": "./gitignore-config/index#gitignoreConfig",
|
|
43
|
+
"schema": "./gitignore-config/schema.json"
|
|
44
|
+
},
|
|
45
|
+
"adr": {
|
|
46
|
+
"description": "Generates an Architecture Decision Record (ADR) markdown file",
|
|
47
|
+
"factory": "./adr/index#adr",
|
|
48
|
+
"schema": "./adr/schema.json"
|
|
49
|
+
},
|
|
50
|
+
"k8s-config": {
|
|
51
|
+
"description": "Adds Kubernetes Deployment, Service, and Ingress manifests to the project",
|
|
52
|
+
"factory": "./k8s-config/index#k8sConfig",
|
|
53
|
+
"schema": "./k8s-config/schema.json"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.header = header;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
function header(options) {
|
|
7
|
+
return (tree, _context) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const sourceTemplates = (0, schematics_1.url)('./files');
|
|
10
|
+
const sourceParametrizedTemplates = (0, schematics_1.apply)(sourceTemplates, [
|
|
11
|
+
(0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
12
|
+
(0, schematics_1.move)((_a = options.path) !== null && _a !== void 0 ? _a : 'src/app/components/common'),
|
|
13
|
+
]);
|
|
14
|
+
return (0, schematics_1.mergeWith)(sourceParametrizedTemplates)(tree, _context);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/header/index.ts"],"names":[],"mappings":";;AAgBA,wBAYC;AA5BD,+CAA+C;AAC/C,2DASoC;AAMpC,SAAgB,MAAM,CAAC,OAA+B;IACpD,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;;QAChD,MAAM,eAAe,GAAG,IAAA,gBAAG,EAAC,SAAS,CAAC,CAAC;QACvC,MAAM,2BAA2B,GAAG,IAAA,kBAAK,EAAC,eAAe,EAAE;YACzD,IAAA,2BAAc,kCACT,cAAO,GACP,OAAO,EACV;YACF,IAAA,iBAAI,EAAC,MAAA,OAAO,CAAC,IAAI,mCAAI,2BAA2B,CAAC;SAClD,CAAC,CAAC;QACH,OAAO,IAAA,sBAAS,EAAC,2BAA2B,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
FROM nginx:1.31.0
|
|
2
|
+
# Upgrade OS packages to pick up security fixes:
|
|
3
|
+
# CVE-2026-4878 (libcap2), CVE-2026-27135 (libnghttp2-14), CVE-2026-29111 (libsystemd0, libudev1)
|
|
4
|
+
# CVE-2026-40356 (libgssapi-krb5-2, libk5crypto3, libkrb5-3, libkrb5support0)
|
|
5
|
+
RUN apt-get update && apt-get upgrade -y --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
|
6
|
+
|
|
7
|
+
COPY dist/<%= dasherize(applicationName) %>/browser /usr/share/nginx/html
|
|
8
|
+
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
|
|
9
|
+
# RESOLVER: Docker embedded DNS. Override in K8s to your CoreDNS ClusterIP
|
|
10
|
+
# e.g. kubectl get svc -n kube-system kube-dns -o jsonpath='{.spec.clusterIP}'
|
|
11
|
+
ENV RESOLVER=127.0.0.11
|
|
12
|
+
ENV BACKEND_HOST=<%= dasherize(backend_name) %>:8080
|
|
13
|
+
ENV NGINX_PORT=<%= port %>
|
|
14
|
+
|
|
15
|
+
EXPOSE <%= port %>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
server {
|
|
2
|
+
listen 80;
|
|
3
|
+
server_name _;
|
|
4
|
+
|
|
5
|
+
root /usr/share/nginx/html;
|
|
6
|
+
index index.html;
|
|
7
|
+
|
|
8
|
+
# Resolver is injected at container start via RESOLVER env var.
|
|
9
|
+
# Docker embedded DNS: 127.0.0.11
|
|
10
|
+
# AKS CoreDNS: typically 10.0.0.10 (check with: kubectl get svc -n kube-system kube-dns)
|
|
11
|
+
resolver ${RESOLVER} valid=30s ipv6=off;
|
|
12
|
+
|
|
13
|
+
# Proxy API calls to the backend service.
|
|
14
|
+
# Using a variable defers DNS lookup to request time, so nginx starts even if the backend is not yet available.
|
|
15
|
+
location /api/ {
|
|
16
|
+
set $backend http://${BACKEND_HOST}/api/;
|
|
17
|
+
proxy_pass $backend;
|
|
18
|
+
proxy_set_header Host $host;
|
|
19
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
20
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
21
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# Angular SPA: fall back to index.html for any unknown path
|
|
25
|
+
location / {
|
|
26
|
+
try_files $uri $uri/ /index.html;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Cache static assets aggressively
|
|
30
|
+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
|
31
|
+
expires 1y;
|
|
32
|
+
add_header Cache-Control "public, immutable";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dockerConfig = dockerConfig;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
function dockerConfig(options) {
|
|
7
|
+
return (tree, _context) => {
|
|
8
|
+
const sourceTemplates = (0, schematics_1.url)('./files');
|
|
9
|
+
const sourceParametrizedTemplates = (0, schematics_1.apply)(sourceTemplates, [
|
|
10
|
+
(0, schematics_1.applyTemplates)(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), { backend_name: options.backendName })),
|
|
11
|
+
(0, schematics_1.move)(''),
|
|
12
|
+
]);
|
|
13
|
+
return (0, schematics_1.mergeWith)(sourceParametrizedTemplates)(tree, _context);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/docker-config/index.ts"],"names":[],"mappings":";;AAkBA,oCAaC;AA/BD,+CAA+C;AAC/C,2DASoC;AAQpC,SAAgB,YAAY,CAAC,OAA4B;IACvD,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,eAAe,GAAG,IAAA,gBAAG,EAAC,SAAS,CAAC,CAAC;QACvC,MAAM,2BAA2B,GAAG,IAAA,kBAAK,EAAC,eAAe,EAAE;YACzD,IAAA,2BAAc,gDACT,cAAO,GACP,OAAO,KACV,YAAY,EAAE,OAAO,CAAC,WAAW,IACjC;YACF,IAAA,iBAAI,EAAC,EAAE,CAAC;SACT,CAAC,CAAC;QACH,OAAO,IAAA,sBAAS,EAAC,2BAA2B,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "docker-config",
|
|
4
|
+
"title": "Docker Config",
|
|
5
|
+
"description": "Adds a Dockerfile, compose.yaml, and nginx.conf to the project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"applicationName": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The application name, used for the Docker image and service name",
|
|
11
|
+
"default": "frontend-service"
|
|
12
|
+
},
|
|
13
|
+
"backendName": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The backend service name, used for the BACKEND_HOST env var in the Dockerfile",
|
|
16
|
+
"default": "backend-service"
|
|
17
|
+
},
|
|
18
|
+
"port": {
|
|
19
|
+
"type": "number",
|
|
20
|
+
"description": "The host port to expose in compose.yaml",
|
|
21
|
+
"default": 4200
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Compiled output
|
|
2
|
+
/dist
|
|
3
|
+
/tmp
|
|
4
|
+
/out-tsc
|
|
5
|
+
/bazel-out
|
|
6
|
+
|
|
7
|
+
# Node
|
|
8
|
+
/node_modules
|
|
9
|
+
npm-debug.log
|
|
10
|
+
yarn-error.log
|
|
11
|
+
|
|
12
|
+
# IDEs and editors
|
|
13
|
+
.idea/
|
|
14
|
+
.project
|
|
15
|
+
.classpath
|
|
16
|
+
.c9/
|
|
17
|
+
*.launch
|
|
18
|
+
.settings/
|
|
19
|
+
*.sublime-workspace
|
|
20
|
+
|
|
21
|
+
# Visual Studio Code
|
|
22
|
+
.vscode/*
|
|
23
|
+
!.vscode/settings.json
|
|
24
|
+
!.vscode/tasks.json
|
|
25
|
+
!.vscode/launch.json
|
|
26
|
+
!.vscode/extensions.json
|
|
27
|
+
.history/*
|
|
28
|
+
|
|
29
|
+
# Miscellaneous
|
|
30
|
+
/.angular/cache
|
|
31
|
+
.sass-cache/
|
|
32
|
+
/connect.lock
|
|
33
|
+
/coverage
|
|
34
|
+
/libpeerconnection.log
|
|
35
|
+
npm-debug.log
|
|
36
|
+
yarn-error.log
|
|
37
|
+
testem.log
|
|
38
|
+
/typings
|
|
39
|
+
|
|
40
|
+
# System files
|
|
41
|
+
.DS_Store
|
|
42
|
+
Thumbs.db
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gitignoreConfig = gitignoreConfig;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
function gitignoreConfig(options) {
|
|
7
|
+
return (tree, _context) => {
|
|
8
|
+
const sourceTemplates = (0, schematics_1.url)('./files');
|
|
9
|
+
const sourceParametrizedTemplates = (0, schematics_1.apply)(sourceTemplates, [
|
|
10
|
+
(0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
11
|
+
(0, schematics_1.move)(''),
|
|
12
|
+
]);
|
|
13
|
+
return (0, schematics_1.mergeWith)(sourceParametrizedTemplates)(tree, _context);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gitignore-config/index.ts"],"names":[],"mappings":";;AAcA,0CAYC;AA1BD,+CAA+C;AAC/C,2DASoC;AAIpC,SAAgB,eAAe,CAAC,OAA+B;IAC7D,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,eAAe,GAAG,IAAA,gBAAG,EAAC,SAAS,CAAC,CAAC;QACvC,MAAM,2BAA2B,GAAG,IAAA,kBAAK,EAAC,eAAe,EAAE;YACzD,IAAA,2BAAc,kCACT,cAAO,GACP,OAAO,EACV;YACF,IAAA,iBAAI,EAAC,EAAE,CAAC;SACT,CAAC,CAAC;QACH,OAAO,IAAA,sBAAS,EAAC,2BAA2B,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: <%= dasherize(applicationName) %>
|
|
5
|
+
namespace: <%= namespace %>
|
|
6
|
+
labels:
|
|
7
|
+
app: <%= dasherize(applicationName) %>
|
|
8
|
+
spec:
|
|
9
|
+
replicas: <%= replicas %>
|
|
10
|
+
selector:
|
|
11
|
+
matchLabels:
|
|
12
|
+
app: <%= dasherize(applicationName) %>
|
|
13
|
+
template:
|
|
14
|
+
metadata:
|
|
15
|
+
labels:
|
|
16
|
+
app: <%= dasherize(applicationName) %>
|
|
17
|
+
spec:
|
|
18
|
+
containers:
|
|
19
|
+
- name: <%= dasherize(applicationName) %>
|
|
20
|
+
image: <%= dasherize(applicationName) %>:latest
|
|
21
|
+
ports:
|
|
22
|
+
- containerPort: <%= port %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
apiVersion: networking.k8s.io/v1
|
|
2
|
+
kind: Ingress
|
|
3
|
+
metadata:
|
|
4
|
+
name: <%= dasherize(applicationName) %>
|
|
5
|
+
namespace: <%= namespace %>
|
|
6
|
+
spec:
|
|
7
|
+
rules:
|
|
8
|
+
- host: <%= ingressHost %>
|
|
9
|
+
http:
|
|
10
|
+
paths:
|
|
11
|
+
- path: /
|
|
12
|
+
pathType: Prefix
|
|
13
|
+
backend:
|
|
14
|
+
service:
|
|
15
|
+
name: <%= dasherize(applicationName) %>
|
|
16
|
+
port:
|
|
17
|
+
number: <%= port %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: Service
|
|
3
|
+
metadata:
|
|
4
|
+
name: <%= dasherize(applicationName) %>
|
|
5
|
+
namespace: <%= namespace %>
|
|
6
|
+
labels:
|
|
7
|
+
app: <%= dasherize(applicationName) %>
|
|
8
|
+
spec:
|
|
9
|
+
selector:
|
|
10
|
+
app: <%= dasherize(applicationName) %>
|
|
11
|
+
ports:
|
|
12
|
+
- port: <%= port %>
|
|
13
|
+
targetPort: <%= port %>
|
|
14
|
+
type: ClusterIP
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
interface K8sConfigOptions {
|
|
3
|
+
applicationName: string;
|
|
4
|
+
namespace: string;
|
|
5
|
+
port: number;
|
|
6
|
+
replicas: number;
|
|
7
|
+
ingressHost: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function k8sConfig(options: K8sConfigOptions): Rule;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.k8sConfig = k8sConfig;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const script_1 = require("../utils/script");
|
|
7
|
+
function k8sConfig(options) {
|
|
8
|
+
return (tree, _context) => {
|
|
9
|
+
const sourceTemplates = (0, schematics_1.url)('./files');
|
|
10
|
+
const sourceParametrizedTemplates = (0, schematics_1.apply)(sourceTemplates, [
|
|
11
|
+
(0, schematics_1.applyTemplates)(Object.assign(Object.assign({}, core_1.strings), options)),
|
|
12
|
+
(0, schematics_1.move)(''),
|
|
13
|
+
(0, schematics_1.filter)(path => !tree.exists(path)),
|
|
14
|
+
]);
|
|
15
|
+
return (0, schematics_1.chain)([
|
|
16
|
+
(0, script_1.addScript)('k8s:apply', 'kubectl apply -f k8s/'),
|
|
17
|
+
(0, schematics_1.mergeWith)(sourceParametrizedTemplates),
|
|
18
|
+
])(tree, _context);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/k8s-config/index.ts"],"names":[],"mappings":";;AAuBA,8BAgBC;AAvCD,+CAA+C;AAC/C,2DAWoC;AACpC,4CAA4C;AAU5C,SAAgB,SAAS,CAAC,OAAyB;IACjD,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,eAAe,GAAG,IAAA,gBAAG,EAAC,SAAS,CAAC,CAAC;QACvC,MAAM,2BAA2B,GAAG,IAAA,kBAAK,EAAC,eAAe,EAAE;YACzD,IAAA,2BAAc,kCACT,cAAO,GACP,OAAO,EACV;YACF,IAAA,iBAAI,EAAC,EAAE,CAAC;YACR,IAAA,mBAAM,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACnC,CAAC,CAAC;QACH,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,kBAAS,EAAC,WAAW,EAAE,uBAAuB,CAAC;YAC/C,IAAA,sBAAS,EAAC,2BAA2B,CAAC;SACvC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "k8s-config",
|
|
4
|
+
"title": "K8s Config",
|
|
5
|
+
"description": "Adds Kubernetes Deployment, Service, and Ingress manifests to the project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"applicationName": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Used in resource names, labels, and image reference",
|
|
11
|
+
"default": "frontend-service"
|
|
12
|
+
},
|
|
13
|
+
"namespace": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Kubernetes namespace for all resources",
|
|
16
|
+
"default": "default"
|
|
17
|
+
},
|
|
18
|
+
"port": {
|
|
19
|
+
"type": "number",
|
|
20
|
+
"description": "Container port exposed by the Deployment and targeted by the Service",
|
|
21
|
+
"default": 80
|
|
22
|
+
},
|
|
23
|
+
"replicas": {
|
|
24
|
+
"type": "number",
|
|
25
|
+
"description": "Desired replica count in the Deployment",
|
|
26
|
+
"default": 2
|
|
27
|
+
},
|
|
28
|
+
"ingressHost": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Hostname for the Ingress rule",
|
|
31
|
+
"default": "app.example.com"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Editor configuration, see https://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 2
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.ts]
|
|
12
|
+
quote_type = single
|
|
13
|
+
ij_typescript_use_double_quotes = false
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
max_line_length = off
|
|
17
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"ignorePatterns": [
|
|
4
|
+
"projects/**/*"
|
|
5
|
+
],
|
|
6
|
+
"parserOptions": {
|
|
7
|
+
"project": [
|
|
8
|
+
"tsconfig.(app|spec).json"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"overrides": [
|
|
12
|
+
{
|
|
13
|
+
"files": [
|
|
14
|
+
"*.ts"
|
|
15
|
+
],
|
|
16
|
+
"extends": [
|
|
17
|
+
"eslint:recommended",
|
|
18
|
+
"plugin:@typescript-eslint/recommended",
|
|
19
|
+
"plugin:@angular-eslint/recommended",
|
|
20
|
+
"plugin:@typescript-eslint/recommended-type-checked",
|
|
21
|
+
"plugin:@angular-eslint/template/process-inline-templates"
|
|
22
|
+
],
|
|
23
|
+
"rules": {
|
|
24
|
+
"@angular-eslint/directive-selector": [
|
|
25
|
+
"error",
|
|
26
|
+
{
|
|
27
|
+
"type": "attribute",
|
|
28
|
+
"prefix": "app",
|
|
29
|
+
"style": "camelCase"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"@angular-eslint/component-selector": [
|
|
33
|
+
"error",
|
|
34
|
+
{
|
|
35
|
+
"type": "element",
|
|
36
|
+
"prefix": "app",
|
|
37
|
+
"style": "kebab-case"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"files": [
|
|
44
|
+
"*.html"
|
|
45
|
+
],
|
|
46
|
+
"extends": [
|
|
47
|
+
"plugin:@angular-eslint/template/recommended",
|
|
48
|
+
"plugin:@angular-eslint/template/accessibility"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"files": [
|
|
53
|
+
"**/*.test.{ts,tsx, js}",
|
|
54
|
+
"**/*.spec.{ts,tsx, js}"
|
|
55
|
+
],
|
|
56
|
+
"rules": {
|
|
57
|
+
"@typescript-eslint/unbound-method": "off"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|