@@ -51,7 +51,7 @@ const libraries = Object.keys(libraryMap);
51
51
52
52
hbs . registerPartial (
53
53
"octocat" ,
54
- fs . readFileSync ( path . join ( __dirname , "/ partials/ octocat.handlebars" ) , "utf8" )
54
+ fs . readFileSync ( path . join ( __dirname , ".." , " partials" , " octocat.handlebars") , "utf8" )
55
55
) ;
56
56
57
57
// Helper to color progress bar based on test scores
@@ -66,14 +66,15 @@ hbs.registerHelper("warning-level", function (score) {
66
66
}
67
67
} ) ;
68
68
69
- const tmpl = fs . readFileSync ( path . join ( __dirname , "index.handlebars" ) , "utf8" ) ;
69
+ const tmpl = fs . readFileSync ( path . join ( __dirname , ".." , " index.handlebars") , "utf8" ) ;
70
70
const render = hbs . compile ( tmpl ) ;
71
71
const out = render ( { libraries : buildContext ( libraries ) } ) ;
72
72
73
73
function buildContext ( libraries ) {
74
74
return libraries . map ( library => {
75
75
const repo = require ( path . resolve (
76
76
__dirname ,
77
+ ".." ,
77
78
"libraries" ,
78
79
library ,
79
80
"results/repo.json"
@@ -97,6 +98,7 @@ function buildContext(libraries) {
97
98
function getTestResults ( library ) {
98
99
const json = require ( path . resolve (
99
100
__dirname ,
101
+ ".." ,
100
102
"libraries" ,
101
103
library ,
102
104
"results/results.json"
@@ -111,6 +113,7 @@ function getTestResults(library) {
111
113
function getIssues ( library ) {
112
114
return require ( path . resolve (
113
115
__dirname ,
116
+ ".." ,
114
117
"libraries" ,
115
118
library ,
116
119
"meta/issues.json"
@@ -120,13 +123,13 @@ function getIssues(library) {
120
123
// Collect markdown summary of library, process markdown, and return as string.
121
124
function getSummary ( library ) {
122
125
const md = fs . readFileSync (
123
- path . resolve ( __dirname , "libraries" , library , "meta/summary.md" ) ,
126
+ path . resolve ( __dirname , ".." , " libraries", library , "meta/summary.md" ) ,
124
127
"utf8"
125
128
) ;
126
129
const content = marked . parse ( md ) ;
127
130
128
131
return { content } ;
129
132
}
130
133
131
- // npm build script writes this output to index.html
132
- console . log ( out ) ;
134
+ fs . mkdirSync ( path . resolve ( __dirname , '../../out' ) , { recursive : true } ) ;
135
+ fs . writeFileSync ( path . resolve ( __dirname , '../../out/index.html' ) , out ) ;
0 commit comments