mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Add sanity check for libGD.js size
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const shell = require('shelljs');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const args = require('minimist')(process.argv.slice(2));
|
||||
const ghpages = require('gh-pages');
|
||||
const isGitClean = require('is-git-clean');
|
||||
@@ -30,6 +31,33 @@ isGitClean()
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
return new Promise(resolve => {
|
||||
fs.stat(path.join('../../app/public/libGD.js'), (err, stats) => {
|
||||
if (err) {
|
||||
shell.echo(
|
||||
`❌ Unable to check libGD.js size. Have you compiled GDevelop.js? Error is: ${err}`
|
||||
);
|
||||
shell.exit(1);
|
||||
}
|
||||
|
||||
const sizeInMiB = stats.size / 1024 / 1024;
|
||||
if (sizeInMiB > 5) {
|
||||
shell.echo(
|
||||
`❌ libGD.js size is too big (${sizeInMiB.toFixed(
|
||||
2
|
||||
)}MiB) - are you sure you're not trying to deploy the development version?`
|
||||
);
|
||||
shell.exit(1);
|
||||
}
|
||||
|
||||
shell.echo(
|
||||
`✅ libGD.js size seems correct (${sizeInMiB.toFixed(2)}MiB)`
|
||||
);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
if (!args['cf-zoneid'] || !args['cf-token']) {
|
||||
shell.echo(
|
||||
|
Reference in New Issue
Block a user