Use EXTENSION_PATH to specify subdirectory in add_extension_from_source

This commit is contained in:
Shivam Mathur
2021-04-19 17:03:57 +05:30
parent 909090903e
commit fe944a16b5
10 changed files with 25 additions and 28 deletions

View File

@ -448,12 +448,10 @@ export async function parseExtensionSource(
extension: string,
prefix: string
): Promise<string> {
// Groups: extension, domain url, org, repo, subdirectory, release
// https://regex101.com/r/P3rJiy/1
const regex = /(\w+)-(.+:\/\/.+(?:[.:][^/]+)+)?(?:\/)?([^/]+)\/([^/]+)(?:\/)?(.+)*@(.+)/;
// Groups: extension, domain url, org, repo, release
const regex = /(\w+)-(.+:\/\/.+(?:[.:].+)+(?:\/))?([\w.-]+)\/([\w.-]+)@(.+)/;
const matches = regex.exec(extension) as RegExpExecArray;
matches[2] = matches[2] ?? 'https://github.com';
matches[5] = matches[5] ?? '.';
matches[2] = matches[2] ? matches[2].slice(0, -1) : 'https://github.com';
return await joins(
'\nadd_extension_from_source',
...matches.splice(1, matches.length),