|
@@ -1,4 +1,5 @@
|
|
|
const copydir = require('copy-dir');
|
|
|
+const LineReader = require('n-readlines');
|
|
|
const file = require('./src/file');
|
|
|
const deploy = require('./deploy.json');
|
|
|
|
|
@@ -44,4 +45,30 @@ deploy.programs.forEach(program => {
|
|
|
let json = JSON.stringify(pckg, null, 4);
|
|
|
json = json.replace(new RegExp(program.main, 'g'), 'main.js');
|
|
|
file.put(distPath + '/package.json', json);
|
|
|
-});
|
|
|
+ // Ecriture ReadMe
|
|
|
+ file.put(distPath + '/README.md', readMe(program.part));
|
|
|
+});
|
|
|
+
|
|
|
+// Fonction découpage readme
|
|
|
+function readMe(part) {
|
|
|
+ const liner = new LineReader('./README.md');
|
|
|
+ let data = '';
|
|
|
+ let line = liner.next().toString();
|
|
|
+ while (line !== 'false' && line.indexOf('## Partie ') === -1) {
|
|
|
+ data += '\n' + line;
|
|
|
+ line = liner.next().toString();
|
|
|
+ }
|
|
|
+ while (line !== 'false' && line.indexOf('## Partie ' + part) === -1) {
|
|
|
+ line = liner.next().toString();
|
|
|
+ }
|
|
|
+ data += '\n' + line;
|
|
|
+ line = liner.next().toString();
|
|
|
+ while (line !== 'false' && line.indexOf('## Partie ') === -1) {
|
|
|
+ data += '\n' + line;
|
|
|
+ line = liner.next().toString();
|
|
|
+ }
|
|
|
+ if (line !== 'false') {
|
|
|
+ liner.close();
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+}
|