chore: init oxc

This commit is contained in:
Julien Calixte
2026-03-28 09:34:04 +01:00
parent d457fd4064
commit 8e8706e258
19 changed files with 830 additions and 192 deletions

View File

@@ -3,42 +3,43 @@
// Script pour changer facilement le thème sombre de l'application Remanso
// Usage: pnpm run theme:dark [theme-name]
import { readFileSync, writeFileSync } from "fs"
import { join } from "path"
import { commitTheme } from "./change-theme"
import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
import { commitTheme } from './change-theme'
// Chemins vers les fichiers
const themeConfigPath = join(__dirname, "..", "src", "theme.config.ts")
const appCssPath = join(__dirname, "..", "src", "styles", "app.css")
const themeConfigPath = join(__dirname, '..', 'src', 'theme.config.ts')
const appCssPath = join(__dirname, '..', 'src', 'styles', 'app.css')
// Vérifier les arguments
if (process.argv.length < 3) {
console.log("Usage: pnpm run theme:dark [theme-name]")
console.log("Exemple: pnpm run theme:dark business")
console.log('Usage: pnpm run theme:dark [theme-name]')
console.log('Exemple: pnpm run theme:dark business')
process.exit(1)
}
// Mode fixé à dark pour ce script
const mode = "dark"
const mode = 'dark'
const newTheme = process.argv[2] // nom du nouveau thème
// Lire le contenu actuel du fichier de configuration
let themeConfigContent = readFileSync(themeConfigPath, "utf8")
let themeConfigContent = readFileSync(themeConfigPath, 'utf8')
// Remplacer la valeur du thème sombre
themeConfigContent = themeConfigContent.replace(
/dark:\s*['"][^'"]*['"],/,
`dark: '${newTheme}',`,
`dark: '${newTheme}',`
)
// Écrire le contenu mis à jour dans le fichier
writeFileSync(themeConfigPath, themeConfigContent)
// Mettre à jour également le fichier app.css pour le thème --prefersdark
let appCssContent = readFileSync(appCssPath, "utf8")
let appCssContent = readFileSync(appCssPath, 'utf8')
appCssContent = appCssContent.replace(
/(\s+)([a-zA-Z0-9-]+)(\s+--prefersdark;)/,
`$1${newTheme}$3`,
`$1${newTheme}$3`
)
writeFileSync(appCssPath, appCssContent)

View File

@@ -3,51 +3,52 @@
// Script pour changer facilement le thème clair de l'application Remanso
// Usage: pnpm run theme:light [theme-name]
import { readFileSync, writeFileSync } from "fs"
import { join } from "path"
import { commitTheme } from "./change-theme"
import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
import { commitTheme } from './change-theme'
// Chemins vers les fichiers
const themeConfigPath = join(__dirname, "..", "src", "theme.config.ts")
const indexPath = join(__dirname, "..", "index.html")
const appCssPath = join(__dirname, "..", "src", "styles", "app.css")
const themeConfigPath = join(__dirname, '..', 'src', 'theme.config.ts')
const indexPath = join(__dirname, '..', 'index.html')
const appCssPath = join(__dirname, '..', 'src', 'styles', 'app.css')
// Vérifier les arguments
if (process.argv.length < 3) {
console.log("Usage: pnpm run theme:light [theme-name]")
console.log("Exemple: pnpm run theme:light cupcake")
console.log('Usage: pnpm run theme:light [theme-name]')
console.log('Exemple: pnpm run theme:light cupcake')
process.exit(1)
}
// Mode fixé à light pour ce script
const mode = "light"
const mode = 'light'
const newTheme = process.argv[2] // nom du nouveau thème
// Lire le contenu actuel du fichier de configuration
let themeConfigContent = readFileSync(themeConfigPath, "utf8")
let themeConfigContent = readFileSync(themeConfigPath, 'utf8')
// Remplacer la valeur du thème clair
themeConfigContent = themeConfigContent.replace(
/light:\s*['"][^'"]*['"],/,
`light: '${newTheme}',`,
`light: '${newTheme}',`
)
// Écrire le contenu mis à jour dans le fichier
writeFileSync(themeConfigPath, themeConfigContent)
// Mettre à jour également le fichier index.html
let indexContent = readFileSync(indexPath, "utf8")
let indexContent = readFileSync(indexPath, 'utf8')
indexContent = indexContent.replace(
/data-theme="[^"]*"/,
`data-theme="${newTheme}"`,
`data-theme="${newTheme}"`
)
writeFileSync(indexPath, indexContent)
// Mettre à jour également le fichier app.css pour le thème --default
let appCssContent = readFileSync(appCssPath, "utf8")
let appCssContent = readFileSync(appCssPath, 'utf8')
appCssContent = appCssContent.replace(
/(\s+)([a-zA-Z0-9-]+)(\s+--default,)/,
`$1${newTheme}$3`,
`$1${newTheme}$3`
)
writeFileSync(appCssPath, appCssContent)

View File

@@ -1,22 +1,22 @@
import { execSync } from "child_process"
import { execSync } from 'child_process'
export const commitTheme = (mode: string, newTheme: string) => {
// Créer un commit avec les changements
try {
// Ajouter tous les fichiers modifiés
execSync("git add .", { stdio: "inherit" })
execSync('git add .', { stdio: 'inherit' })
// Créer le commit avec le message approprié
const commitMessage = `design: change ${mode} theme to ${newTheme}`
execSync(`git commit -m "${commitMessage}"`, { stdio: "inherit" })
execSync(`git commit -m "${commitMessage}"`, { stdio: 'inherit' })
console.log(`Commit créé avec succès: "${commitMessage}"`)
execSync(`git push`, { stdio: "inherit" })
execSync(`git push`, { stdio: 'inherit' })
console.log(`Push sur origin`)
} catch (error) {
console.error("Erreur lors de la création du commit:", error)
console.error('Erreur lors de la création du commit:', error)
process.exit(1)
}
}