@bootmap/wpep-cli 1.0.0 → 1.0.2

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/bin/wpep.js CHANGED
@@ -26,7 +26,7 @@ program
26
26
  program
27
27
  .command('deploy')
28
28
  .description('Build and deploy your Next.js project to WordPress')
29
- .option('-d, --dir <dir>', 'The export directory to deploy', 'out')
29
+ .option('-d, --dir <dir>', 'The export directory to deploy')
30
30
  .option('-u, --url <url>', 'WordPress site URL (overrides .wpeprc)')
31
31
  .option('-k, --key <key>', 'WPEP API Key (overrides .wpeprc)')
32
32
  .option('--no-build', 'Skip running the build step')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bootmap/wpep-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "CLI tool for deploying Next.js static exports to WordPress via WP Elementor Publisher",
5
5
  "main": "bin/wpep.js",
6
6
  "type": "module",
@@ -30,12 +30,15 @@ export default async function deployCommand(options) {
30
30
  const config = JSON.parse(fs.readFileSync(rcPath, 'utf8'));
31
31
  url = url || config.url;
32
32
  key = key || config.key;
33
+ options.dir = options.dir || config.dir;
33
34
  } catch (e) {
34
35
  throw new Error('Could not read .wpeprc.json. Run "wpep init" first.');
35
36
  }
36
37
  }
37
38
  }
38
39
 
40
+ const outputDir = options.dir || 'out';
41
+
39
42
  if (!url || !key) {
40
43
  throw new Error('Missing WordPress URL or API Key. Run "wpep init" or provide --url and --key arguments.');
41
44
  }
@@ -54,9 +57,9 @@ export default async function deployCommand(options) {
54
57
  }
55
58
  }
56
59
 
57
- const outDir = path.join(process.cwd(), options.dir);
60
+ const outDir = path.join(process.cwd(), outputDir);
58
61
  if (!fs.existsSync(outDir)) {
59
- throw new Error(`Export directory "${options.dir}" does not exist. Did the build succeed?`);
62
+ throw new Error(`Export directory "${outputDir}" does not exist. Did the build succeed?`);
60
63
  }
61
64
 
62
65
  const spinner = ora('Preparing files for upload...').start();
@@ -41,6 +41,18 @@ export default async function initCommand() {
41
41
  }
42
42
  return true;
43
43
  }
44
+ },
45
+ {
46
+ type: 'input',
47
+ name: 'dir',
48
+ message: 'What is your export directory? (default: out)',
49
+ default: existingConfig.dir || 'out',
50
+ validate: (input) => {
51
+ if (input.trim() === '') {
52
+ return 'Directory is required';
53
+ }
54
+ return true;
55
+ }
44
56
  }
45
57
  ]);
46
58
 
@@ -49,7 +61,8 @@ export default async function initCommand() {
49
61
 
50
62
  const config = {
51
63
  url: cleanUrl,
52
- key: answers.key.trim()
64
+ key: answers.key.trim(),
65
+ dir: answers.dir.trim()
53
66
  };
54
67
 
55
68
  fs.writeFileSync(rcPath, JSON.stringify(config, null, 2));