@@ -32,21 +32,18 @@ const TECHNOLOGY = {
32
32
JavaScript : '' ,
33
33
Rust : '' ,
34
34
} ,
35
- releases : [ {
36
- version : '0.0.1' ,
37
- date : '2021-01-01T00:00:00Z'
38
- } ] ,
35
+ releases : [
36
+ {
37
+ version : '0.0.1' ,
38
+ date : '2021-01-01T00:00:00Z' ,
39
+ } ,
40
+ ] ,
39
41
url : 'https://' ,
40
42
community : 'https://' ,
41
43
documentation : 'https://' ,
42
44
} ;
43
45
44
- const categories = [
45
- 'Browser engine' ,
46
- 'Compiled' ,
47
- 'JavaScript projection' ,
48
- 'Web' ,
49
- ] ;
46
+ const categories = [ 'Browser engine' , 'Direct drawing' , 'Platform controls' ] ;
50
47
51
48
/**
52
49
* Listens for stdin and returns the first line of text received.
@@ -143,7 +140,9 @@ const writeTemplates = async (templates, information, destination) => {
143
140
144
141
for ( const [ filePath , content ] of templates ) {
145
142
// 🛑 HACK ahead!! we assume that `information[1]` is `normalizedTechnology`. We should probably validate this
146
- const finalPath = path . join ( destination , filePath ) . replace ( 'technology' , information [ 1 ] . value ) ;
143
+ const finalPath = path
144
+ . join ( destination , filePath )
145
+ . replace ( 'technology' , information [ 1 ] . value ) ;
147
146
148
147
const interpolatedContent = interpolate ( content , information ) ;
149
148
@@ -189,31 +188,29 @@ ${categories.join('\n')}`);
189
188
} ,
190
189
] ;
191
190
192
- const createdFiles = await writeTemplates (
193
- templates ,
194
- information ,
195
- path . join ( DOCS_ROOT , normalizedCategory )
196
- ) ;
191
+ const createdFiles = await writeTemplates ( templates , information , DOCS_ROOT ) ;
197
192
198
193
console . log ( `Documentation files created:
199
194
${ createdFiles . join ( '\n' ) } `) ;
200
195
201
196
const json = { ...TECHNOLOGY , ...{ name : technology } } ;
202
197
203
198
await fs . writeFile (
204
- path . join ( DATA_PATH , `${ normalizedTechnology } .json` ) ,
199
+ path . join ( DATA_PATH , 'technologies' , `${ normalizedTechnology } .json` ) ,
205
200
JSON . stringify ( json , null , 2 ) ,
206
201
'utf-8'
207
202
) ;
208
203
209
204
const sidebars = require ( SIDEBARS_PATH ) ;
210
205
211
- const categoryItem = sidebars . websiteSidebar . find ( ( item ) => {
206
+ const categoryItem = sidebars . websiteSidebar . find ( ( item ) => {
212
207
return item . label === category ;
213
208
} ) ;
214
209
215
- if ( ! categoryItem ) {
216
- console . error ( `There was an error adding the element to "sidebars.js" under the category ${ category } , please do it manually` ) ;
210
+ if ( ! categoryItem ) {
211
+ console . error (
212
+ `There was an error adding the element to "sidebars.js" under the category ${ category } , please do it manually`
213
+ ) ;
217
214
process . exit ( 1 ) ;
218
215
}
219
216
0 commit comments