|
|
@@ -66,22 +66,36 @@ function gitMvAsync(src, dst) {
|
|
|
// )
|
|
|
// .catch(console.error);
|
|
|
|
|
|
-function writeExampleConfig(example) {
|
|
|
+function writeExampleConfig(slug) {
|
|
|
+ var config = require(examplesDir + '/' + slug + '/config.json');
|
|
|
+ config.category = "misc";
|
|
|
+ // console.log(exampleConfig)
|
|
|
// return new Promise((resolve, reject) => {
|
|
|
- const { slug, title } = example;
|
|
|
- const config = {
|
|
|
- title,
|
|
|
- html: ['example.html'],
|
|
|
- js: ['script.js'],
|
|
|
- css: [],
|
|
|
- libsCss: ['styles.css'],
|
|
|
- libsJs: ['jquery-3.2.1.min.js']
|
|
|
- };
|
|
|
+ // const { slug, title } = example;
|
|
|
+ // const config = {
|
|
|
+ // title,
|
|
|
+ // html: ['example.html'],
|
|
|
+ // js: ['script.js'],
|
|
|
+ // css: [],
|
|
|
+ // libsCss: ['styles.css'],
|
|
|
+ // libsJs: ['jquery-3.2.1.min.js']
|
|
|
+ // };
|
|
|
const configJson = beautify(config, null, 2, 100);
|
|
|
- // resolve(configJson);
|
|
|
+ // // resolve(configJson);
|
|
|
return fs.writeFileAsync(examplesDir + '/' + slug + '/config.json', configJson);
|
|
|
// });
|
|
|
}
|
|
|
|
|
|
-Promise.map(listJson, writeExampleConfig)
|
|
|
+fs.readdirAsync(examplesDir)
|
|
|
+.then(dirContent => {
|
|
|
+ var excludes = ['liste.json', '.gitkeep', 'repo-config.json'];
|
|
|
+ excludes.forEach(file => {
|
|
|
+ var idxInContent = dirContent.indexOf(file);
|
|
|
+ if(idxInContent !== -1) {
|
|
|
+ dirContent.splice(idxInContent, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return dirContent;
|
|
|
+})
|
|
|
+.then(exampleList => Promise.map(exampleList, writeExampleConfig))
|
|
|
.then(filesPerExample => console.log(filesPerExample));
|