Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from garaio/improvingFileSearch
Browse files Browse the repository at this point in the history
Improved file search (replaced recursiveSearchSync)
  • Loading branch information
MadMonkey87 authored Sep 16, 2021
2 parents 1d5999c + 9a18ba1 commit 12c1d89
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/Resources/_generated/TestResources.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Resources/_generated/TestResources.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ function getFilesFromFolder(virtualResxFolder: string, fileNameRegex: any): any
safeVirtualFolder = safeVirtualFolder.substr(0, safeVirtualFolder.length - 1);
}

files = search.recursiveSearchSync(fileNameRegex, __dirname + virtualProjectRoot + safeVirtualFolder);
const directory = __dirname + virtualProjectRoot + safeVirtualFolder + "\\";
console.log("directory: ", directory);
console.log("fileNameRegex: ", fileNameRegex);
const filenames = fs.readdirSync(__dirname + virtualProjectRoot + safeVirtualFolder).filter((fn:string) => fn.match(fileNameRegex));
files = filenames.map((file:any) => directory + file);
console.log("Matching filepaths: ", files);
}

if (files !== undefined && files !== null) {
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "resx-to-ts-json",
"version": "2.0.1",
"version": "2.1.0",
"description": "Converts resx files to TypeScript definitions and json files",
"main": "dist/index.js",
"scripts": {
"test": "node dist/test.js",
"build": "tsc -p ./"
},
"author": {
"name": "Hasan Afzal",
"originalAuthor": "Martijn van der Corput"
"name": "Fabian Gander",
"originalAuthor": "Hasan Afzal"
},
"devDependencies": {
"typescript": "^1.8.10"
Expand All @@ -22,7 +22,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hmafzal/resx-to-ts-json.git"
"url": "git+https://github.com/garaio/resx-to-ts-json.git"
},
"keywords": [
"typescript",
Expand All @@ -35,7 +35,7 @@
],
"license": "ISC",
"bugs": {
"url": "https://github.com/hmafzal/resx-to-ts-json/issues"
"url": "https://github.com/garaio/resx-to-ts-json/issues"
},
"homepage": "https://github.com/hmafzal/resx-to-ts-json#readme"
"homepage": "https://github.com/garaio/resx-to-ts-json#readme"
}
2 changes: 1 addition & 1 deletion test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import program = require('./index');

program.executeResxToTs('testnamespace', '/Resources', '/Resources/_generated');
program.executeResxToJson('/Resources', '/Resources/_generated/');
program.executeResxToTsTranslationKeys('Reka.RekaNet.EmployerPortal.Web.VueResources.', '/Resources', '/Resources/_generated/keysOnly', /VueResources.resx$/);
program.executeResxToTsTranslationKeys('Reka.RekaNet.EmployerPortal.Web.VueResources.', '/Resources', '/Resources/_generated/keysOnly', /TestResources\.resx$/);

0 comments on commit 12c1d89

Please sign in to comment.