This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ if (!fs.existsSync('public/calendar.json')) {
28
28
}
29
29
30
30
if ( fs . existsSync ( 'tmp/readme-parse-diagnostic.json' ) ) {
31
- const diagnostics = require ( '../tmp/readme-parse-diagnostic.json' )
31
+ const diagnostics = JSON . parse (
32
+ fs . readFileSync ( 'tmp/readme-parse-diagnostic.json' , 'utf8' )
33
+ )
32
34
if ( diagnostics . errors && diagnostics . errors . length ) {
33
35
console . log ( ':x: **ข้อผิดพลาดในการประมวลผลไฟล์ (Processing errors):**' )
34
36
console . log ( )
Original file line number Diff line number Diff line change 13
13
const fs = require ( 'fs' )
14
14
15
15
const html = fs . readFileSync ( 'public/index.html' , 'utf8' )
16
- const data = require ( '../ public/calendar' )
16
+ const data = JSON . parse ( fs . readFileSync ( ' public/calendar.json' , 'utf8' ) )
17
17
const mkdirp = require ( 'mkdirp' )
18
18
const path = require ( 'path' )
19
19
const escapeHtml = require ( 'escape-html' )
Original file line number Diff line number Diff line change 1
1
// Generates ICS file from `public/calendar.json`
2
2
3
- const data = require ( '../public/calendar' )
3
+ const fs = require ( 'fs' )
4
+
5
+ const data = JSON . parse ( fs . readFileSync ( 'public/calendar.json' , 'utf8' ) )
4
6
const icalendar = require ( 'icalendar' )
5
7
6
8
const ICalendar = icalendar . iCalendar
@@ -76,6 +78,6 @@ function generateICS() {
76
78
77
79
const ics = generateICS ( )
78
80
const path = `public/calendar.ics`
79
- require ( 'fs' ) . writeFileSync ( path , ics )
81
+ fs . writeFileSync ( path , ics )
80
82
81
83
console . log ( '* Generated' , path )
Original file line number Diff line number Diff line change 1
1
// Generates SVG file from `public/calendar.json`
2
2
3
- const data = require ( '../public/calendar' )
3
+ const fs = require ( 'fs' )
4
+
5
+ const data = JSON . parse ( fs . readFileSync ( 'public/calendar.json' , 'utf8' ) )
4
6
5
7
const totalWidth = 200
6
8
const totalHeight = 185
@@ -105,7 +107,7 @@ for (let year = 2018; year <= 2018; year += 1) {
105
107
const path = `public/generated/calendar-images/${ year } -${ String (
106
108
month + 1
107
109
) . padStart ( 2 , '0' ) } .svg`
108
- require ( 'fs' ) . writeFileSync ( path , svg )
110
+ fs . writeFileSync ( path , svg )
109
111
console . log ( '* Generated' , path )
110
112
}
111
113
}
You can’t perform that action at this time.
0 commit comments