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

Commit bbaad1b

Browse files
author
Glen Pike
committed
Check that histories directory exists before trying to create.
Add post-install script that should be cross-platform. Closes #18
1 parent 0bd35df commit bbaad1b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

bin/npm-postinstall

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
const { exec } = require('child_process');
4+
5+
const historiesPath = path.normalize('./histories');
6+
7+
if(!fs.existsSync(historiesPath)) {
8+
exec('mkdir ' + historiesPath, (error) => {
9+
if (error) {
10+
throw new Error(`error making histories directory: ${error}`);
11+
}
12+
});
13+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Line focuser",
55
"main": "src/locus.js",
66
"scripts": {
7-
"postinstall": "mkdir ./histories"
7+
"postinstall": "node bin/npm-postinstall"
88
},
99
"files": [
1010
"src/"

0 commit comments

Comments
 (0)