Skip to content

Commit

Permalink
prettify all
Browse files Browse the repository at this point in the history
  • Loading branch information
willybrauner committed Feb 7, 2024
1 parent 3ae6c43 commit 7102861
Show file tree
Hide file tree
Showing 39 changed files with 158 additions and 164 deletions.
2 changes: 1 addition & 1 deletion apps/front/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ return new Promise((resolve) => {
// duplicate route with lang if the router is configured on this way
"/fr",
"/fr/work",
"/fr/work/first-work",
"/fr/work/first-work"
])
})
```
Expand Down
2 changes: 1 addition & 1 deletion apps/front/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export default {
// Build htaccess
htaccessTemplateFilePath: resolve(
"config/tasks/build-htaccess/templates/.htaccess.template"
),
)
}
12 changes: 6 additions & 6 deletions apps/front/config/tasks/build-htaccess/build-htaccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const _createHtpasswdFile = async ({ outputPath, user, password }) => {
log("create htpasswd file", {
outputPath,
user,
password,
password
})

if (!outputPath || !user || !password) {
Expand Down Expand Up @@ -74,7 +74,7 @@ const _htpasswdLinkInHtaccess = async ({ newHtaccessFilePath, serverWebRootPath
AuthType Basic
AuthName "Restricted Area"
Require valid-user
`,
`
]
.join("\n")
.replace(/ +/g, "")
Expand All @@ -90,14 +90,14 @@ const _htpasswdLinkInHtaccess = async ({ newHtaccessFilePath, serverWebRootPath
*/
const _rewriteHttpToHttpsInHtaccess = async (newHtaccessFilePath) => {
debug("rewrite http to https in htaccess", {
newHtaccessFilePath,
newHtaccessFilePath
})

const template = [
`# Force http to https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
`,
`
]
.join("\n")
.replace(/ +/g, "")
Expand All @@ -115,12 +115,12 @@ export default async ({
user,
password,
outputPath,
htaccessTemplatePath,
htaccessTemplatePath
}) => {
// create htaccess file and get returned newHtaccessFilePath
const newHtaccessFilePath = await _createHtaccessFile({
outputPath,
htaccessTemplatePath,
htaccessTemplatePath
})

if (!newHtaccessFilePath) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const viteChersiteCustomLogger = ({
protocol,
host,
port,
base,
base
}: {
protocol: "http" | "https"
host: string
Expand Down
4 changes: 2 additions & 2 deletions apps/front/config/vite-plugins/vite-plugin-build-dotenv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import buildDotenv from "../tasks/build-dotenv/build-dotenv"
export default function buildDotenvPlugin({
envVars = process.env,
dotenvOutDir,
additionalVarKeys,
additionalVarKeys
}: {
envVars: { [x: string]: any }
dotenvOutDir: string[]
Expand All @@ -14,6 +14,6 @@ export default function buildDotenvPlugin({
name: "vite-plugin-dotenv",
buildStart: async () => {
await buildDotenv({ envVars, dotenvOutDir, additionalVarKeys })
},
}
}
}
6 changes: 3 additions & 3 deletions apps/front/config/vite-plugins/vite-plugin-build-htaccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function buildHtaccessPlugin({
serverWebRootPath,
htaccessTemplatePath,
outputPath,
enable,
enable
}: {
user: string | undefined
password: string | undefined
Expand All @@ -29,8 +29,8 @@ export default function buildHtaccessPlugin({
serverWebRootPath,
password,
htaccessTemplatePath,
outputPath,
outputPath
})
},
}
}
}
2 changes: 1 addition & 1 deletion apps/front/config/vite-plugins/vite-plugin-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ export default function htmlPlugin(env) {
name: "html-transform",
transformIndexHtml(html) {
return html.replace(/<!-- VITE_APP_URL -->/gm, `${env.VITE_APP_URL}`)
},
}
}
}
2 changes: 1 addition & 1 deletion apps/front/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion apps/front/prerender/__tests__/ManifestParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const url = import.meta.url

const manifestRaw = fs.readFileSync(
path.join(path.dirname(fileURLToPath(url)), `fixtures/manifest.json`),
{ encoding: "utf8" },
{ encoding: "utf8" }
)

it("should return assets list", () => {
Expand Down
4 changes: 2 additions & 2 deletions apps/front/prerender/helpers/ManifestParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class ManifestParser {
} else {
return {
...a,
[ext]: [b],
[ext]: [b]
}
}
}, {})
Expand Down Expand Up @@ -157,7 +157,7 @@ export class ManifestParser {
...a,
jsonManifest[b].file,
...(jsonManifest[b]?.assets || []),
...(jsonManifest[b]?.css || []),
...(jsonManifest[b]?.css || [])
]
: a,
[]
Expand Down
2 changes: 1 addition & 1 deletion apps/front/prerender/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const prerender = async (urls: string[], outDirStatic = config.outDirStat
},
onError(x) {
console.error(x)
},
}
})
} catch (e) {
console.log(e)
Expand Down
8 changes: 4 additions & 4 deletions apps/front/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const isSSL = protocol === "https"

// dev script to inject
const devScripts = {
js: [{ tag: "script", attr: { type: "module", src: "/src/index.tsx" } }],
js: [{ tag: "script", attr: { type: "module", src: "/src/index.tsx" } }]
}

// Create Vite server in middleware mode.
Expand All @@ -50,9 +50,9 @@ const isSSL = protocol === "https"
server: {
middlewareMode: true,
https: (isSSL && { key, cert }) || false,
cors: false,
cors: false
},
appType: "custom",
appType: "custom"
})

// use vite's connect instance as middleware
Expand All @@ -75,7 +75,7 @@ const isSSL = protocol === "https"
onError(e) {
res.statusCode = 500
console.error(e)
},
}
})
} catch (e) {
vite.ssrFixStacktrace(e)
Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/components/cookiesBanner/CookiesBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function CookiesBanner(props: IProps) {
// targets script DOM by ids
const $gTagManagerScript = document.getElementById("__gaTagManagerScript")
const $gTagManagerDataLayerScript = document.getElementById(
"__gTagManagerDataLayerScript",
"__gTagManagerDataLayerScript"
)
const $gTagManagerNoScript = document.getElementById("__gaTagManagerNoScript")

Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const history = createBrowserHistory()
const langService = new LangService({
showDefaultLangInUrl,
languages,
base,
base
})

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/front/src/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { TLanguage } from "@cher-ami/router"
export const languages: TLanguage[] = [
{
key: "fr",
default: true,
},
default: true
}
// {
// key: "en",
// },
Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/libs/dom/MetaManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class MetasManager {
values = null,
tags = MetasManager.DEFAULT_META_TAGS,
autoCreateMetaTag = true,
autoRemoveMetaTag = true,
autoRemoveMetaTag = true
}: {
values?: TMetaTags<string>
tags?: TMetaTags<TTag[]>
Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/libs/events/Beeper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ export function Beeper<S = any>(initialState: S = null): TBeeper<S> {
},
get initialState() {
return _initialState
},
}
}
}
2 changes: 1 addition & 1 deletion apps/front/src/libs/hooks/useMinWidth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getBreakpointCssVariable,
TBreakpoint,
TBreakpoint
} from "~/libs/dom/getBreakpointCssVariable"
import { browserOnly } from "@cher-ami/utils"
import { useMatchMedia } from "~/libs/hooks/useMatchMedia"
Expand Down
6 changes: 3 additions & 3 deletions apps/front/src/libs/load/PreloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class PreloadService {
this.onPreloadSignal = Beeper<IPreloadSignal>({
complete: false,
counter: 0,
percent: 0,
percent: 0
})
}

Expand All @@ -35,7 +35,7 @@ export class PreloadService {
this.onPreloadSignal.dispatch({
complete: true,
percent: 100,
counter: 0,
counter: 0
})
return
}
Expand Down Expand Up @@ -84,7 +84,7 @@ export class PreloadService {
const dispatchValue = {
counter,
percent,
complete,
complete
}
log("dispatchValue", dispatchValue)
this.onPreloadSignal.dispatch(dispatchValue)
Expand Down
16 changes: 8 additions & 8 deletions apps/front/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import NotFoundPage from "./pages/notFoundPage/NotFoundPage"
export enum EPages {
HOME = "home",
WORK = "work",
NOT_FOUND = "not-found",
NOT_FOUND = "not-found"
}

export const routes: TRoute[] = [
Expand All @@ -22,10 +22,10 @@ export const routes: TRoute[] = [
const meta: TMetaTags = {
title: "Home",
description: "Home description",
imageUrl: "",
imageUrl: ""
}
return { time, meta }
},
}
},
{
path: "/work/:slug?",
Expand All @@ -35,10 +35,10 @@ export const routes: TRoute[] = [
const meta: TMetaTags = {
title: `Work - ${props.params.slug}`,
description: "Work description",
imageUrl: "",
imageUrl: ""
}
return { meta }
},
}
},
{
path: "/:rest",
Expand All @@ -48,9 +48,9 @@ export const routes: TRoute[] = [
const meta = {
title: `404`,
description: "Not found",
imageUrl: "",
imageUrl: ""
}
return { meta }
},
},
}
}
]
6 changes: 1 addition & 5 deletions apps/front/src/server/helpers/CherScripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ export const ScriptTag = ({ tag, attr }: TScript): JSX.Element => {
}

export const CherScripts = ({ scripts }: { scripts: TScript[] }): JSX.Element => (
<>
{scripts?.map((script, i) => (
<ScriptTag key={i} {...script} />
))}
</>
<>{scripts?.map((script, i) => <ScriptTag key={i} {...script} />)}</>
)
2 changes: 1 addition & 1 deletion apps/front/src/server/helpers/RawScript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const RawScript = ({ name, data }) => {
<script
type="text/javascript"
dangerouslySetInnerHTML={{
__html: `window.${name}=${stringify(data)}`,
__html: `window.${name}=${stringify(data)}`
}}
/>
)
Expand Down
4 changes: 2 additions & 2 deletions apps/front/src/server/helpers/ViteDevScripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ViteDevScripts = () => {
dangerouslySetInnerHTML={{
__html: `
import { inject } from "/@vite-plugin-checker-runtime";
inject({ overlayConfig: {}, base: "${base}"});`,
inject({ overlayConfig: {}, base: "${base}"});`
}}
/>

Expand All @@ -27,7 +27,7 @@ export const ViteDevScripts = () => {
refresh.injectIntoGlobalHook(window)
window.$RefreshReg$ = () => {}
window.$RefreshSig$ = () => (type) => type
window.__vite_plugin_react_preamble_installed__ = true`,
window.__vite_plugin_react_preamble_installed__ = true`
}}
/>
</>
Expand Down
Loading

0 comments on commit 7102861

Please sign in to comment.