Merge branch 'develop' into merge-develop-to-goog_module

This commit is contained in:
kozbial
2021-09-21 16:04:33 -07:00
265 changed files with 21385 additions and 7566 deletions

View File

@@ -67,15 +67,9 @@ function copyPlaygroundDeps() {
/**
* Deploys files from tmp directory to appengine to version based on the version
* specified in package.json and then cleans the tmp directory.
* passed in and then cleans the tmp directory.
*/
function deployAndClean(done) {
const minorVersion = packageJson.version.split('.')[1];
const patchVersion = packageJson.version.split('.')[2];
let demoVersion = minorVersion;
if (patchVersion != 0) {
demoVersion += '-' + patchVersion
}
function deployToAndClean(demoVersion) {
try {
execSync(`gcloud app deploy --project blockly-demo --version ${demoVersion} --no-promote`, { stdio: 'inherit', cwd: demoTmpDir });
} finally {
@@ -84,6 +78,50 @@ function deployAndClean(done) {
rimraf.sync(demoTmpDir);
}
}
}
/**
* Constructs a demo version name based on the version specified in
* package.json.
*/
function getDemosVersion() {
const minorVersion = packageJson.version.split('.')[1];
const patchVersion = packageJson.version.split('.')[2];
let demoVersion = minorVersion;
if (patchVersion != 0) {
demoVersion += '-' + patchVersion
}
return demoVersion;
}
/**
* Deploys files from tmp directory to appengine to version based on the version
* specified in package.json and then cleans the tmp directory.
*/
function deployAndClean(done) {
const demoVersion = getDemosVersion();
deployToAndClean(demoVersion);
done();
}
/**
* Constructs a beta demo version name based on the current date.
*/
function getDemosBetaVersion() {
var date = new Date();
var mm = date.getMonth() + 1; // Month, 0-11
var dd = date.getDate(); // Day of the month, 1-31
var yyyy = date.getFullYear();
return `${yyyy}${mm < 10 ? '0' + mm : mm}${dd}-beta`;
}
/**
* Deploys files from tmp directory to appengine to a beta version based on the
* current date and then cleans the tmp directory.
*/
function deployBetaAndClean(done) {
const demoVersion = getDemosBetaVersion();
deployToAndClean(demoVersion);
done();
}
@@ -99,7 +137,13 @@ const prepareDemos = gulp.series(
*/
const deployDemos = gulp.series(prepareDemos, deployAndClean);
/**
* Deploys beta version of demos (version appended with -beta).
*/
const deployDemosBeta = gulp.series(prepareDemos, deployBetaAndClean);
module.exports = {
deployDemos: deployDemos,
deployDemosBeta: deployDemosBeta,
prepareDemos: prepareDemos
}

View File

@@ -364,7 +364,7 @@ function buildDeps(done) {
*/
function generateLangfiles(done) {
// Run js_to_json.py
const jsToJsonCmd = `python scripts/i18n/js_to_json.py \
const jsToJsonCmd = `python3 scripts/i18n/js_to_json.py \
--input_file ${path.join('msg', 'messages.js')} \
--output_dir ${path.join('msg', 'json')} \
--quiet`;
@@ -402,7 +402,7 @@ function buildLangfiles(done) {
json_files = json_files.filter(file => file.endsWith('json') &&
!(new RegExp(/(keys|synonyms|qqq|constants)\.json$/).test(file)));
json_files = json_files.map(file => path.join('msg', 'json', file));
const createMessagesCmd = `python ./scripts/i18n/create_messages.py \
const createMessagesCmd = `python3 ./scripts/i18n/create_messages.py \
--source_lang_file ${path.join('msg', 'json', 'en.json')} \
--source_synonym_file ${path.join('msg', 'json', 'synonyms.json')} \
--source_constants_file ${path.join('msg', 'json', 'constants.json')} \