roll-right 0.0.2 → 0.1.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 +14 -0
- package/bin/breakup.js +56 -0
- package/lib/phase1.js +6 -2
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -34,6 +34,20 @@ roll-right --phase 2 <website-identifier> <directory including config>
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
## reverse it
|
|
38
|
+
|
|
39
|
+
It can help, when developing, to split up a file that has been composed by **roll-right**. Later versions of **roll-right** will put in file separators when files are appended together to form a single file artifact for a web page or module. The command line tool, **roll-right-breakup**, will output a directory of all the files between the separators. There are times that it may be useful to use compare tools with the output of **roll-right-breakup** and the source files.
|
|
40
|
+
|
|
41
|
+
Here is how to call it:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
roll-right-breakup <path to file> <optional output directory>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
**roll-right-breakup** will create a directory in the calling directory named **rr-breakup** or within the optional directory if it is on the command line.
|
|
49
|
+
|
|
50
|
+
|
|
37
51
|
|
|
38
52
|
## How it Helps
|
|
39
53
|
|
package/bin/breakup.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const {FileOperations} = require('extra-file-class')
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let fosc = new FileOperations(false)
|
|
8
|
+
|
|
9
|
+
async function process_file(file_name,deposit_dir) {
|
|
10
|
+
let is_file = await fosc.exists(file_name)
|
|
11
|
+
if ( is_file ) {
|
|
12
|
+
if ( await fosc.ensure_directories(deposit_dir) ) {
|
|
13
|
+
let file_txt = await fosc.load_data_at_path(file_name)
|
|
14
|
+
if ( file_txt ) {
|
|
15
|
+
let parts = file_txt.split('// ---->>>')
|
|
16
|
+
console.log(`# of parts: ${parts.length}`)
|
|
17
|
+
if ( parts.length > 0 ) {
|
|
18
|
+
parts.pop()
|
|
19
|
+
let count = 0
|
|
20
|
+
let ext = ".html"
|
|
21
|
+
for ( let part of parts ) {
|
|
22
|
+
count++
|
|
23
|
+
await fosc.output_string(`${deposit_dir}/part_${count}.${ext}`,parts[count-1])
|
|
24
|
+
ext = "js"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
console.log(`Could not read ${file_name}`)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
console.log(`can't find file ${file_name}`)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
let deposit_dir = "rr-breakup"
|
|
38
|
+
let holding_dir = process.argv[3]
|
|
39
|
+
if ( holding_dir !== undefined ) {
|
|
40
|
+
if ( holding_dir[holding_dir.length-1] !== '/' ) {
|
|
41
|
+
holding_dir += '/'
|
|
42
|
+
}
|
|
43
|
+
deposit_dir = holding_dir + deposit_dir
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
let file = process.argv[2]
|
|
48
|
+
//
|
|
49
|
+
if ( file === undefined ) {
|
|
50
|
+
console.log("roll-right-breakup is expecting at least one command line parameter: name of file to be processed")
|
|
51
|
+
} else {
|
|
52
|
+
console.log(file)
|
|
53
|
+
process_file(file,deposit_dir)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
package/lib/phase1.js
CHANGED
|
@@ -427,9 +427,13 @@ console.dir(found_sub)
|
|
|
427
427
|
run() {
|
|
428
428
|
//
|
|
429
429
|
console.log("ENSURE: ",this.tconf.out_dir)
|
|
430
|
-
console.log("TARGET:",this._target)
|
|
431
430
|
//
|
|
432
|
-
|
|
431
|
+
let outfile_dir = translate_marker(this.tconf.out_dir,this.tconf)
|
|
432
|
+
this.tconf.out_dir = outfile_dir
|
|
433
|
+
console.log("ENSURE: ",this.tconf.out_dir)
|
|
434
|
+
//
|
|
435
|
+
this.ensure_directory(outfile_dir,this._target)
|
|
436
|
+
//
|
|
433
437
|
for ( let file in this.tconf.files ) {
|
|
434
438
|
this.config(this.tconf,file)
|
|
435
439
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roll-right",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.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": {
|
|
7
7
|
"example": "examples"
|
|
8
8
|
},
|
|
9
9
|
"bin": {
|
|
10
|
-
"roll-right": "./bin/index.js"
|
|
10
|
+
"roll-right": "./bin/index.js",
|
|
11
|
+
"roll-right-breakup": "./bin/breakup.js"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"test": "node tests/index.js"
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
17
|
"byte-base64": "^1.1.0",
|
|
18
|
+
"extra-file-class": "^0.9.12",
|
|
17
19
|
"fs-extra": "^10.0.1",
|
|
18
20
|
"handlebars": "^4.7.7",
|
|
19
21
|
"minimist": "^1.2.5",
|