Files
GDevelop/newIDE/app/scripts/import-GDJS-Runtime.js
T
Florian Rival 83e7314863 Clean the GDJS runtime folder only when starting the development app
Potential fix for filesystem issue like #1528
2020-04-04 22:36:03 +02:00

71 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const shell = require('shelljs');
const path = require('path');
const copy = require('recursive-copy');
const args = require('minimist')(process.argv.slice(2));
const gdevelopRootPath = path.join(__dirname, '..', '..', '..');
const destinationPaths = [
path.join(__dirname, '..', 'resources', 'GDJS', 'Runtime'),
path.join(
__dirname,
'..',
'node_modules',
'GDJS-for-web-app-only',
'Runtime'
),
];
const copyOptions = {
overwrite: true,
expand: true,
dot: true,
junk: true,
};
destinationPaths.forEach(destinationPath => {
shell.echo(
`️ Copying GDJS and extensions runtime files (*.js) to "${destinationPath}"...`
);
if (args.clean) {
shell.echo(`️ Cleaning destination first...`);
shell.rm('-rf', destinationPath);
}
shell.mkdir('-p', destinationPath);
copy(
path.join(gdevelopRootPath, 'GDJS', 'Runtime'),
destinationPath,
copyOptions
)
.then(function(results) {
console.info(
`✅ GDJS and extensions runtime copy succeeded (${
results.length
} file(s) copied`
);
})
.catch(function(error) {
console.error('❌ Copy failed: ' + error);
});
copy(
path.join(gdevelopRootPath, 'Extensions'),
path.join(destinationPath, 'Extensions'),
{
...copyOptions,
filter: ['**/*.js'],
}
)
.then(function(results) {
console.info(
`✅ GDJS and extensions runtime copy succeeded (${
results.length
} file(s) copied`
);
})
.catch(function(error) {
console.error('❌ Copy failed: ' + error);
});
});