Skip to content

Commit dcc2af1

Browse files
committed
1.3.0
1 parent dc5508f commit dcc2af1

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@idrinth/typescript-language-from-yaml",
3-
"version": "1.2.4",
3+
"version": "1.3.0",
44
"description": "Translates yaml files to ts for translation autocompletion, autocorrection and better developer support",
55
"bin": {
66
"itlfy": "bin/itlfy.js"

src/cli.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import check from './check.js';
99
import Logger from './logger.js';
1010
import Config from './config.js';
1111
import init from './init.js';
12+
import dump from './dump.js';
1213

1314
// eslint-disable-next-line complexity
1415
export default async(args: string[], cwd: string,): Promise<number> => {
@@ -26,6 +27,12 @@ export default async(args: string[], cwd: string,): Promise<number> => {
2627
config,
2728
);
2829
return EXIT_SUCCESS;
30+
case 'dump':
31+
dump(
32+
logger,
33+
config,
34+
);
35+
return EXIT_SUCCESS;
2936
case 'init':
3037
init(
3138
logger,

src/dump.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Logger from './logger.js';
2+
import Config from './config.js';
3+
import {
4+
readFileSync,
5+
writeFileSync,
6+
} from 'fs';
7+
8+
export default (
9+
logger: Logger,
10+
config: Config,
11+
) => {
12+
for (const folder of config.folders) {
13+
const data = readFileSync(
14+
`${ folder }/${ config.originDirectory }/en.yml`,
15+
'utf8',
16+
).replace(/ *[a-z_0-9]+:/ug, '',);
17+
writeFileSync(`${ folder }/dump.txt`, data, 'utf8',);
18+
}
19+
};

0 commit comments

Comments
 (0)