Skip to content

Commit

Permalink
Markdown to HTML in gulp script
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricGuillemet committed Feb 13, 2024
1 parent 8ede856 commit b2e120e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Package/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,36 @@ const shelljs = require('shelljs');
const rename = require('gulp-rename');
const glob = require('glob');
const chalk = require('chalk');
const marked = require('marked');

let assemblediOSAndroidDir = 'Assembled-iOSAndroid';
let assembledWindowsDir = 'Assembled-Windows';
let basekitBuild = false;
let cmakeBasekitBuildDefinition = '';
let basekitPackagePath = '';


const makeHTMLNotice = async () => {
fs.readFile('../README.md', 'utf8', (err, data) => {
if (err) {
console.error('Error reading file:', err);
return;
}

// Convert Markdown to HTML
const html = marked.parse(data);

// Write the HTML to a file
fs.writeFile('../NOTICE.html', html, 'utf8', err => {
if (err) {
console.error('Error writing file:', err);
return;
}
console.log('NOTICE Conversion complete!');
});
});
};

function exec(command, workingDirectory = '.', logCommand = true) {
if (logCommand) {
log(command);
Expand Down Expand Up @@ -616,6 +639,8 @@ const build = gulp.series(buildIOSAndroid, switchToBaseKit, buildIOSAndroid);
const rebuild = gulp.series(clean, build);
const pack = gulp.series(rebuild, createPackage);

exports.buildNotice = makeHTMLNotice;

exports.validateAssembled = validateAssembled;
exports.validateAssemblediOSAndroid = validateAssemblediOSAndroid;

Expand Down
19 changes: 19 additions & 0 deletions Package/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"gulp": "^4.0.2",
"gulp-rename": "2.0.0",
"shelljs": "^0.8.4"
},
"dependencies": {
"marked": "^4.3.0"
}
}

0 comments on commit b2e120e

Please sign in to comment.