add lint-fix task, fix linting errors in fetching examples code
This commit is contained in:
parent
8120fdd7db
commit
1d6e59ada3
3 changed files with 25 additions and 25 deletions
|
@ -6,6 +6,7 @@
|
||||||
"start": "BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
|
"start": "BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
|
||||||
"start:prod": "NODE_ENV=production node index.js",
|
"start:prod": "NODE_ENV=production node index.js",
|
||||||
"lint": "eslint client server",
|
"lint": "eslint client server",
|
||||||
|
"lint-fix": "eslint client server --fix",
|
||||||
"build": "NODE_ENV=production webpack --config webpack.config.prod.js --progress",
|
"build": "NODE_ENV=production webpack --config webpack.config.prod.js --progress",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"fetch-examples": "node fetch-examples.js",
|
"fetch-examples": "node fetch-examples.js",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import rp from 'request-promise';
|
import rp from 'request-promise';
|
||||||
import Q from 'q';
|
import Q from 'q';
|
||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
import objectID from 'bson-objectid'
|
import objectID from 'bson-objectid';
|
||||||
import shortid from 'shortid';
|
import shortid from 'shortid';
|
||||||
import User from './models/user';
|
import User from './models/user';
|
||||||
import Project from './models/project';
|
import Project from './models/project';
|
||||||
|
@ -88,7 +88,7 @@ function getCategories() {
|
||||||
url: 'https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/en?client_id=' +
|
url: 'https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/en?client_id=' +
|
||||||
client_id + '&client_secret=' + client_secret,
|
client_id + '&client_secret=' + client_secret,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: headers
|
headers
|
||||||
};
|
};
|
||||||
return rp(options).then(res => {
|
return rp(options).then(res => {
|
||||||
const json = JSON.parse(res);
|
const json = JSON.parse(res);
|
||||||
|
@ -112,7 +112,7 @@ function getSketchesInCategories(categories) {
|
||||||
const options = {
|
const options = {
|
||||||
url: category.url.replace('?ref=master', '') + '?client_id=' + client_id + '&client_secret=' + client_secret,
|
url: category.url.replace('?ref=master', '') + '?client_id=' + client_id + '&client_secret=' + client_secret,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: headers
|
headers
|
||||||
};
|
};
|
||||||
|
|
||||||
return rp(options).then(res => {
|
return rp(options).then(res => {
|
||||||
|
@ -131,14 +131,13 @@ function getSketchesInCategories(categories) {
|
||||||
} else {
|
} else {
|
||||||
projectName = category.name + ': ' + example.name.replace('.js', '');
|
projectName = category.name + ': ' + example.name.replace('.js', '');
|
||||||
}
|
}
|
||||||
projectsInOneCategory.push({sketchUrl: example.download_url, projectName: projectName});
|
projectsInOneCategory.push({ sketchUrl: example.download_url, projectName });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return projectsInOneCategory;
|
return projectsInOneCategory;
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +147,7 @@ function getSketchContent(projectsInAllCategories) {
|
||||||
const options = {
|
const options = {
|
||||||
url: project.sketchUrl.replace('?ref=master', '') + '?client_id=' + client_id + '&client_secret=' + client_secret,
|
url: project.sketchUrl.replace('?ref=master', '') + '?client_id=' + client_id + '&client_secret=' + client_secret,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: headers
|
headers
|
||||||
};
|
};
|
||||||
|
|
||||||
return rp(options).then(res => {
|
return rp(options).then(res => {
|
||||||
|
@ -175,7 +174,7 @@ function createProjectsInP5user(projectsInAllCategories) {
|
||||||
url: 'https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/assets?client_id=' +
|
url: 'https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/assets?client_id=' +
|
||||||
client_id + '&client_secret=' + client_secret,
|
client_id + '&client_secret=' + client_secret,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: headers
|
headers
|
||||||
};
|
};
|
||||||
|
|
||||||
rp(options).then(res => {
|
rp(options).then(res => {
|
||||||
|
@ -322,7 +321,6 @@ function createProjectsInP5user(projectsInAllCategories) {
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable */
|
||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { uniqWith, isEqual } from 'lodash';
|
import { uniqWith, isEqual } from 'lodash';
|
||||||
|
|
Loading…
Reference in a new issue