Skip to content

Commit

Permalink
docs: updates on workflows
Browse files Browse the repository at this point in the history
Added information on documentation
  • Loading branch information
ADMSK\AVROGAL1 committed Mar 19, 2021
1 parent 2c74335 commit 8fa6a4a
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: codespell
uses: codespell-project/actions-codespell@master
with:
skip: .git,*.png,*.jpg,*.svg,*.sum,*.json,*.lock
skip: .git,*.png,*.jpg,*.svg,*.sum,*.json,*.lock,*.js,*.html,*.yml
ignore_words_list: aks,keyserver,atleast,dne,ser,ist,files',ba,dum,iam,te,parm
check_filenames: true
check_hidden: true
2 changes: 2 additions & 0 deletions .github/workflows/opengraph-card.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:
full_path="${full_path}&heights=$i"
done
mkdir -p images
echo "$full_path"
curl "$full_path" > ./images/opengraph-card.png
shell: bash

Expand Down
4 changes: 4 additions & 0 deletions typings/standard-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Optional {@link T} or null/undefined type
*/
export type Optional<T> = T | null | undefined
46 changes: 16 additions & 30 deletions typings/types.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
import { Optional } from './standard-types'

export enum HeroPattern {
plus = 'plus',
topography = 'topography',
texture = 'texture',
hideout = 'hideout',
fallingTriangles = 'fallingTriangles',
iLikeFood = 'iLikeFood',
fourPointStars = 'fourPointStars',
brickWall = 'brickWall',
wiggle = 'wiggle',
jigsaw = 'jigsaw',
bubbles = 'bubbles',
floatingCogs = 'floatingCogs',
leaf = 'leaf',
rain = 'rain',
polkaDots = 'polkaDots',
ticTacToe = 'ticTacToe',
overcast = 'overcast',
formalInvitation = 'formalInvitation',
topography = 'topography',
texture = 'texture',
jupiter = 'jupiter',
architect = 'architect',
cutout = 'cutout',
hideout = 'hideout',
graphPaper = 'graphPaper',
yyy = 'yyy',
squares = 'squares',
fallingTriangles = 'fallingTriangles',
pianoMan = 'pianoMan',
pieFactory = 'pieFactory',
dominos = 'dominos',
Expand All @@ -33,6 +24,7 @@ export enum HeroPattern {
stampCollection = 'stampCollection',
deathStar = 'deathStar',
churchOnSunday = 'churchOnSunday',
iLikeFood = 'iLikeFood',
overlappingHexagons = 'overlappingHexagons',
bamboo = 'bamboo',
bathroomFloor = 'bathroomFloor',
Expand All @@ -47,25 +39,32 @@ export enum HeroPattern {
xEquals = 'xEquals',
anchorsAway = 'anchorsAway',
bevelCircle = 'bevelCircle',
brickWall = 'brickWall',
fancyRectangles = 'fancyRectangles',
heavyRain = 'heavyRain',
overlappingCircles = 'overlappingCircles',
plus = 'plus',
roundedPlusConnected = 'roundedPlusConnected',
volcanoLamp = 'volcanoLamp',
wiggle = 'wiggle',
bubbles = 'bubbles',
cage = 'cage',
connections = 'connections',
current = 'current',
diagonalStripes = 'diagonalStripes',
flippedDiamonds = 'flippedDiamonds',
floatingCogs = 'floatingCogs',
glamorous = 'glamorous',
houndstooth = 'houndstooth',
leaf = 'leaf',
linesInMotion = 'linesInMotion',
moroccan = 'moroccan',
morphingDiamonds = 'morphingDiamonds',
rails = 'rails',
rain = 'rain',
skulls = 'skulls',
squaresInSquares = 'squaresInSquares',
stripes = 'stripes',
ticTacToe = 'ticTacToe',
zigZag = 'zigZag',
aztec = 'aztec',
bankNote = 'bankNote',
Expand All @@ -83,6 +82,7 @@ export enum HeroPattern {
overlappingDiamonds = 'overlappingDiamonds',
parkayFloor = 'parkayFloor',
pixelDots = 'pixelDots',
polkaDots = 'polkaDots',
signal = 'signal',
slantedStars = 'slantedStars',
wallpaper = 'wallpaper',
Expand Down Expand Up @@ -131,11 +131,6 @@ export enum CategoryPattern {
portuguese = 'portuguese',
}

/**
* Optional {@link T} or null/undefined type
*/
export type Optional<T> = T | null | undefined

export type QuoteData = {
/**
* Quote identifier
Expand All @@ -151,8 +146,6 @@ export type QuoteData = {
author: string
}

export type QuoteMapper = { [K in CategoryPattern]: QuoteData[] }

export interface ParsedRequest {
/**
* Quote category
Expand Down Expand Up @@ -260,10 +253,3 @@ export interface ProfileOptions {
*/
readonly indexOptions: IndexOptions
}

/**
* Profile configuration options.
*/
export type ConfigOptions = {
readonly [K in Profile]: ProfileOptions
}
7 changes: 4 additions & 3 deletions utils/bg-hero.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as pattern from 'hero-patterns'

import { HeroPattern, Optional } from '../typings/types'
import { Optional } from '../typings/standard-types'
import { HeroPattern } from '../typings/types'
import { randomEnum, strToEnum } from './commons'

type PatternOperator = (fill: string, opacity: string) => string

type PatternMapper = { [K in HeroPattern]: PatternOperator }
type PatternMapper = Record<HeroPattern, PatternOperator>

const patternMapper: PatternMapper = strToEnum(Object.values(HeroPattern), value => pattern[value])
const patternMapper: Readonly<PatternMapper> = strToEnum(Object.values(HeroPattern), value => pattern[value])

const getPattern = (pattern: Optional<HeroPattern>, opacity: string, colorPattern: string): string => {
const patternOperator: PatternOperator = pattern
Expand Down
4 changes: 3 additions & 1 deletion utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ConfigOptions } from '../typings/types'
import { Profile, ProfileOptions } from '../typings/types'

export type ConfigOptions = Record<Profile, ProfileOptions>

export const CONFIG: Readonly<ConfigOptions> = {
dev: {
Expand Down
4 changes: 2 additions & 2 deletions utils/env.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ProfileOptions } from '../typings/types'
import { CONFIG } from './config'

const getProfileOptions = (): ProfileOptions => {
const getProfile = (): ProfileOptions => {
return process.env.AWS_LAMBDA_FUNCTION_VERSION ? CONFIG.prod : CONFIG.dev
}

export const profile = getProfileOptions()
export const profile = getProfile()
7 changes: 4 additions & 3 deletions utils/quote.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import gradient from 'gradient-string'
import randomColor from 'randomcolor'

import { Optional } from '../typings/standard-types'
import {
CategoryPattern,
ColorOptions,
ImageOptions,
Optional,
ParsedRequest,
QuoteData,
} from '../typings/types'
import gradient from 'gradient-string'
import randomColor from 'randomcolor'

import { getSearchResults, idx } from './search'
import { capitalize, delim, mergeProps, randomElement, randomEnum, toFormatString } from './commons'
Expand Down
8 changes: 5 additions & 3 deletions utils/quotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ import * as wisdom from '../data/wisdom_quotes.json'
import * as writing from '../data/writing_quotes.json'

import { mergeProps } from './commons'
import { QuoteMapper } from '../typings/types'
import { CategoryPattern, QuoteData } from '../typings/types'

const getQuoteData = (): QuoteMapper =>
export type QuoteMapper = Record<CategoryPattern, QuoteData[]>

const getQuotes = (): QuoteMapper =>
mergeProps<QuoteMapper>(
anger,
books,
Expand Down Expand Up @@ -96,4 +98,4 @@ const getQuoteData = (): QuoteMapper =>
writing
)

export const quotes = getQuoteData()
export const quotes = getQuotes()
4 changes: 2 additions & 2 deletions utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { join } from 'path'
import boxen from 'boxen'
import cron from 'node-cron'

import { quotes } from './quotes'

import { CategoryPattern } from '../typings/types'
import { ensureDirExists, tempDir } from './commons'
import { profile } from './env'

import { quotes } from './quotes'

const task = cron.schedule('0 * * * *', () => {
console.log(
boxen('Running task every 60 minutes on index search', {
Expand Down

0 comments on commit 8fa6a4a

Please sign in to comment.