Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
fix: published files
Browse files Browse the repository at this point in the history
NPM hates symlinks, so we create them in postinstall
  • Loading branch information
aleclarson committed Jul 22, 2018
1 parent 0241620 commit 278cc69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 0 additions & 5 deletions index.js
@@ -1,8 +1,3 @@
const fs = require('fs');
try {
fs.symlinkSync('..', 'node_modules/cush');
} catch(e) {}

const cush = require('./lib/index');
module.exports = cush;

Expand Down
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -5,12 +5,15 @@
"description": "Modern module bundler",
"repository": "https://github.com/aleclarson/cush.git",
"scripts": {
"build": "coffee-build src -o lib"
"build": "coffee-build src -o lib",
"postinstall": "node ./postinstall"
},
"engines": {
"node": ">=9"
},
"files": [
"index.js",
"postinstall.js",
"lib",
"utils"
],
Expand Down
11 changes: 11 additions & 0 deletions postinstall.js
@@ -0,0 +1,11 @@
const fs = require('fs');

try {
// allow require("cush") from inside cush
fs.symlinkSync('..', 'node_modules/cush');
} catch(e) {}

try {
// allow require("cush/utils")
fs.symlinkSync('./lib/utils', 'utils');
} catch(e) {}

0 comments on commit 278cc69

Please sign in to comment.