How to use the shelljs.echo function in shelljs

To help you get started, we’ve selected a few shelljs 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 shunwuyu / lesson_md / react / jianshu / react-jianshu-copy / myscript / deploy.js View on Github external
//   shelljs.echo('error: npm install error.');
//   shelljs.exit(1);
// }

// 测试
// console.log(colors.yellow('🐛️ 进行测试'));
// if (shelljs.exec('npm run test').code !== 0) {
//   shelljs.echo('error: npm install error.');
//   shelljs.exit(1);
// }

// // 构建

console.log(colors.yellow('☕️ 开始构建'));
if (shelljs.exec('npm run build').code !== 0) {
  shelljs.echo('error: npm install error.');
  shelljs.exit(1);
}

// // 部署
console.log(colors.yellow('🐛️ 开始部署'));
const rsync = Rsync.build({
  source: path.join(__dirname, '../build/*'),
  destination: host_map[targetName],
  flags: 'avz',
  shell: 'ssh',
});

rsync.execute((err, code, cmd) => {
  console.log(err, code, cmd);
  console.log(colors.green('🚀 部署完成'));
});
github Datawheel / canon / bin / release.js View on Github external
}, error => {
              if (error) {
                shell.echo(`repo: ${name}`);
                shell.echo(`tag/name: v${version}`);
                shell.echo(`body: ${body}`);
                shell.echo(`prerelease: ${prerelease}`);
                shell.echo(error.message);
                shell.exit(1);
              }
              else {
                shell.echo("release pushed");
                shell.exit(0);

              }
            });
github eslint / eslint / Makefile.js View on Github external
target.lint = function([fix = false] = []) {
    let errors = 0,
        lastReturn;

    echo("Validating JavaScript files");
    lastReturn = exec(`${ESLINT}${fix ? "--fix" : ""} .`);
    if (lastReturn.code !== 0) {
        errors++;
    }

    echo("Validating JSON Files");
    lodash.forEach(JSON_FILES, validateJsonFile);

    echo("Validating Markdown Files");
    lastReturn = lintMarkdown(MARKDOWN_FILES_ARRAY);
    if (lastReturn.code !== 0) {
        errors++;
    }

    if (errors) {
        exit(1);
    }
};
github ArcBlock / forge-js / packages / forge-cli / src / cli / node / debug / debug.js View on Github external
shell.echo('');
  shell.echo(hr);
  shell.echo('Forge CLI Version');
  shell.echo(hr);
  shell.exec('forge --version');

  shell.echo('');
  shell.echo(hr);
  shell.echo('Forge CLI Env');
  shell.echo(hr);
  shell.echo('Required Dirs:');
  shell.echo(`  cache: ${requiredDirs.cache}`);
  shell.echo(`  release: ${requiredDirs.release}`);
  shell.echo(hr);
  shell.echo('Runtime config:');
  shell.echo(`  forgeBinPath: ${config.get('cli.forgeBinPath')}`);
  shell.echo(`  starterBinPath: ${config.get('cli.starterBinPath')}`);
  shell.echo(`  simulatorBinPath: ${config.get('cli.simulatorBinPath')}`);
  shell.echo(`  forgeConfigPath: ${config.get('cli.forgeConfigPath')}`);

  shell.echo('');
  shell.echo(hr);
  shell.echo('Forge Release Info');
  shell.echo(hr);
  describe();
}
github Dugnist / jsberry / tasks / create.js View on Github external
function setup({
    framework = 'express', database = 'mongoose',
    websockets = false, validation = true,
    modules = ['clear'], currentPath, name,
}) {
    shell.echo('');
    shell.echo(chalk.cyan('🕓  The setup process can take few minutes.'));
    shell.echo('');
    shell.exec(`git clone ${jsbCoreRepo} ${currentPath}/${name}`).output;
    shell.echo(chalk.cyan('👣 Go to project'));
    shell.cd(`${currentPath}/${name}`).output;
    shell.echo(chalk.cyan('📥 Install scripts'));
    shell.exec('npm i').output;
    shell.echo(chalk.cyan('📥 Install framework'));
    shell.cd(`${currentPath}/${name}/src/plugins`).output;
    shell.exec(`git clone ${jsbFrameworkRepo(framework)} ${framework}-api`).output;
    shell.cd(`${currentPath}/${name}/src/plugins/${framework}-api`).output;
    shell.exec('node install').output;
    shell.echo(chalk.cyan('📥 Install database'));
    shell.cd('../').output;
    shell.exec(`git clone ${jsbDatabaseRepo(database)} ${database}`).output;
    shell.cd(`${currentPath}/${name}/src/plugins/${database}`).output;
github iketari / preoccupyjs / tools / gh-pages-publish.ts View on Github external
if (typeof pkg.repository === 'object') {
  if (!pkg.repository.hasOwnProperty('url')) {
    throw new Error('URL does not exist in repository section');
  }
  repoUrl = pkg.repository.url;
} else {
  repoUrl = pkg.repository;
}

let parsedUrl = url.parse(repoUrl);
let repository = (parsedUrl.host || '') + (parsedUrl.path || '');
let ghToken = process.env.GH_TOKEN;

rm('-rf', 'temp')
mkdir('temp');
echo('Copying demo SPA...');
cp('-r', 'test-spa/dist/*', 'temp/demo');
echo('Copying docs...');
cp('-r', 'docs', 'temp');
echo('Copying coverage...');
cp('-r', 'coverage', 'temp');
cd('temp');
echo('Initiasing git repo...');
exec('git init');
exec('git add .');
exec('git config user.name "Artsiom Mezin"');
exec('git config user.email "artsiom.mezin@behavox.com"');
exec('git commit -m "docs(docs): update gh-pages"');
echo('Deploying...');
exec(`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`);
echo('All deployed!');
github gramps-graphql / gramps-express / bin / gramps.js View on Github external
globby.sync(fileGlob).forEach(file => {
    shell.cp(file, targetDir);
    shell.echo(chalk.dim(` -> copied ${path.basename(file)}`));
  });
}
github storybook-eol / react-cdk / packages / cdk-scripts / .dev / pack.js View on Github external
const tarballs = shell.find(`${tarballPath}/*`)
  .filter(file => file.match(/\/cdk-scripts(\d+|\.+|-alpha\.|\w?)*\.tgz$/));

shell.echo(chalk.white('\n=> removing tarballs'));
tarballs.forEach(tar => shell.echo(chalk.gray(`rm ${tar}`)));

shell.rm(tarballs);
} catch(err) {

}

const packageName = name.match(/[^\/]*$/)[0];
const tarballName = `${packageName}.${version}.${build}.tgz`;
const exec = `yarn pack --filename ${tarballPath}/${tarballName}`;

shell.echo(chalk.white('\n=> pack a tarball\n'));
shell.echo(chalk.gray(exec));
shell.echo();

shell.exec(exec);

const isCreated = fs.pathExistsSync(`${tarballPath}/${tarballName}`);

if (isCreated) {
  shell.echo(chalk.white('\n=> tarball is created:\n'));
  shell.echo(chalk.cyan(tarballName));
  shell.echo();
} else {
  shell.echo(chalk.red('\n=> tarball is not created :(\n'));
  shell.echo();
}
github hyperloris / tyson / tools / gh-pages-publish.ts View on Github external
let repoUrl;
let pkg = JSON.parse(readFileSync("package.json") as any);
if (typeof pkg.repository === "object") {
  if (!pkg.repository.hasOwnProperty("url")) {
    throw new Error("URL does not exist in repository section");
  }
  repoUrl = pkg.repository.url;
} else {
  repoUrl = pkg.repository;
}

let parsedUrl = url.parse(repoUrl);
let repository = (parsedUrl.host || "") + (parsedUrl.path || "");
let ghToken = process.env.GH_TOKEN;

echo("Deploying docs!!!");
cd("docs");
touch(".nojekyll");
exec("git init");
exec("git add .");
exec('git config user.name "Lorenzo Gigli"');
exec('git config user.email "lorenzo.dramis@gmail.com"');
exec('git commit -m "docs(docs): update gh-pages"');
exec(
  `git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
);
echo("Docs deployed!!");
github electerm / electerm / bin / build.js View on Github external
/**
 * build
 */

const { exec, echo } = require('shelljs')

echo('start build')

const timeStart = +new Date()

echo('clean')
exec('npm run clean')
exec('npm run ver')
exec('npm run build')

const endTime = +new Date()
echo(`done build in ${(endTime - timeStart) / 1000} s`)