Skip to content

Commit a4545bc

Browse files
authored
chore: AppVeyor integration (#115)
1 parent 65e1df7 commit a4545bc

File tree

6 files changed

+58
-16
lines changed

6 files changed

+58
-16
lines changed

.appveyor.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
environment:
2+
matrix:
3+
- nodejs_version: "8"
4+
- nodejs_version: ""
5+
6+
cache:
7+
- node_modules
8+
- example/node_modules
9+
- '%APPDATA%\npm-cache'
10+
- '%USERPROFILE%\.npm'
11+
- '%USERPROFILE%\.cache'
12+
13+
install:
14+
- ps: Install-Product node $env:nodejs_version
15+
- npm install -g yarn
16+
- yarn install --frozen-lockfile
17+
- yarn cypress install
18+
- cd example
19+
- yarn install --frozen-lockfile
20+
- cd ..
21+
22+
build: off
23+
24+
before_test:
25+
- cd example
26+
- yarn docs
27+
- yarn docs:docstrap
28+
- yarn docs:minami
29+
- yarn docs:tui
30+
- cd ..
31+
32+
test_script:
33+
- yarn lint
34+
- yarn test -i
35+
- yarn codecov
36+
- yarn cypress run --config watchForFileChanges=false --record

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ cache:
1111
directories:
1212
- node_modules
1313
- example/node_modules
14+
- ~/.npm
1415
- ~/.cache
1516

1617
before_install:
@@ -32,4 +33,4 @@ before_script:
3233
script:
3334
- yarn lint
3435
- yarn test -i && yarn codecov
35-
- yarn cypress run --config watchForFileChanges=false --record --key $CYPRESS_KEY
36+
- yarn cypress run --config watchForFileChanges=false --record

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ JSDoc for VueJS
22
===============
33

44
[![npm version](https://badge.fury.io/js/jsdoc-vuejs.svg)](https://badge.fury.io/js/jsdoc-vuejs)
5-
[![Build Status](https://travis-ci.org/Kocal/jsdoc-vuejs.svg?branch=master)](https://travis-ci.org/Kocal/jsdoc-vuejs)
5+
[![Build Status (Travis)](https://travis-ci.org/Kocal/jsdoc-vuejs.svg?branch=master)](https://travis-ci.org/Kocal/jsdoc-vuejs)
6+
[![Build Status (AppVeyor)](https://ci.appveyor.com/api/projects/status/a36pui6w1qhqq582?svg=true)](https://ci.appveyor.com/project/Kocal/jsdoc-vuejs)
67
[![codecov](https://codecov.io/gh/Kocal/jsdoc-vuejs/branch/master/graph/badge.svg)](https://codecov.io/gh/Kocal/jsdoc-vuejs)
8+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/850b7601f2bf4e8787a6aadbafa8afef)](https://www.codacy.com/app/kocal/jsdoc-vuejs?utm_source=github.com&utm_medium=referral&utm_content=Kocal/jsdoc-vuejs&utm_campaign=Badge_Grade)
79

810
> A JSDoc plugin for listing props, data, computed data, and methods from *.vue files.
911
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
/* eslint-disable no-console */
2-
2+
const { normalize } = require('path');
33
const getTemplatePath = require('../../lib/core/getTemplatePath');
44

55
describe('guessTemplatePath', () => {
66
test('guess default', () => {
7-
expect(getTemplatePath().endsWith('lib/templates/default.ejs')).toBeTruthy();
8-
expect(getTemplatePath('default').endsWith('lib/templates/default.ejs')).toBeTruthy();
7+
expect(getTemplatePath().endsWith(normalize('lib/templates/default.ejs'))).toBeTruthy();
8+
expect(getTemplatePath('default').endsWith(normalize('lib/templates/default.ejs'))).toBeTruthy();
99
});
1010

1111
test('guess docstrap', () => {
1212
const templatePath = getTemplatePath('./node_modules/ink-docstrap/template');
1313

14-
expect(templatePath.endsWith('lib/templates/docstrap.ejs')).toBeTruthy();
14+
expect(templatePath.endsWith(normalize('lib/templates/docstrap.ejs'))).toBeTruthy();
1515
});
1616

1717
test('guess minami', () => {
1818
const templatePath = getTemplatePath('node_modules/minami');
1919

20-
expect(templatePath.endsWith('lib/templates/minami.ejs')).toBeTruthy();
20+
expect(templatePath.endsWith(normalize('lib/templates/minami.ejs'))).toBeTruthy();
2121
});
2222

2323
test('guess tui', () => {
2424
const templatePath = getTemplatePath('node_modules/tui-jsdoc-template');
2525

26-
expect(templatePath.endsWith('lib/templates/tui.ejs')).toBeTruthy();
26+
expect(templatePath.endsWith(normalize('lib/templates/tui.ejs'))).toBeTruthy();
2727
});
2828

2929
test('guess unsupported', () => {
3030
console.warn = jest.fn();
3131

32-
expect(getTemplatePath('foo-bar').endsWith('lib/templates/default.ejs')).toBeTruthy();
32+
expect(getTemplatePath('foo-bar').endsWith(normalize('lib/templates/default.ejs'))).toBeTruthy();
3333
expect(console.warn).toHaveBeenCalledWith('The template "foo-bar" is not recognized by jsdoc-vuejs. Using default template as fallback.');
3434
});
3535
});

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { join } = require('path');
12
const config = require('./config');
23
const render = require('./lib/core/renderer');
34
const extractVueScript = require('./lib/core/vueScriptExtractor');
@@ -19,7 +20,7 @@ exports.handlers = {
1920
},
2021
newDoclet(e) {
2122
if (e.doclet.meta.filename.endsWith('.vue')) {
22-
const fullPath = `${e.doclet.meta.path}/${e.doclet.meta.filename}`;
23+
const fullPath = join(e.doclet.meta.path, e.doclet.meta.filename);
2324
const componentName = e.doclet.meta.filename.replace(/\.vue$/, '');
2425

2526
// The main doclet before `export default {}`

lib/core/getTemplatePath.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ module.exports = function getTemplatePath(template) {
44
// eslint-disable-next-line no-param-reassign
55
template = template || 'default';
66

7-
const path = (() => {
7+
const templateFilename = (() => {
88
switch (true) {
99
case template === 'default':
10-
return `${__dirname}/../templates/default.ejs`;
10+
return 'default.ejs';
1111
case /ink-docstrap\/template/.test(template):
12-
return `${__dirname}/../templates/docstrap.ejs`;
12+
return 'docstrap.ejs';
1313
case /minami/.test(template):
14-
return `${__dirname}/../templates/minami.ejs`;
14+
return 'minami.ejs';
1515
case /tui-jsdoc-template/.test(template):
16-
return `${__dirname}/../templates/tui.ejs`;
16+
return 'tui.ejs';
1717
default:
1818
// eslint-disable-next-line no-console
1919
console.warn(`The template "${template}" is not recognized by jsdoc-vuejs. Using default template as fallback.`);
20-
return `${__dirname}/../templates/default.ejs`;
20+
return 'default.ejs';
2121
}
2222
})();
2323

24+
const path = resolve(__dirname, '../templates', templateFilename);
25+
2426
return resolve(path);
2527
};

0 commit comments

Comments
 (0)