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

Commit

Permalink
Bundle postinstall script dependencies. #213 (also, switched to promp…
Browse files Browse the repository at this point in the history
…t-lite as it has way less dependencies)
  • Loading branch information
EddyVerbruggen committed Nov 20, 2016
2 parents a7fd210 + 83b80f7 commit 2c25fa4
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
.DS_Store
node_modules
node_modules
*.tgz
scripts/postinstall.js
6 changes: 5 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
platforms/android/libraryproject/
docs
README.md
CHANGELOG.md
CHANGELOG.md
*.tgz
scripts/webpack.config.js
scripts/installer.js
scripts/winston-mock.js
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
}
},
"scripts": {
"bundle-installer": "webpack --config scripts/webpack.config.js scripts/installer.js scripts/postinstall.js",
"prepublish": "npm run bundle-installer",
"postinstall": "node scripts/postinstall.js"
"postinstall": "node scripts/postinstall.js",
"config": "node scripts/postinstall.js config"
},
Expand Down Expand Up @@ -42,6 +45,9 @@
"url": "https://github.com/eddyverbruggen/nativescript-plugin-firebase/issues"
},
"homepage": "https://github.com/eddyverbruggen/nativescript-plugin-firebase",
"devDependencies": {
"prompt": "^1.0.0",
"webpack": "~2.1.0-beta.25"
"dependencies": {
"app-root-path": "^2.0.1",
"prompt-lite": "0.1.1"
Expand Down
2 changes: 2 additions & 0 deletions scripts/postinstall.js → scripts/installer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var fs = require('fs');
var path = require('path');
var prompt = require('prompt-lite');
var path = require('path');
var prompt = require('prompt');

// Default settings for using ios and android with Firebase
var usingiOS = false, usingAndroid = false;
Expand Down
20 changes: 20 additions & 0 deletions scripts/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var path = require("path");
var webpack = require("webpack");

module.exports = {
target: "node",
output: {
//some debug info around module imports
pathinfo: true
},
resolve: {
alias: {
//winston is inherently unpackable. replace with our mock
"winston": path.join(__dirname, "winston-mock.js")
}
},
externals: {
//pkginfo is unpackable too, but we can replace it with a simple expression
"pkginfo": "function(){}"
}
}
12 changes: 12 additions & 0 deletions scripts/winston-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//Export a Logger-like to avoid crashing winston clients
module.exports.Logger = function Logger() {};
module.exports.Logger.prototype = {
cli: function() {},
help: function() {},
input: function() {},
error: function() {},
};

module.exports.transports = {
Console: function Console() {}
};

0 comments on commit 2c25fa4

Please sign in to comment.