@iservice-dev/is-wp-plugin-kit 1.6.9 → 1.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/files/compile-mo.mjs +8 -2
- package/package.json +1 -1
package/files/compile-mo.mjs
CHANGED
|
@@ -6,9 +6,8 @@ import { promisify } from 'node:util'
|
|
|
6
6
|
import fg from 'fast-glob'
|
|
7
7
|
|
|
8
8
|
const execFileP = promisify(execFile);
|
|
9
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const root = path.resolve(__dirname, '..');
|
|
11
9
|
|
|
10
|
+
const root = process.cwd();
|
|
12
11
|
|
|
13
12
|
const srcDir = path.join(root, 'assets', 'src', 'l10n');
|
|
14
13
|
const outDir = path.join(root, 'languages');
|
|
@@ -18,6 +17,11 @@ const pluginName = path.basename(root);
|
|
|
18
17
|
await fs.mkdir(outDir, { recursive: true });
|
|
19
18
|
const poFiles = await fg('**/*.po', { cwd: srcDir });
|
|
20
19
|
|
|
20
|
+
if (poFiles.length === 0) {
|
|
21
|
+
console.log('⚠ No .po files found in', srcDir);
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
for (const rel of poFiles) {
|
|
22
26
|
const inPath = path.join(srcDir, rel)
|
|
23
27
|
const outSubdir = path.dirname(rel)
|
|
@@ -35,3 +39,5 @@ for (const rel of poFiles) {
|
|
|
35
39
|
|
|
36
40
|
console.log(`✔ ${rel} -> ${path.relative(root, outPath)} (with prefix ${pluginName}-)`)
|
|
37
41
|
}
|
|
42
|
+
|
|
43
|
+
console.log(`\n✅ Compiled ${poFiles.length} translation file(s)`);
|
package/package.json
CHANGED