resume-cli 3.1.0 → 3.1.1

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.
package/build/builder.js CHANGED
@@ -4,7 +4,7 @@ const themeServer = process.env.THEME_SERVER || 'https://themes.jsonresume.org/t
4
4
  const fs = require('fs');
5
5
  const request = require('superagent');
6
6
  const chalk = require('chalk');
7
- const renderHtml = require('./render-html');
7
+ const renderHtml = require('./render-html').default;
8
8
  const denormalizeTheme = value => {
9
9
  return value.match(/jsonresume-theme-(.*)/)[1];
10
10
  };
@@ -18,10 +18,12 @@ var _default = async ({
18
18
  const cwd = process.cwd();
19
19
  let path;
20
20
  if (themePath[0] === '.') {
21
- path = tryResolve(path.join(cwd, themePath), {
21
+ path = tryResolve(require('path').join(cwd, themePath), {
22
22
  paths: [cwd]
23
23
  });
24
- throw new Error(`Theme ${themePath} could not be resolved relative to ${cwd}`);
24
+ if (!path) {
25
+ throw new Error(`Theme ${themePath} could not be resolved relative to ${cwd}`);
26
+ }
25
27
  }
26
28
  if (!path) {
27
29
  path = tryResolve(themePath, {
@@ -7,9 +7,6 @@ describe('renderHTML', () => {
7
7
  const originalRequireResolve = require.resolve;
8
8
  const mockThemePath = 'mock/path/to/jsonresume-theme-even';
9
9
  require.resolve = (...args) => {
10
- if (args[0] === 'jsonresume-theme-even') {
11
- return mockThemePath;
12
- }
13
10
  if (args[0] === 'jsonresume-theme-even') {
14
11
  return mockThemePath;
15
12
  }
@@ -26,13 +23,13 @@ describe('renderHTML', () => {
26
23
  email: 'test4@test.com'
27
24
  }
28
25
  };
29
- it('should reject when theme is not availlable', async () => {
26
+ it('should reject when theme is not available', async () => {
30
27
  await expect((0, _renderHtml.default)({
31
28
  resume,
32
29
  themePath: 'unknown'
33
30
  })).rejects.toBeTruthy();
34
31
  });
35
- describe('should render html when theme is availlable', () => {
32
+ describe('should render html when theme is available', () => {
36
33
  it('with long theme name', async () => {
37
34
  expect(await (0, _renderHtml.default)({
38
35
  resume,
@@ -45,5 +42,17 @@ describe('renderHTML', () => {
45
42
  themePath: 'even'
46
43
  })).toStartWith('<!doctype html>');
47
44
  });
45
+ it('should reject theme with invalid path', async () => {
46
+ await expect((0, _renderHtml.default)({
47
+ resume,
48
+ themePath: './unknown'
49
+ })).rejects.toBeTruthy();
50
+ });
51
+ it('with local theme path', async () => {
52
+ expect(await (0, _renderHtml.default)({
53
+ resume,
54
+ themePath: './node_modules/jsonresume-theme-even'
55
+ })).toStartWith('<!doctype html>');
56
+ });
48
57
  });
49
58
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resume-cli",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "The JSON Resume command line interface",
5
5
  "main": "index.js",
6
6
  "engines": {