Refactor import-GDJS-Runtime script to use Node.js

This commit is contained in:
Florian Rival
2020-01-18 14:06:33 +00:00
committed by Florian Rival
parent 054e48227c
commit 01a844c356
13 changed files with 4105 additions and 5542 deletions

View File

@@ -75,21 +75,3 @@ ELSE()
target_link_libraries(GDJS GDCore)
target_link_libraries(GDJS ${sfml_LIBRARIES})
ENDIF()
#Post build tasks
###
IF(EMSCRIPTEN)
#Nothing.
ELSE()
IF(WIN32)
add_custom_target(GDJS_Runtime
ALL
COMMAND "${GD_base_dir}/GDJS/scripts/CopyRuntimeToGD.bat" ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/JsPlatform/Runtime
WORKING_DIRECTORY ${GD_base_dir}/GDJS/scripts)
ELSE()
add_custom_target(GDJS_Runtime
ALL
COMMAND bash "CopyRuntimeToGD.sh" ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME}/JsPlatform/Runtime
WORKING_DIRECTORY ${GD_base_dir}/GDJS/scripts)
ENDIF()
ENDIF()

View File

@@ -14,7 +14,6 @@
"jsdoc-autoprivate": "0.0.1"
},
"scripts": {
"copy-runtime-to-ide": "echo \"Use scripts/CopyRuntimeToGD.sh (or .bat on Windows)\"",
"check-types": "tsc"
}
}

View File

@@ -1,14 +0,0 @@
::This script copies the runtimes files (i.e: the javascript files located into the Runtime
::folder and in the Extensions folder) to the GDevelop folder.
@echo off
cd /d %~dp0
set destDir=%1
if [%destDir%]==[] set destDir="..\..\Binaries\Output\Release_Windows\JsPlatform\Runtime"
echo Copying GDJS and extensions runtime files (*.js) to %destDir%...
xcopy "..\Runtime"\* %destDir%\* /S /E /D /Y /Q
xcopy "..\..\Extensions"\*.js %destDir%\Extensions\*.js /S /E /D /Y /Q /EXCLUDE:FilesExcludedFromCopy
echo ✅ Copied GDJS and extensions runtime files (*.js) to %destDir%.

View File

@@ -1,18 +0,0 @@
#!/bin/bash
#Get the destination, or copy by default to release directory
DESTINATION=../../Binaries/Output/Release_Linux/JsPlatform/Runtime/
if [ "$(uname)" == "Darwin" ]; then
DESTINATION=../../Binaries/Output/Release_Darwin/JsPlatform/Runtime/
fi
if [ ! $# -eq 0 ]; then
DESTINATION=$1
fi
#Copy all js files
echo " Copying GDJS and extensions runtime files (*.js) to '$DESTINATION'..."
mkdir -p "$DESTINATION"
cp -R ../Runtime/* "$DESTINATION"
rsync -r -u --include=*.js --include=*/ --exclude=* ../../Extensions/ "$DESTINATION"/Extensions/
echo "✅ Copied GDJS and extensions runtime files (*.js) to '$DESTINATION'."

View File

@@ -3195,6 +3195,12 @@
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
"dev": true
},
"array-differ": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
"integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=",
"dev": true
},
"array-equal": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
@@ -6888,6 +6894,12 @@
"minimalistic-crypto-utils": "^1.0.0"
}
},
"emitter-mixin": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/emitter-mixin/-/emitter-mixin-0.0.3.tgz",
"integrity": "sha1-WUjLKG8uSO3DslGnz8H3iDOW1lw=",
"dev": true
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@@ -13226,6 +13238,12 @@
"object.assign": "^4.1.0"
}
},
"junk": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/junk/-/junk-1.0.3.tgz",
"integrity": "sha1-h75jSIZJy9ym9Tqzm+yczSNH9ZI=",
"dev": true
},
"keen-core": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/keen-core/-/keen-core-0.1.2.tgz",
@@ -13717,6 +13735,18 @@
"integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==",
"dev": true
},
"maximatch": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz",
"integrity": "sha1-hs2NawTJ8wfAWmuUGZBtA2D7E6I=",
"dev": true,
"requires": {
"array-differ": "^1.0.0",
"array-union": "^1.0.1",
"arrify": "^1.0.0",
"minimatch": "^3.0.0"
}
},
"md5.js": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
@@ -19088,6 +19118,61 @@
}
}
},
"recursive-copy": {
"version": "2.0.10",
"resolved": "https://registry.npmjs.org/recursive-copy/-/recursive-copy-2.0.10.tgz",
"integrity": "sha512-S9J9XJUnfZ2NUS3lK6lx6HWLl2nWui+f7AKuu+qoFs4ikEPYgZ3qKk1T6tmBnr7PzhtKnawE+6TREy9XQKmxCA==",
"dev": true,
"requires": {
"del": "^2.2.0",
"emitter-mixin": "0.0.3",
"errno": "^0.1.2",
"graceful-fs": "^4.1.4",
"junk": "^1.0.1",
"maximatch": "^0.1.0",
"mkdirp": "^0.5.1",
"pify": "^2.3.0",
"promise": "^7.0.1",
"slash": "^1.0.0"
},
"dependencies": {
"del": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",
"integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=",
"dev": true,
"requires": {
"globby": "^5.0.0",
"is-path-cwd": "^1.0.0",
"is-path-in-cwd": "^1.0.0",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0",
"rimraf": "^2.2.8"
}
},
"globby": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
"integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"arrify": "^1.0.0",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
}
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"recursive-readdir": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz",

View File

@@ -20,6 +20,7 @@
"iso-639-1": "^2.0.3",
"prettier": "1.15.3",
"react-scripts": "2.1.4",
"recursive-copy": "^2.0.10",
"recursive-readdir": "^2.2.2",
"shelljs": "^0.7.7",
"unzipper": "^0.9.11",

View File

@@ -1,25 +1,66 @@
var shell = require('shelljs');
var path = require('path');
var isWin = /^win/.test(process.platform);
const shell = require('shelljs');
const path = require('path');
const copy = require('recursive-copy');
var destFolder = path.join(__dirname, '..', 'resources', 'GDJS', 'Runtime');
var destFolder2 = path.join(__dirname, '..', 'node_modules', 'GDJS-for-web-app-only', 'Runtime');
var gdjsScriptsFolder = path.join(__dirname, '../../../GDJS/scripts');
const gdevelopRootPath = path.join(__dirname, '..', '..', '..');
const destinationPaths = [
path.join(__dirname, '..', 'resources', 'GDJS', 'Runtime'),
path.join(
__dirname,
'..',
'node_modules',
'GDJS-for-web-app-only',
'Runtime'
),
];
if (isWin) {
shell.exec('CopyRuntimeToGD.bat ' + "\"" + destFolder + "\"", {
cwd: gdjsScriptsFolder,
});
shell.exec('CopyRuntimeToGD.bat ' + "\"" + destFolder2 + "\"", {
cwd: gdjsScriptsFolder,
});
} else {
shell.rm('-rf', destFolder);
shell.rm('-rf', destFolder2);
shell.exec('./CopyRuntimeToGD.sh ' + destFolder, {
cwd: gdjsScriptsFolder,
});
shell.exec('./CopyRuntimeToGD.sh ' + destFolder2, {
cwd: gdjsScriptsFolder,
});
}
var copyOptions = {
overwrite: true,
expand: true,
dot: true,
junk: true,
};
destinationPaths.forEach(destinationPath => {
shell.echo(
` Copying GDJS and extensions runtime files (*.js) to "${destinationPath}"...`
);
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);
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,6 @@ const path = require('path');
const axios = require('axios');
const async = require('async');
const { makeTimestampedId } = require('./Utils/TimestampedId');
const recursive = require('recursive-readdir');
const isDev = require('electron-is').dev();
const log = require('electron-log');
const { Transform } = require('stream');

View File

@@ -1986,24 +1986,6 @@
"set-immediate-shim": "^1.0.1"
}
},
"recursive-readdir": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.1.tgz",
"integrity": "sha1-kO8jHQd4xc4JPJpI105cVCLROpk=",
"requires": {
"minimatch": "3.0.3"
},
"dependencies": {
"minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha1-Kk5AkLlrLbBqnX3wEFWmKnfJt3Q=",
"requires": {
"brace-expansion": "^1.0.0"
}
}
}
},
"regex-cache": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz",

View File

@@ -21,7 +21,6 @@
"live-server": "^1.2.0",
"lodash.throttle": "^4.1.1",
"minimist": "^1.2.0",
"recursive-readdir": "^2.2.1",
"ws": "^5.1.1"
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff