slicejs-cli 3.7.0 → 3.7.1

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.
@@ -230,7 +230,7 @@ export default async function initializeProject(options = {}) {
230
230
  const srcDir = path.join(sliceBaseDir, 'src');
231
231
 
232
232
  try {
233
- if (fs.existsSync(destinationApi)) throw new Error(`The "api" directory already exists: ${destinationApi}`);
233
+ if (fs.existsSync(path.join(destinationApi, 'index.js'))) throw new Error(`api/index.js already exists: ${path.join(destinationApi, 'index.js')}`);
234
234
  if (fs.existsSync(destinationSrc)) throw new Error(`The "src" directory already exists: ${destinationSrc}`);
235
235
  } catch (error) {
236
236
  Print.error('Validating destination directories:', error.message);
@@ -238,14 +238,16 @@ export default async function initializeProject(options = {}) {
238
238
  return;
239
239
  }
240
240
 
241
- // 1. COPY API FOLDER (keep original logic)
242
- const apiSpinner = ora('Copying API structure...').start();
241
+ // 1. COPY ONLY api/index.js — el resto se importa desde el paquete
242
+ const apiSpinner = ora('Creating api/index.js...').start();
243
243
  try {
244
- if (!fs.existsSync(apiDir)) throw new Error(`API folder not found: ${apiDir}`);
245
- await fs.copy(apiDir, destinationApi, { recursive: true });
246
- apiSpinner.succeed('API structure created successfully');
244
+ const srcIndex = path.join(apiDir, 'index.js');
245
+ if (!fs.existsSync(srcIndex)) throw new Error(`api/index.js not found: ${srcIndex}`);
246
+ await fs.ensureDir(destinationApi);
247
+ await fs.copy(srcIndex, path.join(destinationApi, 'index.js'));
248
+ apiSpinner.succeed('api/index.js created successfully');
247
249
  } catch (error) {
248
- apiSpinner.fail('Error copying API structure');
250
+ apiSpinner.fail('Error creating api/index.js');
249
251
  Print.error(error.message);
250
252
  console.error(error.stack);
251
253
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-cli",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "Command client for developing web applications with Slice.js framework",
5
5
  "main": "client.js",
6
6
  "bin": {