Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #!/usr/bin/env node
  2. 'use strict'
  3. const configUtil = require('../lib/config-util')
  4. const { cliWrapper, suppressEPIPE } = require('../lib/commands/helpers')
  5. const foreground = require('foreground-child')
  6. const resolveFrom = require('resolve-from')
  7. const NYC = require('../index.js')
  8. // parse configuration and command-line arguments;
  9. // we keep these values in a few different forms,
  10. // used in the various execution contexts of nyc:
  11. // reporting, instrumenting subprocesses, etc.
  12. async function main () {
  13. const { argv, childArgs, yargs } = await configUtil()
  14. if (['check-coverage', 'report', 'instrument', 'merge'].includes(argv._[0])) {
  15. // look in lib/commands for logic.
  16. return
  17. }
  18. if (argv._.length === 0) {
  19. // I don't have a clue what you're doing.
  20. process.exitCode = 1
  21. yargs.showHelp()
  22. return
  23. }
  24. // if instrument is set to false,
  25. // enable a noop instrumenter.
  26. if (!argv.instrument) argv.instrumenter = './lib/instrumenters/noop'
  27. else argv.instrumenter = './lib/instrumenters/istanbul'
  28. var nyc = (new NYC(argv))
  29. if (argv.clean) {
  30. await nyc.reset()
  31. } else {
  32. await nyc.createTempDirectory()
  33. }
  34. const env = {
  35. NYC_CONFIG: JSON.stringify(argv),
  36. NYC_CWD: process.cwd()
  37. }
  38. /* istanbul ignore else */
  39. if (argv['babel-cache'] === false) {
  40. // babel's cache interferes with some configurations, so is
  41. // disabled by default. opt in by setting babel-cache=true.
  42. env.BABEL_DISABLE_CACHE = process.env.BABEL_DISABLE_CACHE = '1'
  43. }
  44. if (!argv.useSpawnWrap) {
  45. const requireModules = [
  46. require.resolve('../lib/register-env.js'),
  47. ...nyc.require.map(mod => resolveFrom.silent(nyc.cwd, mod) || mod)
  48. ]
  49. const preloadList = require('node-preload')
  50. preloadList.push(
  51. ...requireModules,
  52. require.resolve('../lib/wrap.js')
  53. )
  54. Object.assign(process.env, env)
  55. requireModules.forEach(mod => {
  56. require(mod)
  57. })
  58. }
  59. if (argv.all) {
  60. await nyc.addAllFiles()
  61. }
  62. if (argv.useSpawnWrap) {
  63. const wrapper = require.resolve('./wrap.js')
  64. // Support running nyc as a user without HOME (e.g. linux 'nobody'),
  65. // https://github.com/istanbuljs/nyc/issues/951
  66. env.SPAWN_WRAP_SHIM_ROOT = process.env.SPAWN_WRAP_SHIM_ROOT || process.env.XDG_CACHE_HOME || require('os').homedir()
  67. const sw = require('spawn-wrap')
  68. sw([wrapper], env)
  69. }
  70. // Both running the test script invocation and the check-coverage run may
  71. // set process.exitCode. Keep track so that both children are run, but
  72. // a non-zero exit codes in either one leads to an overall non-zero exit code.
  73. process.exitCode = 0
  74. foreground(childArgs, async () => {
  75. const mainChildExitCode = process.exitCode
  76. try {
  77. await nyc.writeProcessIndex()
  78. nyc.maybePurgeSourceMapCache()
  79. if (argv.checkCoverage) {
  80. await nyc.checkCoverage({
  81. lines: argv.lines,
  82. functions: argv.functions,
  83. branches: argv.branches,
  84. statements: argv.statements
  85. }, argv['per-file']).catch(suppressEPIPE)
  86. process.exitCode = process.exitCode || mainChildExitCode
  87. }
  88. if (!argv.silent) {
  89. await nyc.report().catch(suppressEPIPE)
  90. }
  91. } catch (error) {
  92. /* istanbul ignore next */
  93. process.exitCode = process.exitCode || mainChildExitCode || 1
  94. /* istanbul ignore next */
  95. console.error(error.message)
  96. }
  97. })
  98. }
  99. cliWrapper(main)()