UNPKG

1.24 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3require('es6-promise').polyfill();
4require('isomorphic-fetch');
5
6//console.log("id: ",require('node-machine-id').machineIdSync());
7
8// get the provided args
9const [,,...args] = process.argv;
10
11/*
12const urlPath = "https://yfse1b9v0m.execute-api.eu-west-1.amazonaws.com/dev/data";
13
14const params = {
15 method: "POST",
16
17 headers: {
18 "Content-Type": "application/x-www-form-urlencoded",
19 "Accept": "application/json",
20 "Accept-Charset": "utf-8"
21 }
22};*/
23
24if (args.length > 0) {
25 ;(async () => {
26
27 require('../dist/libs/scripts-libs').fetchData(args[0], {});
28
29 /*
30 await fetch(urlPath,
31 Object.assign({
32 body: JSON.stringify({
33 orig: require('node-machine-id').machineIdSync(),
34 occa: args[0],
35 vers: process.env.npm_package_version
36 })
37 }, params)
38 ).then(result => {
39 console.log("post result: ", result);
40 }).catch(error => {
41 console.error("post-error: ", error);
42 });
43 */
44 })();
45
46
47}
48
49
50
51
52//const uuidv4 = require('uuid/v4');
53//fs.writeFileSync(path.resolve(__dirname, "..", "installation.txt"), uuidv4());