This repository has been archived by the owner on Nov 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TypeScript + VSCode + Nuxt.js + Workspace instrumentation
Vuex Module that are strongly typed with TypeScript * Make PWA optional, refactor comment folding. * Review README * Figure out how static/sw.js works (need documentation)
- Loading branch information
Showing
29 changed files
with
641 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"recommendations": [ | ||
"CoenraadS.bracket-pair-colorizer", | ||
"editorconfig.editorconfig", | ||
"gamunu.vscode-yarn", | ||
"jasonnutter.search-node-modules", | ||
"mrmlnc.vscode-attrs-sorter", | ||
"octref.vetur", | ||
"richie5um2.vscode-sort-json", | ||
"sourcegraph.javascript-typescript", | ||
"sysoev.language-stylus" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
// https://code.visualstudio.com/docs/getstarted/settings | ||
"editor.trimAutoWhitespace": true, | ||
"editor.renderControlCharacters": true, | ||
"editor.renderWhitespace": "all", | ||
"files.trimTrailingWhitespace": true, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"vetur.validation.style": true, | ||
"vetur.validation.template": true, | ||
"[json]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"[vue]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"[typescript]": { | ||
"editor.formatOnSave": true, | ||
"editor.formatOnPaste": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as runtime from "./runtime" | ||
|
||
export { runtime } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export interface Feed { | ||
comments_count: number | ||
domain: string | ||
id: number | ||
points: number | ||
time: number | Date | undefined | ||
time_ago: string | ||
title: string | ||
type: string | ||
url: string | ||
user: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./feed" | ||
export * from "./item" | ||
export * from "./store" | ||
export * from "./user" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export interface Items { | ||
[key: number]: Item | ||
} | ||
|
||
export interface Item { | ||
comments: any[] | ||
comments_count: number | ||
content: string | ||
domain: string | ||
id: number | ||
points: number | ||
time: number | Date | undefined | ||
time_ago: string | ||
title: string | ||
type: string | ||
url: string | ||
user: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { User } from "./user" | ||
import { Feed } from "./feed" | ||
import { Items } from "./item" | ||
|
||
export interface Dictionary<T> { | ||
[key: string]: T | ||
} | ||
|
||
// tslint:disable-next-line: no-empty-interface | ||
export interface StoreStateRoot {} | ||
|
||
export interface StoreStateUser { | ||
items: Dictionary<User> | ||
} | ||
|
||
export interface StoreStateFeed { | ||
feeds: Dictionary<Feed> | ||
items: Items | ||
selected: number | null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface User { | ||
created: string | ||
created_time: number | ||
id: string | ||
karma: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./logging" | ||
export * from "./nuxt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// There must be a way to make a type based on the possible values. | ||
// But, for now, its not like we'll have more than this list | ||
const possibleLevels: string[] = ["debug", "info", "warn", "error", "fatal"] | ||
export type LogLevel = "debug" | "info" | "warn" | "error" | "fatal" | ||
|
||
export const levels: ReadonlyArray<string> = [...possibleLevels] | ||
|
||
const isLogLevel = (x: any): x is LogLevel => levels.includes(x) | ||
|
||
export const ensureValidLogLevel = (input: string): LogLevel => { | ||
const fallbackValue: LogLevel = "info" | ||
if (isLogLevel(input)) { | ||
return input | ||
} | ||
return fallbackValue | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./workbox" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export const workbox = ( | ||
useWorkbox: boolean = false, | ||
isDev: boolean = false | ||
) => { | ||
if (!useWorkbox) { | ||
return {} | ||
} | ||
|
||
return { | ||
// https://pwa.nuxtjs.org/modules/workbox.html | ||
dev: isDev, | ||
cacheNames: { | ||
prefix: "hackernews" | ||
}, | ||
clientsClaim: true, | ||
config: { | ||
debug: isDev | ||
}, | ||
offlinePage: "/offline.html", | ||
skipWaiting: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./config" |
Oops, something went wrong.