resume-cli 3.7.2 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var _fs = _interopRequireDefault(require("fs"));
8
8
  var _mimeTypes = require("mime-types");
9
9
  var _path = require("path");
10
- var _quaff = _interopRequireDefault(require("quaff"));
10
+ var _quaffLoader = _interopRequireDefault(require("./quaff-loader"));
11
11
  var _streamToString = _interopRequireDefault(require("stream-to-string"));
12
12
  var _yamlJs = _interopRequireDefault(require("yaml-js"));
13
13
  var _util = require("util");
@@ -30,7 +30,7 @@ var _default = async ({
30
30
  mime = inputMime || (0, _mimeTypes.lookup)('.json');
31
31
  input = process.stdin;
32
32
  } else if (path && (await stat(path)).isDirectory()) {
33
- return (0, _quaff.default)(path);
33
+ return (0, _quaffLoader.default)(path);
34
34
  }
35
35
  if (!input) {
36
36
  mime = inputMime || (0, _mimeTypes.lookup)(path);
@@ -37,26 +37,6 @@ describe('get-resume', () => {
37
37
  }
38
38
  `);
39
39
  });
40
- it('should consume an entire directory as if it were a json object', async () => {
41
- expect(await (0, _getResume.default)({
42
- path: '/quaff'
43
- })).toMatchInlineSnapshot(`
44
- {
45
- "basics": {
46
- "email": "thomas@example.com",
47
- "name": "thomas",
48
- },
49
- "work": [
50
- {
51
- "company": "Pied Piper",
52
- "endDate": "2014-12-01",
53
- "position": "CEO/President",
54
- "startDate": "2013-12-01",
55
- },
56
- ],
57
- }
58
- `);
59
- });
60
40
  it('should read from process.stdin when path is a dash', async () => {
61
41
  const stdin = (0, _mockStdin.stdin)();
62
42
  const gotResume = (0, _getResume.default)({
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _child_process = require("child_process");
4
+ var _path = _interopRequireDefault(require("path"));
5
+ var _util = require("util");
6
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
+ const execFile = (0, _util.promisify)(_child_process.execFile);
8
+ describe('directory resume loading', () => {
9
+ it('loads a real directory through the ESM-only quaff adapter', async () => {
10
+ const loaderPath = _path.default.join(__dirname, 'quaff-loader.js');
11
+ const fixturePath = _path.default.join(__dirname, '..', 'test-fixtures', 'quaff-resume');
12
+ const script = [`const load = require(${JSON.stringify(loaderPath)});`, 'load(process.argv[1])', ' .then((resume) => console.log(JSON.stringify(resume)))', ' .catch((error) => { console.error(error); process.exitCode = 1; });'].join('\n');
13
+ const {
14
+ stdout
15
+ } = await execFile(process.execPath, ['-e', script, fixturePath], {
16
+ cwd: __dirname
17
+ });
18
+ expect(JSON.parse(stdout)).toEqual({
19
+ basics: {
20
+ email: 'thomas@example.com',
21
+ name: 'thomas'
22
+ },
23
+ work: [{
24
+ company: 'Pied Piper',
25
+ position: 'CEO/President'
26
+ }]
27
+ });
28
+ });
29
+ });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ // The CLI is compiled to CommonJS, while quaff 5 is ESM-only. Keeping the
4
+ // native import behind the Function constructor prevents Babel from rewriting
5
+ // it to require(), which would fail on Node 18 and 20.
6
+ const nativeImport = new Function('specifier', 'return import(specifier)');
7
+ let quaffPromise;
8
+ const loadDirectory = async directory => {
9
+ quaffPromise ||= nativeImport('quaff');
10
+ const {
11
+ load
12
+ } = await quaffPromise;
13
+ return load(directory);
14
+ };
15
+ module.exports = loadDirectory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resume-cli",
3
- "version": "3.7.2",
3
+ "version": "3.7.3",
4
4
  "description": "The JSON Resume command line interface",
5
5
  "main": "build/main.js",
6
6
  "engines": {
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "ajv": "^8.17.1",
24
24
  "ajv-formats": "^3.0.1",
25
- "browser-sync": "^2.29.3",
25
+ "browser-sync": "^3.0.4",
26
26
  "btoa": "^1.2.1",
27
27
  "chalk": "^4.1.0",
28
28
  "commander": "^6.0.0",
@@ -34,7 +34,7 @@
34
34
  "mime-types": "^2.1.27",
35
35
  "object-path-immutable": "^4.1.1",
36
36
  "puppeteer": "^23.0.0",
37
- "quaff": "^4.2.0",
37
+ "quaff": "^5.0.0",
38
38
  "read": "^1.0.7",
39
39
  "stream-to-string": "^1.2.1",
40
40
  "superagent": "^6.0.0",