postinstall script

This commit is contained in:
Clément GOUIN
2019-06-19 10:37:17 +02:00
parent f170b4c3ea
commit 2842c89d71
4 changed files with 26 additions and 1 deletions
+2 -1
View File
@@ -18,7 +18,8 @@
"supertest": "^4.0.2"
},
"scripts": {
"test": "jest"
"test": "jest",
"install": "postinstall.js"
},
"repository": {
"type": "git",
+18
View File
@@ -0,0 +1,18 @@
const fs = require('fs');
const ncp = require('ncp').ncp;
const pad0 = n => ('0'+n).substr(-2);
const datetime = new Date();
const dir = `./data/${datetime.getFullYear()}/${pad0(datetime.getMonth())}/${pad0(datetime.getDay())}/`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, {recursive: true});
}
ncp('./sample_data/',dir, function(err){
if(err)
console.error(err);
else
console.log('done');
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 898 KiB

+6
View File
@@ -0,0 +1,6 @@
# Welcome to your new blog
## If you see this page, that means it's working
![missing image](./birthday-cake.png)