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.

pretty-quick.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env node
  2. 'use strict';
  3. const chalk = require('chalk');
  4. const mri = require('mri');
  5. const prettyQuick = require('..').default;
  6. const args = mri(process.argv.slice(2), {
  7. alias: {
  8. 'resolve-config': 'resolveConfig',
  9. 'ignore-path': 'ignorePath',
  10. },
  11. });
  12. const prettyQuickResult = prettyQuick(
  13. process.cwd(),
  14. Object.assign({}, args, {
  15. onFoundSinceRevision: (scm, revision) => {
  16. console.log(
  17. `🔍 Finding changed files since ${chalk.bold(
  18. scm,
  19. )} revision ${chalk.bold(revision)}.`,
  20. );
  21. },
  22. onFoundChangedFiles: (changedFiles) => {
  23. console.log(
  24. `🎯 Found ${chalk.bold(changedFiles.length)} changed ${
  25. changedFiles.length === 1 ? 'file' : 'files'
  26. }.`,
  27. );
  28. },
  29. onPartiallyStagedFile: (file) => {
  30. console.log(`✗ Found ${chalk.bold('partially')} staged file ${file}.`);
  31. },
  32. onWriteFile: (file) => {
  33. console.log(`✍️ Fixing up ${chalk.bold(file)}.`);
  34. },
  35. onCheckFile: (file, isFormatted) => {
  36. if (!isFormatted) {
  37. console.log(`⛔️ Check failed: ${chalk.bold(file)}`);
  38. }
  39. },
  40. onExamineFile: (file) => {
  41. console.log(`🔍 Examining ${chalk.bold(file)}.`);
  42. },
  43. }),
  44. );
  45. if (prettyQuickResult.success) {
  46. console.log('✅ Everything is awesome!');
  47. } else {
  48. if (prettyQuickResult.errors.indexOf('PARTIALLY_STAGED_FILE') !== -1) {
  49. console.log(
  50. '✗ Partially staged files were fixed up.' +
  51. ` ${chalk.bold('Please update stage before committing')}.`,
  52. );
  53. }
  54. if (prettyQuickResult.errors.indexOf('BAIL_ON_WRITE') !== -1) {
  55. console.log(
  56. '✗ File had to be prettified and prettyQuick was set to bail mode.',
  57. );
  58. }
  59. if (prettyQuickResult.errors.indexOf('CHECK_FAILED') !== -1) {
  60. console.log(
  61. '✗ Code style issues found in the above file(s). Forgot to run Prettier?',
  62. );
  63. }
  64. process.exit(1); // ensure git hooks abort
  65. }