Exemple #1
0
compiler.plugin('done', function (stats) {
  clearConsole();

  var hasErrors = stats.hasErrors();
  var hasWarnings = stats.hasWarnings();

  if (!hasErrors && !hasWarnings) {

    console.log(chalk.green('Compiled successfully!'));
    console.log('\nThe app is running at:');
    console.log('\n    ' + chalk.cyan('http://localhost:' + port + '/'));
    console.log('\nTo create production build, run:');
    console.log('\n    elm-app build');
    return;
  }

  if (hasErrors) {
    console.log(chalk.red('Compilation failed.\n'));

    var json = formatWebpackMessages(stats.toJson({}, true));

    json.errors.forEach(function (message) {
      console.log(message);
      console.log();
    });
  }
});
Exemple #2
0
  compiler.plugin('done', stats => {
    clearConsole();

    const jsonStats = stats.toJson({}, true);
    const messages = formatWebpackMessages(jsonStats);
    const seconds = jsonStats.time / 1000;
    if (!messages.errors.length && !messages.warnings.length) {
      console.log(chalk.green('Compiled successfully!'));
      console.log('Duration: ' + seconds.toFixed(2) + 's');
      console.log();
      console.log('The app is running at:');
      console.log();
      console.log('  ' + chalk.cyan(protocol + '://' + host + ':' + port + '/'));
      console.log();
    }

    if (messages.errors.length) {
      console.log(chalk.red('Failed to compile.'));
      console.log();
      messages.errors.forEach(message => {
        console.log(message);
        console.log();
      });
    }
  });
Exemple #3
0
  devServer.listen(port, (err, result) => {
    if (err) {
      return console.log(err);
    }

    clearConsole();
    console.log(chalk.cyan("Starting the development server on", `http://${host}:${port}`));
    console.log();
  });
Exemple #4
0
  devServer.listen(port, err => {
    if (err) {
      console.log(err);
      return;
    }

    clearConsole();
    console.log(chalk.cyan('Starting the development server...'));
    console.log();
  });
Exemple #5
0
 compiler.plugin('invalid', () => {
   if (isInteractive) {
     clearConsole();
   }
   console.log('Compiling...');
   send({
     type: 'sdk_status',
     message: 'dev_compiler_compiling',
   });
 });
 compiler.plugin('invalid', params => {
   WEBPACK_DONE = false;
   if (!WEBPACK_COMPILING) {
     if (!this.verbose) {
       clearConsole();
     }
     logger.start('Compiling...');
     WEBPACK_COMPILING = true;
   }
 });
Exemple #7
0
  devServer.listen(port, (err, result) => {
    if (err) {
      return console.log(err);
    }

    clearConsole();
    console.log(chalk.cyan('Starting the development server...'));
    console.log();
    openBrowser(protocol + '://' + host + ':' + port + '/');
  });
 devServer.listen(port, HOST, err => {
   if (err) {
     return console.log(err);
   }
   if (isInteractive) {
     clearConsole();
   }
   console.log(chalk.cyan('Starting the development server...\n'));
   openBrowser(urls.localUrlForBrowser);
 });
Exemple #9
0
 devServer.listen(port, HOST, err => {
     if (err) {
         return console.error(err);
     }
     if (isInteractive) {
         clearConsole();
     }
     console.log(chalk.cyan('Starting the development server...\n'));
     console.log(chalk.cyan('启动服务中...\n'));
     openBrowser(`http://${HOST}:${PORT}`);
 });
 devServer.listen(port, HOST, err => {
   if (err) {
     return console.log(err);
   }
   if (isInteractive) {
     clearConsole();
   }
   console.log(chalk.cyan('Starting the development server...\n'));
   if (process.env.BUILD_TARGET === 'web' && AUTO_OPEN_BROWSER) {
     openBrowser(urls.localUrlForBrowser);
   }
 });
  compiler.plugin('done', function(stats) {
    if (isInteractive) {
      clearConsole();
    }

    // We have switched off the default Webpack output in WebpackDevServer
    // options so we are going to "massage" the warnings and errors and present
    // them in a readable focused way.
    var messages = formatWebpackMessages(stats.toJson({}, true));
    var isSuccessful = !messages.errors.length && !messages.warnings.length;
    var showInstructions = isSuccessful && (isInteractive || isFirstCompile);

    if (isSuccessful) {
      console.log(chalk.green('Compiled successfully!'));
    }

    if (showInstructions) {
      console.log();
      console.log('The app is running at:');
      console.log();
      console.log('  ' + chalk.cyan(protocol + '://' + host + ':' + port + '/'));
      console.log();
      console.log('Note that the development build is not optimized.');
      console.log('To create a production build, use ' + chalk.cyan(cli + ' run build') + '.');
      console.log();
      isFirstCompile = false;
    }

    // If errors exist, only show errors.
    if (messages.errors.length) {
      console.log(chalk.red('Failed to compile.'));
      console.log();
      messages.errors.forEach(message => {
        console.log(message);
        console.log();
      });
      return;
    }

    // Show warnings if no errors were found.
    if (messages.warnings.length) {
      console.log(chalk.yellow('Compiled with warnings.'));
      console.log();
      messages.warnings.forEach(message => {
        console.log(message);
        console.log();
      });
      // Teach some ESLint tricks.
      console.log('You may use special comments to disable some warnings.');
      console.log('Use ' + chalk.yellow('// eslint-disable-next-line') + ' to ignore the next line.');
      console.log('Use ' + chalk.yellow('/* eslint-disable */') + ' to ignore all warnings in a file.');
    }
  });
Exemple #12
0
 compiler.plugin('invalid', () => {
   if (isInteractive) {
     clearConsole();
   }
   console.log('Compiling...');
   send({
     action: 'update_project',
     message: 'compiler_compiling',
     data: {
       statusCompile: 'compiling',
     },
   });
 });
    devServer.listen(port, HOST, err => {
      if (err) {
        return console.log(err);
      }
      if (isInteractive) {
        clearConsole();
      }
      console.log(chalk.cyan('Starting the development server...\n'));
      mainWindow = new BrowserWindow({ width: 1024, height: 728 });

      mainWindow.loadURL(`http://localhost:8080`);
    
      mainWindow.on('closed', () => {
        mainWindow = null;
      });
    });
Exemple #14
0
detect(DEFAULT_PORT).then(port => {
  if (port === DEFAULT_PORT) {
    run(port);
    return;
  }

  clearConsole();
  var question =
    chalk.yellow("Something is already running on port " + DEFAULT_PORT + ".") +
    "\n\nWould you like to run the app on another port instead?";

  prompt(question, true).then(shouldChangePort => {
    if (shouldChangePort) {
      run(port);
    }
  });
});
    compiler.plugin('done', stats => {
      const rawMessages = stats.toJson({}, true);
      const messages = formatWebpackMessages(rawMessages);
      WEBPACK_COMPILING = false;
      if (!messages.errors.length && !messages.warnings.length) {
        if (!WEBPACK_DONE) {
          if (!this.verbose) {
            clearConsole();
          }
          logger.done('Compiled successfully');
          WEBPACK_DONE = true;

          if (this.onSuccessMessage) {
            logger.log(this.onSuccessMessage);
            logger.log('');
          }
        }
      }

      if (
        messages.errors.length &&
        !(
          rawMessages.errors &&
          rawMessages.errors.length > 0 &&
          (rawMessages.errors[0].includes('assets.json') ||
            rawMessages.errors[0].includes("Module not found: Can't resolve"))
        )
      ) {
        messages.errors.forEach(e => {
          logger.error(
            `Failed to compile ${this.target} with ${messages.errors
              .length} errors`,
            e
          );
        });
        // return;
      }

      if (messages.warnings.length) {
        logger.warn(
          `Failed to compile with ${messages.warnings.length} warnings`
        );
        messages.warnings.forEach(w => logger.log(w));
      }
    });
Exemple #16
0
  compiler.plugin("done", function(stats) {
    clearConsole();

    // We have switched off the default Webpack output in WebpackDevServer
    // options so we are going to "massage" the warnings and errors and present
    // them in a readable focused way.
    var messages = formatWebpackMessages(stats.toJson({}, true));
    if (!messages.errors.length && !messages.warnings.length) {
      console.log(chalk.green("Compiled successfully!"));
      console.log();
      console.log("The app is running at:");
      console.log();
      console.log("  " + chalk.cyan(protocol + "://" + host + ":" + port + "/"));
      console.log();
      console.log("Note that the development build is not optimized.");
      console.log("To create a production build, use " + chalk.cyan("npm run build") + ".");
      console.log();
    }

    // If errors exist, only show errors.
    if (messages.errors.length) {
      console.log(chalk.red("Failed to compile."));
      console.log();
      messages.errors.forEach(message => {
        console.log(message);
        console.log();
      });
      return;
    }

    // Show warnings if no errors were found.
    if (messages.warnings.length) {
      console.log(chalk.yellow("Compiled with warnings."));
      console.log();
      messages.warnings.forEach(message => {
        console.log(message);
        console.log();
      });
      // Teach some ESLint tricks.
      console.log("You may use special comments to disable some warnings.");
      console.log("Use " + chalk.yellow("// eslint-disable-next-line") + " to ignore the next line.");
      console.log("Use " + chalk.yellow("/* eslint-disable */") + " to ignore all warnings in a file.");
    }
  });
Exemple #17
0
function forNewConsent() {
  clearConsole();
  console.log(
    wrap(
      '👋  Welcome to Slate! During the alpha, we would like to gather usage analytics, such as interactions with Slate commands, performance reports, and error occurances. The data does not include any sensitive information. The detailed list of data we gather can be found at:',
      {width: 80, indent: ''},
    ),
  );
  console.log(
    chalk.cyan(
      '\n  https://github.com/Shopify/slate/wiki/Slate-Analytics',
    ),
  );
  console.log();

  question.message = 'To continue, please enter your email address:';

  return inquirer.prompt(question);
}
Exemple #18
0
    devServer.listen(port, HOST, err => {
      if (err) {
        return console.log(err);
      }
      if (isInteractive) {
        clearConsole();
      }
      console.log(chalk.cyan('Starting the development server...\n'));

      makeDevUrlFile(urls.lanUrlForTerminal);

      logPlatformInfo();
      compiler.plugin('done', () => {
        // ...after react dev server clears screen again
        logPlatformInfo();
      });

      if (!isTargetingCordova && !isTargetingElectron) {
        openBrowser(urls.localUrlForBrowser);
      }
    });
Exemple #19
0
async function init() {
  let config = rc.get() || rc.generate();

  if (process.env.NODE_ENV === 'test') {
    return config;
  }

  // Check if we need to ask for consent
  if (
    typeof config.tracking === 'undefined' ||
    config.trackingVersion < packageJson.trackingVersion
  ) {
    if (typeof config.tracking === 'undefined') {
      // If new user
      const answers = await prompt.forNewConsent();
      config = Object.assign({}, config, answers, {
        tracking: true,
        trackingVersion: packageJson.trackingVersion,
      });
      rc.update(config);
      event('slate-analytics:new-user', config);
    } else {
      // If existing user an needs to update consent
      event('slate-analytics:renew-consent-prompt', config);
      const answers = await prompt.forUpdatedConsent();
      config = Object.assign({}, config, answers, {
        tracking: true,
        trackingVersion: packageJson.trackingVersion,
      });
      rc.update(config);
      event('slate-analytics:renew-consent-true', config);
    }

    clearConsole();
    console.log(`Thanks for helping improve the Slate development experience!`);
  }

  return config;
}
Exemple #20
0
    devServer.listen(port, HOST, err => {
      if (err) {
        return console.log(err);
      }
      if (isInteractive) {
        clearConsole();
      }

      // We used to support resolving modules according to `NODE_PATH`.
      // This now has been deprecated in favor of jsconfig/tsconfig.json
      // This lets you use absolute paths in imports inside large monorepos:
      if (process.env.NODE_PATH) {
        console.log(
          chalk.yellow(
            'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
          )
        );
        console.log();
      }

      console.log(chalk.cyan('Starting the development server...\n'));
      openBrowser(urls.localUrlForBrowser);
    });
detect(DEFAULT_PORT).then(port => {
  if (port === DEFAULT_PORT) {
    run(port);
    return;
  }

  if (isInteractive) {
    clearConsole();
    var existingProcess = getProcessForPort(DEFAULT_PORT);
    var question =
      chalk.yellow('Something is already running on port ' + DEFAULT_PORT + '.' +
        ((existingProcess) ? ' Probably:\n  ' + existingProcess : '')) +
        '\n\nWould you like to run the app on another port instead?';

    prompt(question, true).then(shouldChangePort => {
      if (shouldChangePort) {
        run(port);
      }
    });
  } else {
    console.log(chalk.red('Something is already running on port ' + DEFAULT_PORT + '.'));
  }
});
Exemple #22
0
 compiler.plugin('invalid', () => {
   clearConsole();
   console.log('Compiling...');
 });
Exemple #23
0
 compiler.plugin("invalid", function() {
   clearConsole();
   console.log("Compiling...");
 });
Exemple #24
0
 compiler.plugin('invalid', function() {
   clearConsole();
   console.log('Compiling...');
 });
Exemple #25
0
  compiler.plugin('done', (stats) => {
    if (isInteractive) {
      clearConsole();
    }
    if (isFirstCompile) {
      send({
        type: 'sdk_status',
        message: 'dev_server_finished',
        data: {
          url: `http://${LOCAL_IP}:${PORT}`,
        },
      });

      isFirstCompile = false;
      console.log(chalk.cyan('Starting the development server...'));
      console.log('   ', chalk.yellow(`http://localhost:${PORT}`));
      console.log('   ', chalk.yellow(`http://${LOCAL_IP}:${PORT}`));
    }

    console.log(
      stats.toString({
        colors: true,
        chunks: false,
        assets: true,
        children: false,
        modules: false,
      })
    );

    const json = stats.toJson({}, true);
    const messages = formatWebpackMessages(json);
    const isSuccessful = !messages.errors.length && !messages.warnings.length;

    if (isSuccessful) {
      if (stats.stats) {
        console.log(chalk.green('Compiled successfully'));
      } else {
        console.log(
          chalk.green(
            `Compiled successfully in ${(json.time / 1000).toFixed(1)}s!`
          )
        );
      }
    }

    if (messages.errors.length) {
      if (messages.errors.length > 1) {
        messages.errors.length = 1;
      }
      console.log(chalk.red('Failed to compile.\n'));
      console.log(messages.errors.join('\n\n'));
    } else if (messages.warnings.length) {
      console.log(chalk.yellow('Compiled with warnings.'));
      console.log();
      messages.warnings.forEach((message) => {
        console.log(message);
        console.log();
      });
      // Teach some ESLint tricks.
      console.log('You may use special comments to disable some warnings.');
      console.log(
        `Use ${chalk.yellow(
          '// eslint-disable-next-line'
        )} to ignore the next line.`
      );
      console.log(
        `Use ${chalk.yellow(
          '/* eslint-disable */'
        )} to ignore all warnings in a file.`
      );
      console.log();
    }

    if (isSuccessful) {
      // 服务启动完成切没有任务错误与警告
      send({
        type: 'sdk_status',
        message: 'dev_compiler_success',
        data: {
          url: `http://${LOCAL_IP}:${PORT}`,
        },
      });
    } else {
      // 服务启动完成切没有任务错误与警告
      send({
        type: 'sdk_status',
        message: 'dev_compiler_failed',
        data: {
          url: `http://${LOCAL_IP}:${PORT}`,
        },
      });
    }
  });
 compiler.plugin('invalid', function() {
   if (isInteractive) {
     clearConsole();
   }
   console.log('Compiling...');
 });