mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-18 05:02:24 +08:00
refactor(core): migrate cli
to TS
This commit is contained in:
parent
fb9f801048
commit
1b8a469471
@ -3,7 +3,7 @@ import chalk from 'chalk';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
import { parseList, getEnvConfig, checkDeprecatedFlags } from './utils';
|
||||
|
||||
async function getCLI(packageJson) {
|
||||
async function getCLI(packageJson: { version: string; name: string }) {
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
program
|
@ -3,7 +3,7 @@ import chalk from 'chalk';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
import { parseList, getEnvConfig, checkDeprecatedFlags } from './utils';
|
||||
|
||||
function getCLI(packageJson) {
|
||||
function getCLI(packageJson: { version: string; name: string }) {
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
||||
|
||||
program
|
@ -1,11 +1,11 @@
|
||||
import deprecate from 'util-deprecate';
|
||||
import dedent from 'ts-dedent';
|
||||
|
||||
export function parseList(str) {
|
||||
export function parseList(str: string) {
|
||||
return str.split(',');
|
||||
}
|
||||
|
||||
export function getEnvConfig(program, configEnv) {
|
||||
export function getEnvConfig(program: Record<string, any>, configEnv: Record<string, any>) {
|
||||
Object.keys(configEnv).forEach((fieldName) => {
|
||||
const envVarName = configEnv[fieldName];
|
||||
const envVarValue = process.env[envVarName];
|
||||
@ -24,7 +24,11 @@ const warnDLLsDeprecated = deprecate(
|
||||
`
|
||||
);
|
||||
|
||||
export function checkDeprecatedFlags(options) {
|
||||
export function checkDeprecatedFlags(options: {
|
||||
dlls?: boolean;
|
||||
uiDll?: boolean;
|
||||
docsDll?: boolean;
|
||||
}) {
|
||||
if (!options.dlls || options.uiDll || options.docsDll) {
|
||||
warnDLLsDeprecated();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user