import { buildAndWatchIntlayer, runParallel } from "@intlayer/chokidar";
import { getConfiguration } from "@intlayer/config";

//#region src/build.ts
/**
* Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.
* Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}
*/
const build = async (options) => {
	const config = getConfiguration(options?.configOptions);
	let parallelProcess = null;
	if (options?.with) {
		parallelProcess = runParallel(options.with);
		parallelProcess.result.catch(() => {});
	}
	await buildAndWatchIntlayer({
		persistent: options?.watch ?? false,
		skipPrepare: options?.skipPrepare ?? false,
		configuration: config
	});
	if (!options?.watch && parallelProcess) parallelProcess.kill();
};

//#endregion
export { build };
//# sourceMappingURL=build.mjs.map