Skip to content

Commit

Permalink
fix: making build be platform-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
akosbalasko authored Jun 5, 2020
2 parents 6e9f04f + b72ad0b commit a46dff8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var fs = require('fs')
var resolve = require('path').resolve
var join = require('path').join
var cp = require('child_process')
var os = require('os')

// get library path
var lib = resolve(__dirname, 'node_modules', 'turndown');

// ensure path has package.json
if (!fs.existsSync(join(lib, 'package.json'))) return

// npm binary based on OS
var npmCmd = os.platform().startsWith('win') ? 'npm.cmd' : 'npm'

// install folder
cp.execSync(`${npmCmd} i`, { cwd: lib, stdio: 'inherit' })
cp.execSync(`${npmCmd} run build`, { cwd: lib, stdio: 'inherit' })

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yarle-evernote-to-md",
"version": "2.7.0",
"version": "2.7.1",
"description": "Yet Another Rope Ladder from Evernote",
"keywords": [
"evernote",
Expand All @@ -17,7 +17,7 @@
"lint": "tslint --project ./src/tsconfig.json",
"start": "node --max-old-space-size=1024 ./dist/dropTheRope.js",
"test": "nyc --reporter=html --reporter=text mocha",
"postinstall": "cd ./node_modules/turndown; npm i; npm run build"
"postinstall": "node build.js"
},
"author": "Akos Balasko",
"dependencies": {
Expand Down

0 comments on commit a46dff8

Please sign in to comment.