Added Dockerfile and renamed project
This commit is contained in:
parent
376c42c3e6
commit
b4b4f1f312
13
.dockerignore
Normal file
13
.dockerignore
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
node_modules.angular
|
||||||
|
.vscode
|
||||||
|
dist
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
Dockerfile*
|
||||||
|
docker-compose*
|
||||||
|
.dockerignore
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
README.md
|
||||||
|
LICENSE
|
||||||
|
.editorconfig
|
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Build application
|
||||||
|
FROM node:20-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
ARG API_URL="local"
|
||||||
|
ENV JTR_API_URL=${API_URL}
|
||||||
|
ARG NODE_ENV="development"
|
||||||
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Serve application
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
COPY --from=build /app/dist/jtr/browser /usr/share/nginx/html
|
||||||
|
EXPOSE 80
|
29
angular.json
29
angular.json
@ -3,7 +3,7 @@
|
|||||||
"version": 1,
|
"version": 1,
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot": "projects",
|
||||||
"projects": {
|
"projects": {
|
||||||
"DevDisciples.Json.Tools.App": {
|
"jtr": {
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"schematics": {
|
"schematics": {
|
||||||
"@schematics/angular:component": {
|
"@schematics/angular:component": {
|
||||||
@ -15,9 +15,9 @@
|
|||||||
"prefix": "app",
|
"prefix": "app",
|
||||||
"architect": {
|
"architect": {
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:application",
|
"builder": "@ngx-env/builder:application",
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/dev-disciples.json.tools.app",
|
"outputPath": "dist/jtr",
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"browser": "src/main.ts",
|
"browser": "src/main.ts",
|
||||||
"polyfills": [
|
"polyfills": [
|
||||||
@ -30,7 +30,8 @@
|
|||||||
"glob": "**/*",
|
"glob": "**/*",
|
||||||
"input": "public"
|
"input": "public"
|
||||||
},
|
},
|
||||||
{ "glob": "**/*",
|
{
|
||||||
|
"glob": "**/*",
|
||||||
"input": "node_modules/monaco-editor",
|
"input": "node_modules/monaco-editor",
|
||||||
"output": "/assets/monaco/"
|
"output": "/assets/monaco/"
|
||||||
}
|
}
|
||||||
@ -38,7 +39,10 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": []
|
"scripts": [],
|
||||||
|
"ngxEnv": {
|
||||||
|
"prefix": "JTR_"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
@ -65,22 +69,22 @@
|
|||||||
"defaultConfiguration": "production"
|
"defaultConfiguration": "production"
|
||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder": "@ngx-env/builder:dev-server",
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"buildTarget": "DevDisciples.Json.Tools.App:build:production"
|
"buildTarget": "jtr:build:production"
|
||||||
},
|
},
|
||||||
"development": {
|
"development": {
|
||||||
"buildTarget": "DevDisciples.Json.Tools.App:build:development"
|
"buildTarget": "jtr:build:development"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "development"
|
"defaultConfiguration": "development"
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n": {
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n"
|
"builder": "@ngx-env/builder:extract-i18n"
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"builder": "@angular-devkit/build-angular:karma",
|
"builder": "@ngx-env/builder:karma",
|
||||||
"options": {
|
"options": {
|
||||||
"polyfills": [
|
"polyfills": [
|
||||||
"zone.js",
|
"zone.js",
|
||||||
@ -93,7 +97,8 @@
|
|||||||
"glob": "**/*",
|
"glob": "**/*",
|
||||||
"input": "public"
|
"input": "public"
|
||||||
},
|
},
|
||||||
{ "glob": "**/*",
|
{
|
||||||
|
"glob": "**/*",
|
||||||
"input": "node_modules/monaco-editor",
|
"input": "node_modules/monaco-editor",
|
||||||
"output": "/assets/monaco/"
|
"output": "/assets/monaco/"
|
||||||
}
|
}
|
||||||
@ -107,4 +112,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
27
nginx.conf
Normal file
27
nginx.conf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# the events block is required
|
||||||
|
events { }
|
||||||
|
|
||||||
|
http {
|
||||||
|
# include the default mime.types to map file extensions to MIME types
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
|
||||||
|
server {
|
||||||
|
# set the root directory for the server (we need to copy our
|
||||||
|
# application files here)
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
# set the default index file for the server (Angular generates the
|
||||||
|
# index.html file for us and it will be in the above directory)
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# specify the configuration for the '/' location
|
||||||
|
location / {
|
||||||
|
# try to serve the requested URI. if that fails then try to
|
||||||
|
# serve the URI with a trailing slash. if that fails, then
|
||||||
|
# serve the index.html file; this is needed in order to serve
|
||||||
|
# Angular routes--e.g.,'localhost:8080/customer' will serve
|
||||||
|
# the index.html file
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2294
package-lock.json
generated
2294
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,7 @@
|
|||||||
"@angular-devkit/build-angular": "^18.2.4",
|
"@angular-devkit/build-angular": "^18.2.4",
|
||||||
"@angular/cli": "^18.2.4",
|
"@angular/cli": "^18.2.4",
|
||||||
"@angular/compiler-cli": "^18.2.0",
|
"@angular/compiler-cli": "^18.2.0",
|
||||||
|
"@ngx-env/builder": "^18.0.2",
|
||||||
"@types/jasmine": "~5.1.0",
|
"@types/jasmine": "~5.1.0",
|
||||||
"jasmine-core": "~5.2.0",
|
"jasmine-core": "~5.2.0",
|
||||||
"karma": "~6.4.0",
|
"karma": "~6.4.0",
|
||||||
|
@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core';
|
|||||||
import {EditorComponent} from "ngx-monaco-editor-v2";
|
import {EditorComponent} from "ngx-monaco-editor-v2";
|
||||||
import {FormsModule} from "@angular/forms";
|
import {FormsModule} from "@angular/forms";
|
||||||
import {InputOutputComponent} from "../input-output/input-output.component";
|
import {InputOutputComponent} from "../input-output/input-output.component";
|
||||||
import {JsonTransformService} from "../json-transform.service";
|
import {JtrService} from "../jtr.service";
|
||||||
import {
|
import {
|
||||||
DebounceTime,
|
DebounceTime,
|
||||||
GenerateDefaultJsonObjectString,
|
GenerateDefaultJsonObjectString,
|
||||||
@ -23,14 +23,12 @@ import {BehaviorSubject, debounceTime} from "rxjs";
|
|||||||
styleUrl: './beautify.component.scss'
|
styleUrl: './beautify.component.scss'
|
||||||
})
|
})
|
||||||
export class BeautifyComponent implements OnInit {
|
export class BeautifyComponent implements OnInit {
|
||||||
// input: string = ;
|
|
||||||
$input: BehaviorSubject<string> = new BehaviorSubject<string>(GenerateDefaultJsonObjectString());
|
$input: BehaviorSubject<string> = new BehaviorSubject<string>(GenerateDefaultJsonObjectString());
|
||||||
inputOptions = MonacoJsonConfig;
|
inputOptions = MonacoJsonConfig;
|
||||||
output: string = GenerateDefaultJsonObjectString(2);
|
output: string = GenerateDefaultJsonObjectString(2);
|
||||||
outputOptions = ReadOnlyMonacoJsonConfig;
|
outputOptions = ReadOnlyMonacoJsonConfig;
|
||||||
// error: string = "";
|
|
||||||
|
|
||||||
constructor(private service: JsonTransformService) {
|
constructor(private service: JtrService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core';
|
|||||||
import {InputOutputComponent} from "../input-output/input-output.component";
|
import {InputOutputComponent} from "../input-output/input-output.component";
|
||||||
import {DebounceTime, GenerateDefaultJsonObjectString, MonacoJsonConfig, ReadOnlyMonacoCSharpConfig} from "../defaults";
|
import {DebounceTime, GenerateDefaultJsonObjectString, MonacoJsonConfig, ReadOnlyMonacoCSharpConfig} from "../defaults";
|
||||||
import {BehaviorSubject, debounceTime} from "rxjs";
|
import {BehaviorSubject, debounceTime} from "rxjs";
|
||||||
import {JsonTransformService} from "../json-transform.service";
|
import {JtrService} from "../jtr.service";
|
||||||
import {MatFormField} from "@angular/material/form-field";
|
import {MatFormField} from "@angular/material/form-field";
|
||||||
import {MatInputModule} from "@angular/material/input";
|
import {MatInputModule} from "@angular/material/input";
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ export class JsonPathComponent implements OnInit {
|
|||||||
output: string = "";
|
output: string = "";
|
||||||
outputOptions = ReadOnlyMonacoCSharpConfig;
|
outputOptions = ReadOnlyMonacoCSharpConfig;
|
||||||
|
|
||||||
constructor(private service: JsonTransformService) {
|
constructor(private service: JtrService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { JsonTransformService } from './json-transform.service';
|
|
||||||
|
|
||||||
describe('JsonTransformService', () => {
|
|
||||||
let service: JsonTransformService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({});
|
|
||||||
service = TestBed.inject(JsonTransformService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,6 +1,6 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {InputOutputComponent} from "../input-output/input-output.component";
|
import {InputOutputComponent} from "../input-output/input-output.component";
|
||||||
import {JsonTransformService} from "../json-transform.service";
|
import {JtrService} from "../jtr.service";
|
||||||
import {
|
import {
|
||||||
DebounceTime,
|
DebounceTime,
|
||||||
GenerateDefaultJsonObjectString,
|
GenerateDefaultJsonObjectString,
|
||||||
@ -24,7 +24,7 @@ export class Json2CsharpComponent implements OnInit {
|
|||||||
output: string = "";
|
output: string = "";
|
||||||
outputOptions = ReadOnlyMonacoCSharpConfig;
|
outputOptions = ReadOnlyMonacoCSharpConfig;
|
||||||
|
|
||||||
constructor(private service: JsonTransformService) {
|
constructor(private service: JtrService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
16
src/app/jtr.service.spec.ts
Normal file
16
src/app/jtr.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { JtrService } from './jtr.service';
|
||||||
|
|
||||||
|
describe('JtrService', () => {
|
||||||
|
let service: JtrService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(JtrService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -5,8 +5,8 @@ import {Observable} from "rxjs";
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class JsonTransformService {
|
export class JtrService {
|
||||||
private url: string = "https://localhost:5001";
|
private url: string = import.meta.env.JTR_API_URL;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
}
|
}
|
@ -15,7 +15,7 @@
|
|||||||
<button mat-icon-button (click)="drawer.toggle()">
|
<button mat-icon-button (click)="drawer.toggle()">
|
||||||
<mat-icon>menu</mat-icon>
|
<mat-icon>menu</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<span>JSON Transform</span>
|
<span>JSON Transform / JTR</span>
|
||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {JsonTransformService} from "../json-transform.service";
|
import {JtrService} from "../jtr.service";
|
||||||
import {InputOutputComponent} from "../input-output/input-output.component";
|
import {InputOutputComponent} from "../input-output/input-output.component";
|
||||||
import {
|
import {
|
||||||
DebounceTime,
|
DebounceTime,
|
||||||
@ -25,7 +25,7 @@ export class UglifyComponent implements OnInit {
|
|||||||
output: string = GenerateDefaultJsonObjectString();
|
output: string = GenerateDefaultJsonObjectString();
|
||||||
outputOptions = ReadOnlyMonacoJsonConfig;
|
outputOptions = ReadOnlyMonacoJsonConfig;
|
||||||
|
|
||||||
constructor(private service: JsonTransformService) {
|
constructor(private service: JtrService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
28
src/env.d.ts
vendored
Normal file
28
src/env.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Define the type of the environment variables.
|
||||||
|
declare interface Env {
|
||||||
|
readonly NODE_ENV: string;
|
||||||
|
// Replace the following with your own environment variables.
|
||||||
|
// Example: NGX_VERSION: string;
|
||||||
|
readonly JTR_API_URL: string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Choose how to access the environment variables.
|
||||||
|
// Remove the unused options.
|
||||||
|
|
||||||
|
// 1. Use import.meta.env.YOUR_ENV_VAR in your code. (conventional)
|
||||||
|
declare interface ImportMeta {
|
||||||
|
readonly env: Env;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Use _NGX_ENV_.YOUR_ENV_VAR in your code. (customizable)
|
||||||
|
// You can modify the name of the variable in angular.json.
|
||||||
|
// ngxEnv: {
|
||||||
|
// define: '_NGX_ENV_',
|
||||||
|
// }
|
||||||
|
declare const _NGX_ENV_: Env;
|
||||||
|
|
||||||
|
// 3. Use process.env.YOUR_ENV_VAR in your code. (deprecated)
|
||||||
|
declare namespace NodeJS {
|
||||||
|
export interface ProcessEnv extends Env {}
|
||||||
|
}
|
@ -10,7 +10,7 @@
|
|||||||
@include mat.core();
|
@include mat.core();
|
||||||
|
|
||||||
// Define the theme object.
|
// Define the theme object.
|
||||||
$DevDisciples-Json-Tools-App-theme: mat.define-theme((
|
$jtr-app-theme: mat.define-theme((
|
||||||
color: (
|
color: (
|
||||||
theme-type: light,
|
theme-type: light,
|
||||||
primary: mat.$azure-palette,
|
primary: mat.$azure-palette,
|
||||||
@ -25,15 +25,15 @@ $DevDisciples-Json-Tools-App-theme: mat.define-theme((
|
|||||||
// Alternatively, you can import and @include the theme mixins for each component
|
// Alternatively, you can import and @include the theme mixins for each component
|
||||||
// that you are using.
|
// that you are using.
|
||||||
:root {
|
:root {
|
||||||
@include mat.all-component-themes($DevDisciples-Json-Tools-App-theme);
|
@include mat.all-component-themes($jtr-app-theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comment out the line below if you want to use the pre-defined typography utility classes.
|
// Comment out the line below if you want to use the pre-defined typography utility classes.
|
||||||
// For more information: https://material.angular.io/guide/typography#using-typography-styles-in-your-application.
|
// For more information: https://material.angular.io/guide/typography#using-typography-styles-in-your-application.
|
||||||
// @include mat.typography-hierarchy($DevDisciples.Json.Tools.App-theme);
|
// @include mat.typography-hierarchy($jtr-theme);
|
||||||
|
|
||||||
// Comment out the line below if you want to use the deprecated `color` inputs.
|
// Comment out the line below if you want to use the deprecated `color` inputs.
|
||||||
// @include mat.color-variants-backwards-compatibility($DevDisciples.Json.Tools.App-theme);
|
// @include mat.color-variants-backwards-compatibility($jtr-theme);
|
||||||
/* You can add global styles to this file, and also import other style files */
|
/* You can add global styles to this file, and also import other style files */
|
||||||
|
|
||||||
html, body { height: 100%; }
|
html, body { height: 100%; }
|
||||||
|
Loading…
Reference in New Issue
Block a user