Example #1
0
 this._browser.on('status', function(info) {
     console.log(chalk.cyan(info));
 });
Example #2
0
/**
 * echo str > path.
 *
 * @param {String} path
 * @param {String} str
 */
function write(path, str) {
  fs.writeFile(path, str);
  console.log(chalk.cyan('   create:'), path);
}
Example #3
0
 stdout: function (out) {
     grunt.log.writeln(chalk.cyan('Ember-cli::') + out);
 },
Example #4
0
        callback(Error(r.errorMessage))
      }
      else {
        callback(null, r)
      }
    }
  })
}

var invoking = require.main === module
if (invoking) {

  var name = process.argv[2]
  var alias = process.argv[3]
  var payload = process.argv[4]

  console.log(chalk.green(' λ ') + chalk.dim('invoking ' + chalk.cyan(name)))

  invoke(name, alias, payload, (err, res)=> {
    if (err) {
      console.error(chalk.red(err))
    }
    else {
      var j = JSON.stringify(res, null, 2)
      console.log(chalk.green(j))
    }
  })
}

module.exports = invoke
Example #5
0
 infos.forEach(function (marketInfo) {
   var endTime = marketInfo.endTime;
   var date = new Date(endTime * 1000);
   console.log(chalk.green.dim("ID:"), chalk.green.dim(marketInfo.id), chalk.green(marketInfo.description));
   console.log(chalk.cyan("endTime:"), chalk.cyan(endTime), chalk.red(date), chalk.white(marketInfo.marketType), chalk.blue(marketInfo.reportingState), chalk.red("DR:"), chalk.red(marketInfo.designatedReporter), "\n");
 });
Example #6
0
Logger.prototype.user = function(message) {
  this._log(chalk.cyan(message));
};
Example #7
0
  webpack(config).run((err, stats) => {
    if (err) {
      console.error('Failed to create a production build. Reason:')
      console.error(err.message || err)
      process.exit(1)
    }

    console.log(chalk.green('Compiled successfully.'))
    console.log()

    console.log('File sizes after gzip:')
    console.log()

    // Print a detailed summary of build files.
    printFileSizes(stats, previousSizeMap)

    console.log()

    var openCommand = process.platform === 'win32' ? 'start' : 'open'
    var homepagePath = require(paths.appPackageJson).homepage
    var publicPath = config.output.publicPath
    if (homepagePath && homepagePath.indexOf('.github.io/') !== -1) {
      // "homepage": "http://user.github.io/project"
      console.log('The project was built assuming it is hosted at ' + chalk.green(publicPath) + '.')
      console.log('You can control this with the ' + chalk.green('homepage') + ' field in your '  + chalk.cyan('package.json') + '.')
      console.log()
      console.log('The ' + chalk.cyan('build') + ' folder is ready to be deployed.')
      console.log('To publish it at ' + chalk.green(homepagePath) + ', run:')
      console.log()
      console.log('  ' + chalk.cyan('git') + ' commit -am ' + chalk.yellow('"Save local changes"'))
      console.log('  ' + chalk.cyan('git') + ' checkout -B gh-pages')
      console.log('  ' + chalk.cyan('git') + ' add -f build')
      console.log('  ' + chalk.cyan('git') + ' commit -am ' + chalk.yellow('"Rebuild website"'))
      console.log('  ' + chalk.cyan('git') + ' filter-branch -f --prune-empty --subdirectory-filter build')
      console.log('  ' + chalk.cyan('git') + ' push -f origin gh-pages')
      console.log('  ' + chalk.cyan('git') + ' checkout -')
      console.log()
    } else if (publicPath !== '/') {
      // "homepage": "http://mywebsite.com/project"
      console.log('The project was built assuming it is hosted at ' + chalk.green(publicPath) + '.')
      console.log('You can control this with the ' + chalk.green('homepage') + ' field in your '  + chalk.cyan('package.json') + '.')
      console.log()
      console.log('The ' + chalk.cyan('build') + ' folder is ready to be deployed.')
      console.log()
    } else {
      // no homepage or "homepage": "http://mywebsite.com"
      console.log('The project was built assuming it is hosted at the server root.')
      if (homepagePath) {
        // "homepage": "http://mywebsite.com"
        console.log('You can control this with the ' + chalk.green('homepage') + ' field in your '  + chalk.cyan('package.json') + '.')
        console.log()
      } else {
        // no homepage
        console.log('To override this, specify the ' + chalk.green('homepage') + ' in your '  + chalk.cyan('package.json') + '.')
        console.log('For example, add this to build it for GitHub Pages:')
        console.log()
        console.log('  ' + chalk.green('"homepage"') + chalk.cyan(': ') + chalk.green('"http://myname.github.io/myapp"') + chalk.cyan(','))
        console.log()
      }
      console.log('The ' + chalk.cyan('build') + ' folder is ready to be deployed.')
      console.log('You may also serve it locally with a static server:')
      console.log()
      console.log('  ' + chalk.cyan('npm') +  ' install -g pushstate-server')
      console.log('  ' + chalk.cyan('pushstate-server') + ' build')
      console.log('  ' + chalk.cyan(openCommand) + ' http://localhost:9000')
      console.log()
    }
  })
Example #8
0
 ids.forEach(function (id) {
   if (!isMuted(id, muted)) {
     console.info(chalk.cyan('change:'), id)
     muted.push(id)
   }
 })
Example #9
0
 var writeCompiledFile = function (path, output) {
   if (writeFile(path, output)) {
     grunt.log.writeln('File ' + chalk.cyan(path) + ' created.');
   }
 };
 function format(missingComponent) {
   return `${chalk.underline(chalk.cyan(missingComponent.id.toString()))}\n${formatMissing(missingComponent)}`;
 }
Example #11
0
 }, function (sourceMapContent) {
   grunt.file.write(options.sourceMapFilename, sourceMapContent);
   grunt.log.writeln('File ' + chalk.cyan(options.sourceMapFilename) + ' created.');
 });
Example #12
0
 setTimeout(function(){ console.log(chalk.cyan("        Awesome.\n")) }, 900);
					(() => {
						console.log(chalk.cyan(`All good. Project "${projectName}" successfully initialized.`));
					})))
Example #14
0
 style(str) {
   return chalk.cyan(str);
 }
 added.forEach(({ key, message }) => console.log(`  ${green(key)}: ${cyan(message)}`));
Example #16
0
 var writeSourceMapFile = function (path, output) {
   if (writeFile(path, output)) {
     grunt.log.writeln('File ' + chalk.cyan(path) + ' created (source map).');
   }
 };
Example #17
0
 this.debug = function(message) {
   self._log(chalk.cyan(message));
 };
Example #18
0
function now () {
    return chalk.cyan(moment().format());
}
Example #19
0
File: watch.js Project: amasad/jest
        rebuild(filePath);
      } else {
        const buildFile = path.resolve(srcDir, '..', 'build', filename);
        try {
          fs.unlinkSync(buildFile);
          process.stdout.write(
            chalk.red('  \u2022 ') +
              path.relative(path.resolve(srcDir, '..', '..'), buildFile) +
              ' (deleted)' +
              '\n'
          );
        } catch (e) {}
      }
    });
  } catch (e) {
    // doesn't exist
  }
});

setInterval(() => {
  const files = Array.from(filesToBuild.keys());
  if (files.length) {
    filesToBuild = new Map();
    try {
      execSync(`${BUILD_CMD} ${files.join(' ')}`, {stdio: [0, 1, 2]});
    } catch (e) {}
  }
}, 100);

console.log(chalk.red('->'), chalk.cyan('Watching for changes...'));
Example #20
0
  getBlueprintInfoString: function(blueprint, verbose) {
    var options;
    var output = '      ';
    if (blueprint.overridden) {
      output += chalk.grey('(overridden)') + ' ';
      output += chalk.grey(blueprint.name);
    } else {
      output += blueprint.name;

      blueprint.anonymousOptions.forEach(function(opt) {
        output += ' ' + chalk.yellow('<' + opt + '>');
      });

      options = blueprint.availableOptions || [];

      if (options.length > 0) {
        output += ' ' + chalk.cyan('<options...>');
      }

      if (blueprint.description) {
        output += EOL + '        ' + chalk.grey(blueprint.description);
      }

      if (options.length > 0) {
        options.forEach(function(opt) {
          output += EOL + '        ' + chalk.cyan('--' + opt.name);

          if (opt.values) {
            output += chalk.cyan('=' + opt.values.join('|'));
          }

          if (opt.default !== undefined) {
            output += ' ' + chalk.cyan('(Default: ' + opt.default + ')');
          }

          if (opt.required) {
            output += ' ' + chalk.cyan('(Required)');
          }

          if (opt.aliases) {
            output += EOL + '          ' + chalk.grey('aliases: ' + opt.aliases.map(function(a) {
              var key;
              if (typeof a === 'string') {
                return '-' + a + (opt.type === Boolean ? '' : ' <value>');
              } else {
                key = Object.keys(a)[0];
                return  '-' + key + ' (--' + opt.name + '=' + a[key] + ')';
              }
            }).join(', '));
          }

          if (opt.description) {
            output += ' ' + opt.description;
          }
        });
      }

      if (verbose && blueprint.printDetailedHelp) {
        output += EOL + blueprint.printDetailedHelp(options);
      }

    }

    return output;
  }
 hello() {
     this.log( yosay([
         chalk.cyan( 'Generator Bundler' ),
         'Feed me information...'
     ].join( '\n' )))
 }
Example #22
0
 context.fields.forEach((field) => {
     const validationDetails = [];
     const fieldValidate = _.isArray(field.fieldValidateRules) && field.fieldValidateRules.length >= 1;
     if (fieldValidate === true) {
         if (field.fieldValidateRules.includes('required')) {
             validationDetails.push('required');
         }
         if (field.fieldValidateRules.includes('unique')) {
             validationDetails.push('unique');
         }
         if (field.fieldValidateRules.includes('minlength')) {
             validationDetails.push(`minlength='${field.fieldValidateRulesMinlength}'`);
         }
         if (field.fieldValidateRules.includes('maxlength')) {
             validationDetails.push(`maxlength='${field.fieldValidateRulesMaxlength}'`);
         }
         if (field.fieldValidateRules.includes('pattern')) {
             validationDetails.push(`pattern='${field.fieldValidateRulesPattern}'`);
         }
         if (field.fieldValidateRules.includes('min')) {
             validationDetails.push(`min='${field.fieldValidateRulesMin}'`);
         }
         if (field.fieldValidateRules.includes('max')) {
             validationDetails.push(`max='${field.fieldValidateRulesMax}'`);
         }
         if (field.fieldValidateRules.includes('minbytes')) {
             validationDetails.push(`minbytes='${field.fieldValidateRulesMinbytes}'`);
         }
         if (field.fieldValidateRules.includes('maxbytes')) {
             validationDetails.push(`maxbytes='${field.fieldValidateRulesMaxbytes}'`);
         }
     }
     this.log(chalk.red(field.fieldName) + chalk.white(` (${field.fieldType}${field.fieldTypeBlobContent ? ` ${field.fieldTypeBlobContent}` : ''}) `) + chalk.cyan(validationDetails.join(' ')));
 });
Example #23
0
    this.files.forEach(function(f) {
      var src = f.src.filter(function(filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      });

      if (src.length === 0) {
        grunt.log.warn('Destination (' + f.dest + ') not written because src files were empty.');
        return;
      }

      // function to get the name of the sourceMap
      if (typeof options.sourceMap === "function") {
        mapNameGenerator = options.sourceMap;
      }

      // function to get the name of the sourceMap
      if (typeof options.sourceMapIn === "function") {
        if (src.length !== 1) {
          grunt.fail.warn('Cannot generate `sourceMapIn` for multiple source files.');
        }
        mapInNameGenerator = options.sourceMapIn;
      }

      // function to get the sourceMappingURL
      if (typeof options.sourceMappingURL === "function") {
        mappingURLGenerator = options.sourceMappingURL;
      }

      // dynamically create destination sourcemap name
      if (mapNameGenerator) {
        try {
          options.sourceMap = mapNameGenerator(f.dest);
        } catch (e) {
          var err = new Error('SourceMapName failed.');
          err.origError = e;
          grunt.fail.warn(err);
        }
      }

      // dynamically create incoming sourcemap names
      if (mapInNameGenerator) {
        try {
          options.sourceMapIn = mapInNameGenerator(src[0]);
        } catch (e) {
          var err = new Error('SourceMapInName failed.');
          err.origError = e;
          grunt.fail.warn(err);
        }
      }

      // dynamically create sourceMappingURL
      if (mappingURLGenerator) {
        try {
          options.sourceMappingURL = mappingURLGenerator(f.dest);
        } catch (e) {
          var err = new Error('SourceMappingURL failed.');
          err.origError = e;
          grunt.fail.warn(err);
        }
      }

      // Minify files, warn and fail on error.
      var result;
      try {
        result = uglify.minify(src, f.dest, options);
      } catch (e) {
        console.log(e);
        var err = new Error('Uglification failed.');
        if (e.message) {
          err.message += '\n' + e.message + '. \n';
          if (e.line) {
            err.message += 'Line ' + e.line + ' in ' + src + '\n';
          }
        }
        err.origError = e;
        grunt.log.warn('Uglifying source "' + src + '" failed.');
        grunt.fail.warn(err);
      }

      // Concat minified source + footer
      var output = result.min + footer;

      // Only prepend banner if uglify hasn't taken care of it as part of the preamble
      if (!options.sourceMap) {
        output = banner + output;
      }

      // Write the destination file.
      grunt.file.write(f.dest, output);


      // Write source map
      if (options.sourceMap) {
        grunt.file.write(options.sourceMap, result.sourceMap);
        grunt.log.writeln('File ' + chalk.cyan(options.sourceMap) + ' created (source map).');
      }

      // Print a success message.
      grunt.log.writeln('File ' + chalk.cyan(f.dest) + ' created.');

      // ...and report some size information.
      if (options.report) {
        contrib.minMaxInfo(output, result.max, options.report);
      }
    });
Example #24
0
 context.relationships.forEach((relationship) => {
     const validationDetails = [];
     if (relationship.relationshipValidateRules && relationship.relationshipValidateRules.includes('required')) {
         validationDetails.push('required');
     }
     this.log(`${chalk.red(relationship.relationshipName)} ${chalk.white(`(${_.upperFirst(relationship.otherEntityName)})`)} ${chalk.cyan(relationship.relationshipType)} ${chalk.cyan(validationDetails.join(' '))}`);
 });
Example #25
0
 .once('close', function() {
   var filepath = path.join(path.basename(src), name)
   console.error(chalk.grey('created: ') + chalk.cyan(filepath))
   if (!--counter) return done && done()
 })
 deleted.forEach(({ key, message }) => console.log(`  ${red(key)}: ${cyan(message)}`));
Example #27
0
/**
 * Mkdir -p.
 *
 * @param {String} path
 * @param {Function} fn
 */
function mkdir(path, fn) {
  shell.mkdir('-p', path);
  shell.chmod(755, path);
  console.log(chalk.cyan('   create:'), path);
  if (fn) fn();
}
 untranslated.forEach(({ key, message }) => console.log(`  ${yellow(key)}: ${cyan(message)}`));
Example #29
0
    end: function() {
        if(this.abort) return;

        this.log('\n' + chalk.bold.green('Docker Compose configuration successfully generated!'));
        this.log('You can launch all your infrastructure by running : ' + chalk.cyan('docker-compose up -d'));
    }
Example #30
0
      files.forEach(function (filename) {
        debug('looking at file %s', filename);

        grunt.verbose.writeln(chalk.bold('Processing as ' + options.type.toUpperCase() + ' - ') + chalk.cyan(filename));

        // Our revved version locator
        var content = handler.process(filename, options.assetsDirs);

        // write the new content to disk
        grunt.file.write(filename, content);

      });