castle-web-cli 0.4.106 → 0.4.108

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/dist/save-deck.js CHANGED
@@ -96,11 +96,14 @@ export async function saveDeck(dir, opts = {}) {
96
96
  console.error('Not logged in. Run `castle-web login` first.');
97
97
  process.exit(1);
98
98
  }
99
- const visibility = opts.visibility ?? 'unlisted';
100
- if (visibility !== 'unlisted' && visibility !== 'private') {
101
- console.error(`Invalid visibility "${visibility}". Use unlisted or private.`);
99
+ // `--visibility` arrives as an unchecked string from the command line, so the
100
+ // declared type is no guarantee -- widen to validate what actually came in.
101
+ const requested = opts.visibility ?? 'unlisted';
102
+ if (requested !== 'unlisted' && requested !== 'private') {
103
+ console.error(`Invalid visibility "${requested}". Use unlisted or private.`);
102
104
  process.exit(1);
103
105
  }
106
+ const visibility = requested;
104
107
  const projectDir = path.resolve(dir);
105
108
  if (!fs.existsSync(path.join(projectDir, 'index.html'))) {
106
109
  console.error(`No index.html found in ${projectDir}`);