當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript execa.shell函數代碼示例

本文整理匯總了TypeScript中execa.shell函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript shell函數的具體用法?TypeScript shell怎麽用?TypeScript shell使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了shell函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: main

async function main() {
  for (const zoom of range(minzoom, maxzoom + 1)) {
    const mbtilesZoom = `${name}-z${zoom}.mbtiles`
    const args = [
      '--output=' + mbtilesZoom,
      '--force',
      '--minimum-zoom=' + zoom,
      '--maximum-zoom=' + zoom,
      '--full-detail=' + (16 - zoom + 16),
      '--no-line-simplification',
      '--no-feature-limit',
      '--no-tile-size-limit',
      '--no-polygon-splitting',
      '--no-clipping',
      '--no-duplication',
      name + ext
    ]
    if (verbose) { console.log('Args', args) }
    if (verbose) { console.log('Starting zoom', zoom) }
    await execa('tippecanoe', args)
    if (verbose) { console.log('Finished zoom', zoom) }
    await execa.shell(`sqlite3 ${mbtilesZoom} .dump >> ${name}.dump`)
    if (verbose) { console.log('Dumped', mbtilesZoom) }
    await execa.shell(`rm ${mbtilesZoom}`)
    if (verbose) { console.log('Removed', mbtilesZoom) }
  }
  // Clean
  await execa.shell(`sqlite3 ${name}.mbtiles < ${name}.dump`)
  if (verbose) { console.log('Merge dump') }
  await execa.shell(`rm -f ${name}.dump`)
  if (verbose) { console.log('Removed dump') }
  console.log('All Done! :)')
}
開發者ID:osmottawa,項目名稱:imports,代碼行數:33,代碼來源:create-mbtiles.ts

示例2: async

async () => {
    const { stdout } = await execa.shell('noop foo', {
        shell: process.platform === 'win32' ? 'cmd.exe' : '/bin/bash'
    });

    assert(stdout === 'foo');
};
開發者ID:DanCorder,項目名稱:DefinitelyTyped,代碼行數:7,代碼來源:execa-tests.ts

示例3: getVersionString

export function getVersionString(path: string) {
  const cmd = `${path} --version`
  log('finding version string using command "%s"', cmd)
  return execa
    .shell(cmd)
    .then(result => result.stdout)
    .then(trim)
}
開發者ID:YOU54F,項目名稱:cypress,代碼行數:8,代碼來源:index.ts

示例4: invoke

function invoke(cmd: string, options: IRunOptions = {}) {
  const { silent = false } = options;

  // Invoke the command.
  const promise = execa.shell(cmd);

  // Write to console.
  if (!silent) {
    promise.stdout.pipe(process.stdout);
  }

  // Finish up.
  return promise;
}
開發者ID:philcockfield,項目名稱:command-interface,代碼行數:14,代碼來源:util.exec.ts

示例5: resolve

 return new Promise<string>(async (resolve, reject) => {
   try {
     const config = await gitconfig.getCombinedConfig()
     const { gtPrivateKeyPath } = config[`remote "origin"`]
     const { name, email } = config.user
     const env = {
       GIT_SSH_COMMAND: `ssh -i ${gtPrivateKeyPath} -oIdentitiesOnly=yes`,
       GIT_COMMITTER_NAME: name,
       GIT_COMMITTER_EMAIL: email,
       GIT_AUTHOR_NAME: name,
       GIT_AUTHOR_EMAIL: email,
     }
     const result = await execa.shell(command.join(' '), { env })
     resolve(result.stdout)
   } catch (err) {
     reject(err)
   }
 })
開發者ID:uetchy,項目名稱:git-account,代碼行數:18,代碼來源:index.ts

示例6: mdfind

export function mdfind(id: string): Promise<string> {
  const cmd = `mdfind 'kMDItemCFBundleIdentifier=="${id}"' | head -1`
  log('looking for bundle id %s using command: %s', id, cmd)

  const logFound = (str: string) => {
    log('found %s at %s', id, str)
    return str
  }

  const failedToFind = () => {
    log('could not find %s', id)
    throw notInstalledErr(id)
  }

  return execa
    .shell(cmd)
    .then(result => result.stdout)
    .then(tap(logFound))
    .catch(failedToFind)
}
開發者ID:YOU54F,項目名稱:cypress,代碼行數:20,代碼來源:util.ts

示例7: getLinuxBrowser

function getLinuxBrowser(
  name: string,
  binary: string,
  versionRegex: RegExp
): Promise<FoundBrowser> {
  const getVersion = (stdout: string) => {
    const m = versionRegex.exec(stdout)
    if (m) {
      return m[1]
    }
    log(
      'Could not extract version from %s using regex %s',
      stdout,
      versionRegex
    )
    return notInstalledErr(binary)
  }

  const returnError = (err: Error) => {
    log('Could not detect browser %s', err.message)
    return notInstalledErr(binary)
  }

  const cmd = `${binary} --version`
  log('looking using command "%s"', cmd)
  return execa
    .shell(cmd)
    .then(result => result.stdout)
    .then(trim)
    .then(tap(log))
    .then(getVersion)
    .then((version: string) => {
      return {
        name,
        version,
        path: binary
      }
    })
    .catch(returnError)
}
開發者ID:lgandecki,項目名稱:cypress,代碼行數:40,代碼來源:index.ts

示例8: exec

 it('should execute migrations', async () => {
   const command = `${cliPath} migrate --url ${utils.dbURL}`
   await exec(command, {cwd: fixturesPath})
   expect(await state.queryInterface.describeTable('users')).toMatchSnapshot()
   expect(await state.queryInterface.describeTable('photos')).toMatchSnapshot()
   const [indexes] = await state.sequelize.query('show index from users')
   expect(indexes.map(index => index.Key_name)).toMatchSnapshot()
 })
開發者ID:patrickhulce,項目名稱:klay,代碼行數:8,代碼來源:cli.test.ts

示例9: it

    it('should have created a migration file', async () => {
      const command = `${cliPath} migration:bootstrap --kiln-file kiln.js`
      const {stdout} = await exec(command, {cwd: fixturesPath})
      const filename = stdout.match(/(migrations.*)/)[1].trim()
      state.migrationFile = path.join(fixturesPath, filename)

      const content = fs.readFileSync(state.migrationFile, 'utf8')
      expect(content).toMatchSnapshot()
    })
開發者ID:patrickhulce,項目名稱:klay,代碼行數:9,代碼來源:cli.test.ts


注:本文中的execa.shell函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。