Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit fcd7de3

Browse files
committed
fix: Update paths for detect executable external js libs (#92)
1 parent e927d2c commit fcd7de3

2 files changed

Lines changed: 36 additions & 5 deletions

File tree

src/commands/translate.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,24 @@ export class Translate extends Command {
226226
if (err) {
227227
reject(new Error('The path you supplied was not found'));
228228
} else {
229-
const command = 'node ' + resolvePath(__dirname, '..', '..', 'node_modules/@biesbjerg/ngx-translate-extract/bin/cli.js') + ' ' +
229+
let extractCli;
230+
try {
231+
extractCli = resolvePath(__dirname, '..', '..', 'node_modules/@biesbjerg/ngx-translate-extract/bin/cli.js');
232+
readFileSync(extractCli).toString();
233+
} catch (__error) {
234+
try {
235+
extractCli = resolvePath(__dirname, '..', 'node_modules/@biesbjerg/ngx-translate-extract/bin/cli.js');
236+
readFileSync(extractCli).toString();
237+
} catch (__error) {
238+
try {
239+
extractCli = resolvePath(__dirname, 'node_modules/@biesbjerg/ngx-translate-extract/bin/cli.js');
240+
readFileSync(extractCli).toString();
241+
} catch (__error) {
242+
console.error(__error);
243+
}
244+
}
245+
}
246+
const command = 'node ' + extractCli + ' ' +
230247
'--patterns ' + newExcludes.join(' ') + ' ' +
231248
'--input ' + inputFolder + ' ' +
232249
'--output ' + outputFolder + ' ' +

src/utils/schematics-command-builder.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@ export function schematicsCommandBuilder(
77
args: { [key: string]: string | undefined }
88
) {
99
const argsArray: string[] = [];
10-
const localSchematicsCli =
11-
resolve(__dirname, '../../node_modules/@angular-devkit/schematics-cli/bin/schematics.js');
12-
const projectSchematicsCli =
13-
resolve(projectPath as string, 'node_modules/@angular-devkit/schematics-cli/bin/schematics.js');
10+
let localSchematicsCli;
11+
try {
12+
localSchematicsCli = resolve(__dirname, '../../node_modules/@angular-devkit/schematics-cli/bin/schematics.js');
13+
readFileSync(localSchematicsCli).toString();
14+
} catch (__error) {
15+
try {
16+
localSchematicsCli = resolve(__dirname, '../node_modules/@angular-devkit/schematics-cli/bin/schematics.js');
17+
readFileSync(localSchematicsCli).toString();
18+
} catch (__error) {
19+
try {
20+
localSchematicsCli = resolve(__dirname, 'node_modules/@angular-devkit/schematics-cli/bin/schematics.js');
21+
readFileSync(localSchematicsCli).toString();
22+
} catch (__error) {
23+
console.error(__error);
24+
}
25+
}
26+
}
27+
const projectSchematicsCli = resolve(projectPath as string, 'node_modules/@angular-devkit/schematics-cli/bin/schematics.js');
1428
const templateArray = (template as string).split(':');
1529
const templateFolder = templateArray.length ? templateArray[0] : 'empty';
1630
const templateName = templateArray.length ? templateArray[1] : 'empty';

0 commit comments

Comments
 (0)