Skip to content

Commit

Permalink
Rename Combined Module from 'combined' to 'nomi-ceu'
Browse files Browse the repository at this point in the history
Avoids confusion for players playing nomi-ceu, as it may seem like they should download the `nomi-ceu` zip.
  • Loading branch information
IntegerLimit committed Jan 4, 2024
1 parent 02a0ee7 commit 9b1c06c
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 43 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Translations and Localizations for Nomi-CEu and its Projects.<br> Separated into modules for easy downloading and maintenance.

## Modules
- Combined Module: Contains Translations from All Modules
- Nomi-CEu Module: Contains Translations Specific to [Nomi-CEu](https://github.com/Nomi-CEu/Nomi-CEu), like Item Name Overrides and Mod Translation Fixes
- Gregtech-Drawers Module: Contains Translations for [GregTech Drawers](https://github.com/Nomi-CEu/gregtech-drawers)
- Nomi-Labs Module: Contains Translations for [Nomi Labs](https://github.com/Nomi-CEu/Nomi-Labs)
Expand All @@ -12,10 +11,19 @@ Translations and Localizations for Nomi-CEu and its Projects.<br> Separated into
Download from our [Nightly Page](https://nightly.link/Nomi-CEu/Nomi-CEu-Translations/workflows/pushbuildpack/main?preview).

### Which Should I Download?
If you are playing the [Nomi-CEu](https://github.com/Nomi-CEu/Nomi-CEu) modpack, download the 'combined' zip.
If you are playing the [Nomi-CEu](https://github.com/Nomi-CEu/Nomi-CEu) modpack, download the 'nomi-ceu' zip.

If you want translations for a specific mod, download the zip with the mod's name (for example, 'nomi-labs' for [Nomi Labs](https://github.com/Nomi-CEu/Nomi-Labs))

### Zip Information:
#### `nomi-ceu` Zip
This contains Lang Files from ALL modules.

#### `nomi-labs` Zip
This contains Lang Files from the `nomi-labs` module.

#### `gregtech-drawers` Zip
This contains Lang Files from the `gregtech-drawers` module.

## Supported Lanuages:

Expand Down
6 changes: 0 additions & 6 deletions combined/pack.mcmeta

This file was deleted.

Binary file removed combined/pack.png
Binary file not shown.
26 changes: 20 additions & 6 deletions modules.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
{
"_exampleModule": {
"name": "The Name of the Module. Has to be a folder in the root directory of this project. Will also be the name of the output zip. Example: 'nomi-ceu-translations'.",
"formattedName": "The formatted name of the Module, used in English Lang Update Commit Messages.",
"git": "Link to the project's github page (without a slash at the end)",
"pathToAssets": "Path from base of the repo to the assets folder where the en_us.langs are grabbed from. Example: 'nomi-ceu/assets'."
"formattedName": "The formatted name of the Module, used in English Lang Update Commit Messages. Example: 'Nomi CEu Translations'.",
"git": "Link to the project's github page (without a slash at the end). Example: 'https://github.com/Nomi-CEu/Nomi-CEu-Translations'.",
"pathToAssets": "Path from base of the repo to the assets folder where the en_us.langs are grabbed from. Example: 'nomi-ceu/assets'.",
"shouldProvideSeparately": "Whether this module should be provided as a separate zip. Example: 'true'."
},

"_exampleCombined": {
"name": "Name of the Combined Zip. The Directory where the pack.mcmeta and pack.png are grabbed from. Example: 'combined'.",
"formattedName": "Formatted Name of the Combined Zip. Used in log. Example: 'Combined'."
},

"combined": {
"name": "nomi-ceu",
"formattedName": "Nomi-CEu"
},

"modules": [
Expand All @@ -12,19 +23,22 @@
"name": "nomi-ceu",
"formattedName": "Nomi-CEu",
"git": "https://github.com/Nomi-CEu/Nomi-CEu",
"pathToAssets": "overrides/resources"
"pathToAssets": "overrides/resources",
"shouldProvideSeparately": false
},
{
"name": "nomi-labs",
"formattedName": "Nomi Labs",
"git": "https://github.com/Nomi-CEu/Nomi-Labs",
"pathToAssets": "src/main/resources/assets"
"pathToAssets": "src/main/resources/assets",
"shouldProvideSeparately": true
},
{
"name": "gregtech-drawers",
"formattedName": "GregTech Drawers",
"git": "https://github.com/Nomi-CEu/gregtech-drawers",
"pathToAssets": "src/main/resources/assets"
"pathToAssets": "src/main/resources/assets",
"shouldProvideSeparately": true
}
]
}
2 changes: 1 addition & 1 deletion nomi-ceu/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 3,
"description": "Translations for Nomi-CEu."
"description": "Translations for the Nomi-CEu World."
}
}
1 change: 0 additions & 1 deletion tools/buildConfig.default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"buildDestinationDirectory": "../build",
"baseName": "translations",
"combinedName": "combined",
"normalCopyGlobs": [
"assets/**/*",
"pack.png",
Expand Down
2 changes: 1 addition & 1 deletion tools/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ export const makeGHANames = gulp.series(makeGHAFileNames);

export const updateEnglishLang = gulp.series(setup, updateEnglishLangTask);

exports.default = gulp.series(setup, gulp.parallel(compressModulesTask, compressCombinedTask));
exports.default = gulp.series(setup, compressModulesTask, compressCombinedTask);
14 changes: 7 additions & 7 deletions tools/tasks/compressCombinedTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ export async function copyCombinedTask(): Promise<void> {
}

export async function zipOrCopyCombined(zip: boolean): Promise<void> {
const dir = upath.join(rootDirectory, buildConfig.combinedName);
const dest = upath.join(buildConfig.buildDestinationDirectory, buildConfig.combinedName);
log(`${zip ? "Zipping" : "Copying"} Combined...`);
const dir = upath.join(rootDirectory, modulesFile.combined.name);
const dest = upath.join(buildConfig.buildDestinationDirectory, modulesFile.combined.name);
log(`${zip ? "Zipping" : "Copying"} ${modulesFile.combined.formattedName} / Combined...`);
await cleanUp(dest);
await createDirs(dest);
for (const module of modulesFile.modules) {
log(`Copying Module ${module.name} for combined...`);
log(`Copying Module ${module.name} for ${modulesFile.combined.formattedName} / Combined...`);
const moduleDir = upath.join(rootDirectory, module.name);
await copy(moduleDir, dest, buildConfig.copyToCombinedDirGlobs);
log(`Copied Module ${module.name} for combined!`);
log(`Copied Module ${module.name} for ${modulesFile.combined.formattedName} / Combined!`);
}
await copy(dir, dest, buildConfig.copyPackPngGlobs);
await transformMCMeta(dir, dest);
if (zip) await zipFolder(dest, sanitize(`${makeName(buildConfig.combinedName)}.zip`).toLowerCase());
log(`${zip ? "Zipped" : "Copied"} Combined!`);
if (zip) await zipFolder(dest, sanitize(`${makeName(modulesFile.combined.name)}.zip`).toLowerCase());
log(`${zip ? "Zipped" : "Copied"} ${modulesFile.combined.formattedName} / Combined!`);
}
17 changes: 9 additions & 8 deletions tools/tasks/compressModulesTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import sanitize from "sanitize-filename";
import { makeName } from "./name";
import { cleanUp, createDirs, copy, transformMCMeta, zipFolder } from "./util";
import log from "fancy-log";
import { Module } from "../types/modulesFile";

export async function compressModulesTask(): Promise<void> {
return zipOrCopyModules(true);
Expand All @@ -15,19 +16,19 @@ export async function copyModulesTask(): Promise<void> {
}

export async function zipOrCopyModules(zip: boolean): Promise<void> {
for (const module of modulesFile.modules) {
await zipOrCopyModule(zip, module.name);
for (const module of modulesFile.modules.filter((module) => module.shouldProvideSeparately)) {
await zipOrCopyModule(zip, module);
}
}

export async function zipOrCopyModule(zip: boolean, moduleName: string): Promise<void> {
const moduleDir = upath.join(rootDirectory, moduleName);
const moduleDest = upath.join(buildConfig.buildDestinationDirectory, moduleName);
log(`${zip ? "Zipping" : "Copying"} Module ${moduleName}...`);
export async function zipOrCopyModule(zip: boolean, module: Module): Promise<void> {
const moduleDir = upath.join(rootDirectory, module.name);
const moduleDest = upath.join(buildConfig.buildDestinationDirectory, module.name);
log(`${zip ? "Zipping" : "Copying"} Module ${module.formattedName}...`);
await cleanUp(moduleDest);
await createDirs(moduleDest);
await copy(moduleDir, moduleDest, buildConfig.normalCopyGlobs);
await transformMCMeta(moduleDir, moduleDest);
if (zip) await zipFolder(moduleDest, sanitize(`${makeName(moduleName)}.zip`).toLowerCase());
log(`${zip ? "Zipped" : "Copied"} Module ${moduleName}!`);
if (zip) await zipFolder(moduleDest, sanitize(`${makeName(module.name)}.zip`).toLowerCase());
log(`${zip ? "Zipped" : "Copied"} Module ${module.formattedName}!`);
}
13 changes: 8 additions & 5 deletions tools/tasks/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ export function makeName(bodyName: string): string {
}

export async function makeGHAFileNames(): Promise<void> {
const names = modulesFile.modules.map((module) => {
return { MODULE: module.name, FILENAME: sanitize(makeName(module.name).toLowerCase()) } as OutputName;
});
// Output list of names should not include modules that have output zip disabled
const names = modulesFile.modules
.filter((module) => module.shouldProvideSeparately)
.map((module) => {
return { MODULE: module.name, FILENAME: sanitize(makeName(module.name).toLowerCase()) } as OutputName;
});
names.push({
MODULE: buildConfig.combinedName,
FILENAME: sanitize(makeName(buildConfig.combinedName).toLowerCase()),
MODULE: modulesFile.combined.name,
FILENAME: sanitize(makeName(modulesFile.combined.name).toLowerCase()),
});
setOutput("names", JSON.stringify(names));
}
Expand Down
6 changes: 5 additions & 1 deletion tools/tasks/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { checkModuleEnv, cleanUp, createDirs } from "./util";
import buildConfig from "../buildConfig";
import { zipOrCopyCombined } from "./compressCombinedTask";
import { zipOrCopyModule } from "./compressModulesTask";
import { modulesFile } from "../globals";

export async function setup(): Promise<void> {
await cleanUp(buildConfig.buildDestinationDirectory);
Expand All @@ -18,5 +19,8 @@ export async function copySpecifiedModuleTask(): Promise<void> {

async function zipOrCopySpecifiedModule(zip: boolean) {
if (checkModuleEnv(true) === "COMBINED") return zipOrCopyCombined(zip);
return zipOrCopyModule(zip, process.env.MODULE.trim());
return zipOrCopyModule(
zip,
modulesFile.modules.find((module) => module.name === process.env.MODULE.trim()),
);
}
10 changes: 5 additions & 5 deletions tools/tasks/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ export function checkModuleEnv(allowCombined: boolean): OperationType {

module = module.trim();

if (module === buildConfig.combinedName) {
if (module === modulesFile.combined.name) {
if (allowCombined) return "COMBINED";
else throw new Error(`Module Env Variable cannot be '${buildConfig.combinedName}' for this operation!`);
else throw new Error(`Module Env Variable cannot be '${modulesFile.combined.name}' for this operation!`);
}

if (!modulesFile.modules.map((module) => module.name).includes(module)) {
if (allowCombined)
throw new Error(
`Module Env Variable must be a module specified in module.json, or '${
buildConfig.combinedName
}'. Found: '${module}'. Accepted: [${modulesFile.modules.join(", ")}, ${buildConfig.combinedName}].`,
modulesFile.combined.name
}'. Found: '${module}'. Accepted: [${modulesFile.modules.join(", ")}, ${modulesFile.combined.name}].`,
);
else
throw new Error(
`Module Env Variable must be a module specified in module.json. Found: '${module}'. Accepted: [${modulesFile.modules.join(
", ",
)}. Module Env Variable cannot be '${buildConfig.combinedName}' for this operation!`,
)}. Module Env Variable cannot be '${modulesFile.combined.name}' for this operation!`,
);
}
return "MODULE";
Expand Down
18 changes: 18 additions & 0 deletions tools/types/modulesFile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
export interface ModulesFile {
combined: Combined;
modules: Module[];
}

export interface Combined {
/**
* Name of the Combined Zip. The Directory where the pack.mcmeta and pack.png are grabbed from.
*/
name: string;

/**
* Formatted Name of the Combined Zip. Used in log.
*/
formattedName: string;
}

export interface Module {
/**
* The Name of the Module. Has to be a folder in the root directory of this project. Will also be the name of the output zip.
Expand All @@ -22,4 +35,9 @@ export interface Module {
* Path from base of the repo to the assets folder where the en_us.langs are grabbed from.
*/
pathToAssets: string;

/**
* Whether this module should be provided as a separate zip.
*/
shouldProvideSeparately: boolean;
}

0 comments on commit 9b1c06c

Please sign in to comment.