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

Commit 2c25fa4

Browse files
Bundle postinstall script dependencies. #213 (also, switched to prompt-lite as it has way less dependencies)
2 parents a7fd210 + 83b80f7 commit 2c25fa4

File tree

6 files changed

+48
-2
lines changed

6 files changed

+48
-2
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.idea
22
.DS_Store
3-
node_modules
3+
node_modules
4+
*.tgz
5+
scripts/postinstall.js

.npmignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
platforms/android/libraryproject/
22
docs
33
README.md
4-
CHANGELOG.md
4+
CHANGELOG.md
5+
*.tgz
6+
scripts/webpack.config.js
7+
scripts/installer.js
8+
scripts/winston-mock.js

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
}
1212
},
1313
"scripts": {
14+
"bundle-installer": "webpack --config scripts/webpack.config.js scripts/installer.js scripts/postinstall.js",
15+
"prepublish": "npm run bundle-installer",
16+
"postinstall": "node scripts/postinstall.js"
1417
"postinstall": "node scripts/postinstall.js",
1518
"config": "node scripts/postinstall.js config"
1619
},
@@ -42,6 +45,9 @@
4245
"url": "https://github.com/eddyverbruggen/nativescript-plugin-firebase/issues"
4346
},
4447
"homepage": "https://github.com/eddyverbruggen/nativescript-plugin-firebase",
48+
"devDependencies": {
49+
"prompt": "^1.0.0",
50+
"webpack": "~2.1.0-beta.25"
4551
"dependencies": {
4652
"app-root-path": "^2.0.1",
4753
"prompt-lite": "0.1.1"

scripts/postinstall.js renamed to scripts/installer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
var fs = require('fs');
22
var path = require('path');
33
var prompt = require('prompt-lite');
4+
var path = require('path');
5+
var prompt = require('prompt');
46

57
// Default settings for using ios and android with Firebase
68
var usingiOS = false, usingAndroid = false;

scripts/webpack.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var path = require("path");
2+
var webpack = require("webpack");
3+
4+
module.exports = {
5+
target: "node",
6+
output: {
7+
//some debug info around module imports
8+
pathinfo: true
9+
},
10+
resolve: {
11+
alias: {
12+
//winston is inherently unpackable. replace with our mock
13+
"winston": path.join(__dirname, "winston-mock.js")
14+
}
15+
},
16+
externals: {
17+
//pkginfo is unpackable too, but we can replace it with a simple expression
18+
"pkginfo": "function(){}"
19+
}
20+
}

scripts/winston-mock.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//Export a Logger-like to avoid crashing winston clients
2+
module.exports.Logger = function Logger() {};
3+
module.exports.Logger.prototype = {
4+
cli: function() {},
5+
help: function() {},
6+
input: function() {},
7+
error: function() {},
8+
};
9+
10+
module.exports.transports = {
11+
Console: function Console() {}
12+
};

0 commit comments

Comments
 (0)