Compare commits

..

6 commits

52 changed files with 11817 additions and 11530 deletions

View file

@ -1,6 +1,10 @@
pipeline: kind: pipeline
build: type: docker
image: fritteli/headless-nodejs:1.1.0 name: default
steps:
- name: install
image: node:20-alpine
commands: commands:
- npm install - npm install
- npm run test:ci - npm run test:ci

View file

@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org # Editor configuration, see https://editorconfig.org
root = true root = true
[*] [*]
@ -8,6 +8,9 @@ indent_size = 2
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md] [*.md]
max_line_length = off max_line_length = off
trim_trailing_whitespace = false trim_trailing_whitespace = false

28
.gitignore vendored
View file

@ -1,44 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files. # See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output # Compiled output
/dist /dist
/tmp /tmp
/out-tsc /out-tsc
/bazel-out
# dependencies # Node
/node_modules /node_modules
npm-debug.log
yarn-error.log
# IDEs and editors # IDEs and editors
/.idea .idea/
.project .project
.classpath .classpath
.c9/ .c9/
*.launch *.launch
.settings/ .settings/
*.sublime-workspace *.sublime-workspace
*.iml
# IDE - VSCode # Visual Studio Code
.vscode/* .vscode/tasks.json
!.vscode/settings.json !.vscode/settings.json
!.vscode/tasks.json !.vscode/tasks.json
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json
.history/*
# misc # Miscellaneous
/.sass-cache /.angular/cache
.sass-cache/
/connect.lock /connect.lock
/coverage /coverage
/libpeerconnection.log /libpeerconnection.log
npm-debug.log
testem.log testem.log
/typings /typings
# e2e # System files
# /e2e/*.js
/e2e/*.map
# System Files
.DS_Store .DS_Store
Thumbs.db Thumbs.db
*~

View file

@ -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/. This is a short introduction to the awesome Convertorizr hosted at https://conv.friedli.info/.
@ -11,11 +11,11 @@ Cheers!
# Technical stuff # Technical stuff
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.1.5. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.1.0.
## Development server ## Development server
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. 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.
## Code scaffolding ## Code scaffolding
@ -23,7 +23,7 @@ Run `ng generate component component-name` to generate a new component. You can
## Build ## Build
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. Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests ## 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 ## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 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.
## Further help ## Further help
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). 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.

View file

@ -3,25 +3,28 @@
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
"converter": { "convertorizr": {
"root": "",
"sourceRoot": "src",
"projectType": "application", "projectType": "application",
"prefix": "app",
"schematics": { "schematics": {
"@schematics/angular:component": { "@schematics/angular:component": {
"styleext": "scss" "style": "scss"
} }
}, },
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:application",
"options": { "options": {
"outputPath": "dist/converter", "outputPath": "dist/convertorizr",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "browser": "src/main.ts",
"polyfills": "src/polyfills.ts", "polyfills": [
"tsConfig": "src/tsconfig.app.json", "zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [ "assets": [
"src/favicon.ico", "src/favicon.ico",
"src/assets" "src/assets"
@ -33,99 +36,66 @@
}, },
"configurations": { "configurations": {
"production": { "production": {
"fileReplacements": [ "budgets": [
{ {
"replace": "src/environments/environment.ts", "type": "initial",
"with": "src/environments/environment.prod.ts" "maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
} }
], ],
"optimization": true, "outputHashing": "all"
"outputHashing": "all", },
"sourceMap": false, "development": {
"extractCss": true, "optimization": false,
"namedChunks": false, "extractLicenses": false,
"aot": true, "sourceMap": true
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
} }
} },
"defaultConfiguration": "production"
}, },
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "converter:build"
},
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "converter:build:production" "buildTarget": "convertorizr:build:production"
},
"development": {
"buildTarget": "convertorizr:build:development"
} }
} },
"defaultConfiguration": "development"
}, },
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"browserTarget": "converter:build" "buildTarget": "convertorizr:build"
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
"main": "src/test.ts", "polyfills": [
"polyfills": "src/polyfills.ts", "zone.js",
"tsConfig": "src/tsconfig.spec.json", "zone.js/testing"
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
], ],
"scripts": [], "tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [ "assets": [
"src/favicon.ico", "src/favicon.ico",
"src/assets" "src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
], ],
"exclude": [ "styles": [
"**/node_modules/**" "src/styles.scss"
] ],
} "scripts": []
}
}
},
"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"
} }

View file

@ -1,31 +0,0 @@
// 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 } }));
}
};

View file

@ -1,41 +0,0 @@
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?');
});
});
});

View file

@ -1,53 +0,0 @@
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();
}
}

View file

@ -1,13 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

22279
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "convertorizr", "name": "convertorizr",
"version": "1.3.1-1", "version": "2.0.0-dev.1",
"description": "Decode or encode base64, punycode, HTML entities, URI components, ...", "description": "Decode or encode base64, punycode, HTML entities, URI components, ...",
"keywords": [ "keywords": [
"encode", "encode",
@ -14,7 +14,7 @@
"email": "manuel@fritteli.ch" "email": "manuel@fritteli.ch"
}, },
"license": "MIT", "license": "MIT",
"homepage": "https://manuel.pages.gittr.ch/dencode.org", "homepage": "https://conv.friedli.info/",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://gittr.ch/manuel/converter.git" "url": "https://gittr.ch/manuel/converter.git"
@ -22,50 +22,43 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build --delete-output-path", "build": "ng build",
"build-prod": "ng build --prod --optimization --aot --delete-output-path --build-optimizer", "watch": "ng build --watch --configuration development",
"test": "ng test --code-coverage", "test": "ng test",
"test:ci": "ng test --browsers ChromeHeadlessNoSandbox --watch=false --code-coverage", "test:ci": "ng test --no-watch --no-progress --browsers=ChromiumHeadless"
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "npm rebuild node-sass"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/common": "6.1.7", "@angular/animations": "^17.1.0",
"@angular/compiler": "6.1.7", "@angular/common": "^17.1.0",
"@angular/core": "6.1.7", "@angular/compiler": "^17.1.0",
"@angular/forms": "6.1.7", "@angular/core": "^17.1.0",
"@angular/platform-browser": "6.1.7", "@angular/forms": "^17.1.0",
"@angular/platform-browser-dynamic": "6.1.7", "@angular/platform-browser": "^17.1.0",
"@angular/router": "6.1.7", "@angular/platform-browser-dynamic": "^17.1.0",
"core-js": "^2.5.1", "@angular/router": "^17.1.0",
"punycode": "^2.1.0", "punycode": "^2.3.1",
"quoted-printable": "^1.0.0", "quoted-printable": "^1.0.1",
"rxjs": "^6.3.2", "rxjs": "~7.8.0",
"utf8": "^2.1.0", "tslib": "^2.3.0",
"zone.js": "^0.8.26" "utf8": "^3.0.0",
"zone.js": "~0.14.3"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.7.0", "@angular-devkit/build-angular": "^17.1.0",
"@angular/cli": "6.1.5", "@angular/cli": "^17.1.0",
"@angular/compiler-cli": "6.1.7", "@angular/compiler-cli": "^17.1.0",
"@types/jasmine": "~2.8.6", "@types/jasmine": "~5.1.0",
"@types/jasminewd2": "~2.0.3", "@types/node": "^20.11.5",
"@types/node": "~8.9.4", "@types/punycode": "^2.1.3",
"codelyzer": "~4.2.1", "@types/quoted-printable": "^1.0.2",
"jasmine-core": "~2.99.1", "@types/utf8": "^3.0.3",
"jasmine-spec-reporter": "~4.2.1", "jasmine-core": "~5.1.0",
"karma": "~1.7.1", "karma": "~6.4.0",
"karma-chrome-launcher": "~2.2.0", "karma-chrome-launcher": "~3.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "~1.1.1", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^0.2.2", "karma-jasmine-html-reporter": "~2.1.0",
"karma-nightmare": "~0.4.15", "typescript": "~5.3.2"
"protractor": "~5.4.0",
"puppeteer": "~1.7.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "2.9.2"
} }
} }

View file

@ -1,7 +1,9 @@
<div *ngFor="let step of steps" class="inputwrapper"> @for (step of steps; track step.index) {
<app-text-input-field [step]="step" #ti></app-text-input-field> <div class="inputwrapper">
<app-converter-selector [step]="step" [textInput]="ti"></app-converter-selector> <app-text-input-field [step]="step" #ti></app-text-input-field>
<app-error-message [step]="step"></app-error-message> <app-converter-selector [step]="step" [textInput]="ti"></app-converter-selector>
</div> <app-error-message [step]="step"></app-error-message>
</div>
}
<app-version></app-version> <app-version></app-version>
<!--<router-outlet></router-outlet>--> <!--<router-outlet></router-outlet>-->

View file

@ -1,39 +1,26 @@
import {AppComponent} from './app.component'; import {AppComponent} from './app.component';
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {ComponentFixture, TestBed} from '@angular/core/testing';
import {FormsModule} from '@angular/forms';
import {Step} from './step'; 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', () => { describe('AppComponent', () => {
let sut: AppComponent; let sut: AppComponent;
let fixture: ComponentFixture<AppComponent>; let fixture: ComponentFixture<AppComponent>;
const firstStep: Step = new Step(0); const firstStep: Step = new Step(0);
beforeEach(async(() => { beforeEach(async () => {
TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [ imports: [AppComponent]
AppComponent,
ConverterSelectorComponent,
ErrorMessageComponent,
TextInputFieldComponent,
VersionComponent
],
imports: [FormsModule]
}) })
.compileComponents(); .compileComponents();
})); });
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(AppComponent); fixture = TestBed.createComponent(AppComponent);
sut = fixture.componentInstance; sut = fixture.componentInstance;
}); });
it('should create the app', async(() => { it('should create the app', () => {
// const fixture = TestBed.createComponent(AppComponent); // const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; expect(sut).toBeTruthy();
expect(app).toBeTruthy(); });
}));
}); });

View file

@ -1,11 +1,24 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {InputComponentManagerService} from './input-component-manager.service'; import {InputComponentManagerService} from './input-component-manager.service';
import {Step} from './step'; 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({ @Component({
selector: 'app-root', selector: 'app-root',
standalone: true,
imports: [
ConverterSelectorComponent,
ErrorMessageComponent,
RouterOutlet,
TextInputFieldComponent,
VersionComponent
],
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'] styleUrl: './app.component.scss'
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
public steps: Step[] = []; public steps: Step[] = [];

8
src/app/app.config.ts Normal file
View file

@ -0,0 +1,8 @@
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [provideRouter(routes)]
};

View file

@ -12,11 +12,11 @@ import { ErrorMessageComponent } from './error-message/error-message.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, // AppComponent,
VersionComponent, // VersionComponent,
TextInputFieldComponent, // TextInputFieldComponent,
ConverterSelectorComponent, // ConverterSelectorComponent,
ErrorMessageComponent // ErrorMessageComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -27,7 +27,7 @@ import { ErrorMessageComponent } from './error-message/error-message.component';
InputComponentManagerService, InputComponentManagerService,
NativeLibraryWrapperService NativeLibraryWrapperService
], ],
bootstrap: [AppComponent] // bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {
} }

3
src/app/app.routes.ts Normal file
View file

@ -0,0 +1,3 @@
import { Routes } from '@angular/router';
export const routes: Routes = [];

View file

@ -35,7 +35,7 @@ export class ConverterRegistryService {
return this.converters; return this.converters;
} }
public getConverter(id: string): Converter { public getConverter(id: string): Converter | undefined {
return this.converters.find((converter: Converter): boolean => converter.getId() === id); return this.converters.find((converter: Converter): boolean => converter.getId() === id);
} }

View file

@ -2,8 +2,9 @@
<div class="arrow_box"> <div class="arrow_box">
<select class="select" (change)="convert($event)"> <select class="select" (change)="convert($event)">
<option id="undefined">Select conversion ...</option> <option id="undefined">Select conversion ...</option>
<option class="option" *ngFor="let c of converters" id="{{c.getId()}}">{{c.getDisplayname()}} @for (c of converters; track c.getId()) {
</option> <option class="option" id="{{c.getId()}}">{{ c.getDisplayname() }}</option>
}
</select> </select>
</div> </div>
</div> </div>

View file

@ -1,4 +1,4 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {ComponentFixture, TestBed} from '@angular/core/testing';
import {ConverterSelectorComponent} from './converter-selector.component'; import {ConverterSelectorComponent} from './converter-selector.component';
import {Component, ViewChild} from '@angular/core'; import {Component, ViewChild} from '@angular/core';
@ -17,7 +17,7 @@ class TestHostComponent {
public step: Step = new Step(42); public step: Step = new Step(42);
public textInputComponent: TextInputFieldComponent = new TextInputFieldComponent(inputComponentManagerServiceStub); public textInputComponent: TextInputFieldComponent = new TextInputFieldComponent(inputComponentManagerServiceStub);
@ViewChild(ConverterSelectorComponent) @ViewChild(ConverterSelectorComponent)
public sutComponent: ConverterSelectorComponent; public sutComponent!: ConverterSelectorComponent;
} }
const inputComponentManagerServiceStub = createSpyObj(['getNext']); const inputComponentManagerServiceStub = createSpyObj(['getNext']);
@ -39,10 +39,10 @@ describe('ConverterSelectorComponent', () => {
converterRegistryServiceStub.getAllConverters.and.returnValue([converter1, converter2, converter3]); converterRegistryServiceStub.getAllConverters.and.returnValue([converter1, converter2, converter3]);
converterRegistryServiceStub.getConverter.and.returnValue(undefined); converterRegistryServiceStub.getConverter.and.returnValue(undefined);
beforeEach(async(() => { beforeEach(async () => {
TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [ConverterSelectorComponent],
declarations: [ declarations: [
ConverterSelectorComponent,
TestHostComponent TestHostComponent
], ],
providers: [ providers: [
@ -51,7 +51,7 @@ describe('ConverterSelectorComponent', () => {
] ]
}) })
.compileComponents(); .compileComponents();
})); });
beforeEach(() => { beforeEach(() => {
testHostFixture = TestBed.createComponent(TestHostComponent); testHostFixture = TestBed.createComponent(TestHostComponent);
@ -59,7 +59,7 @@ describe('ConverterSelectorComponent', () => {
testHostFixture.detectChanges(); testHostFixture.detectChanges();
}); });
it('should create', () => { it('should create the component', () => {
expect(testHostComponent.sutComponent).toBeTruthy(); expect(testHostComponent.sutComponent).toBeTruthy();
}); });

View file

@ -3,17 +3,20 @@ import {Step} from '../step';
import {Converter} from '../converter/converter'; import {Converter} from '../converter/converter';
import {ConverterRegistryService} from '../converter-registry.service'; import {ConverterRegistryService} from '../converter-registry.service';
import {TextInputFieldComponent} from '../text-input-field/text-input-field.component'; import {TextInputFieldComponent} from '../text-input-field/text-input-field.component';
import {CommonModule} from '@angular/common';
@Component({ @Component({
selector: 'app-converter-selector', selector: 'app-converter-selector',
templateUrl: './converter-selector.component.html', templateUrl: './converter-selector.component.html',
styleUrls: ['./converter-selector.component.scss'] standalone: true,
styleUrls: ['./converter-selector.component.scss'],
imports: [CommonModule]
}) })
export class ConverterSelectorComponent implements OnInit { export class ConverterSelectorComponent implements OnInit {
@Input() @Input()
public step: Step; public step!: Step;
@Input() @Input()
private textInput: TextInputFieldComponent; textInput!: TextInputFieldComponent;
public converters: Converter[] = []; public converters: Converter[] = [];
constructor(private converterRegistryService: ConverterRegistryService) { constructor(private converterRegistryService: ConverterRegistryService) {

View file

@ -1,5 +1,5 @@
import {PunycodeDecoder} from './punycode-decoder'; import {PunycodeDecoder} from './punycode-decoder';
import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; import {NativeLibraryWrapperService, Punycode} from '../native-library-wrapper.service';
import createSpyObj = jasmine.createSpyObj; import createSpyObj = jasmine.createSpyObj;
import Spy = jasmine.Spy; import Spy = jasmine.Spy;
@ -9,8 +9,8 @@ describe('PunycodeDecoder', () => {
let decodeSpy: Spy; let decodeSpy: Spy;
beforeEach(() => { beforeEach(() => {
nativeWrapperSpy = {punycode: createSpyObj(['decode'])}; nativeWrapperSpy = {punycode: createSpyObj<Punycode>(['decode'])};
decodeSpy = nativeWrapperSpy.punycode.decode as Spy; decodeSpy = nativeWrapperSpy.punycode!.decode as Spy;
sut = new PunycodeDecoder((nativeWrapperSpy as NativeLibraryWrapperService)); sut = new PunycodeDecoder((nativeWrapperSpy as NativeLibraryWrapperService));
}); });

View file

@ -1,4 +1,4 @@
import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; import {NativeLibraryWrapperService, Punycode} from '../native-library-wrapper.service';
import {PunycodeEncoder} from './punycode-encoder'; import {PunycodeEncoder} from './punycode-encoder';
import createSpyObj = jasmine.createSpyObj; import createSpyObj = jasmine.createSpyObj;
import Spy = jasmine.Spy; import Spy = jasmine.Spy;
@ -9,8 +9,8 @@ describe('PunycodeEncoder', () => {
let encodeSpy: Spy; let encodeSpy: Spy;
beforeEach(() => { beforeEach(() => {
nativeWrapperSpy = {punycode: createSpyObj(['encode'])}; nativeWrapperSpy = {punycode: createSpyObj<Punycode>(['encode'])};
encodeSpy = nativeWrapperSpy.punycode.encode as Spy; encodeSpy = nativeWrapperSpy.punycode!.encode as Spy;
sut = new PunycodeEncoder(nativeWrapperSpy as NativeLibraryWrapperService); sut = new PunycodeEncoder(nativeWrapperSpy as NativeLibraryWrapperService);
}); });

View file

@ -1,4 +1,4 @@
import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; import {NativeLibraryWrapperService, QuotedPrintable} from '../native-library-wrapper.service';
import {QuotedPrintableDecoder} from './quoted-printable-decoder'; import {QuotedPrintableDecoder} from './quoted-printable-decoder';
import createSpyObj = jasmine.createSpyObj; import createSpyObj = jasmine.createSpyObj;
import Spy = jasmine.Spy; import Spy = jasmine.Spy;
@ -9,8 +9,8 @@ describe('QuotedPrintableDecoder', () => {
let decodeSpy: Spy; let decodeSpy: Spy;
beforeEach(() => { beforeEach(() => {
nativeWrapperSpy = {quotedPrintable: createSpyObj(['decode'])}; nativeWrapperSpy = {quotedPrintable: createSpyObj<QuotedPrintable>(['decode'])};
decodeSpy = nativeWrapperSpy.quotedPrintable.decode as Spy; decodeSpy = nativeWrapperSpy.quotedPrintable!.decode as Spy;
sut = new QuotedPrintableDecoder((nativeWrapperSpy as NativeLibraryWrapperService)); sut = new QuotedPrintableDecoder((nativeWrapperSpy as NativeLibraryWrapperService));
}); });

View file

@ -1,4 +1,4 @@
import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; import {NativeLibraryWrapperService, QuotedPrintable} from '../native-library-wrapper.service';
import {QuotedPrintableEncoder} from './quoted-printable-encoder'; import {QuotedPrintableEncoder} from './quoted-printable-encoder';
import createSpyObj = jasmine.createSpyObj; import createSpyObj = jasmine.createSpyObj;
import Spy = jasmine.Spy; import Spy = jasmine.Spy;
@ -9,8 +9,8 @@ describe('QuotedPrintableEncoder', () => {
let encodeSpy: Spy; let encodeSpy: Spy;
beforeEach(() => { beforeEach(() => {
nativeWrapperSpy = {quotedPrintable: createSpyObj(['encode'])}; nativeWrapperSpy = {quotedPrintable: createSpyObj<QuotedPrintable>(['encode'])};
encodeSpy = nativeWrapperSpy.quotedPrintable.encode as Spy; encodeSpy = nativeWrapperSpy.quotedPrintable!.encode as Spy;
sut = new QuotedPrintableEncoder(nativeWrapperSpy as NativeLibraryWrapperService); sut = new QuotedPrintableEncoder(nativeWrapperSpy as NativeLibraryWrapperService);
}); });

View file

@ -13,7 +13,7 @@ export class ROT13Converter implements Converter {
try { try {
const inChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; const inChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
const outChars = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'; const outChars = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm';
const translate = c => { const translate = (c: string) => {
const charIndex = inChars.indexOf(c); const charIndex = inChars.indexOf(c);
return charIndex > -1 ? outChars[charIndex] : c; return charIndex > -1 ? outChars[charIndex] : c;
}; };

View file

@ -1,4 +1,4 @@
import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; import {NativeLibraryWrapperService, Utf8} from '../native-library-wrapper.service';
import {UTF8Decoder} from './utf8-decoder'; import {UTF8Decoder} from './utf8-decoder';
import createSpyObj = jasmine.createSpyObj; import createSpyObj = jasmine.createSpyObj;
import Spy = jasmine.Spy; import Spy = jasmine.Spy;
@ -9,8 +9,8 @@ describe('UTF8Decoder', () => {
let decodeSpy: Spy; let decodeSpy: Spy;
beforeEach(() => { beforeEach(() => {
nativeWrapperSpy = {utf8: createSpyObj(['decode'])}; nativeWrapperSpy = {utf8: createSpyObj<Utf8>(['decode'])};
decodeSpy = nativeWrapperSpy.utf8.decode as Spy; decodeSpy = nativeWrapperSpy.utf8!.decode as Spy;
sut = new UTF8Decoder((nativeWrapperSpy as NativeLibraryWrapperService)); sut = new UTF8Decoder((nativeWrapperSpy as NativeLibraryWrapperService));
}); });

View file

@ -1,4 +1,4 @@
import {NativeLibraryWrapperService} from '../native-library-wrapper.service'; import {NativeLibraryWrapperService, Utf8} from '../native-library-wrapper.service';
import {UTF8Encoder} from './utf8-encoder'; import {UTF8Encoder} from './utf8-encoder';
import createSpyObj = jasmine.createSpyObj; import createSpyObj = jasmine.createSpyObj;
import Spy = jasmine.Spy; import Spy = jasmine.Spy;
@ -9,8 +9,8 @@ describe('UTF8Encoder', () => {
let encodeSpy: Spy; let encodeSpy: Spy;
beforeEach(() => { beforeEach(() => {
nativeWrapperSpy = {utf8: createSpyObj(['encode'])}; nativeWrapperSpy = {utf8: createSpyObj<Utf8>(['encode'])};
encodeSpy = nativeWrapperSpy.utf8.encode as Spy; encodeSpy = nativeWrapperSpy.utf8!.encode as Spy;
sut = new UTF8Encoder(nativeWrapperSpy as NativeLibraryWrapperService); sut = new UTF8Encoder(nativeWrapperSpy as NativeLibraryWrapperService);
}); });

View file

@ -1 +1,3 @@
<div class="errormessage" *ngIf="step.error" [innerHTML]="step.message"></div> @if (step.error) {
<div class="errormessage" [innerHTML]="step.message"></div>
}

View file

@ -1,4 +1,4 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {ComponentFixture, TestBed} from '@angular/core/testing';
import {ErrorMessageComponent} from './error-message.component'; import {ErrorMessageComponent} from './error-message.component';
import {Component, ViewChild} from '@angular/core'; import {Component, ViewChild} from '@angular/core';
@ -10,22 +10,20 @@ import {Step} from '../step';
class TestHostComponent { class TestHostComponent {
public step: Step = new Step(42); public step: Step = new Step(42);
@ViewChild(ErrorMessageComponent) @ViewChild(ErrorMessageComponent)
public sutComponent: ErrorMessageComponent; public sutComponent!: ErrorMessageComponent;
} }
describe('ErrorMessageComponent', () => { describe('ErrorMessageComponent', () => {
let testHostComponent: TestHostComponent; let testHostComponent: TestHostComponent;
let testHostFixture: ComponentFixture<TestHostComponent>; let testHostFixture: ComponentFixture<TestHostComponent>;
beforeEach(async(() => { beforeEach(async () => {
TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [ imports: [ErrorMessageComponent],
ErrorMessageComponent, declarations: [TestHostComponent]
TestHostComponent
]
}) })
.compileComponents(); .compileComponents();
})); });
beforeEach(() => { beforeEach(() => {
testHostFixture = TestBed.createComponent(TestHostComponent); testHostFixture = TestBed.createComponent(TestHostComponent);

View file

@ -2,13 +2,14 @@ import {Component, Input} from '@angular/core';
import {Step} from '../step'; import {Step} from '../step';
@Component({ @Component({
selector: 'app-error-message', selector: 'app-error-message',
templateUrl: './error-message.component.html', templateUrl: './error-message.component.html',
styleUrls: ['./error-message.component.scss'] standalone: true,
styleUrls: ['./error-message.component.scss']
}) })
export class ErrorMessageComponent { export class ErrorMessageComponent {
@Input() @Input()
public step: Step; public step!: Step;
constructor() { constructor() {
} }

View file

@ -24,12 +24,12 @@ describe('InputComponentManagerService', () => {
); );
it('must not add a null Step', inject([InputComponentManagerService], (service: 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); expect(service.getAllComponents().length).toEqual(0);
})); }));
it('must not add an undefined Step', inject([InputComponentManagerService], (service: InputComponentManagerService) => { 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); expect(service.getAllComponents().length).toEqual(0);
})); }));

View file

@ -1,5 +1,5 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import * as NativePunycode from 'punycode'; import * as NativePunycode from 'punycode/';
import * as NativeQuotedPrintable from 'quoted-printable'; import * as NativeQuotedPrintable from 'quoted-printable';
import * as NativeUtf8 from 'utf8'; import * as NativeUtf8 from 'utf8';
@ -18,19 +18,19 @@ export class NativeLibraryWrapperService {
} }
} }
interface Punycode { export interface Punycode {
encode(input: string): string; encode(input: string): string;
decode(input: string): string; decode(input: string): string;
} }
interface QuotedPrintable { export interface QuotedPrintable {
encode(input: string): string; encode(input: string): string;
decode(input: string): string; decode(input: string): string;
} }
interface Utf8 { export interface Utf8 {
encode(input: any): string; encode(input: any): string;
decode(input: string): any; decode(input: string): any;

View file

@ -2,7 +2,7 @@ import {Converter} from './converter/converter';
export class Step { export class Step {
public content = ''; public content = '';
public selectedConverter: Converter = undefined; public selectedConverter: Converter | undefined;
public index: number; public index: number;
public error = false; public error = false;
public message = ''; public message = '';

View file

@ -1,4 +1,4 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {ComponentFixture, TestBed} from '@angular/core/testing';
import {TextInputFieldComponent} from './text-input-field.component'; import {TextInputFieldComponent} from './text-input-field.component';
import {Step} from '../step'; import {Step} from '../step';
@ -13,7 +13,7 @@ import createSpyObj = jasmine.createSpyObj;
class TestHostComponent { class TestHostComponent {
public step: Step = new Step(42); public step: Step = new Step(42);
@ViewChild(TextInputFieldComponent) @ViewChild(TextInputFieldComponent)
public sutComponent: TextInputFieldComponent; public sutComponent!: TextInputFieldComponent;
} }
describe('TextInputFieldComponent', () => { describe('TextInputFieldComponent', () => {
@ -23,17 +23,16 @@ describe('TextInputFieldComponent', () => {
const inputComponentManagerServiceStub = createSpyObj(['getNext']); const inputComponentManagerServiceStub = createSpyObj(['getNext']);
inputComponentManagerServiceStub.getNext.and.returnValue(undefined); inputComponentManagerServiceStub.getNext.and.returnValue(undefined);
beforeEach(async(() => { beforeEach(async () => {
TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [ declarations: [
TestHostComponent, TestHostComponent
TextInputFieldComponent
], ],
imports: [FormsModule], imports: [TextInputFieldComponent, FormsModule],
providers: [{provide: InputComponentManagerService, useValue: inputComponentManagerServiceStub}] providers: [{provide: InputComponentManagerService, useValue: inputComponentManagerServiceStub}]
}) })
.compileComponents(); .compileComponents();
})); });
beforeEach(() => { beforeEach(() => {
testHostFixture = TestBed.createComponent(TestHostComponent); testHostFixture = TestBed.createComponent(TestHostComponent);
@ -41,7 +40,7 @@ describe('TextInputFieldComponent', () => {
testHostFixture.detectChanges(); testHostFixture.detectChanges();
}); });
it('should create', () => { it('should create the component', () => {
expect(testHostComponent.sutComponent).toBeTruthy(); expect(testHostComponent.sutComponent).toBeTruthy();
}); });

View file

@ -2,32 +2,35 @@ import {Component, Input} from '@angular/core';
import {Step} from '../step'; import {Step} from '../step';
import {Converter} from '../converter/converter'; import {Converter} from '../converter/converter';
import {InputComponentManagerService} from '../input-component-manager.service'; import {InputComponentManagerService} from '../input-component-manager.service';
import {FormsModule} from '@angular/forms';
@Component({ @Component({
selector: 'app-text-input-field', selector: 'app-text-input-field',
templateUrl: './text-input-field.component.html', templateUrl: './text-input-field.component.html',
styleUrls: ['./text-input-field.component.scss'] standalone: true,
styleUrls: ['./text-input-field.component.scss'],
imports: [FormsModule]
}) })
export class TextInputFieldComponent { export class TextInputFieldComponent {
@Input() @Input()
public step: Step; public step!: Step;
constructor(private inputComponentManagerService: InputComponentManagerService) { constructor(private inputComponentManagerService: InputComponentManagerService) {
} }
update(step: Step): void { update(step: Step): void {
const converter: Converter = step.selectedConverter; const converter: Converter | undefined = step.selectedConverter;
if (converter !== undefined) { if (converter !== undefined) {
const content: string = step.content; const content: string = step.content;
let result: string; let result: string | null;
try { try {
result = converter.convert(content); result = converter.convert(content);
} catch (error) { } catch (error) {
if (typeof console === 'object' && typeof console.log === 'function') { if (typeof console === 'object' && typeof console.log === 'function') {
console.log(error); console.log(error);
} }
step.message = error.message; step.message = (error as Error).message;
step.error = true; step.error = true;
result = null; result = null;
} }

View file

@ -1,18 +1,18 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {ComponentFixture, TestBed} from '@angular/core/testing';
import {VersionComponent} from './version.component'; import {VersionComponent} from './version.component';
import {environment} from '../../environments/environment'; import packageInfo from '../../../package.json';
describe('VersionComponent', () => { describe('VersionComponent', () => {
let component: VersionComponent; let component: VersionComponent;
let fixture: ComponentFixture<VersionComponent>; let fixture: ComponentFixture<VersionComponent>;
beforeEach(async(() => { beforeEach(async () => {
TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [VersionComponent] imports: [VersionComponent]
}) })
.compileComponents(); .compileComponents();
})); });
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(VersionComponent); fixture = TestBed.createComponent(VersionComponent);
@ -20,13 +20,13 @@ describe('VersionComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create the component', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
it('should contain the correct version', () => { it('should contain the correct version', () => {
// when executing the test, we're always running with the dev environment // when executing the test, we're always running with the dev environment
expect(component.VERSION).toEqual(`${environment.appVersion} (development build)`); expect(component.VERSION).toEqual(`${packageInfo.version} (development build)`);
}); });
it('should have the correct value for the "production" property', () => { it('should have the correct value for the "production" property', () => {

View file

@ -1,14 +1,17 @@
import {Component} from '@angular/core'; import {Component, isDevMode} from '@angular/core';
import {environment} from '../../environments/environment'; import {CommonModule} from '@angular/common';
import packageInfo from '../../../package.json';
@Component({ @Component({
selector: 'app-version', selector: 'app-version',
templateUrl: './version.component.html', templateUrl: './version.component.html',
styleUrls: ['./version.component.scss'] standalone: true,
styleUrls: ['./version.component.scss'],
imports: [CommonModule]
}) })
export class VersionComponent { export class VersionComponent {
public readonly PROD: boolean = environment.production; public readonly PROD: boolean = !isDevMode();
public readonly VERSION: string = environment.appVersion + (this.PROD ? '' : ' (development build)'); public readonly VERSION: string = packageInfo.version + (this.PROD ? '' : ' (development build)');
constructor() { constructor() {
} }

View file

@ -1,11 +0,0 @@
# 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

View file

@ -1,4 +0,0 @@
export const environment = {
production: true,
appVersion: require('../../package.json').version
};

View file

@ -1,16 +0,0 @@
// 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.

View file

@ -1,40 +0,0 @@
// 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
});
};

View file

@ -1,12 +1,6 @@
import { enableProdMode } from '@angular/core'; import { bootstrapApplication } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
import { AppModule } from './app/app.module'; bootstrapApplication(AppComponent, appConfig)
import { environment } from './environments/environment'; .catch((err) => console.error(err));
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));

View file

@ -1,76 +0,0 @@
/**
* 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
*/

View file

@ -1,20 +0,0 @@
// 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);

View file

@ -1,13 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": [
"node"
]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}

View file

@ -1,18 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View file

@ -1,17 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}

16
tsconfig.app.json Normal file
View file

@ -0,0 +1,16 @@
/* 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"
]
}

View file

@ -1,21 +1,35 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{ {
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"esModuleInterop": true,
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "es5", "moduleResolution": "node",
"typeRoots": [ "importHelpers": true,
"node_modules/@types" "target": "ES2022",
], "module": "ES2022",
"useDefineForClassFields": false,
"lib": [ "lib": [
"es2017", "ES2022",
"dom" "dom"
] ],
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
} }
} }

14
tsconfig.spec.json Normal file
View file

@ -0,0 +1,14 @@
/* 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"
]
}

View file

@ -1,130 +0,0 @@
{
"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
}
}