How to use the @s-ui/helpers/cli.getSpawnPromise function in @s-ui/helpers

To help you get started, we’ve selected a few @s-ui/helpers 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 SUI-Components / sui / packages / sui-svg / bin / sui-svg-demo.js View on Github external
/* eslint no-console:0 */
const program = require('commander')
const path = require('path')
const {getSpawnPromise} = require('@s-ui/helpers/cli')

program
  .on('--help', () => {
    console.log('  Description:')
    console.log('')
    console.log('    Shows a demo of your SVG library')
    console.log('')
  })
  .parse(process.argv)

const devServerExec = require.resolve('@s-ui/bundler/bin/sui-bundler-dev')
getSpawnPromise(
  devServerExec,
  ['-c', path.join(__dirname, '..', 'src'), '--no-pre-loader'],
  {
    shell: false,
    env: process.env
  }
).then(process.exit, process.exit)
github SUI-Components / sui / packages / sui-mono / bin / sui-mono-commit-all.js View on Github external
* Functions that executes the commit for each package
 * @type {Array}
 */
const checkStageFuncs = config.getScopes().map(pkg => {
  const pkgPath = path.join(packagesDir, pkg)
  return () =>
    hasChangedFiles(pkgPath).then(hasChanges => {
      if (hasChanges) {
        let args = ['commit', `-m "${type}(${pkg}): ${message}"`]
        commitsCount++ && args.push('--no-verify') // precommit only once
        return getSpawnPromise('git', args)
      }
    })
})

getSpawnPromise('git', ['reset']) // Unstage all prossible staged files
  .then(() =>
    checkStageFuncs.reduce(
      (promise, func) => promise.then(func),
      Promise.resolve()
    )
  )
  .catch(showError)
github SUI-Components / sui / packages / sui-test / bin / sui-test-e2e.js View on Github external
.then(cypressBinPath =>
    getSpawnPromise(cypressBinPath, [
      gui ? 'open' : 'run',
      '--config=' + objectToCommaString(cypressConfig),
      '--project=' + CYPRESS_FOLDER_PATH
    ])
  )
github SUI-Components / sui / packages / sui-studio / bin / sui-studio-deploy.js View on Github external
console.log('    $ NOW_TOKEN=my-token sui-studio deploy --name=my-domain')
    console.log('')
  })
  .parse(process.argv)

if (typeof program.name !== 'string') {
  console.log('ERR: --name flag is mandatory')
  process.exit(1)
}

if (!process.env.NOW_TOKEN) {
  console.log('ERR: NOW_TOKEN env variable is missing')
  process.exit(1)
}

getSpawnPromise(DEPLOY_PATH, ['spa', program.name, BUILD_FOLDER]).catch(err => {
  showError(err.message)
})
github SUI-Components / sui-components / scripts / build-themes.js View on Github external
const writeThemesInDemoFolders = async themes => {
  await getSpawnPromise('rm', ['-Rf', './demo/**/**/themes'], {
    cwd: process.cwd()
  })
  const paths = await globby(
    [path.join(process.cwd(), 'demo', '**', '**'), '!**/node_modules/**'],
    {onlyDirectories: true, cwd: process.cwd()}
  )
  paths
    .filter(p => p.match(/\/demo\/\w+\/\w+$/))
    .forEach(async demo => {
      try {
        const [, component] = demo.split('/demo/')
        await createDir(`${demo}/themes`)
        await Promise.all(
          themes.map(theme =>
            writeFile(
              `${demo}/themes/${theme}.scss`,
github SUI-Components / sui / packages / sui-lint / bin / sui-lint-format-js.js View on Github external
.then(() => {
          const lintArgs = ['js', '--fix']
          isOptionSet(staged) && lintArgs.push(staged)
          isOptionSet(addFixes) && lintArgs.push(addFixes)
          return getSpawnPromise('sui-lint', lintArgs)
        })
        .catch(showError)) ||
github SUI-Components / sui / packages / sui-studio-create / src / index.js View on Github external
  .then(() => getSpawnPromise('npm', ['i'], {cwd: PROJECT_PATH}))
  .then(process.exit)
github SUI-Components / sui / packages / sui-lint / src / helpers.js View on Github external
const stageFilesIfRequired = async extensions => {
  const {argv} = process
  if (argv.includes(OPTIONS.staged) && argv.includes(OPTIONS.addFixes)) {
    const {getSpawnPromise} = require('@s-ui/helpers/cli')
    const files = await getGitStatusFiles(extensions)
    return getSpawnPromise('git', ['add', ...files])
  }
}
github SUI-Components / sui / packages / sui-precommit / bin / sui-precommit-install.js View on Github external
function installHuskyIfNotInstalled() {
  if (!isHuskyInstalled()) {
    log('husky will be installed to allow git hook integration with node')
    return getSpawnPromise('npm', [
      'install',
      'husky@0.13.4',
      '--save-dev',
      '--save-exact'
    ])
  } else {
    return Promise.resolve(0)
  }
}
github SUI-Components / sui / packages / sui-studio / bin / sui-studio.js View on Github external
setTimeout(() => {
      const devServerExec = require.resolve('@s-ui/bundler/bin/sui-bundler-dev')
      getSpawnPromise(
        devServerExec,
        ['-c', path.join(__dirname, '..', 'src')],
        {
          shell: false,
          env: process.env
        }
      ).then(process.exit, process.exit)
    }, 3000)
  })