Skip to content

Commit

Permalink
refactor(cli): migrate generate file to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanmaisse committed May 15, 2020
1 parent c7d14d7 commit a63cb5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cli/src/generate.js → lib/cli/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import path from 'path';
import chalk from 'chalk';
import envinfo from 'envinfo';
import leven from 'leven';
import pkg from '../package.json';
import initiate from './initiate';
import { add } from './add';
import { migrate } from './migrate';
import { extract } from './extract';

// Cannot be `import` as it's not under TS root dir
const pkg = require('../package.json');

const logger = console;

program
Expand Down Expand Up @@ -81,7 +83,7 @@ program.command('*', { noHelp: true }).action(() => {
const [, , invalidCmd] = process.argv;
logger.error(' Invalid command: %s.\n See --help for a list of available commands.', invalidCmd);
// eslint-disable-next-line
const availableCommands = program.commands.map(cmd => cmd._name);
const availableCommands = program.commands.map((cmd) => cmd._name);
const suggestion = availableCommands.find((cmd) => leven(cmd, invalidCmd) < 3);
if (suggestion) {
logger.log(`\n Did you mean ${suggestion}?`);
Expand Down
1 change: 1 addition & 0 deletions lib/cli/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module '@storybook/codemod';
declare module 'envinfo';

0 comments on commit a63cb5a

Please sign in to comment.