create-web3cart-store 1.0.2 → 1.0.4
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/lib/config.js +5 -2
- package/lib/download.js +26 -25
- package/package.json +1 -1
package/lib/config.js
CHANGED
|
@@ -112,14 +112,17 @@ INSTALL_DATE=${new Date().toISOString()}
|
|
|
112
112
|
const envPath = path.join(targetDir, '.env');
|
|
113
113
|
fs.writeFileSync(envPath, envContent, 'utf8');
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
/*
|
|
116
|
+
// MOVED: The .installed file will be created by the web installer's Step 4
|
|
117
|
+
// to prevent the "Installation Complete" lock from triggering prematurely.
|
|
116
118
|
const installedPath = path.join(targetDir, '.installed');
|
|
117
119
|
fs.writeFileSync(installedPath, JSON.stringify({
|
|
118
120
|
installed_at: new Date().toISOString(),
|
|
119
121
|
method: 'cli',
|
|
120
|
-
version: '1.
|
|
122
|
+
version: '1.4.0',
|
|
121
123
|
skip_to_step: 4
|
|
122
124
|
}), 'utf8');
|
|
125
|
+
*/
|
|
123
126
|
|
|
124
127
|
// Store admin credentials for step 4 to use
|
|
125
128
|
if (admin) {
|
package/lib/download.js
CHANGED
|
@@ -117,34 +117,35 @@ async function extractPackage(zipPath, targetDir) {
|
|
|
117
117
|
try {
|
|
118
118
|
await extractZip(zipPath, { dir: targetDir });
|
|
119
119
|
|
|
120
|
-
// Check if files were extracted to a subdirectory
|
|
121
|
-
const items = fs.readdirSync(targetDir);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
continue;
|
|
120
|
+
// Check if files were extracted to a single subdirectory
|
|
121
|
+
const items = fs.readdirSync(targetDir).filter(item => item !== 'web3cart-temp.zip' && item !== '.DS_Store');
|
|
122
|
+
|
|
123
|
+
if (items.length === 1) {
|
|
124
|
+
const potentialDir = path.join(targetDir, items[0]);
|
|
125
|
+
if (fs.statSync(potentialDir).isDirectory()) {
|
|
126
|
+
const subItems = fs.readdirSync(potentialDir);
|
|
127
|
+
|
|
128
|
+
for (const item of subItems) {
|
|
129
|
+
const srcPath = path.join(potentialDir, item);
|
|
130
|
+
const destPath = path.join(targetDir, item);
|
|
131
|
+
|
|
132
|
+
// Force overwrite if it exists (CLI might have created some files)
|
|
133
|
+
if (fs.existsSync(destPath)) {
|
|
134
|
+
if (fs.statSync(destPath).isDirectory()) {
|
|
135
|
+
// Merge directories if needed (basic version)
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
fs.renameSync(srcPath, destPath);
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
|
|
142
|
+
// Remove the now-empty subdirectory
|
|
143
|
+
try {
|
|
144
|
+
fs.rmdirSync(potentialDir);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
// Ignore if not empty due to skipped items
|
|
147
|
+
}
|
|
144
148
|
}
|
|
145
|
-
|
|
146
|
-
// Remove empty subdirectory
|
|
147
|
-
fs.rmdirSync(subDir);
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
return true;
|