-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathset_xgpu_dev.js
More file actions
22 lines (16 loc) · 810 Bytes
/
set_xgpu_dev.js
File metadata and controls
22 lines (16 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import fs from 'fs';
import path from 'path';
import { fileURLToPath, pathToFileURL } from 'url';
// Obtenir le chemin du module actuel
const currentDir = path.dirname(fileURLToPath(import.meta.url));
// Chemin vers le projet xgpu
const XGPU_PATH = path.join(currentDir, './');
const PACKAGE_JSON_PATH = pathToFileURL(path.join(XGPU_PATH, 'package.json')).href;
// Lire le package.json de xgpu de manière synchrone
const packageJsonData = fs.readFileSync(fileURLToPath(PACKAGE_JSON_PATH), 'utf-8');
const packageJson = JSON.parse(packageJsonData);
// Modifier les champs nécessaires
packageJson.main = "src/index.ts";
packageJson.types = "src/index.ts";
// Écrire les modifications dans le package.json de xgpu
fs.writeFileSync(fileURLToPath(PACKAGE_JSON_PATH), JSON.stringify(packageJson, null, 2));