Skip to content

Commit

Permalink
update deno.json, tsconfig.json, and bat/buildDeclarationFiles.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
anqisoft committed Jan 16, 2024
1 parent e879caa commit 78cdda1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions bat/buildDeclarationFiles.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@ECHO OFF
cd..
del /s/q/f types\*.d.ts
tsc --declaration -p .\ -t esnext --emitDeclarationOnly --outDir types & pause
if exist types\src\ (move types\src\*.d.ts types\ && rd types\src\)
tsc --declaration -p .\ -t esnext --emitDeclarationOnly --outDir types\
pause
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ import { assert } from 'https://deno.land/[email protected]/assert/mod.ts';
* @returns boolean <en_us>Conversion is successful or not.</en_us><zh_cn>转换成功与否</zh_cn><zh_tw>轉換成功與否</zh_tw>
*/
export function convert(sourceFilename: string, goalFilename: string): boolean {
const FILE_WRITE_MODE = { mode: 0o777 };
const FILE_MODE_ALL = { mode: 0o777 };
try {
const fileInfo = Deno.statSync(sourceFilename);
assert(fileInfo.isFile);

const SOURCE_CONTENT = Deno.readTextFileSync(sourceFilename);
Deno.writeTextFileSync(goalFilename, tw2cn(SOURCE_CONTENT), FILE_WRITE_MODE);
Deno.writeTextFileSync(goalFilename, tw2cn(SOURCE_CONTENT), FILE_MODE_ALL);

return true;
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { convert } from "../index.ts";
import { assert } from 'https://deno.land/[email protected]/assert/mod.ts';

(() => {
const FILE_WRITE_MODE = { mode: 0o777 };
const FILE_MODE_ALL = { mode: 0o777 };

const SOURCE_FILENAME = 'zh_tw.txt';
Deno.writeTextFileSync(SOURCE_FILENAME, '乾,天乾,今天乾燥,如今天乾燥熱,假如今天乾燥熱暈了', FILE_WRITE_MODE);
Deno.writeTextFileSync(SOURCE_FILENAME, '乾,天乾,今天乾燥,如今天乾燥熱,假如今天乾燥熱暈了', FILE_MODE_ALL);

const GOAL_FILENAME = 'zh_cn.txt';
console.log(convert(SOURCE_FILENAME, GOAL_FILENAME));
Expand Down

0 comments on commit 78cdda1

Please sign in to comment.