Skip to content

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Idrinth committed Apr 5, 2024
1 parent dc5508f commit dcc2af1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@idrinth/typescript-language-from-yaml",
"version": "1.2.4",
"version": "1.3.0",
"description": "Translates yaml files to ts for translation autocompletion, autocorrection and better developer support",
"bin": {
"itlfy": "bin/itlfy.js"
Expand Down
7 changes: 7 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import check from './check.js';
import Logger from './logger.js';
import Config from './config.js';
import init from './init.js';
import dump from './dump.js';

// eslint-disable-next-line complexity
export default async(args: string[], cwd: string,): Promise<number> => {
Expand All @@ -26,6 +27,12 @@ export default async(args: string[], cwd: string,): Promise<number> => {
config,
);
return EXIT_SUCCESS;
case 'dump':
dump(
logger,
config,
);
return EXIT_SUCCESS;
case 'init':
init(
logger,
Expand Down
19 changes: 19 additions & 0 deletions src/dump.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Logger from './logger.js';
import Config from './config.js';
import {
readFileSync,
writeFileSync,
} from 'fs';

export default (
logger: Logger,
config: Config,
) => {
for (const folder of config.folders) {
const data = readFileSync(
`${ folder }/${ config.originDirectory }/en.yml`,
'utf8',
).replace(/ *[a-z_0-9]+:/ug, '',);
writeFileSync(`${ folder }/dump.txt`, data, 'utf8',);
}
};

0 comments on commit dcc2af1

Please sign in to comment.