-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathoutput-paths.js
26 lines (26 loc) · 942 Bytes
/
output-paths.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureOutputPaths = ensureOutputPaths;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
function ensureOutputPaths(baseOutputPath, i18n) {
const outputPaths = i18n.shouldInline
? [...i18n.inlineLocales].map((l) => [
l,
i18n.flatOutput ? baseOutputPath : (0, node_path_1.join)(baseOutputPath, i18n.locales[l].subPath),
])
: [['', baseOutputPath]];
for (const [, outputPath] of outputPaths) {
if (!(0, node_fs_1.existsSync)(outputPath)) {
(0, node_fs_1.mkdirSync)(outputPath, { recursive: true });
}
}
return new Map(outputPaths);
}