From 439d0628626b2ca129990c37e958c316a731bdb3 Mon Sep 17 00:00:00 2001 From: CherryKitten Date: Tue, 29 Nov 2022 23:08:37 +0100 Subject: [PATCH] Rework `custom` behaviour --- .gitignore | 1 - custom/{ => assets}/instance.css | 0 custom/locales/.gitkeep | 0 gulpfile.js | 2 +- locales/index.js | 4 ++-- 5 files changed, 3 insertions(+), 4 deletions(-) rename custom/{ => assets}/instance.css (100%) create mode 100644 custom/locales/.gitkeep diff --git a/.gitignore b/.gitignore index fcab9e323..a4e031399 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,6 @@ api-docs.json ormconfig.json /custom packages/backend/assets/instance.css -/locales/custom # blender backups *.blend1 diff --git a/custom/instance.css b/custom/assets/instance.css similarity index 100% rename from custom/instance.css rename to custom/assets/instance.css diff --git a/custom/locales/.gitkeep b/custom/locales/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/gulpfile.js b/gulpfile.js index 86f860e56..89a6acb83 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,7 +16,7 @@ gulp.task('copy:backend:views', () => ); gulp.task('copy:backend:custom', () => - gulp.src('./custom/*').pipe(gulp.dest('./packages/backend/assets/')) + gulp.src('./custom/assets/*').pipe(gulp.dest('./packages/backend/assets/')) ); gulp.task('copy:client:fonts', () => diff --git a/locales/index.js b/locales/index.js index 94643a76e..7399bb5a1 100644 --- a/locales/index.js +++ b/locales/index.js @@ -23,7 +23,7 @@ fs.readdirSync(__dirname).forEach((file) => { } }) -fs.readdirSync(__dirname + '/custom').forEach((file) => { +fs.readdirSync(__dirname + '/../custom/locales').forEach((file) => { if (file.includes('.yml')){ file = file.slice(0, file.indexOf('.')) languages_custom.push(file); @@ -40,7 +40,7 @@ const primaries = { const clean = (text) => text.replace(new RegExp(String.fromCodePoint(0x08), 'g'), ''); const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/${c}.yml`, 'utf-8'))) || {}, a), {}); -const locales_custom = languages_custom.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/custom/${c}.yml`, 'utf-8'))) || {}, a), {}); +const locales_custom = languages_custom.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/../custom/locales/${c}.yml`, 'utf-8'))) || {}, a), {}); Object.assign(locales, locales_custom) module.exports = Object.entries(locales)