-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.js
97 lines (82 loc) · 3.41 KB
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
*
* Package: requireurl
* Author: Ganesh B
* Description:
* Install: npm i require-urls --save
* Github: https://github.com/ganeshkbhat/requireurl
* npmjs Link: https://www.npmjs.com/package/require-urls
* File: demos/demo.js
* File Description: Using requireurl instead of require to fetch files from git repositories like Github or Bitbucket like repository directly
*
*/
/* eslint no-console: 0 */
'use strict';
let requireurls = require("../index");
// /**
// *
// * Demos are based on commit numbers or on tag numbers or version numbers
// *
// * A commit number variable will start with C. Example C8d8681c4a2 will be commit - 8d8681c4a2
// * A version number based fetch example will start with V. Example V00_00_7 will be version - 00.00.7
// * A tag commit based fetch example will start with T. Example T0_0_7 will be tag - 0.0.7
// *
// * NOTE:
// *
// * All function implements will be based on the most recent commit of index.js.
// * Any change in demos of usage of function will be based on the recent commit.
// * The URLs usage will based on what was fetched.
// *
// */
// /**
// * Commit:
// * C8d8681c4a2
// *
// * @type {*}
// *
// */
// let C8d8681c4a2 = requireurls("https://raw.githubusercontent.com/ganeshkbhat/requireurl/8d8681c4a28d64f23fb473064fa86880a0b930ff/index.js");
// console.log("[C8d8681c4a2] Testing returns: ", C8d8681c4a2);
// /**
// * Version:
// * V00_00_7
// *
// * @type {*}
// *
// */
// let V00_00_7 = requireurls("https://github.com/ganeshkbhat/requireurl/blob/a34a222d761bb70d51ff3267c8530f40918db53e/index.js");
// console.log("[V00_00_7] Testing returns: ", V00_00_7);
// /**
// * Tag:
// * T0_0_7
// *
// * @type {*}
// *
// */
// let T0_0_7 = requireurls("https://github.com/ganeshkbhat/requireurl/blob/a34a222d761bb70d51ff3267c8530f40918db53e/index.js");
// console.log("[T0_0_7] Testing returns: ", T0_0_7);
// /**
// * Commit:
// * C2e5181793d
// *
// * @type {*}
// *
// */
// let C2e5181793d = requireurls("https://github.com/ganeshkbhat/requireurl/blob/2e5181793dd8c076aafd46f3330c59e4abd70908/index.js");
// console.log("[C2e5181793d] Testing returns: ", C2e5181793d);
// /**
// * Commit:
// * Clatestcommit
// *
// * @type {*}
// *
// */
// let Clatestcommit = requireurls("https://github.com/ganeshkbhat/requireurl/blob/main/index.js", { baseType: "git", recursive: false, forceUpdate: true, logger: console.log, cacheFetch: false, getMethods: false, noRequire: false });
// console.log("[Clatestcommit] index.js: ", Clatestcommit);
// let Clatest = requireurls("https://github.com/cgi-js/cgi-js/blob/main/src/index.js", { baseType: "git", recursive: true, forceUpdate: true, logger: console.log, cacheFetch: false, getMethods: false, noRequire: false });
// console.log("[Clatestcommit] index.js: ", Clatest);
// let Clatest = requireurls("https://raw.githubusercontent.com/traverse-fs/fssys/main/index.js", { baseType: "git", recursive: true, forceUpdate: true, logger: console.log, cacheFetch: false, getMethods: false, noRequire: false });
// console.log("[Clatestcommit] index.js: ", Clatest);
// let pjsonLatest = requireurls("https://raw.githubusercontent.com/ganeshkbhat/fastprimenumbers/main/nodejs/package.json");
// // console.log(pjsonLatest.then(console.log));
// console.log("pjsonLatest: ", pjsonLatest.then(console.log));