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.

printConfig.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. const _ = require('lodash');
  3. const createStylelint = require('./createStylelint');
  4. const globby = require('globby');
  5. const path = require('path');
  6. /** @typedef {import('stylelint').StylelintConfig} StylelintConfig */
  7. /**
  8. * @param {import('stylelint').StylelintStandaloneOptions} options
  9. * @returns {Promise<StylelintConfig | null>}
  10. */
  11. module.exports = function (options) {
  12. const code = options.code;
  13. const config = options.config;
  14. const configBasedir = options.configBasedir;
  15. const configFile = options.configFile;
  16. const configOverrides = options.configOverrides;
  17. const globbyOptions = options.globbyOptions;
  18. const files = options.files;
  19. const isCodeNotFile = code !== undefined;
  20. if (!files || files.length !== 1 || isCodeNotFile) {
  21. return Promise.reject(
  22. new Error('The --print-config option must be used with exactly one file path.'),
  23. );
  24. }
  25. const filePath = files[0];
  26. if (globby.hasMagic(filePath)) {
  27. return Promise.reject(new Error('The --print-config option does not support globs.'));
  28. }
  29. const stylelint = createStylelint({
  30. config,
  31. configFile,
  32. configBasedir,
  33. configOverrides,
  34. });
  35. const cwd = _.get(globbyOptions, 'cwd', process.cwd());
  36. const absoluteFilePath = !path.isAbsolute(filePath)
  37. ? path.join(cwd, filePath)
  38. : path.normalize(filePath);
  39. const configSearchPath = stylelint._options.configFile || absoluteFilePath;
  40. return stylelint.getConfigForFile(configSearchPath).then((result) => {
  41. if (result === null) {
  42. return result;
  43. }
  44. return result.config;
  45. });
  46. };