Skip to content
This repository was archived by the owner on Oct 2, 2020. It is now read-only.

Commit e1e3a5d

Browse files
authored
Merge pull request #54 from malept/travis-ci
Add Travis CI support
2 parents 7570ddf + b3347ca commit e1e3a5d

File tree

10 files changed

+79
-71
lines changed

10 files changed

+79
-71
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
language: node_js
2+
node_js:
3+
- '5'
4+
- '6'
5+
- '7'
6+
7+
script:
8+
- npm run lint
9+
- npm run compile

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"doc": "esdoc -c ./esdoc.json",
88
"compile": "git clean -xdf lib && babel -d lib/ src/",
9+
"lint": "eslint src",
910
"prepublish": "npm run compile"
1011
},
1112
"repository": {

src/compiler-base.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,147 @@
11
/**
2-
* This class is the base interface for compilers that are used by
3-
* electron-compile. If your compiler library only supports a
2+
* This class is the base interface for compilers that are used by
3+
* electron-compile. If your compiler library only supports a
44
* synchronous API, use SimpleCompilerBase instead.
55
*
66
* @interface
7-
*/
7+
*/
88
export class CompilerBase {
99
constructor() {
1010
this.compilerOptions = {};
1111
}
12-
13-
/**
14-
* This method describes the MIME types that your compiler supports as input.
12+
13+
/**
14+
* This method describes the MIME types that your compiler supports as input.
1515
* Many precompiled file types don't have a specific MIME type, so if it's not
1616
* recognized by the mime-types package, you need to patch rig-mime-types in
1717
* electron-compile.
1818
*
1919
* @return {string[]} An array of MIME types that this compiler can compile.
2020
*
2121
* @abstract
22-
*/
22+
*/
2323
static getInputMimeTypes() {
2424
throw new Error("Implement me!");
2525
}
2626

2727

2828
/**
2929
* Determines whether a file should be compiled
30-
*
30+
*
3131
* @param {string} fileName The full path of a file to compile.
3232
* @param {object} compilerContext An object that compilers can add extra
3333
information to as part of a job - the caller
3434
won't do anything with this.
3535
* @return {Promise<bool>} True if you are able to compile this file.
3636
*
3737
* @abstract
38-
*/
39-
async shouldCompileFile(fileName, compilerContext) {
38+
*/
39+
async shouldCompileFile(fileName, compilerContext) { // eslint-disable-line no-unused-vars
4040
throw new Error("Implement me!");
4141
}
4242

43-
44-
/**
43+
44+
/**
4545
* Returns the dependent files of this file. This is used for languages such
4646
* as LESS which allow you to import / reference other related files. In future
4747
* versions of electron-compile, we will use this information to invalidate
4848
* all of the parent files if a child file changes.
49-
*
49+
*
5050
* @param {string} sourceCode The contents of filePath
5151
* @param {string} fileName The full path of a file to compile.
5252
* @param {object} compilerContext An object that compilers can add extra
5353
information to as part of a job - the caller
5454
won't do anything with this.
5555
* @return {Promise<string[]>} An array of dependent file paths, or an empty
56-
* array if there are no dependent files.
56+
* array if there are no dependent files.
5757
*
5858
* @abstract
59-
*/
60-
async determineDependentFiles(sourceCode, fileName, compilerContext) {
59+
*/
60+
async determineDependentFiles(sourceCode, fileName, compilerContext) { // eslint-disable-line no-unused-vars
6161
throw new Error("Implement me!");
6262
}
6363

64-
65-
/**
64+
65+
/**
6666
* Compiles the file
67-
*
67+
*
6868
* @param {string} sourceCode The contents of filePath
6969
* @param {string} fileName The full path of a file to compile.
7070
* @param {object} compilerContext An object that compilers can add extra
7171
information to as part of a job - the caller
7272
won't do anything with this.
7373
* @return {Promise<object>} An object representing the compiled result
7474
* @property {string} code The compiled code
75-
* @property {string} mimeType The MIME type of the compiled result, which
75+
* @property {string} mimeType The MIME type of the compiled result, which
7676
* should exist in the mime-types database.
7777
*
7878
* @abstract
79-
*/
80-
async compile(sourceCode, fileName, compilerContext) {
79+
*/
80+
async compile(sourceCode, fileName, compilerContext) { // eslint-disable-line no-unused-vars
8181
throw new Error("Implement me!");
8282
}
8383

84-
shouldCompileFileSync(fileName, compilerContext) {
84+
shouldCompileFileSync(fileName, compilerContext) { // eslint-disable-line no-unused-vars
8585
throw new Error("Implement me!");
8686
}
8787

88-
determineDependentFilesSync(sourceCode, fileName, compilerContext) {
88+
determineDependentFilesSync(sourceCode, fileName, compilerContext) { // eslint-disable-line no-unused-vars
8989
throw new Error("Implement me!");
9090
}
9191

92-
compileSync(sourceCode, fileName, compilerContext) {
92+
compileSync(sourceCode, fileName, compilerContext) { // eslint-disable-line no-unused-vars
9393
throw new Error("Implement me!");
9494
}
9595

9696
/**
97-
* Returns a version number representing the version of the underlying
97+
* Returns a version number representing the version of the underlying
9898
* compiler library. When this number changes, electron-compile knows
9999
* to throw all away its generated code.
100-
*
101-
* @return {string} A version number. Note that this string isn't
100+
*
101+
* @return {string} A version number. Note that this string isn't
102102
* parsed in any way, just compared to the previous
103103
* one for equality.
104104
*
105105
* @abstract
106-
*/
106+
*/
107107
getCompilerVersion() {
108108
throw new Error("Implement me!");
109109
}
110110
}
111111

112112

113113
/**
114-
* This class implements all of the async methods of CompilerBase by just
115-
* calling the sync version. Use it to save some time when implementing
114+
* This class implements all of the async methods of CompilerBase by just
115+
* calling the sync version. Use it to save some time when implementing
116116
* simple compilers.
117117
*
118-
* To use it, implement the compile method, the getCompilerVersion method,
119-
* and the getInputMimeTypes static method.
120-
*
118+
* To use it, implement the compile method, the getCompilerVersion method,
119+
* and the getInputMimeTypes static method.
120+
*
121121
* @abstract
122-
*/
122+
*/
123123
export class SimpleCompilerBase extends CompilerBase {
124124
constructor() {
125125
super();
126126
}
127127

128-
async shouldCompileFile(fileName, compilerContext) {
128+
async shouldCompileFile(fileName, compilerContext) { // eslint-disable-line no-unused-vars
129129
return true;
130130
}
131131

132-
async determineDependentFiles(sourceCode, filePath, compilerContext) {
132+
async determineDependentFiles(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
133133
return [];
134134
}
135135

136136
async compile(sourceCode, filePath, compilerContext) {
137137
return this.compileSync(sourceCode, filePath, compilerContext);
138138
}
139139

140-
shouldCompileFileSync(fileName, compilerContext) {
140+
shouldCompileFileSync(fileName, compilerContext) { // eslint-disable-line no-unused-vars
141141
return true;
142142
}
143143

144-
determineDependentFilesSync(sourceCode, filePath, compilerContext) {
144+
determineDependentFilesSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
145145
return [];
146146
}
147147
}

src/css/less.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ export default class LessCompiler extends CompilerBase {
2424
return mimeTypes;
2525
}
2626

27-
async shouldCompileFile(fileName, compilerContext) {
27+
async shouldCompileFile(fileName, compilerContext) { // eslint-disable-line no-unused-vars
2828
return true;
2929
}
3030

3131
async determineDependentFiles(sourceCode, filePath, compilerContext) {
3232
return this.determineDependentFilesSync(sourceCode, filePath, compilerContext);
3333
}
3434

35-
async compile(sourceCode, filePath, compilerContext) {
35+
async compile(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
3636
lessjs = lessjs || this.getLess();
3737

3838
let thisPath = path.dirname(filePath);
@@ -66,11 +66,11 @@ export default class LessCompiler extends CompilerBase {
6666
};
6767
}
6868

69-
shouldCompileFileSync(fileName, compilerContext) {
69+
shouldCompileFileSync(fileName, compilerContext) { // eslint-disable-line no-unused-vars
7070
return true;
7171
}
7272

73-
determineDependentFilesSync(sourceCode, filePath, compilerContext) {
73+
determineDependentFilesSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
7474
let dependencyFilenames = detective(sourceCode);
7575
let dependencies = [];
7676

@@ -81,7 +81,7 @@ export default class LessCompiler extends CompilerBase {
8181
return dependencies;
8282
}
8383

84-
compileSync(sourceCode, filePath, compilerContext) {
84+
compileSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
8585
lessjs = lessjs || this.getLess();
8686

8787
let source;

src/css/sass.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ export default class SassCompiler extends CompilerBase {
2929
return mimeTypes;
3030
}
3131

32-
async shouldCompileFile(fileName, compilerContext) {
32+
async shouldCompileFile(fileName, compilerContext) { // eslint-disable-line no-unused-vars
3333
return true;
3434
}
3535

3636
async determineDependentFiles(sourceCode, filePath, compilerContext) {
3737
return this.determineDependentFilesSync(sourceCode, filePath, compilerContext);
3838
}
3939

40-
async compile(sourceCode, filePath, compilerContext) {
40+
async compile(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
4141
sass = sass || this.getSass();
4242

4343
let thisPath = path.dirname(filePath);
@@ -86,11 +86,11 @@ export default class SassCompiler extends CompilerBase {
8686
};
8787
}
8888

89-
shouldCompileFileSync(fileName, compilerContext) {
89+
shouldCompileFileSync(fileName, compilerContext) { // eslint-disable-line no-unused-vars
9090
return true;
9191
}
9292

93-
determineDependentFilesSync(sourceCode, filePath, compilerContext) {
93+
determineDependentFilesSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
9494
let dependencyFilenames = path.extname(filePath) === '.sass' ? detectiveSASS(sourceCode) : detectiveSCSS(sourceCode);
9595
let dependencies = [];
9696

@@ -101,7 +101,7 @@ export default class SassCompiler extends CompilerBase {
101101
return dependencies;
102102
}
103103

104-
compileSync(sourceCode, filePath, compilerContext) {
104+
compileSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
105105
sass = sass || this.getSass();
106106

107107
let thisPath = path.dirname(filePath);

src/css/stylus.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ export default class StylusCompiler extends CompilerBase {
3434
return mimeTypes;
3535
}
3636

37-
async shouldCompileFile(fileName, compilerContext) {
37+
async shouldCompileFile(fileName, compilerContext) { // eslint-disable-line no-unused-vars
3838
return true;
3939
}
4040

41-
async determineDependentFiles(sourceCode, filePath, compilerContext) {
41+
async determineDependentFiles(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
4242
return this.determineDependentFilesSync(sourceCode, filePath, compilerContext);
4343
}
4444

45-
async compile(sourceCode, filePath, compilerContext) {
45+
async compile(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
4646
nib = nib || require('nib');
4747
stylusjs = stylusjs || require('stylus');
4848
this.seenFilePaths[path.dirname(filePath)] = true;
@@ -89,8 +89,8 @@ export default class StylusCompiler extends CompilerBase {
8989

9090
return opts;
9191
}
92-
93-
92+
93+
9494
applyOpts(opts, stylus) {
9595
each(opts, (val, key) => {
9696
switch(key) {
@@ -109,11 +109,11 @@ export default class StylusCompiler extends CompilerBase {
109109
stylus.set('paths', Object.keys(this.seenFilePaths).concat(['.']));
110110
}
111111

112-
shouldCompileFileSync(fileName, compilerContext) {
112+
shouldCompileFileSync(fileName, compilerContext) { // eslint-disable-line no-unused-vars
113113
return true;
114114
}
115115

116-
determineDependentFilesSync(sourceCode, filePath, compilerContext) {
116+
determineDependentFilesSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
117117
let dependencyFilenames = detective(sourceCode);
118118
let dependencies = [];
119119

@@ -124,7 +124,7 @@ export default class StylusCompiler extends CompilerBase {
124124
return dependencies;
125125
}
126126

127-
compileSync(sourceCode, filePath, compilerContext) {
127+
compileSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
128128
nib = nib || require('nib');
129129
stylusjs = stylusjs || require('stylus');
130130
this.seenFilePaths[path.dirname(filePath)] = true;

src/html/inline-html.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ export default class InlineHtmlCompiler extends CompilerBase {
6565
return inputMimeTypes;
6666
}
6767

68-
async shouldCompileFile(fileName, compilerContext) {
68+
async shouldCompileFile(fileName, compilerContext) { // eslint-disable-line no-unused-vars
6969
return true;
7070
}
7171

72-
async determineDependentFiles(sourceCode, filePath, compilerContext) {
72+
async determineDependentFiles(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
7373
return [];
7474
}
7575

@@ -178,11 +178,11 @@ export default class InlineHtmlCompiler extends CompilerBase {
178178
};
179179
}
180180

181-
shouldCompileFileSync(fileName, compilerContext) {
181+
shouldCompileFileSync(fileName, compilerContext) { // eslint-disable-line no-unused-vars
182182
return true;
183183
}
184184

185-
determineDependentFilesSync(sourceCode, filePath, compilerContext) {
185+
determineDependentFilesSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
186186
return [];
187187
}
188188

0 commit comments

Comments
 (0)