Skip to content

Commit

Permalink
feat(): added commitlint, husky and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
hiukky committed Nov 24, 2020
1 parent d422eec commit 3e7f5f7
Show file tree
Hide file tree
Showing 14 changed files with 9,672 additions and 92 deletions.
12 changes: 4 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true

[*.ts]
quote_type = single
insert_final_newline = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

{
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"arrowParens": "avoid"
}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ["@commitlint/config-conventional"] };
65 changes: 42 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,64 @@
{
"name": "enva",
"version": "0.0.0",
"author": {
"name": "Romullo",
"email": "[email protected]",
"url": "https://hiukky.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/hiukky/enva/issues"
},
"homepage": "https://github.com/hiukky/enva#readme",
"repository": {
"type": "git",
"url": "https://github.com/hiukky/enva"
},
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"e2e": "ng e2e",
"format": "prettier --write \"./src/**/*.{ts,js}\""
},
"private": true,
"dependencies": {
"@angular/animations": "~11.0.1",
"@angular/common": "~11.0.1",
"@angular/compiler": "~11.0.1",
"@angular/core": "~11.0.1",
"@angular/forms": "~11.0.1",
"@angular/platform-browser": "~11.0.1",
"@angular/platform-browser-dynamic": "~11.0.1",
"@angular/router": "~11.0.1",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
"@angular/animations": "~11.0.2",
"@angular/common": "~11.0.2",
"@angular/compiler": "~11.0.2",
"@angular/core": "~11.0.2",
"@angular/forms": "~11.0.2",
"@angular/platform-browser": "~11.0.2",
"@angular/platform-browser-dynamic": "~11.0.2",
"@angular/router": "~11.0.2",
"rxjs": "~6.6.3",
"tslib": "^2.0.3",
"zone.js": "~0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.2",
"@angular/cli": "~11.0.2",
"@angular/compiler-cli": "~11.0.1",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"@angular/compiler-cli": "~11.0.2",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@types/jasmine": "~3.6.2",
"@types/node": "^14.14.9",
"codelyzer": "^6.0.1",
"husky": "^4.3.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"jasmine-spec-reporter": "~6.0.0",
"karma": "~5.2.3",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"prettier": "^2.2.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
"ts-node": "~9.0.0",
"tslint": "~6.1.3",
"typescript": "~4.1.2"
}
}
42 changes: 21 additions & 21 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { TestBed } from '@angular/core/testing'
import { AppComponent } from './app.component'

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
});
declarations: [AppComponent],
}).compileComponents()
})

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
const fixture = TestBed.createComponent(AppComponent)
const app = fixture.componentInstance
expect(app).toBeTruthy()
})

it(`should have as title 'enva'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('enva');
});
const fixture = TestBed.createComponent(AppComponent)
const app = fixture.componentInstance
expect(app.title).toEqual('enva')
})

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('enva app is running!');
});
});
const fixture = TestBed.createComponent(AppComponent)
fixture.detectChanges()
const compiled = fixture.nativeElement
expect(compiled.querySelector('.content span').textContent).toContain(
'enva app is running!',
)
})
})
6 changes: 3 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component } from '@angular/core';
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'enva';
title = 'enva'
}
18 changes: 7 additions & 11 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'
import { NgModule } from '@angular/core'

import { AppComponent } from './app.component';
import { AppComponent } from './app.component'

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
declarations: [AppComponent],
imports: [BrowserModule],
providers: [],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
4 changes: 2 additions & 2 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const environment = {
production: true
};
production: true,
}
4 changes: 2 additions & 2 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// The list of file replacements can be found in `angular.json`.

export const environment = {
production: false
};
production: false,
}

/*
* For easier debugging in development mode, you can import the following file
Expand Down
15 changes: 8 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core'
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { AppModule } from './app/app.module'
import { environment } from './environments/environment'

if (environment.production) {
enableProdMode();
enableProdMode()
}

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch(err => console.error(err))
3 changes: 1 addition & 2 deletions src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.

import 'zone.js/dist/zone' // Included with Angular CLI.

/***************************************************************************************************
* APPLICATION IMPORTS
Expand Down
30 changes: 17 additions & 13 deletions src/test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
// 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 'zone.js/dist/zone-testing'
import { getTestBed } from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'

declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
context(
path: string,
deep?: boolean,
filter?: RegExp,
): {
keys(): string[]
<T>(id: string): T
}
}

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
platformBrowserDynamicTesting(),
)
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
const context = require.context('./', true, /\.spec\.ts$/)
// And load the modules.
context.keys().map(context);
context.keys().map(context)
Loading

0 comments on commit 3e7f5f7

Please sign in to comment.