瀏覽代碼

remove extra script file

Olivier Massot 2 月之前
父節點
當前提交
4ee2d98e0a
共有 1 個文件被更改,包括 0 次插入60 次删除
  1. 0 60
      prepare/compileAbilitiesConfig.js

+ 0 - 60
prepare/compileAbilitiesConfig.js

@@ -1,60 +0,0 @@
-/**
- * Precompile the abilities config from Yaml to TS
- */
-import * as fs from 'fs'
-import * as path from 'path'
-import * as yaml from 'js-yaml'
-function loadYamlFile(filePath) {
-  try {
-    const fileContents = fs.readFileSync(filePath, 'utf8')
-    return yaml.load(fileContents)
-  } catch (error) {
-    console.error(`Error loading YAML file ${filePath}:`, error)
-    return {}
-  }
-}
-function compileAbilitiesConfig() {
-  const configDir = path.join(process.cwd(), 'config/abilities/pages')
-  const outputPath = path.join(
-    process.cwd(),
-    'config/abilities-config-precompiled.ts',
-  )
-  console.log('Starting abilities config compilation...')
-  // Read all YAML files from the pages directory
-  const yamlFiles = fs
-    .readdirSync(configDir)
-    .filter((file) => file.endsWith('.yaml'))
-  const compiledAbilities = {}
-  yamlFiles.forEach((file) => {
-    const filePath = path.join(configDir, file)
-    console.log(`Processing ${file}...`)
-    const config = loadYamlFile(filePath)
-    // Merge all abilities from this file into the compiled config
-    Object.assign(compiledAbilities, config)
-  })
-  // Generate TypeScript content
-  const header = `/**
- * AUTO-GENERATED FILE - DO NOT MODIFY MANUALLY
- *
- * This file is automatically generated from YAML configuration files
- * in config/abilities/pages/ directory.
- *
- * To make changes, edit the source YAML files and run the compilation script:
- * npm run compile:abilities
- *
- * Generated on: ${new Date().toISOString()}
- */
-
-`
-  const tsContent = `${header}export default ${JSON.stringify(compiledAbilities, null, 2)} as const
-`
-  // Write the compiled TypeScript file
-  fs.writeFileSync(outputPath, tsContent, 'utf8')
-  console.log(`✓ Abilities config compiled successfully to ${outputPath}`)
-  console.log(`✓ Processed ${yamlFiles.length} YAML files`)
-  console.log(
-    `✓ Generated ${Object.keys(compiledAbilities).length} ability definitions`,
-  )
-}
-// Run the compilation
-compileAbilitiesConfig()