mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
This commit is contained in:
parent
f0f62670c5
commit
7e26256cac
4563 changed files with 1246712 additions and 17558 deletions
30
node_modules/webvr-polyfill-dpdb/scripts/build.js
generated
vendored
Normal file
30
node_modules/webvr-polyfill-dpdb/scripts/build.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
const inputFile = path.join(__dirname, '..', 'dpdb-formatted.json');
|
||||
const outputFile = path.join(__dirname, '..', 'dpdb.json');
|
||||
const dpdbStr = fs.readFileSync(inputFile, 'utf8');
|
||||
let dpdbObj;
|
||||
|
||||
try {
|
||||
dpdbObj = JSON.parse(dpdbStr);
|
||||
console.log(`Successfully parsed JSON object from file "${inputFile}".`);
|
||||
} catch (err) {
|
||||
throw new Error(`Could not parse as JSON from file "${inputFile}"`);
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (argv.includes('--write') || argv.includes('-w')) {
|
||||
// Rewrite the files only if the source file, `dpdb-formatted.json`,
|
||||
// contains valid JSON.
|
||||
const now = new Date().toISOString();
|
||||
const newUpdate = now.slice(0, -5) + now.slice(-1);
|
||||
dpdbObj.last_updated = newUpdate;
|
||||
|
||||
console.log(`Writing to file "${inputFile}"`);
|
||||
fs.writeFileSync(inputFile, JSON.stringify(dpdbObj, null, 2));
|
||||
console.log(`Writing to file "${outputFile}"`);
|
||||
fs.writeFileSync(outputFile, JSON.stringify(dpdbObj));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue