roll-right 0.0.1 → 0.0.2
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/README.md +41 -10
- package/bin/index.js +107 -4
- package/index.js +1 -1
- package/lib/mod_utils.js +79 -0
- package/lib/phase1.js +441 -0
- package/lib/phase2.js +77 -0
- package/lib/rr_utils.js +128 -8
- package/lib/to_export.js +39 -0
- package/lib/utils.js +97 -0
- package/package.json +8 -1
- package/tools/affiliates.js +132 -0
- package/tools/allgen.sh +20 -0
- package/tools/charwindow.js +17 -0
- package/tools/filter_requires.js +60 -0
- package/tools/genpage.js +141 -0
- package/tools/npm_much.sh +57 -0
- package/tools/prep_body_insert_only.js +28 -0
- package/tools/releasepages.js +814 -0
- package/tools/rungen.sh +6 -0
- package/tools/rungen_dashboard.sh +5 -0
- package/tools/rungen_header_shell.sh +5 -0
- package/tools/rungen_paramed_shell.sh +12 -0
- package/tools/rungen_profile.sh +5 -0
- package/tools/web_files.js +149 -0
- package/transform.js +490 -0
- package/roll_right.js +0 -96
package/lib/to_export.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FuncToExport {
|
|
7
|
+
|
|
8
|
+
constructor(file_text) {
|
|
9
|
+
this.code = file_text
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function_to_exports(code_str) {
|
|
13
|
+
code_str = code_str.replace(/^\s*async\s+function\s*/g,'async function ')
|
|
14
|
+
//
|
|
15
|
+
let code_array = code_str.split('async function')
|
|
16
|
+
for ( let i = 0; i < code_array.length; i++ ) {
|
|
17
|
+
let str = code_array[i]
|
|
18
|
+
let lines = str.split('\n')
|
|
19
|
+
for ( let j = 0; j < lines.length; j++ ) {
|
|
20
|
+
let line = lines[j]
|
|
21
|
+
if ( /^\s*function\s+/.test(line) ) {
|
|
22
|
+
line = line.replace(/^\s*function\s+/g,"export function ")
|
|
23
|
+
lines[j] = line
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
str = lines.join('\n')
|
|
27
|
+
code_array[i] = str
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
code_array = code_array.map((str) => str.trim())
|
|
31
|
+
|
|
32
|
+
let out = code_array.join("\nexport async function ")
|
|
33
|
+
return out
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
module.exports = FuncToExport
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const untildify = require('untildify')
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// //
|
|
6
|
+
module.exports.load_json_file = (src) => {
|
|
7
|
+
try {
|
|
8
|
+
let contents = JSON.parse(fs.readFileSync(src).toString())
|
|
9
|
+
return contents
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.log(e)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
module.exports.gsubst = (str,pattern,value) => {
|
|
18
|
+
let i = str.indexOf(pattern)
|
|
19
|
+
let j = 0
|
|
20
|
+
while ( i >= 0 ) {
|
|
21
|
+
str = str.replace(pattern,value,j)
|
|
22
|
+
j = i
|
|
23
|
+
i = str.indexOf(pattern)
|
|
24
|
+
}
|
|
25
|
+
return str
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// recursive_flat
|
|
30
|
+
function recursive_flat(ary) {
|
|
31
|
+
if ( Array.isArray(ary) ) {
|
|
32
|
+
let outary = []
|
|
33
|
+
for ( let el of ary ) {
|
|
34
|
+
if ( Array.isArray(el) ) {
|
|
35
|
+
outary = outary.concat(recursive_flat(el))
|
|
36
|
+
} else {
|
|
37
|
+
outary.push(el)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return outary
|
|
41
|
+
} else {
|
|
42
|
+
return ary
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
module.exports.array_flatten = (items_array) => {
|
|
48
|
+
let final_array = []
|
|
49
|
+
for ( let item of items_array ) {
|
|
50
|
+
if ( !Array.isArray(item) ) {
|
|
51
|
+
final_array.push(item)
|
|
52
|
+
} else {
|
|
53
|
+
let ary = recursive_flat(item)
|
|
54
|
+
final_array = final_array.concat(ary)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return final_array
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function pop_dir(where_am_i) {
|
|
61
|
+
let last_dir = where_am_i.lastIndexOf('/')
|
|
62
|
+
if ( last_dir > 0 ) {
|
|
63
|
+
where_am_i = where_am_i.substr(0,last_dir)
|
|
64
|
+
}
|
|
65
|
+
return where_am_i
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function default_realtive_asset_dir() {
|
|
69
|
+
let where_am_i = __dirname
|
|
70
|
+
let default_dir = pop_dir(where_am_i)
|
|
71
|
+
return default_dir
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
function translate_marker(clean_key,conf) {
|
|
76
|
+
if ( clean_key === "default" ) {
|
|
77
|
+
clean_key = default_realtive_asset_dir()
|
|
78
|
+
} else {
|
|
79
|
+
let syntax_boundary = clean_key.indexOf(']')
|
|
80
|
+
if ( syntax_boundary > 0 ) {
|
|
81
|
+
let location_marker = clean_key.substr(0,syntax_boundary+1)
|
|
82
|
+
let findable = conf.path_abreviations[location_marker]
|
|
83
|
+
if ( findable ) {
|
|
84
|
+
clean_key = clean_key.replace(location_marker,findable).trim()
|
|
85
|
+
if ( clean_key[0] === '[' ) {
|
|
86
|
+
clean_key = translate_marker(clean_key,conf)
|
|
87
|
+
} else if ( clean_key[0] === '~' ) {
|
|
88
|
+
clean_key = untildify(clean_key)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return clean_key
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
module.exports.translate_marker = translate_marker
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roll-right",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A helper utilty for gather browser artifacts from node modules, code repositories, etc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "node tests/index.js"
|
|
14
14
|
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"byte-base64": "^1.1.0",
|
|
17
|
+
"fs-extra": "^10.0.1",
|
|
18
|
+
"handlebars": "^4.7.7",
|
|
19
|
+
"minimist": "^1.2.5",
|
|
20
|
+
"untildify": "^4.0.0"
|
|
21
|
+
},
|
|
15
22
|
"repository": {
|
|
16
23
|
"type": "git",
|
|
17
24
|
"url": "git+https://github.com/copious-world/roll-right.git"
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
|
|
4
|
+
// //
|
|
5
|
+
let output_dir = process.argv[2]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function load_affiliate_db() {
|
|
10
|
+
let data = fs.readFileSync("affiliates.json",'ascii').toString()
|
|
11
|
+
return JSON.parse(data)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const MY_OCCUR_THESHOLD = 2
|
|
16
|
+
|
|
17
|
+
function count_occurances(key,text) {
|
|
18
|
+
let next_find = 0
|
|
19
|
+
let occurs = 0
|
|
20
|
+
while ( next_find >= 0 ) {
|
|
21
|
+
next_find = text.indexOf(key,next_find)
|
|
22
|
+
if ( next_find > 0 ) occurs++
|
|
23
|
+
}
|
|
24
|
+
return(occurs)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class AffiliateGenerator {
|
|
29
|
+
//
|
|
30
|
+
constructor(file_conf) {
|
|
31
|
+
this.web_links_list = []
|
|
32
|
+
let deprefixed = (file_conf.file_path.substr(0,2) === 't_') ? file_conf.file_path.replace('t_','').trim() : file_conf.file_path.trim()
|
|
33
|
+
let source_dir = file_conf.source_dir ? file_conf.source_dir : '.'
|
|
34
|
+
this.out_file = ( file_conf.output_spec !== undefined ) ?
|
|
35
|
+
(`${output_dir}/${file_conf.output_spec}`) :
|
|
36
|
+
(`${output_dir}/${deprefixed}`)
|
|
37
|
+
this.placement_symbol = file_conf.symbol
|
|
38
|
+
if ( file_conf.template_file ) {
|
|
39
|
+
let path = `./${source_dir}/${file_conf.file_path}`
|
|
40
|
+
this.template = fs.readFileSync(path,'ascii').toString()
|
|
41
|
+
} else {
|
|
42
|
+
this.template = false
|
|
43
|
+
}
|
|
44
|
+
this.about_keys = file_conf.about
|
|
45
|
+
}
|
|
46
|
+
//
|
|
47
|
+
add_link(link) {
|
|
48
|
+
this.web_links_list.push(link)
|
|
49
|
+
}
|
|
50
|
+
//
|
|
51
|
+
appropos(link_descr) { // AI
|
|
52
|
+
//
|
|
53
|
+
let l_keys = link_descr.keys
|
|
54
|
+
let score = 0
|
|
55
|
+
this.about_keys.forEach(key => {
|
|
56
|
+
if ( key in l_keys ) {
|
|
57
|
+
score++
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
//
|
|
61
|
+
this.about_keys.forEach(key => {
|
|
62
|
+
let occurances = count_occurances(key,link_descr.text)
|
|
63
|
+
if ( occurances > MY_OCCUR_THESHOLD ) score++
|
|
64
|
+
})
|
|
65
|
+
//
|
|
66
|
+
if ( this.template ) {
|
|
67
|
+
l_keys.forEach(key => {
|
|
68
|
+
let occurances = count_occurances(key,this.template)
|
|
69
|
+
if ( occurances > MY_OCCUR_THESHOLD ) score++
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
//
|
|
73
|
+
console.log(score + " " + link_descr.text)
|
|
74
|
+
return(score > 0.5) // false // how much??
|
|
75
|
+
}
|
|
76
|
+
//
|
|
77
|
+
generate_output() {
|
|
78
|
+
//
|
|
79
|
+
let configured = this.web_links_list.map(link => {
|
|
80
|
+
return(link.txt)
|
|
81
|
+
})
|
|
82
|
+
//
|
|
83
|
+
if ( configured.length ) {
|
|
84
|
+
let all_link_txt = configured.join('/n')
|
|
85
|
+
if ( this.template === false ) {
|
|
86
|
+
return all_link_txt
|
|
87
|
+
} else {
|
|
88
|
+
let txt = this.template
|
|
89
|
+
txt = txt.replace(this.symbol,all_link_txt)
|
|
90
|
+
return txt
|
|
91
|
+
}
|
|
92
|
+
} else if ( this.template !== false ) {
|
|
93
|
+
let txt = this.template
|
|
94
|
+
txt = txt.replace(this.placement_symbol,'')
|
|
95
|
+
return txt
|
|
96
|
+
}
|
|
97
|
+
//
|
|
98
|
+
}
|
|
99
|
+
//
|
|
100
|
+
async generate() {
|
|
101
|
+
let output = this.generate_output()
|
|
102
|
+
let ofile = this.out_file
|
|
103
|
+
fs.writeFile(ofile,output,() => {
|
|
104
|
+
console.log(ofile)
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
//
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
function main() {
|
|
113
|
+
//
|
|
114
|
+
let affiliate_db = load_affiliate_db()
|
|
115
|
+
let generators = affiliate_db.all_files.map(file => {
|
|
116
|
+
return(new AffiliateGenerator(file))
|
|
117
|
+
})
|
|
118
|
+
affiliate_db.affiliates.forEach(affiliate => {
|
|
119
|
+
generators.forEach(generator => {
|
|
120
|
+
if ( generator.appropos(affiliate.description) ) {
|
|
121
|
+
generator.add_link(affiliate.link)
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
//
|
|
126
|
+
generators.forEach(gen => {
|
|
127
|
+
gen.generate()
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
main()
|
package/tools/allgen.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
dir=$1
|
|
2
|
+
toplevel=$2
|
|
3
|
+
target=$3
|
|
4
|
+
echo $dir
|
|
5
|
+
bash ./tools/rungen.sh $dir $toplevel
|
|
6
|
+
bash ./tools/rungen_header_shell.sh $dir $toplevel
|
|
7
|
+
if [ ! -z "$target" ]; then
|
|
8
|
+
echo "next --------------------------- "
|
|
9
|
+
pwd
|
|
10
|
+
echo $target
|
|
11
|
+
if [ -d "$target" ]; then
|
|
12
|
+
if [ ! -d "$target/html" ]; then
|
|
13
|
+
mkdir ${target}/html
|
|
14
|
+
fi
|
|
15
|
+
if [ ! -d "$target/html/${dir}" ]; then
|
|
16
|
+
mkdir ${target}/html/${dir}
|
|
17
|
+
fi
|
|
18
|
+
cp ${toplevel}/${dir}/*.html ${target}/html/${dir}/
|
|
19
|
+
fi
|
|
20
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
|
|
3
|
+
//
|
|
4
|
+
let file = process.argv[2]
|
|
5
|
+
console.log(file)
|
|
6
|
+
|
|
7
|
+
let char_offset = parseInt(process.argv[3])
|
|
8
|
+
console.log(char_offset)
|
|
9
|
+
|
|
10
|
+
let text = fs.readFileSync(file,'ascii').toString()
|
|
11
|
+
|
|
12
|
+
let default_wsize = 40
|
|
13
|
+
let window = text.substr(char_offset - default_wsize/2, default_wsize)
|
|
14
|
+
|
|
15
|
+
console.log("-------------------------------------------------------------------")
|
|
16
|
+
console.log(window)
|
|
17
|
+
console.log("-------------------------------------------------------------------")
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const builtinModules = require('builtin-modules');
|
|
3
|
+
|
|
4
|
+
let builtInSet = {}
|
|
5
|
+
builtinModules.forEach(mod => {
|
|
6
|
+
builtInSet[mod] = 1
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
let text = fs.readFileSync('reqfile.txt','ascii').toString()
|
|
11
|
+
let text_lines = text.split('\n')
|
|
12
|
+
|
|
13
|
+
let trimmed_lines = text_lines.map(line => { return(line.trim())})
|
|
14
|
+
|
|
15
|
+
let filtered_lines = trimmed_lines.filter(line => {
|
|
16
|
+
if ( line.substr(0,2) === '//' ) return(false)
|
|
17
|
+
if ( line.indexOf('"require') >= 0 ) return(false)
|
|
18
|
+
if ( line.indexOf('require.main.require') >= 0 ) return(false)
|
|
19
|
+
if ( (line.indexOf("require('.") >= 0) || line.indexOf('require(".') >= 0 ) return(false)
|
|
20
|
+
if ( line.indexOf('lib/') >= 0 ) return(false)
|
|
21
|
+
if ( line.indexOf('/package.json') >= 0 ) return(false)
|
|
22
|
+
if ( line.indexOf(".js')") >= 0 ) return(false)
|
|
23
|
+
return((line.indexOf('require("') >= 0) || (line.indexOf("require('") >= 0))
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
//console.log(filtered_lines.join('\n'))
|
|
27
|
+
|
|
28
|
+
let extracted_lines = filtered_lines.map(line => {
|
|
29
|
+
let b = line.split('require(')
|
|
30
|
+
let rest = b[1]
|
|
31
|
+
rest = rest.substr(0,rest.indexOf(')'))
|
|
32
|
+
return(rest)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
//console.log(extracted_lines.join('\n'))
|
|
36
|
+
|
|
37
|
+
let mod_set = {}
|
|
38
|
+
|
|
39
|
+
extracted_lines.forEach(line => {
|
|
40
|
+
line = line.replace("'","").replace("'","").trim()
|
|
41
|
+
line = line.replace('"',"").replace('"',"").trim()
|
|
42
|
+
mod_set[line] = 1
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
for ( let mod in builtInSet ) {
|
|
47
|
+
delete mod_set[mod]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
let mod_list = Object.keys(mod_set)
|
|
52
|
+
mod_list.sort()
|
|
53
|
+
|
|
54
|
+
let npm_commands = mod_list.map(mod => {
|
|
55
|
+
let cmd = `npm install ${mod} --save`
|
|
56
|
+
return(cmd)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
console.log(npm_commands.join('\n'))
|
package/tools/genpage.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const Handlebars = require('handlebars')
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
7
|
+
|
|
8
|
+
function extension_from_path(src) {
|
|
9
|
+
let srcext = path.extname(src)
|
|
10
|
+
if ( srcext.length === 0 ) {
|
|
11
|
+
srcext = 'text'
|
|
12
|
+
}
|
|
13
|
+
srcext = srcext.replace('.','')
|
|
14
|
+
return srcext
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function reset_svg_height_width(svg_txt, output_width, output_height) {
|
|
19
|
+
let svg_tag_start = svg_txt.indexOf("<svg")
|
|
20
|
+
let svg_tag_end = svg_txt.indexOf(">",svg_tag_start)
|
|
21
|
+
let tag_text = svg_txt.substr(svg_tag_start,(svg_tag_end - svg_tag_start + 1))
|
|
22
|
+
//
|
|
23
|
+
if ( output_width ) {
|
|
24
|
+
tag_text = tag_text.replace(/width=".*"/,`width="${output_width}"`)
|
|
25
|
+
}
|
|
26
|
+
if ( output_height ) {
|
|
27
|
+
tag_text = tag_text.replace(/height=".*"/,`height="${output_height}"`)
|
|
28
|
+
}
|
|
29
|
+
svg_txt = svg_txt.substring(0, svg_tag_start) + tag_text + svg_txt.substring(svg_tag_end + 1);
|
|
30
|
+
//
|
|
31
|
+
return(svg_txt)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function is_file_source(descr) {
|
|
37
|
+
return ((typeof descr === 'object') && ( descr.file || ( descr.content && descr.content.file ) || ( descr.button && descr.button.file ) ))
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
var g_compiler_schedule = []
|
|
43
|
+
|
|
44
|
+
function process_sub_content(datObj,descr) {
|
|
45
|
+
let src_file = descr.file ? descr.file : ( descr.content ? descr.content.file : descr.button.file );
|
|
46
|
+
try {
|
|
47
|
+
if ( src_file[0] === '.' ) {
|
|
48
|
+
src_file = datObj.srcPath + src_file.substr(1)
|
|
49
|
+
}
|
|
50
|
+
let src = fs.readFileSync(src_file,'utf8').toString()
|
|
51
|
+
//
|
|
52
|
+
let operator = { 'data' : datObj, 'source' : src, 'target' : descr }
|
|
53
|
+
//
|
|
54
|
+
if ( descr.button && descr.button.file ) {
|
|
55
|
+
operator.target = descr.button
|
|
56
|
+
}
|
|
57
|
+
let ext = extension_from_path(src_file)
|
|
58
|
+
descr.ext = ext
|
|
59
|
+
if ( ext === "svg" ) {
|
|
60
|
+
if ( descr.output_height || descr.output_width ) {
|
|
61
|
+
operator.alteration = (content) => {
|
|
62
|
+
return(reset_svg_height_width(content, descr.output_width, descr.output_height))
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
g_compiler_schedule.unshift(operator)
|
|
67
|
+
} catch (e) {
|
|
68
|
+
g_forgotten_files.push(src_file)
|
|
69
|
+
console.log(e.message)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var g_forgotten_files = []
|
|
75
|
+
function load_source_data(datObj,src) {
|
|
76
|
+
g_compiler_schedule.unshift({ 'data' : datObj, 'source' : src })
|
|
77
|
+
for ( let field in datObj ) {
|
|
78
|
+
let descr = datObj[field]
|
|
79
|
+
if ( (typeof descr === 'object') && descr.length ) {
|
|
80
|
+
descr.forEach(element => {
|
|
81
|
+
if ( is_file_source(element) ) {
|
|
82
|
+
process_sub_content(datObj,element)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
} else if ( is_file_source(descr) ) {
|
|
86
|
+
process_sub_content(datObj,descr)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
// STARTS HERE...
|
|
96
|
+
|
|
97
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
98
|
+
var data_file = process.argv[2]
|
|
99
|
+
var source_file = process.argv[3]
|
|
100
|
+
var output = process.argv[4]
|
|
101
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
console.log("SOURCE FILE: " + source_file)
|
|
105
|
+
|
|
106
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
107
|
+
var data = fs.readFileSync(data_file,'ascii').toString()
|
|
108
|
+
var confObj = JSON.parse(data)
|
|
109
|
+
//
|
|
110
|
+
confObj.srcPath = path.dirname(data_file)
|
|
111
|
+
var source = fs.readFileSync(source_file,'utf8').toString()
|
|
112
|
+
load_source_data(confObj,source)
|
|
113
|
+
|
|
114
|
+
//console.dir(confObj)
|
|
115
|
+
//
|
|
116
|
+
|
|
117
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
118
|
+
var result = "nothing"
|
|
119
|
+
g_compiler_schedule.forEach(operator => {
|
|
120
|
+
//let operator = { 'data' : datObj, 'source' : src, 'target' : descr }
|
|
121
|
+
let source = operator.source
|
|
122
|
+
let template = Handlebars.compile(source);
|
|
123
|
+
let confObj = operator.data
|
|
124
|
+
//console.dir(confObj)
|
|
125
|
+
let content = template(confObj);
|
|
126
|
+
if ( operator.alteration ) {
|
|
127
|
+
content = operator.alteration(content)
|
|
128
|
+
}
|
|
129
|
+
if ( operator.target ) {
|
|
130
|
+
operator.target.content = content
|
|
131
|
+
}
|
|
132
|
+
result = content
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
console.log("OUTPUT FILE: " + output)
|
|
137
|
+
fs.writeFileSync(output,result)
|
|
138
|
+
|
|
139
|
+
if ( g_forgotten_files.length ) {
|
|
140
|
+
console.log("echo > " + g_forgotten_files.join('\necho > '))
|
|
141
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
npm install atomic-sleep --save
|
|
2
|
+
npm install aws-sign2 --save
|
|
3
|
+
npm install aws4 --save
|
|
4
|
+
npm install benchmark --save
|
|
5
|
+
npm install body-parser --save
|
|
6
|
+
npm install caseless --save
|
|
7
|
+
npm install clone --save
|
|
8
|
+
npm install connect-memcached --save
|
|
9
|
+
npm install cookie-parser --save
|
|
10
|
+
npm install cors --save
|
|
11
|
+
npm install express --save
|
|
12
|
+
npm install express-fileupload --save
|
|
13
|
+
npm install express-session --save
|
|
14
|
+
npm install extend --save
|
|
15
|
+
npm install fastbench --save
|
|
16
|
+
npm install flatstr --save
|
|
17
|
+
npm install forever-agent --save
|
|
18
|
+
npm install form-data --save
|
|
19
|
+
npm install forwarded --save
|
|
20
|
+
npm install generate-password --save
|
|
21
|
+
npm install handlebars --save
|
|
22
|
+
npm install html-minifier --save
|
|
23
|
+
npm install http-shutdown --save
|
|
24
|
+
npm install http-signature --save
|
|
25
|
+
npm install inherits --save
|
|
26
|
+
npm install ini --save
|
|
27
|
+
npm install is-typedarray --save
|
|
28
|
+
npm install isstream --save
|
|
29
|
+
npm install jshint-stylish --save
|
|
30
|
+
npm install mime-db --save
|
|
31
|
+
npm install mime-types --save
|
|
32
|
+
npm install nanoassert --save
|
|
33
|
+
npm install node-fetch --save
|
|
34
|
+
npm install node-scp --save
|
|
35
|
+
npm install passport --save
|
|
36
|
+
npm install passport-amazon --save
|
|
37
|
+
npm install passport-facebook --save
|
|
38
|
+
npm install passport-github --save
|
|
39
|
+
npm install passport-google-oauth20 --save
|
|
40
|
+
npm install passport-linkedin --save
|
|
41
|
+
npm install passport-soundcloud --save
|
|
42
|
+
npm install passport-spotify --save
|
|
43
|
+
npm install passport-twitter --save
|
|
44
|
+
npm install performance-now --save
|
|
45
|
+
npm install pino-std-serializers --save
|
|
46
|
+
npm install proxyquire --save
|
|
47
|
+
npm install ps-list --save
|
|
48
|
+
npm install quick-format-unescaped --save
|
|
49
|
+
npm install request --save
|
|
50
|
+
npm install ret --save
|
|
51
|
+
npm install safe-buffer --save
|
|
52
|
+
npm install sodium-native --save
|
|
53
|
+
npm install tap --save
|
|
54
|
+
npm install tape --save
|
|
55
|
+
npm install tar --save
|
|
56
|
+
npm install uuid/v4 --save
|
|
57
|
+
npm install ws --save
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
|
|
3
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
4
|
+
|
|
5
|
+
//$$BODY_INSERT
|
|
6
|
+
// fauth_logged_in_closer.html
|
|
7
|
+
// fauth_fail_closer.html
|
|
8
|
+
// fauth_success_closer.html
|
|
9
|
+
|
|
10
|
+
// node prep_body_insert_only.js ../${dir}/static/template/${body_source} ../${dir}/static/${source} ../${dir}/static/tmp_output.html
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
14
|
+
var template_file = process.argv[2]
|
|
15
|
+
var source_file = process.argv[3]
|
|
16
|
+
var output = process.argv[4]
|
|
17
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
console.log("SOURCE FILE: " + source_file)
|
|
21
|
+
|
|
22
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
23
|
+
var template = fs.readFileSync(template_file,'ascii').toString()
|
|
24
|
+
var source = fs.readFileSync(source_file,'utf8').toString()
|
|
25
|
+
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
|
26
|
+
|
|
27
|
+
let result = template.replace('$$BODY_INSERT',source)
|
|
28
|
+
fs.writeFileSync(output,result)
|