sg-frontend-starter 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/postinstall.js +11 -16
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -11,6 +11,7 @@ const source = path.join(__dirname);
|
|
|
11
11
|
const projectRoot = path.join(__dirname, '..', '..');
|
|
12
12
|
|
|
13
13
|
const targetPackageJson = path.join(projectRoot, 'package.json');
|
|
14
|
+
const sourcePackageJson = path.join(source, 'package.json');
|
|
14
15
|
|
|
15
16
|
if (fs.existsSync(source)) {
|
|
16
17
|
// Az sg-frontend-starter mappájában lévő összes fájlt és mappát másolja ki
|
|
@@ -39,29 +40,23 @@ if (fs.existsSync(source)) {
|
|
|
39
40
|
console.log('✓ sg-frontend-starter tartalma sikeresen áthelyezve');
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
// Biztosítja, hogy a cél package.json
|
|
43
|
-
|
|
43
|
+
// Biztosítja, hogy a cél package.json megegyezzen a sablonnal
|
|
44
|
+
syncPackageJson(targetPackageJson, sourcePackageJson);
|
|
44
45
|
|
|
45
|
-
function
|
|
46
|
-
if (!fs.existsSync(
|
|
46
|
+
function syncPackageJson(targetPath, templatePath) {
|
|
47
|
+
if (!fs.existsSync(templatePath)) {
|
|
48
|
+
console.error('Nem található a sablon package.json:', templatePath);
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
try {
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
+
const templateRaw = fs.readFileSync(templatePath, 'utf8');
|
|
54
|
+
const templatePkg = JSON.parse(templateRaw);
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!pkg.scripts.dev) {
|
|
59
|
-
pkg.scripts.dev = 'vite';
|
|
60
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
61
|
-
console.log('✓ dev script hozzáadva a package.json-hoz');
|
|
62
|
-
}
|
|
56
|
+
fs.writeFileSync(targetPath, JSON.stringify(templatePkg, null, 2) + '\n');
|
|
57
|
+
console.log('✓ package.json szinkronizálva a sablonnal');
|
|
63
58
|
} catch (error) {
|
|
64
|
-
console.error('Hiba a package.json
|
|
59
|
+
console.error('Hiba a package.json szinkronizálása során:', error);
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
62
|
|