Repository: mingfunwong/all-bitcoin-private-key
Branch: main
Commit: 9014feaefa23
Files: 48
Total size: 29.4 KB
Directory structure:
gitextract_fynmuqcp/
├── .browserslistrc
├── .editorconfig
├── .gitignore
├── .vscode/
│ ├── extensions.json
│ ├── launch.json
│ └── tasks.json
├── README.md
├── angular.json
├── karma.conf.js
├── package.json
├── src/
│ ├── app/
│ │ ├── app-routing.module.ts
│ │ ├── app.component.css
│ │ ├── app.component.html
│ │ ├── app.component.spec.ts
│ │ ├── app.component.ts
│ │ ├── app.module.ts
│ │ ├── components/
│ │ │ └── layout/
│ │ │ ├── layout.component.css
│ │ │ ├── layout.component.html
│ │ │ ├── layout.component.spec.ts
│ │ │ └── layout.component.ts
│ │ ├── pages/
│ │ │ ├── about/
│ │ │ │ ├── about.component.css
│ │ │ │ ├── about.component.html
│ │ │ │ ├── about.component.spec.ts
│ │ │ │ └── about.component.ts
│ │ │ └── home/
│ │ │ ├── home.component.css
│ │ │ ├── home.component.html
│ │ │ ├── home.component.spec.ts
│ │ │ └── home.component.ts
│ │ ├── pipes/
│ │ │ ├── balance.pipe.spec.ts
│ │ │ └── balance.pipe.ts
│ │ ├── services/
│ │ │ ├── all-key.service.spec.ts
│ │ │ ├── all-key.service.ts
│ │ │ ├── balance.service.spec.ts
│ │ │ └── balance.service.ts
│ │ └── types/
│ │ ├── IAllKey.ts
│ │ └── IBlockchain.ts
│ ├── assets/
│ │ └── .gitkeep
│ ├── environments/
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── index.html
│ ├── main.ts
│ ├── polyfills.ts
│ ├── styles.css
│ └── test.ts
├── tailwind.config.js
├── tsconfig.app.json
├── tsconfig.json
└── tsconfig.spec.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .browserslistrc
================================================
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
================================================
FILE: .editorconfig
================================================
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false
================================================
FILE: .gitignore
================================================
# See http://help.github.com/ignore-files/ for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db
================================================
FILE: .vscode/extensions.json
================================================
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}
================================================
FILE: .vscode/launch.json
================================================
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "pwa-chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
]
}
================================================
FILE: .vscode/tasks.json
================================================
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}
================================================
FILE: README.md
================================================
# all-key
All bitcoin private key.
## Demo
https://all-bitcoin-private-key.pages.dev/
## Development
```
git clone https://github.com/mingfunwong/all-bitcoin-private-key.git
cd ./all-bitcoin-private-key
yarn
yarn start
```
================================================
FILE: angular.json
================================================
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"all-key": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/all-key",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"scripts": ["node_modules/bitcoinjs-lib/build/bitcoinjs-min.js"]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "all-key:build:production"
},
"development": {
"browserTarget": "all-key:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "all-key:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"scripts": []
}
}
}
}
},
"cli": {
"analytics": false
}
}
================================================
FILE: karma.conf.js
================================================
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/all-key'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
================================================
FILE: package.json
================================================
{
"name": "all-key",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.2.9",
"@angular/common": "^14.2.9",
"@angular/compiler": "^14.2.9",
"@angular/core": "^14.2.9",
"@angular/forms": "^14.2.9",
"@angular/platform-browser": "^14.2.9",
"@angular/platform-browser-dynamic": "^14.2.9",
"@angular/router": "^14.2.9",
"bitcoinjs-lib": "pointbiz/bitcoinjs-lib",
"rxjs": "~7.5.7",
"tslib": "^2.4.1",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.8",
"@angular/cli": "~14.2.8",
"@angular/compiler-cli": "^14.2.9",
"@types/jasmine": "~4.3.0",
"autoprefixer": "^10.4.13",
"jasmine-core": "~4.5.0",
"karma": "~6.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"postcss": "^8.4.18",
"tailwindcss": "^3.2.2",
"typescript": "~4.8.4"
}
}
================================================
FILE: src/app/app-routing.module.ts
================================================
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AboutComponent } from './pages/about/about.component';
import { HomeComponent } from './pages/home/home.component';
const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: 'about', component: AboutComponent },
{ path: '', redirectTo: '/home', pathMatch: 'full' },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
================================================
FILE: src/app/app.component.css
================================================
================================================
FILE: src/app/app.component.html
================================================
================================================
FILE: src/app/app.component.spec.ts
================================================
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'all-key'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('all-key');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('all-key app is running!');
});
});
================================================
FILE: src/app/app.component.ts
================================================
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'all-key';
}
================================================
FILE: src/app/app.module.ts
================================================
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './pages/home/home.component';
import { AboutComponent } from './pages/about/about.component';
import { BalancePipe } from './pipes/balance.pipe';
import { HttpClientModule } from '@angular/common/http';
import { LayoutComponent } from './components/layout/layout.component';
@NgModule({
declarations: [AppComponent, HomeComponent, AboutComponent, BalancePipe, LayoutComponent],
imports: [BrowserModule, AppRoutingModule, HttpClientModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
================================================
FILE: src/app/components/layout/layout.component.css
================================================
================================================
FILE: src/app/components/layout/layout.component.html
================================================
================================================
FILE: src/app/components/layout/layout.component.spec.ts
================================================
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LayoutComponent } from './layout.component';
describe('LayoutComponent', () => {
let component: LayoutComponent;
let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LayoutComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(LayoutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
================================================
FILE: src/app/components/layout/layout.component.ts
================================================
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-layout',
templateUrl: './layout.component.html',
styleUrls: ['./layout.component.css']
})
export class LayoutComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
================================================
FILE: src/app/pages/about/about.component.css
================================================
================================================
FILE: src/app/pages/about/about.component.html
================================================
================================================
FILE: src/app/pages/about/about.component.spec.ts
================================================
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AboutComponent } from './about.component';
describe('AboutComponent', () => {
let component: AboutComponent;
let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AboutComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(AboutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
================================================
FILE: src/app/pages/about/about.component.ts
================================================
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.css']
})
export class AboutComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
================================================
FILE: src/app/pages/home/home.component.css
================================================
================================================
FILE: src/app/pages/home/home.component.html
================================================
{{ page }} of {{ maxPage }}
================================================
FILE: src/app/pages/home/home.component.spec.ts
================================================
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomeComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
================================================
FILE: src/app/pages/home/home.component.ts
================================================
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { firstValueFrom } from 'rxjs';
import { AllKeyService } from 'src/app/services/all-key.service';
import { BalanceService } from 'src/app/services/balance.service';
import { IAllKey } from 'src/app/types/IAllKey';
import { IBlockchain } from 'src/app/types/IBlockchain';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css'],
})
export class HomeComponent implements OnInit {
tableHeaderColumns: string[] = [
'privateKey',
'address',
'balance',
'received',
'compressed',
'balance',
'received',
];
items: IAllKey[] = [];
maxNumber =
0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140n; // secp256k1_n - 1
page = 1n;
limitPerPage = 16;
maxPage = this.maxNumber / BigInt(this.limitPerPage);
isLoadingResults = true;
isError = false;
constructor(
private allKeyService: AllKeyService,
private route: ActivatedRoute,
private router: Router,
private balanceService: BalanceService
) {}
ngOnInit() {
this.route.queryParamMap.subscribe((params) => {
this.page = BigInt(params.get('page') || '1');
this.getData();
});
}
onOlder() {
this.page = this.page - 1n;
if (this.page === 0n) {
this.page = 1n;
}
this.router.navigate(['/home'], { queryParams: { page: this.page } });
}
onNewer() {
this.page = this.page + 1n;
if (this.page >= this.maxPage) {
this.page = this.maxPage;
}
this.router.navigate(['/home'], { queryParams: { page: this.page } });
}
async getData() {
this.isLoadingResults = true;
const items = this.allKeyService.getData(this.page, this.limitPerPage);
this.items = items;
const addresses: string[] = [];
for (const key in items) {
const item = items[key];
addresses.push(item.addressCompressed);
addresses.push(item.addressUnCompressed);
}
const balanceList = await firstValueFrom(
this.balanceService.getBalance(addresses)
);
this.items = this.items.map((item) => {
item.addressCompressedBalance = this.getBalance(
item.addressCompressed,
balanceList,
'final_balance'
);
item.addressCompressedReceived = this.getBalance(
item.addressCompressed,
balanceList,
'total_received'
);
item.addressUnCompressedBalance = this.getBalance(
item.addressUnCompressed,
balanceList,
'final_balance'
);
item.addressUnCompressedReceived = this.getBalance(
item.addressUnCompressed,
balanceList,
'total_received'
);
return item;
});
}
getBalance(
address: string,
balanceList: IBlockchain[],
type: 'final_balance' | 'total_received'
): number {
const balance = balanceList[address as any];
return balance ? balance[type] : 0;
}
getBalanceClass(balance: number | null) {
return balance ? 'text-slate-900' : 'text-slate-400';
}
}
================================================
FILE: src/app/pipes/balance.pipe.spec.ts
================================================
import { BalancePipe } from './balance.pipe';
describe('BalancePipe', () => {
it('create an instance', () => {
const pipe = new BalancePipe();
expect(pipe).toBeTruthy();
});
});
================================================
FILE: src/app/pipes/balance.pipe.ts
================================================
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'balance',
})
export class BalancePipe implements PipeTransform {
transform(value: number | null) {
return value !== null
? parseFloat(value.toString()) / Math.pow(10, 8) + ' BTC'
: 'Loading...';
}
}
================================================
FILE: src/app/services/all-key.service.spec.ts
================================================
import { TestBed } from '@angular/core/testing';
import { AllKeyService } from './all-key.service';
describe('AllKeyService', () => {
let service: AllKeyService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AllKeyService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
================================================
FILE: src/app/services/all-key.service.ts
================================================
import { Injectable } from '@angular/core';
import { IAllKey } from '../types/IAllKey';
declare var Bitcoin: { ECKey: new (arg0: any) => any },
Crypto: { util: { hexToBytes: (arg0: string) => any } };
@Injectable({
providedIn: 'root',
})
export class AllKeyService {
getData(page: bigint, limitPerPage: number): IAllKey[] {
const items: IAllKey[] = [];
const addresses: string[] = [];
for (let index = 0; index < limitPerPage; index++) {
let id = (
(page - 1n) * BigInt(limitPerPage) +
BigInt(index) +
1n
).toString(16);
if (id.length % 2 !== 0) {
id = '0' + id;
}
const addressUnCompressed = this.getAddress(id, false);
const addressCompressed = this.getAddress(id, true);
const privateKey = this.getPrivateKey(id);
addresses.push(addressUnCompressed);
addresses.push(addressCompressed);
items.push({
id,
privateKey,
addressUnCompressed,
addressUnCompressedBalance: null,
addressUnCompressedReceived: null,
addressCompressed,
addressCompressedBalance: null,
addressCompressedReceived: null,
});
}
return items;
}
private getAddress(id: string, compressed: boolean) {
const bytes = Crypto.util.hexToBytes(id);
const btcKey = new Bitcoin.ECKey(bytes);
btcKey.compressed = compressed;
const address = btcKey.getBitcoinAddress().toString();
return address;
}
private getPrivateKey(id: string) {
const bytes = Crypto.util.hexToBytes(id);
const btcKey = new Bitcoin.ECKey(bytes);
const privateKey = btcKey.getExportedPrivateKey();
return privateKey;
}
}
================================================
FILE: src/app/services/balance.service.spec.ts
================================================
import { TestBed } from '@angular/core/testing';
import { BalanceService } from './balance.service';
describe('BalanceService', () => {
let service: BalanceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(BalanceService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
================================================
FILE: src/app/services/balance.service.ts
================================================
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { IBlockchain } from '../types/IBlockchain';
@Injectable({
providedIn: 'root',
})
export class BalanceService {
constructor(private _httpClient: HttpClient) {}
getBalance(addresses: string[]): Observable {
const requestUrl = `https://blockchain.info/balance?cors=true&active=${addresses.join(
','
)}`;
const obser = this._httpClient.get(requestUrl);
return obser;
}
}
================================================
FILE: src/app/types/IAllKey.ts
================================================
export interface IAllKey {
id: string;
privateKey: string;
addressUnCompressed: string;
addressUnCompressedBalance: number | null;
addressUnCompressedReceived: number | null;
addressCompressed: string;
addressCompressedBalance: number | null;
addressCompressedReceived: number | null;
}
================================================
FILE: src/app/types/IBlockchain.ts
================================================
export interface IBlockchain {
final_balance: number;
n_tx: number;
total_received: number;
}
================================================
FILE: src/assets/.gitkeep
================================================
================================================
FILE: src/environments/environment.prod.ts
================================================
export const environment = {
production: true
};
================================================
FILE: src/environments/environment.ts
================================================
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
================================================
FILE: src/index.html
================================================
AllKey
================================================
FILE: src/main.ts
================================================
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
================================================
FILE: src/polyfills.ts
================================================
/**
* 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 recent versions of Safari, Chrome (including
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (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__UNPATCHED_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;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
================================================
FILE: src/styles.css
================================================
@tailwind base;
@tailwind components;
@tailwind utilities;
================================================
FILE: src/test.ts
================================================
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
(id: string): T;
keys(): string[];
};
};
// 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().forEach(context);
================================================
FILE: tailwind.config.js
================================================
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,ts}"],
theme: {
extend: {},
},
plugins: [],
};
================================================
FILE: tsconfig.app.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
================================================
FILE: tsconfig.json
================================================
/* 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,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2020",
"module": "es2020",
"lib": [
"es2020",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
================================================
FILE: tsconfig.spec.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}