-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for published package language vendor files (#177)
* Support for published package language vendor files * Added published package lang examples * Added test for php_vendor.json merge into other langs .json * Refactored merge logic to parseAll from prepareExtendedParsedLangFiles * Adjusted loader test to correspond with parseAll function's output * Isolate fixture folder in loader.test
- Loading branch information
1 parent
66a2e6d
commit 565faad
Showing
5 changed files
with
131 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
return [ | ||
'welcome' => 'Welcome to the example package.', | ||
'success' => 'The package did the task successfully.', | ||
'foo' => [ | ||
'level1' => [ | ||
'level2' => 'package' | ||
] | ||
], | ||
'arr' => ['foo', 'bar'], | ||
'multiline' => 'Lorem ' . | ||
'ipsum ' . | ||
'dolor ' . | ||
'sit ' . | ||
'amet.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
return [ | ||
'welcome' => 'Bem-vindo ao exemplo do pacote.', | ||
'success' => 'O pacote executou a tarefa com sucesso.', | ||
'foo' => [ | ||
'level1' => [ | ||
'level2' => 'pacote' | ||
] | ||
], | ||
'arr' => ['foo', 'bar'], | ||
'multiline' => 'Lorem ' . | ||
'ipsum ' . | ||
'dolor ' . | ||
'sit ' . | ||
'amet.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
|
||
export function isolateFolder(folderToIsolate: string, testName: string) { | ||
const isolatedFolder = folderToIsolate + '_isolated_' + testName; | ||
copyDirSync(folderToIsolate, isolatedFolder); | ||
|
||
return isolatedFolder; | ||
} | ||
|
||
export function removeIsolatedFolder(isolatedFolder: string) { | ||
fs.rmSync(isolatedFolder, { recursive: true, force: true }) | ||
} | ||
|
||
function copyDirSync(source: string, destination: string) { | ||
const exists = fs.existsSync(source); | ||
const stats = exists && fs.statSync(source); | ||
const isDirectory = exists && stats.isDirectory(); | ||
if (isDirectory) { | ||
fs.mkdirSync(destination); | ||
fs.readdirSync(source).forEach(childItemName => { | ||
copyDirSync(path.join(source, childItemName), path.join(destination, childItemName)); | ||
}); | ||
} else { | ||
fs.copyFileSync(source, destination); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters