Compare commits
No commits in common. "d8e4c7689f3fafc62ba868323dbbedef7bddf5eb" and "39db41badfa82f35f6d3e6a0b915b2f2d81ec338" have entirely different histories.
d8e4c7689f
...
39db41badf
52 changed files with 11666 additions and 11953 deletions
10
.drone.yml
10
.drone.yml
|
@ -1,10 +1,6 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: install
|
||||
image: node:20-alpine
|
||||
pipeline:
|
||||
build:
|
||||
image: fritteli/headless-nodejs:1.1.0
|
||||
commands:
|
||||
- npm install
|
||||
- npm run test:ci
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Editor configuration, see https://editorconfig.org
|
||||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
|
@ -8,9 +8,6 @@ indent_size = 2
|
|||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
|
28
.gitignore
vendored
28
.gitignore
vendored
|
@ -1,42 +1,44 @@
|
|||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
# compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
# dependencies
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
*.iml
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/tasks.json
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
# misc
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System files
|
||||
# e2e
|
||||
# /e2e/*.js
|
||||
/e2e/*.map
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*~
|
||||
|
|
12
README.md
12
README.md
|
@ -1,4 +1,4 @@
|
|||
# Convertorizr - Convert whatever you want!
|
||||
# convertorizr - Convert whatever you want!
|
||||
|
||||
This is a short introduction to the awesome Convertorizr hosted at https://conv.friedli.info/.
|
||||
|
||||
|
@ -11,11 +11,11 @@ Cheers!
|
|||
|
||||
# Technical stuff
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.1.0.
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.1.5.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
|
@ -23,7 +23,7 @@ Run `ng generate component component-name` to generate a new component. You can
|
|||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
|
@ -31,8 +31,8 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
|
|||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
|
|
132
angular.json
132
angular.json
|
@ -3,28 +3,25 @@
|
|||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"convertorizr": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
}
|
||||
},
|
||||
"converter": {
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"projectType": "application",
|
||||
"prefix": "app",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"styleext": "scss"
|
||||
}
|
||||
},
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:application",
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/convertorizr",
|
||||
"outputPath": "dist/converter",
|
||||
"index": "src/index.html",
|
||||
"browser": "src/main.ts",
|
||||
"polyfills": [
|
||||
"zone.js"
|
||||
],
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
|
@ -36,66 +33,99 @@
|
|||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
"fileReplacements": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kb",
|
||||
"maximumError": "1mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"optimization": false,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "converter:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "convertorizr:build:production"
|
||||
},
|
||||
"development": {
|
||||
"buildTarget": "convertorizr:build:development"
|
||||
"browserTarget": "converter:build:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"buildTarget": "convertorizr:build"
|
||||
"browserTarget": "converter:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"polyfills": [
|
||||
"zone.js",
|
||||
"zone.js/testing"
|
||||
],
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.spec.json",
|
||||
"karmaConfig": "src/karma.conf.js",
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
"scripts": [],
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"src/tsconfig.app.json",
|
||||
"src/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"converter-e2e": {
|
||||
"root": "e2e/",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"e2e": {
|
||||
"builder": "@angular-devkit/build-angular:protractor",
|
||||
"options": {
|
||||
"protractorConfig": "e2e/protractor.conf.js",
|
||||
"devServerTarget": "converter:serve"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "converter:serve:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": "e2e/tsconfig.e2e.json",
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "converter"
|
||||
}
|
||||
|
|
31
e2e/protractor.conf.js
Normal file
31
e2e/protractor.conf.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||
|
||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./src/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome',
|
||||
chromeOptions: {
|
||||
args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
onPrepare() {
|
||||
require('ts-node').register({
|
||||
project: require('path').join(__dirname, './tsconfig.e2e.json')
|
||||
});
|
||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||
}
|
||||
};
|
41
e2e/src/app.e2e-spec.ts
Normal file
41
e2e/src/app.e2e-spec.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import {ConvertorizrPage} from './app.po';
|
||||
|
||||
describe('convertorizr App', () => {
|
||||
let page: ConvertorizrPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new ConvertorizrPage();
|
||||
});
|
||||
|
||||
it('should display a textarea that is initially empty', () => {
|
||||
page.navigateTo()
|
||||
.then(() => page.getInputFieldContent(0))
|
||||
.then((value: string) => {
|
||||
expect(value).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
it('should convert a string to its base64 representation', () => {
|
||||
page.navigateTo()
|
||||
.then(() => page.setInputFieldContent(0, 'Hello, World!'))
|
||||
.then(() => page.getSelectedConverterOption(0))
|
||||
.then((option: string) => {
|
||||
expect(option).toEqual('Select conversion ...');
|
||||
})
|
||||
.then(() => page.selectConverterOption(0, 'Encode Base 64'))
|
||||
.then(() => page.getInputFieldContent(1))
|
||||
.then((content: string) => {
|
||||
expect(content).toEqual('SGVsbG8sIFdvcmxkIQ==');
|
||||
});
|
||||
});
|
||||
|
||||
it('should display an error message if the conversion fails', () => {
|
||||
page.navigateTo()
|
||||
.then(() => page.setInputFieldContent(0, 'Oh noes!'))
|
||||
.then(() => page.selectConverterOption(0, 'Decode Base 64'))
|
||||
.then(() => page.getErrorMessage(0))
|
||||
.then((content: string) => {
|
||||
expect(content).toEqual('Could not decode base64 string. Maybe corrupt input?');
|
||||
});
|
||||
});
|
||||
});
|
53
e2e/src/app.po.ts
Normal file
53
e2e/src/app.po.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
import {browser, by, element, ElementFinder} from 'protractor';
|
||||
import {promise, WebElementPromise} from 'selenium-webdriver';
|
||||
|
||||
export class ConvertorizrPage {
|
||||
navigateTo(): promise.Promise<any> {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
private getInputField(index: number): WebElementPromise {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('.textwrapper textarea'))
|
||||
.getWebElement();
|
||||
}
|
||||
|
||||
getInputFieldContent(index: number): promise.Promise<string> {
|
||||
return this.getInputField(index).getText();
|
||||
}
|
||||
|
||||
setInputFieldContent(index: number, content: string): promise.Promise<void> {
|
||||
return this.getInputField(index).sendKeys(content);
|
||||
}
|
||||
|
||||
private getConverterDropdown(index: number): ElementFinder {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('.selectwrapper select'));
|
||||
}
|
||||
|
||||
getSelectedConverterOption(index: number): promise.Promise<string> {
|
||||
return this.getConverterDropdown(index)
|
||||
.$('option:checked')
|
||||
.getWebElement()
|
||||
.getText();
|
||||
}
|
||||
|
||||
selectConverterOption(index: number, optionName: string): promise.Promise<void> {
|
||||
return this.getConverterDropdown(index)
|
||||
.element(by.cssContainingText('option', optionName))
|
||||
.click();
|
||||
}
|
||||
|
||||
getErrorMessage(index: number): promise.Promise<string> {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('app-error-message div.errormessage'))
|
||||
.getWebElement()
|
||||
.getText();
|
||||
}
|
||||
}
|
13
e2e/tsconfig.e2e.json
Normal file
13
e2e/tsconfig.e2e.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
22483
package-lock.json
generated
22483
package-lock.json
generated
File diff suppressed because it is too large
Load diff
77
package.json
77
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "convertorizr",
|
||||
"version": "2.0.0-dev.1",
|
||||
"version": "1.3.1-1",
|
||||
"description": "Decode or encode base64, punycode, HTML entities, URI components, ...",
|
||||
"keywords": [
|
||||
"encode",
|
||||
|
@ -14,7 +14,7 @@
|
|||
"email": "manuel@fritteli.ch"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://conv.friedli.info/",
|
||||
"homepage": "https://manuel.pages.gittr.ch/dencode.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gittr.ch/manuel/converter.git"
|
||||
|
@ -22,43 +22,50 @@
|
|||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"test:ci": "ng test --no-watch --no-progress --browsers=ChromiumHeadless"
|
||||
"build": "ng build --delete-output-path",
|
||||
"build-prod": "ng build --prod --optimization --aot --delete-output-path --build-optimizer",
|
||||
"test": "ng test --code-coverage",
|
||||
"test:ci": "ng test --browsers ChromeHeadlessNoSandbox --watch=false --code-coverage",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"postinstall": "npm rebuild node-sass"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^17.1.0",
|
||||
"@angular/common": "^17.1.0",
|
||||
"@angular/compiler": "^17.1.0",
|
||||
"@angular/core": "^17.1.0",
|
||||
"@angular/forms": "^17.1.0",
|
||||
"@angular/platform-browser": "^17.1.0",
|
||||
"@angular/platform-browser-dynamic": "^17.1.0",
|
||||
"@angular/router": "^17.1.0",
|
||||
"punycode": "^2.3.1",
|
||||
"quoted-printable": "^1.0.1",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0",
|
||||
"utf8": "^3.0.0",
|
||||
"zone.js": "~0.14.3"
|
||||
"@angular/common": "6.1.7",
|
||||
"@angular/compiler": "6.1.7",
|
||||
"@angular/core": "6.1.7",
|
||||
"@angular/forms": "6.1.7",
|
||||
"@angular/platform-browser": "6.1.7",
|
||||
"@angular/platform-browser-dynamic": "6.1.7",
|
||||
"@angular/router": "6.1.7",
|
||||
"core-js": "^2.5.1",
|
||||
"punycode": "^2.1.0",
|
||||
"quoted-printable": "^1.0.0",
|
||||
"rxjs": "^6.3.2",
|
||||
"utf8": "^2.1.0",
|
||||
"zone.js": "^0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^17.1.0",
|
||||
"@angular/cli": "^17.1.0",
|
||||
"@angular/compiler-cli": "^17.1.0",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"@types/node": "^20.11.5",
|
||||
"@types/punycode": "^2.1.3",
|
||||
"@types/quoted-printable": "^1.0.2",
|
||||
"@types/utf8": "^3.0.3",
|
||||
"jasmine-core": "~5.1.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-coverage": "~2.2.0",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.1.0",
|
||||
"typescript": "~5.3.2"
|
||||
"@angular-devkit/build-angular": "~0.7.0",
|
||||
"@angular/cli": "6.1.5",
|
||||
"@angular/compiler-cli": "6.1.7",
|
||||
"@types/jasmine": "~2.8.6",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "~8.9.4",
|
||||
"codelyzer": "~4.2.1",
|
||||
"jasmine-core": "~2.99.1",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
"karma": "~1.7.1",
|
||||
"karma-chrome-launcher": "~2.2.0",
|
||||
"karma-coverage-istanbul-reporter": "~2.0.0",
|
||||
"karma-jasmine": "~1.1.1",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"karma-nightmare": "~0.4.15",
|
||||
"protractor": "~5.4.0",
|
||||
"puppeteer": "~1.7.0",
|
||||
"ts-node": "~5.0.1",
|
||||
"tslint": "~5.9.1",
|
||||
"typescript": "2.9.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
@for (step of steps; track step.index) {
|
||||
<div class="inputwrapper">
|
||||
<div *ngFor="let step of steps" class="inputwrapper">
|
||||
<app-text-input-field [step]="step" #ti></app-text-input-field>
|
||||
<app-converter-selector [step]="step" [textInput]="ti"></app-converter-selector>
|
||||
<app-error-message [step]="step"></app-error-message>
|
||||
</div>
|
||||
}
|
||||
<app-version></app-version>
|
||||
<!--<router-outlet></router-outlet>-->
|
||||
|
|
|
@ -1,26 +1,39 @@
|
|||
import {AppComponent} from './app.component';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Step} from './step';
|
||||
import {VersionComponent} from './version/version.component';
|
||||
import {ConverterSelectorComponent} from './converter-selector/converter-selector.component';
|
||||
import {TextInputFieldComponent} from './text-input-field/text-input-field.component';
|
||||
import {ErrorMessageComponent} from './error-message/error-message.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
let sut: AppComponent;
|
||||
let fixture: ComponentFixture<AppComponent>;
|
||||
const firstStep: Step = new Step(0);
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AppComponent]
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
ConverterSelectorComponent,
|
||||
ErrorMessageComponent,
|
||||
TextInputFieldComponent,
|
||||
VersionComponent
|
||||
],
|
||||
imports: [FormsModule]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppComponent);
|
||||
sut = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
it('should create the app', async(() => {
|
||||
// const fixture = TestBed.createComponent(AppComponent);
|
||||
expect(sut).toBeTruthy();
|
||||
});
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {InputComponentManagerService} from './input-component-manager.service';
|
||||
import {Step} from './step';
|
||||
import {RouterOutlet} from '@angular/router';
|
||||
import {TextInputFieldComponent} from './text-input-field/text-input-field.component';
|
||||
import {ConverterSelectorComponent} from './converter-selector/converter-selector.component';
|
||||
import {ErrorMessageComponent} from './error-message/error-message.component';
|
||||
import {VersionComponent} from './version/version.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
standalone: true,
|
||||
imports: [
|
||||
ConverterSelectorComponent,
|
||||
ErrorMessageComponent,
|
||||
RouterOutlet,
|
||||
TextInputFieldComponent,
|
||||
VersionComponent
|
||||
],
|
||||
templateUrl: './app.component.html',
|
||||
styleUrl: './app.component.scss'
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
public steps: Step[] = [];
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [provideRouter(routes)]
|
||||
};
|
|
@ -12,11 +12,11 @@ import { ErrorMessageComponent } from './error-message/error-message.component';
|
|||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
// AppComponent,
|
||||
// VersionComponent,
|
||||
// TextInputFieldComponent,
|
||||
// ConverterSelectorComponent,
|
||||
// ErrorMessageComponent
|
||||
AppComponent,
|
||||
VersionComponent,
|
||||
TextInputFieldComponent,
|
||||
ConverterSelectorComponent,
|
||||
ErrorMessageComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -27,7 +27,7 @@ import { ErrorMessageComponent } from './error-message/error-message.component';
|
|||
InputComponentManagerService,
|
||||
NativeLibraryWrapperService
|
||||
],
|
||||
// bootstrap: [AppComponent]
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
import { Routes } from '@angular/router';
|
||||
|
||||
export const routes: Routes = [];
|
|
@ -35,7 +35,7 @@ export class ConverterRegistryService {
|
|||
return this.converters;
|
||||
}
|
||||
|
||||
public getConverter(id: string): Converter | undefined {
|
||||
public getConverter(id: string): Converter {
|
||||
return this.converters.find((converter: Converter): boolean => converter.getId() === id);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
<div class="arrow_box">
|
||||
<select class="select" (change)="convert($event)">
|
||||
<option id="undefined">Select conversion ...</option>
|
||||
@for (c of converters; track c.getId()) {
|
||||
<option class="option" id="{{c.getId()}}">{{ c.getDisplayname() }}</option>
|
||||
}
|
||||
<option class="option" *ngFor="let c of converters" id="{{c.getId()}}">{{c.getDisplayname()}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ConverterSelectorComponent} from './converter-selector.component';
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
|
@ -17,7 +17,7 @@ class TestHostComponent {
|
|||
public step: Step = new Step(42);
|
||||
public textInputComponent: TextInputFieldComponent = new TextInputFieldComponent(inputComponentManagerServiceStub);
|
||||
@ViewChild(ConverterSelectorComponent)
|
||||
public sutComponent!: ConverterSelectorComponent;
|
||||
public sutComponent: ConverterSelectorComponent;
|
||||
}
|
||||
|
||||
const inputComponentManagerServiceStub = createSpyObj(['getNext']);
|
||||
|
@ -39,10 +39,10 @@ describe('ConverterSelectorComponent', () => {
|
|||
converterRegistryServiceStub.getAllConverters.and.returnValue([converter1, converter2, converter3]);
|
||||
converterRegistryServiceStub.getConverter.and.returnValue(undefined);
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ConverterSelectorComponent],
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
ConverterSelectorComponent,
|
||||
TestHostComponent
|
||||
],
|
||||
providers: [
|
||||
|
@ -51,7 +51,7 @@ describe('ConverterSelectorComponent', () => {
|
|||
]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
testHostFixture = TestBed.createComponent(TestHostComponent);
|
||||
|
@ -59,7 +59,7 @@ describe('ConverterSelectorComponent', () => {
|
|||
testHostFixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create the component', () => {
|
||||
it('should create', () => {
|
||||
expect(testHostComponent.sutComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
|
|
|
@ -3,20 +3,17 @@ import {Step} from '../step';
|
|||
import {Converter} from '../converter/converter';
|
||||
import {ConverterRegistryService} from '../converter-registry.service';
|
||||
import {TextInputFieldComponent} from '../text-input-field/text-input-field.component';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-converter-selector',
|
||||
templateUrl: './converter-selector.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./converter-selector.component.scss'],
|
||||
imports: [CommonModule]
|
||||
styleUrls: ['./converter-selector.component.scss']
|
||||
})
|
||||
export class ConverterSelectorComponent implements OnInit {
|
||||
@Input()
|
||||
public step!: Step;
|
||||
public step: Step;
|
||||
@Input()
|
||||
textInput!: TextInputFieldComponent;
|
||||
private textInput: TextInputFieldComponent;
|
||||
public converters: Converter[] = [];
|
||||
|
||||
constructor(private converterRegistryService: ConverterRegistryService) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {PunycodeDecoder} from './punycode-decoder';
|
||||
import {NativeLibraryWrapperService, Punycode} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
||||
|
@ -9,8 +9,8 @@ describe('PunycodeDecoder', () => {
|
|||
let decodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {punycode: createSpyObj<Punycode>(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.punycode!.decode as Spy;
|
||||
nativeWrapperSpy = {punycode: createSpyObj(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.punycode.decode as Spy;
|
||||
sut = new PunycodeDecoder((nativeWrapperSpy as NativeLibraryWrapperService));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService, Punycode} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {PunycodeEncoder} from './punycode-encoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('PunycodeEncoder', () => {
|
|||
let encodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {punycode: createSpyObj<Punycode>(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.punycode!.encode as Spy;
|
||||
nativeWrapperSpy = {punycode: createSpyObj(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.punycode.encode as Spy;
|
||||
sut = new PunycodeEncoder(nativeWrapperSpy as NativeLibraryWrapperService);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService, QuotedPrintable} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {QuotedPrintableDecoder} from './quoted-printable-decoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('QuotedPrintableDecoder', () => {
|
|||
let decodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj<QuotedPrintable>(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.quotedPrintable!.decode as Spy;
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.quotedPrintable.decode as Spy;
|
||||
sut = new QuotedPrintableDecoder((nativeWrapperSpy as NativeLibraryWrapperService));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService, QuotedPrintable} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {QuotedPrintableEncoder} from './quoted-printable-encoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('QuotedPrintableEncoder', () => {
|
|||
let encodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj<QuotedPrintable>(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.quotedPrintable!.encode as Spy;
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.quotedPrintable.encode as Spy;
|
||||
sut = new QuotedPrintableEncoder(nativeWrapperSpy as NativeLibraryWrapperService);
|
||||
});
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ export class ROT13Converter implements Converter {
|
|||
try {
|
||||
const inChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
const outChars = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm';
|
||||
const translate = (c: string) => {
|
||||
const translate = c => {
|
||||
const charIndex = inChars.indexOf(c);
|
||||
return charIndex > -1 ? outChars[charIndex] : c;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService, Utf8} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {UTF8Decoder} from './utf8-decoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('UTF8Decoder', () => {
|
|||
let decodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {utf8: createSpyObj<Utf8>(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.utf8!.decode as Spy;
|
||||
nativeWrapperSpy = {utf8: createSpyObj(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.utf8.decode as Spy;
|
||||
sut = new UTF8Decoder((nativeWrapperSpy as NativeLibraryWrapperService));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService, Utf8} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {UTF8Encoder} from './utf8-encoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('UTF8Encoder', () => {
|
|||
let encodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {utf8: createSpyObj<Utf8>(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.utf8!.encode as Spy;
|
||||
nativeWrapperSpy = {utf8: createSpyObj(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.utf8.encode as Spy;
|
||||
sut = new UTF8Encoder(nativeWrapperSpy as NativeLibraryWrapperService);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
@if (step.error) {
|
||||
<div class="errormessage" [innerHTML]="step.message"></div>
|
||||
}
|
||||
<div class="errormessage" *ngIf="step.error" [innerHTML]="step.message"></div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ErrorMessageComponent} from './error-message.component';
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
|
@ -10,20 +10,22 @@ import {Step} from '../step';
|
|||
class TestHostComponent {
|
||||
public step: Step = new Step(42);
|
||||
@ViewChild(ErrorMessageComponent)
|
||||
public sutComponent!: ErrorMessageComponent;
|
||||
public sutComponent: ErrorMessageComponent;
|
||||
}
|
||||
|
||||
describe('ErrorMessageComponent', () => {
|
||||
let testHostComponent: TestHostComponent;
|
||||
let testHostFixture: ComponentFixture<TestHostComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ErrorMessageComponent],
|
||||
declarations: [TestHostComponent]
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
ErrorMessageComponent,
|
||||
TestHostComponent
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
testHostFixture = TestBed.createComponent(TestHostComponent);
|
||||
|
|
|
@ -4,12 +4,11 @@ import {Step} from '../step';
|
|||
@Component({
|
||||
selector: 'app-error-message',
|
||||
templateUrl: './error-message.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./error-message.component.scss']
|
||||
})
|
||||
export class ErrorMessageComponent {
|
||||
@Input()
|
||||
public step!: Step;
|
||||
public step: Step;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ describe('InputComponentManagerService', () => {
|
|||
);
|
||||
|
||||
it('must not add a null Step', inject([InputComponentManagerService], (service: InputComponentManagerService) => {
|
||||
expect(() => service.register(null!)).toThrowError();
|
||||
expect(() => service.register(null)).toThrowError();
|
||||
expect(service.getAllComponents().length).toEqual(0);
|
||||
}));
|
||||
|
||||
it('must not add an undefined Step', inject([InputComponentManagerService], (service: InputComponentManagerService) => {
|
||||
expect(() => service.register(undefined!)).toThrowError();
|
||||
expect(() => service.register(undefined)).toThrowError();
|
||||
expect(service.getAllComponents().length).toEqual(0);
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import * as NativePunycode from 'punycode/';
|
||||
import * as NativePunycode from 'punycode';
|
||||
import * as NativeQuotedPrintable from 'quoted-printable';
|
||||
import * as NativeUtf8 from 'utf8';
|
||||
|
||||
|
@ -18,19 +18,19 @@ export class NativeLibraryWrapperService {
|
|||
}
|
||||
}
|
||||
|
||||
export interface Punycode {
|
||||
interface Punycode {
|
||||
encode(input: string): string;
|
||||
|
||||
decode(input: string): string;
|
||||
}
|
||||
|
||||
export interface QuotedPrintable {
|
||||
interface QuotedPrintable {
|
||||
encode(input: string): string;
|
||||
|
||||
decode(input: string): string;
|
||||
}
|
||||
|
||||
export interface Utf8 {
|
||||
interface Utf8 {
|
||||
encode(input: any): string;
|
||||
|
||||
decode(input: string): any;
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Converter} from './converter/converter';
|
|||
|
||||
export class Step {
|
||||
public content = '';
|
||||
public selectedConverter: Converter | undefined;
|
||||
public selectedConverter: Converter = undefined;
|
||||
public index: number;
|
||||
public error = false;
|
||||
public message = '';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {TextInputFieldComponent} from './text-input-field.component';
|
||||
import {Step} from '../step';
|
||||
|
@ -13,7 +13,7 @@ import createSpyObj = jasmine.createSpyObj;
|
|||
class TestHostComponent {
|
||||
public step: Step = new Step(42);
|
||||
@ViewChild(TextInputFieldComponent)
|
||||
public sutComponent!: TextInputFieldComponent;
|
||||
public sutComponent: TextInputFieldComponent;
|
||||
}
|
||||
|
||||
describe('TextInputFieldComponent', () => {
|
||||
|
@ -23,16 +23,17 @@ describe('TextInputFieldComponent', () => {
|
|||
const inputComponentManagerServiceStub = createSpyObj(['getNext']);
|
||||
inputComponentManagerServiceStub.getNext.and.returnValue(undefined);
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
TestHostComponent
|
||||
TestHostComponent,
|
||||
TextInputFieldComponent
|
||||
],
|
||||
imports: [TextInputFieldComponent, FormsModule],
|
||||
imports: [FormsModule],
|
||||
providers: [{provide: InputComponentManagerService, useValue: inputComponentManagerServiceStub}]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
testHostFixture = TestBed.createComponent(TestHostComponent);
|
||||
|
@ -40,7 +41,7 @@ describe('TextInputFieldComponent', () => {
|
|||
testHostFixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create the component', () => {
|
||||
it('should create', () => {
|
||||
expect(testHostComponent.sutComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
|
|
|
@ -2,35 +2,32 @@ import {Component, Input} from '@angular/core';
|
|||
import {Step} from '../step';
|
||||
import {Converter} from '../converter/converter';
|
||||
import {InputComponentManagerService} from '../input-component-manager.service';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-text-input-field',
|
||||
templateUrl: './text-input-field.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./text-input-field.component.scss'],
|
||||
imports: [FormsModule]
|
||||
styleUrls: ['./text-input-field.component.scss']
|
||||
})
|
||||
export class TextInputFieldComponent {
|
||||
@Input()
|
||||
public step!: Step;
|
||||
public step: Step;
|
||||
|
||||
constructor(private inputComponentManagerService: InputComponentManagerService) {
|
||||
}
|
||||
|
||||
update(step: Step): void {
|
||||
const converter: Converter | undefined = step.selectedConverter;
|
||||
const converter: Converter = step.selectedConverter;
|
||||
|
||||
if (converter !== undefined) {
|
||||
const content: string = step.content;
|
||||
let result: string | null;
|
||||
let result: string;
|
||||
try {
|
||||
result = converter.convert(content);
|
||||
} catch (error) {
|
||||
if (typeof console === 'object' && typeof console.log === 'function') {
|
||||
console.log(error);
|
||||
}
|
||||
step.message = (error as Error).message;
|
||||
step.message = error.message;
|
||||
step.error = true;
|
||||
result = null;
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {VersionComponent} from './version.component';
|
||||
import packageInfo from '../../../package.json';
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
describe('VersionComponent', () => {
|
||||
let component: VersionComponent;
|
||||
let fixture: ComponentFixture<VersionComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [VersionComponent]
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [VersionComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(VersionComponent);
|
||||
|
@ -20,13 +20,13 @@ describe('VersionComponent', () => {
|
|||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create the component', () => {
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should contain the correct version', () => {
|
||||
// when executing the test, we're always running with the dev environment
|
||||
expect(component.VERSION).toEqual(`${packageInfo.version} (development build)`);
|
||||
expect(component.VERSION).toEqual(`${environment.appVersion} (development build)`);
|
||||
});
|
||||
|
||||
it('should have the correct value for the "production" property', () => {
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
import {Component, isDevMode} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import packageInfo from '../../../package.json';
|
||||
import {Component} from '@angular/core';
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-version',
|
||||
templateUrl: './version.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./version.component.scss'],
|
||||
imports: [CommonModule]
|
||||
styleUrls: ['./version.component.scss']
|
||||
})
|
||||
export class VersionComponent {
|
||||
public readonly PROD: boolean = !isDevMode();
|
||||
public readonly VERSION: string = packageInfo.version + (this.PROD ? '' : ' (development build)');
|
||||
public readonly PROD: boolean = environment.production;
|
||||
public readonly VERSION: string = environment.appVersion + (this.PROD ? '' : ' (development build)');
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
|
11
src/browserslist
Normal file
11
src/browserslist
Normal file
|
@ -0,0 +1,11 @@
|
|||
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
#
|
||||
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
not IE 9-11
|
4
src/environments/environment.prod.ts
Normal file
4
src/environments/environment.prod.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
appVersion: require('../../package.json').version
|
||||
};
|
16
src/environments/environment.ts
Normal file
16
src/environments/environment.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
appVersion: require('../../package.json').version
|
||||
};
|
||||
|
||||
/*
|
||||
* In development mode, for easier debugging, you can ignore zone related error
|
||||
* stack frames such as `zone.run`/`zoneDelegate.invokeTask` by importing the
|
||||
* below file. Don't forget to comment it out in production mode
|
||||
* because it will have a performance impact when errors are thrown
|
||||
*/
|
||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
40
src/karma.conf.js
Normal file
40
src/karma.conf.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine'),
|
||||
require('karma-nightmare'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, '../coverage'),
|
||||
reports: ['html', 'lcovonly'],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['ChromeHeadless'],
|
||||
customLaunchers: {
|
||||
ChromeHeadlessNoSandbox: {
|
||||
base: 'ChromeHeadless',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
singleRun: false
|
||||
});
|
||||
};
|
16
src/main.ts
16
src/main.ts
|
@ -1,6 +1,12 @@
|
|||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { appConfig } from './app/app.config';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
bootstrapApplication(AppComponent, appConfig)
|
||||
.catch((err) => console.error(err));
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.log(err));
|
||||
|
|
76
src/polyfills.ts
Normal file
76
src/polyfills.ts
Normal file
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/weak-map';
|
||||
// import 'core-js/es6/set';
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
import 'core-js/es6/reflect';
|
||||
/** Evergreen browsers require these. **/
|
||||
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||
import 'core-js/es7/reflect';
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/**
|
||||
* Web Animations `@angular/platform-browser/animations`
|
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
||||
**/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
*/
|
||||
|
||||
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
|
||||
/*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*/
|
||||
// (window as any).__Zone_enable_cross_context_check = true;
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
20
src/test.ts
Normal file
20
src/test.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: any;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
13
src/tsconfig.app.json
Normal file
13
src/tsconfig.app.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
18
src/tsconfig.spec.json
Normal file
18
src/tsconfig.spec.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts",
|
||||
"polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
17
src/tslint.json
Normal file
17
src/tslint.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"app",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"app",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
|
@ -1,35 +1,21 @@
|
|||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"experimentalDecorators": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"useDefineForClassFields": false,
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"dom"
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
130
tslint.json
Normal file
130
tslint.json
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"arrow-return-shorthand": true,
|
||||
"callable-types": true,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"deprecation": {
|
||||
"severity": "warn"
|
||||
},
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-over-type-literal": true,
|
||||
"label-position": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-super": true,
|
||||
"no-empty": false,
|
||||
"no-empty-interface": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-misused-new": true,
|
||||
"no-non-null-assertion": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unnecessary-initializer": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"prefer-const": true,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"unified-signatures": true,
|
||||
"variable-name": false,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"no-output-on-prefix": true,
|
||||
"use-input-property-decorator": true,
|
||||
"use-output-property-decorator": true,
|
||||
"use-host-property-decorator": true,
|
||||
"no-input-rename": true,
|
||||
"no-output-rename": true,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"component-class-suffix": true,
|
||||
"directive-class-suffix": true
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue