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 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
- // Create .installed file to skip web installer steps 1-3
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.0.0',
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
- const extractedDir = items.find(item => {
123
- const itemPath = path.join(targetDir, item);
124
- return fs.statSync(itemPath).isDirectory() &&
125
- item !== 'node_modules' &&
126
- !item.startsWith('.');
127
- });
128
-
129
- // If extracted to subdirectory, move contents up
130
- if (extractedDir && items.length <= 3) { // zip, extracted folder, maybe .DS_Store
131
- const subDir = path.join(targetDir, extractedDir);
132
- const subItems = fs.readdirSync(subDir);
133
-
134
- for (const item of subItems) {
135
- const srcPath = path.join(subDir, item);
136
- const destPath = path.join(targetDir, item);
137
-
138
- if (fs.existsSync(destPath)) {
139
- // Skip if already exists
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
- fs.renameSync(srcPath, destPath);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-web3cart-store",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Create a Web3Cart crypto payment store with one command",
5
5
  "author": "Web3Cart <hello@web3cart.site>",
6
6
  "license": "MIT",