localhostforonline 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +25 -0
- package/package.json +2 -2
package/cli.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var spawnSync = require('child_process').spawnSync;
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
|
|
6
|
+
var platformMap = { linux: 'linux', darwin: 'darwin', win32: 'win32' };
|
|
7
|
+
var archMap = { x64: 'amd64', arm64: 'arm64' };
|
|
8
|
+
|
|
9
|
+
var plat = platformMap[process.platform];
|
|
10
|
+
var arch = archMap[process.arch];
|
|
11
|
+
|
|
12
|
+
if (!plat || !arch) {
|
|
13
|
+
console.error('Unsupported platform: ' + process.platform + ' ' + process.arch);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var ext = process.platform === 'win32' ? '.exe' : '';
|
|
18
|
+
var binary = path.join(__dirname, 'binaries', 'lf-' + plat + '-' + arch + ext);
|
|
19
|
+
|
|
20
|
+
if (!fs.existsSync(binary)) {
|
|
21
|
+
require('./install.js');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
25
|
+
process.exit(result.status);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "localhostforonline",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Expose your localhost to the internet",
|
|
5
5
|
"bin": {
|
|
6
|
-
"localhostforonline": "
|
|
6
|
+
"localhostforonline": "cli.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"postinstall": "node install.js"
|