mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
use node-logger instead of console
This commit is contained in:
parent
d20da16167
commit
44ec036d32
@ -28,6 +28,7 @@
|
||||
"@storybook/addons": "^3.4.0-alpha.4",
|
||||
"@storybook/channel-postmessage": "^3.4.0-alpha.4",
|
||||
"@storybook/core": "^3.4.0-alpha.4",
|
||||
"@storybook/node-logger": "^3.4.0-alpha.4",
|
||||
"@storybook/ui": "^3.4.0-alpha.4",
|
||||
"airbnb-js-shims": "^1.1.1",
|
||||
"angular2-template-loader": "^0.6.2",
|
||||
|
7
app/angular/src/server/angular-cli_config.js
vendored
7
app/angular/src/server/angular-cli_config.js
vendored
@ -1,7 +1,6 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const logger = console;
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
|
||||
function isAngularCliInstalled() {
|
||||
try {
|
||||
|
4
app/angular/src/server/babel_config.js
vendored
4
app/angular/src/server/babel_config.js
vendored
@ -1,11 +1,9 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import JSON5 from 'json5';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
import defaultConfig from './config/babel';
|
||||
|
||||
// avoid ESLint errors
|
||||
const logger = console;
|
||||
|
||||
function removeReactHmre(presets) {
|
||||
const index = presets.indexOf('react-hmre');
|
||||
if (index > -1) {
|
||||
|
8
app/angular/src/server/build.js
vendored
8
app/angular/src/server/build.js
vendored
@ -4,6 +4,7 @@ import path from 'path';
|
||||
import fs from 'fs';
|
||||
import chalk from 'chalk';
|
||||
import shelljs from 'shelljs';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
import packageJson from '../../package.json';
|
||||
import getBaseConfig from './config/webpack.config.prod';
|
||||
import loadConfig from './config';
|
||||
@ -11,9 +12,6 @@ import { parseList, getEnvConfig } from './utils';
|
||||
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
||||
|
||||
// avoid ESLint errors
|
||||
const logger = console;
|
||||
|
||||
program
|
||||
.version(packageJson.version)
|
||||
.option('-s, --static-dir <dir-names>', 'Directory where to load static files from', parseList)
|
||||
@ -66,13 +64,13 @@ if (program.staticDir) {
|
||||
logger.error(`Error: no such directory to load static files: ${dir}`);
|
||||
process.exit(-1);
|
||||
}
|
||||
logger.log(`=> Copying static files from: ${dir}`);
|
||||
logger.info(`=> Copying static files from: ${dir}`);
|
||||
shelljs.cp('-r', `${dir}/*`, outputDir);
|
||||
});
|
||||
}
|
||||
|
||||
// compile all resources with webpack and write them to the disk.
|
||||
logger.log('Building storybook ...');
|
||||
logger.info('Building storybook ...');
|
||||
webpack(config).run((err, stats) => {
|
||||
if (err || stats.hasErrors()) {
|
||||
logger.error('Failed to build the storybook');
|
||||
|
4
app/angular/src/server/config.js
vendored
4
app/angular/src/server/config.js
vendored
@ -1,6 +1,7 @@
|
||||
/* eslint-disable global-require, import/no-dynamic-require */
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
import loadBabelConfig from './babel_config';
|
||||
import loadTsConfig from './ts_config';
|
||||
import {
|
||||
@ -8,9 +9,6 @@ import {
|
||||
applyAngularCliWebpackConfig,
|
||||
} from './angular-cli_config';
|
||||
|
||||
// avoid ESLint errors
|
||||
const logger = console;
|
||||
|
||||
// `baseConfig` is a webpack configuration bundled with storybook.
|
||||
// Storybook will look in the `configDir` directory
|
||||
// (inside working directory) if a config path is not provided.
|
||||
|
5
app/angular/src/server/index.js
vendored
5
app/angular/src/server/index.js
vendored
@ -8,14 +8,13 @@ import path from 'path';
|
||||
import fs from 'fs';
|
||||
import chalk from 'chalk';
|
||||
import shelljs from 'shelljs';
|
||||
import { logger } from '@storybook/node-logger';
|
||||
import storybook, { webpackValid } from './middleware';
|
||||
import packageJson from '../../package.json';
|
||||
import { parseList, getEnvConfig } from './utils';
|
||||
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
const logger = console;
|
||||
|
||||
program
|
||||
.version(packageJson.version)
|
||||
.option('-p, --port [number]', 'Port to run Storybook (Required)', parseInt)
|
||||
@ -105,7 +104,7 @@ if (program.staticDir) {
|
||||
logger.error(`Error: no such directory to load static files: ${staticPath}`);
|
||||
process.exit(-1);
|
||||
}
|
||||
logger.log(`=> Loading static files from: ${staticPath} .`);
|
||||
logger.info(`=> Loading static files from: ${staticPath} .`);
|
||||
app.use(express.static(staticPath, { index: false }));
|
||||
|
||||
const faviconPath = path.resolve(staticPath, 'favicon.ico');
|
||||
|
4
app/angular/src/server/ts_config.js
vendored
4
app/angular/src/server/ts_config.js
vendored
@ -1,8 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
// avoid ESLint errors
|
||||
const logger = console;
|
||||
import { logger } from '@storybook/node-logger';
|
||||
|
||||
function resolveTsConfig(tsConfigPath) {
|
||||
if (!fs.existsSync(tsConfigPath)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user