Skip to content

Commit

Permalink
remove vite-checker-plugin & flat-css
Browse files Browse the repository at this point in the history
  • Loading branch information
willybrauner committed Feb 5, 2024
1 parent 001bb72 commit 11799da
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 484 deletions.
2 changes: 1 addition & 1 deletion apps/front/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default {

// Build htaccess
htaccessTemplateFilePath: resolve(
"config/tasks/build-htaccess/templates/.htaccess.template"
"config/tasks/build-htaccess/templates/.htaccess.template",
),
}
2 changes: 1 addition & 1 deletion apps/front/config/tasks/build-htaccess/build-htaccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const _createHtaccessFile = async ({ outputPath, htaccessTemplatePath }) => {
if (!templateExist) {
console.log(
"htaccess template doesn't exit. You need to create manually the template file in",
htaccessTemplatePath
htaccessTemplatePath,
)
return
}
Expand Down
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
6 changes: 0 additions & 6 deletions apps/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"test": "vitest run"
},
"dependencies": {
"@cher-ami/css-flat": "^1.0.1",
"@cher-ami/debug": "^1.2.0",
"@cher-ami/router": "^3.5.0",
"@cher-ami/utils": "^1.4.1",
Expand Down Expand Up @@ -45,13 +44,8 @@
"terser": "^5.27.0",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vite-plugin-checker": "^0.6.4",
"vitest": "^1.2.2"
},
"optionalDependencies": {
"esbuild-android-arm64": "^0.15.18",
"fsevents": "^2.3.3"
},
"browserslist": [
"last 2 versions",
"iOS >= 12"
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 @@ -19,7 +19,7 @@ it("should return a list of assets by type", () => {

extensions.forEach((e) => {
expect(
assetsByType[e].every((f) => f.split(".")[f.split(".").length - 1] === e)
assetsByType[e].every((f) => f.split(".")[f.split(".").length - 1] === e),
).toBe(true)
})
})
Expand Down
6 changes: 3 additions & 3 deletions apps/front/prerender/exe-prerender-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ app.get("/generate", async (req, res) => {
app.listen(port, () => {
console.log("")
console.log(
`> Generate all pages ${chalk.blue(`http://localhost:${port}/generate`)}`
`> Generate all pages ${chalk.blue(`http://localhost:${port}/generate`)}`,
)
console.log(
`> Generate specific page ${chalk.blue(
`http://localhost:${port}/generate?url=/my-page/url`
)}`
`http://localhost:${port}/generate?url=/my-page/url`,
)}`,
)
})
2 changes: 1 addition & 1 deletion apps/front/prerender/helpers/ManifestParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class ManifestParser {
...(jsonManifest[b]?.css || []),
]
: a,
[]
[],
)
.filter((e) => e)

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 @@ -63,7 +63,7 @@ const createHtmlFile = async (
urls: string[],
url: string,
outDir: string,
dom: ReactElement<any, string | JSXElementConstructor<any>>
dom: ReactElement<any, string | JSXElementConstructor<any>>,
): Promise<void> => {
// Prepare file
if (isRouteIndex(url, urls)) url = `${url}/index`
Expand Down
14 changes: 7 additions & 7 deletions apps/front/src/libs/components/cookiesBanner/CookiesBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ 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")

// if injection script tags is enable
if (injectScriptTags) {
if ($gTagManagerScript || $gTagManagerDataLayerScript || $gTagManagerNoScript) {
log(
"$gTagManagerNoScript or $gTagManagerNoScript already exist in DOM, NOT create new scripts. return. "
"$gTagManagerNoScript or $gTagManagerNoScript already exist in DOM, NOT create new scripts. return. ",
)
return
}
Expand All @@ -130,7 +130,7 @@ export function CookiesBanner(props: IProps) {
$gTagManagerNoScript,
// auto generated when script is injected in DOM, we remove it too.
document.querySelector(
`script[src="https://www.googletagmanager.com/gtm.js?id=${trackingID}"]`
`script[src="https://www.googletagmanager.com/gtm.js?id=${trackingID}"]`,
),
]

Expand All @@ -147,7 +147,7 @@ export function CookiesBanner(props: IProps) {
*/
const googleAnalyticsInjection = (
injectScriptTags: boolean,
trackingID: string
trackingID: string,
): void => {
if (!trackingID) return

Expand Down Expand Up @@ -196,7 +196,7 @@ export function CookiesBanner(props: IProps) {
$tracking,
// auto generated when script is injected in DOM, we remove it too.
document.querySelector(
'script[src$="https://www.google-analytics.com/analytics.js"]'
'script[src$="https://www.google-analytics.com/analytics.js"]',
),
]

Expand Down Expand Up @@ -278,7 +278,7 @@ export function CookiesBanner(props: IProps) {
show: boolean = true,
el = rootRef?.current as HTMLElement,
modifier = css.root_show,
modifierHide = css.root_hide
modifierHide = css.root_hide,
): void => {
if (show) {
el?.classList?.add(modifier)
Expand Down Expand Up @@ -317,7 +317,7 @@ export function CookiesBanner(props: IProps) {
} else {
log(
"init > localStorageChoiceExist() doesnt exist, anim show component",
localStorageChoiceExist()
localStorageChoiceExist(),
)
// add show class
CookiesBannerService.show()
Expand Down
6 changes: 3 additions & 3 deletions apps/front/src/libs/dom/MetaManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class MetasManager {
*/
private static selectMetaValue(
customMetasValue: TMetaTags<string>,
pType: string
pType: string,
): string {
return MetasManager.checkValue(customMetasValue?.[pType]) || ""
}
Expand Down Expand Up @@ -144,7 +144,7 @@ export class MetasManager {
newTagElement.setAttribute(property.attr, metaValue)
newTagElement.setAttribute(MetasManager.AUTO_GENERATE_ATTR, "")
const autoGeneratedMetaElement = document.head.querySelectorAll(
`*[${MetasManager.AUTO_GENERATE_ATTR}]`
`*[${MetasManager.AUTO_GENERATE_ATTR}]`,
)

// if there is no meta auto-generated, insert after <title>
Expand All @@ -159,7 +159,7 @@ export class MetasManager {
autoGeneratedMetaElement[autoGeneratedMetaElement.length - 1]
lastAutoGeneratedMeta.parentNode.insertBefore(
newTagElement,
lastAutoGeneratedMeta.nextSibling
lastAutoGeneratedMeta.nextSibling,
)
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/libs/dom/convertRemToPx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const _convertFontSizeCssVarToPx = (cssUnitValue: string): number => {

if (isCalc) {
const viewportReferenceDesktopHeight = parseFloat(
_getRootCssVariable("--viewport-reference-desktop-height")
_getRootCssVariable("--viewport-reference-desktop-height"),
)
return (1 / viewportReferenceDesktopHeight) * window.innerHeight
}
Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/libs/hooks/useIntersectionObserver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface Args extends IntersectionObserverInit {
*/
function useIntersectionObserver(
elementRef: RefObject<Element>,
{ threshold = 0, root = null, rootMargin = "0%", freezeOnceVisible = false }: Args
{ threshold = 0, root = null, rootMargin = "0%", freezeOnceVisible = false }: Args,
): IntersectionObserverEntry | undefined {
const [entry, setEntry] = useState<IntersectionObserverEntry>()

Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/libs/hooks/useIsLandscapeScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useEffect, useState } from "react"
*/
export function useIsLandscapeScreen(): boolean {
const [isLandscapeScreen, setIsLandscapeScreen] = useState<boolean>(
window.innerWidth > window.innerHeight
window.innerWidth > window.innerHeight,
)

const handler = () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/libs/hooks/useMinWidth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ import { useMatchMedia } from "~/libs/hooks/useMatchMedia"
*/
export const useIsMinWidth = (breakpoint: TBreakpoint): boolean => {
return browserOnly(() =>
useMatchMedia(`(min-width:${getBreakpointCssVariable(breakpoint)})`)
useMatchMedia(`(min-width:${getBreakpointCssVariable(breakpoint)})`),
)
}
2 changes: 1 addition & 1 deletion apps/front/src/libs/hooks/useWindowSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const useWindowSize = (): { width: number; height: number } => {
const [size, setSize] = useState(
isBrowser()
? { width: window.innerWidth, height: window.innerHeight }
: { width: null, height: null }
: { width: null, height: null },
)
useEffect(() => {
const handler = () => {
Expand Down
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} />)}</>
)
11 changes: 0 additions & 11 deletions apps/front/src/server/helpers/ViteDevScripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@ import * as React from "react"

export const ViteDevScripts = () => {
if (process.env.NODE_ENV !== "development") return null
const base = process.env.VITE_APP_BASE || "/"
return (
<>
{/* typescript plugin */}
<script
type="module"
dangerouslySetInnerHTML={{
__html: `
import { inject } from "/@vite-plugin-checker-runtime";
inject({ overlayConfig: {}, base: "${base}"});`,
}}
/>

{/* vite HMR */}
<script type="module" src="/@vite/client"></script>

Expand Down
2 changes: 1 addition & 1 deletion apps/front/src/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $breakpoint-desktop: 1680px;

:root {
// DO NOT TOUCH
// .propertyViewport(--font-size, 1);
// .propertyViewport(--font-size, 1);

// Ratio variables
--viewport-reference-width: $viewport-reference-width;
Expand Down
4 changes: 2 additions & 2 deletions apps/front/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ html {

body {
font-family: sans-serif;
// @include font-roboto-regular;
// @include font-roboto-regular;
background: var(--color-bg);
color: var(--color-text);
// font-size: 16rem;
// font-size: 16rem;
}
3 changes: 0 additions & 3 deletions apps/front/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import config from "./config/config.js"
import debug from "@cher-ami/debug"
import react from "@vitejs/plugin-react-swc"
import { visualizer } from "rollup-plugin-visualizer"
// import checker from "vite-plugin-checker"
import buildDotenvPlugin from "./config/vite-plugins/vite-plugin-build-dotenv"
import buildHtaccessPlugin from "./config/vite-plugins/vite-plugin-build-htaccess"
import { viteChersiteCustomLogger } from "./config/vite-plugins/vite-chersite-custom-logger"
Expand Down Expand Up @@ -110,8 +109,6 @@ export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
plugins: [
react(),

// checker({ typescript: true, enableBuild: true, overlay: true, terminal: true }),

legacy({ targets: ["defaults", "not IE 11"] }),

buildDotenvPlugin({
Expand Down
Loading

0 comments on commit 11799da

Please sign in to comment.