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.

index.js 840B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. const {promisify} = require('util');
  3. const fs = require('fs');
  4. const path = require('path');
  5. const parseJson = require('parse-json');
  6. const readFileAsync = promisify(fs.readFile);
  7. module.exports = async options => {
  8. options = {
  9. cwd: process.cwd(),
  10. normalize: true,
  11. ...options
  12. };
  13. const filePath = path.resolve(options.cwd, 'package.json');
  14. const json = parseJson(await readFileAsync(filePath, 'utf8'));
  15. if (options.normalize) {
  16. require('normalize-package-data')(json);
  17. }
  18. return json;
  19. };
  20. module.exports.sync = options => {
  21. options = {
  22. cwd: process.cwd(),
  23. normalize: true,
  24. ...options
  25. };
  26. const filePath = path.resolve(options.cwd, 'package.json');
  27. const json = parseJson(fs.readFileSync(filePath, 'utf8'));
  28. if (options.normalize) {
  29. require('normalize-package-data')(json);
  30. }
  31. return json;
  32. };