How to use umi-build-dev - 9 common examples

To help you get started, we’ve selected a few umi-build-dev examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github umijs / umi / packages / umi / src / scripts / realDev.js View on Github external
// kill(3) Ctrl-\
process.once('SIGQUIT', () => onSignal('SIGQUIT'));
// kill(15) default
process.once('SIGTERM', () => onSignal('SIGTERM'));

function onSignal() {
  if (closed) return;
  closed = true;
  process.exit(0);
}

process.env.NODE_ENV = 'development';

const args = yParser(process.argv.slice(2));
const Service = require('umi-build-dev/lib/Service').default;
new Service(buildDevOpts(args)).run('dev', args);
github umijs / umi / packages / umi / src / cli.js View on Github external
'--help': 'help',
};

spinner.succeed();

switch (script) {
  case 'build':
  case 'dev':
  case 'test':
  case 'inspect':
    // eslint-disable-next-line import/no-dynamic-require
    require(`./scripts/${script}`);
    break;
  default: {
    const Service = require('umi-build-dev/lib/Service').default;
    new Service(buildDevOpts(args)).run(aliasMap[script] || script, args);
    break;
  }
}
github umijs / umi / packages / umi / src / cli.js View on Github external
'-h': 'help',
  '--help': 'help',
};

switch (script) {
  case 'build':
  case 'dev':
  case 'test':
  case 'inspect':
  case 'ui':
    // eslint-disable-next-line import/no-dynamic-require
    require(`./scripts/${script}`);
    break;
  default: {
    const Service = require('umi-build-dev/lib/Service').default;
    new Service(buildDevOpts(args)).run(aliasMap[script] || script, args);
    break;
  }
}
github umijs / father-doc / packages / umi-plugin-father-doc / src / transformer / index.ts View on Github external
jsx(raw: string): TransformResult {
    return {
      // discard frontmatter for source code display
      content: raw.replace(FRONT_COMMENT_EXP, ''),
      config: getYamlConfig(raw),
    };
  },
  tsx(raw: string): TransformResult {
github umijs / umi / packages / umi / src / scripts / dev.js View on Github external
import fork from 'umi-build-dev/lib/fork';

const child = fork(require.resolve('./realDev.js'));
child.on('message', data => {
  if (process.send) {
    process.send(data);
  }
});
child.on('exit', code => {
  if (code === 1) {
    process.exit(1);
  }
});

process.on('SIGINT', () => {
  child.kill('SIGINT');
});
github umijs / umi / packages / umi / src / scripts / build.js View on Github external
import yParser from 'yargs-parser';
import buildDevOpts from '../buildDevOpts';

process.env.NODE_ENV = 'production';
process.env.UMI_UI = 'none';

const args = yParser(process.argv.slice(2));
const Service = require('umi-build-dev/lib/Service').default;
new Service(buildDevOpts(args)).run('build', args);
github umijs / umi / packages / umi / src / build.js View on Github external
export default function(opts = {}) {
  return require('umi-build-dev/lib/build').default(
    buildDevOpts({
      ...opts,
    }),
  );
}
github umijs / umi / packages / umi / src / dev.js View on Github external
export default function(opts = {}) {
  return require('umi-build-dev/lib/dev').default(buildDevOpts(opts));
}
github lemol / umi-plugin-apollo / src / commands / generate / generators / page / index.js View on Github external
export default api => {
  const PageGenerator = makePageGenerator(api);
  const { paths, config } = api;

  return class Generator extends api.Generator {
    constructor(args, options) {
      super(args, options);
      const pageGeneratorOptions = {
        ...options,
        resolved: require.resolve('umi-build-dev/lib/plugins/commands/generate/generators/page'),
      };
      this.pageGenerator = new PageGenerator(args, pageGeneratorOptions);
    }

    writing() {
      this.pageGenerator.writing();

      const pagePath = this.args[0].toString();