Skip to content

Commit

Permalink
feat!: update code structure + ui
Browse files Browse the repository at this point in the history
closes #5 #22 #25
  • Loading branch information
ttu-ttu committed Dec 19, 2021
1 parent dfb2043 commit 06baaf9
Show file tree
Hide file tree
Showing 246 changed files with 20,156 additions and 19,245 deletions.
127 changes: 127 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"plugins": [
"rxjs-angular",
"header"
],
"extends": [
"airbnb-base",
"airbnb-typescript/base",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:rxjs/recommended",
"prettier"
],
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"prefix": "app",
"style": "kebab-case",
"type": "element"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"prefix": "app",
"style": "camelCase",
"type": "attribute"
}
],
"@angular-eslint/prefer-on-push-component-change-detection": "error",
"max-len": [
"error",
{
"code": 140,
"ignoreComments": true,
"ignoreTrailingComments": true,
"ignoreUrls": true
}
],
"import/no-namespace": [
"error"
],
"import/order": [
"error",
{
"newlines-between": "never",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"src/test.ts",
"**/*.spec.ts",
"cypress/**/*.ts"
]
}
],
"import/prefer-default-export": "off",
"no-underscore-dangle": "off",
"class-methods-use-this": [
"off",
{
"exceptMethods": [
"transform"
]
}
],
"no-restricted-syntax": [
"error",
{
"selector": "ForInStatement",
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
},
{
"selector": "LabeledStatement",
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
},
{
"selector": "WithStatement",
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
],
"@typescript-eslint/no-use-before-define": "off",
"rxjs-angular/prefer-takeuntil": "error",
"no-return-assign": ["error", "except-parens"],
"header/header": [ "error", "block", [
"*",
" * @license BSD-3-Clause",
" * Copyright (c) 2021, ッツ Reader Authors",
" * All rights reserved.",
" "
], 2 ]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ speed-measure-plugin*.json
.history/*

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
Expand All @@ -40,7 +41,6 @@ npm-debug.log
yarn-error.log
testem.log
/typings
pnpm-lock.yaml

# System Files
.DS_Store
Expand All @@ -51,3 +51,9 @@ test-files/
.firebase/
.firebaserc
firebase.json
.vscode/
.devcontainer/
.pnpm-store/
cypress/downloads/
cypress/screenshots/
cypress/videos/
117 changes: 72 additions & 45 deletions angular.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": "393ea40f-2995-4b24-90ca-e32b452fc3aa"
},
"version": 1,
"newProjectRoot": "projects",
"cli": {
"analytics": "393ea40f-2995-4b24-90ca-e32b452fc3aa",
"defaultCollection": "@ngneat/spectator"
},
"schematics": {
"@schematics/angular": {
"component": {
"changeDetection": "OnPush",
"style": "scss"
}
},
"@ngneat/spectator:spectator-component": {
"changeDetection": "OnPush",
"style": "scss",
"jest": true
}
},
"projects": {
"ebook-reader": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
Expand Down Expand Up @@ -44,19 +55,6 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
Expand All @@ -69,10 +67,32 @@
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all",
"serviceWorker": true,
"sourceMap": {
"scripts": true,
"styles": false,
"hidden": false,
"vendor": true
},
"ngswConfigPath": "ngsw-config.json"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
Expand All @@ -82,8 +102,12 @@
"configurations": {
"production": {
"browserTarget": "ebook-reader:build:production"
},
"development": {
"browserTarget": "ebook-reader:build:development"
}
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-builders/custom-webpack:extract-i18n",
Expand All @@ -92,47 +116,50 @@
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"builder": "@angular-builders/jest:run",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html",
"cypress/**/*.ts"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"builder": "@cypress/schematic:cypress",
"options": {
"devServerTarget": "ebook-reader:serve:development",
"watch": true,
"headless": false
},
"configurations": {
"production": {
"devServerTarget": "ebook-reader:serve:production"
}
}
},
"cypress-run": {
"builder": "@cypress/schematic:cypress",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ebook-reader:serve"
},
"configurations": {
"production": {
"devServerTarget": "ebook-reader:serve:production"
}
}
},
"cypress-open": {
"builder": "@cypress/schematic:cypress",
"options": {
"watch": true,
"headless": false
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"integrationFolder": "cypress/integration",
"supportFile": "cypress/support/index.ts",
"videosFolder": "cypress/videos",
"screenshotsFolder": "cypress/screenshots",
"pluginsFile": "cypress/plugins/index.ts",
"fixturesFolder": "cypress/fixtures",
"baseUrl": "http://localhost:4200"
}
1 change: 1 addition & 0 deletions cypress/fixtures/books/epubs/corrupt.epub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Corrupted file
Binary file added cypress/fixtures/books/epubs/test.epub
Binary file not shown.
6 changes: 6 additions & 0 deletions cypress/fixtures/books/epubs/test/META-INF/container.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="content.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
33 changes: 33 additions & 0 deletions cypress/fixtures/books/epubs/test/content.opf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:language>ja</dc:language>
<dc:title>Test Book (test.epub)</dc:title>
<meta name="cover" content="cover"/>
</metadata>
<manifest>
<item id="cover" href="cover.jpg" media-type="image/jpeg"/>
<item id="preview-0" href="text/preview-0.html" media-type="application/xhtml+xml"/>
<item id="preview-1" href="text/preview-1.html" media-type="application/xhtml+xml"/>
<item id="preview-2" href="text/preview-2.html" media-type="application/xhtml+xml"/>
<item id="title-0" href="text/title-0.html" media-type="application/xhtml+xml"/>
<item id="toc-0" href="text/toc-0.html" media-type="application/xhtml+xml"/>
<item id="text-0" href="text/text-0.html" media-type="application/xhtml+xml"/>
<item id="text-1" href="text/text-1.html" media-type="application/xhtml+xml"/>
</manifest>
<spine page-progression-direction="rtl">
<itemref idref="preview-0"/>
<itemref idref="preview-1"/>
<itemref idref="preview-2"/>
<itemref idref="title-0"/>
<itemref idref="toc-0"/>
<itemref idref="text-0"/>
<itemref idref="preview-0"/>
<itemref idref="text-0"/>
<itemref idref="preview-1"/>
<itemref idref="text-0"/>
<itemref idref="preview-2"/>
<itemref idref="text-0"/>
<itemref idref="text-1"/>
</spine>
</package>
Binary file added cypress/fixtures/books/epubs/test/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions cypress/fixtures/books/epubs/test/mimetype
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
application/epub+zip
Loading

0 comments on commit 06baaf9

Please sign in to comment.