From 33f6d246fdda1d89b05e3543c6778ea3a5c9dfc8 Mon Sep 17 00:00:00 2001 From: Johannes Konings Date: Thu, 23 May 2024 14:22:15 +0200 Subject: [PATCH] chore: find projects via tasks (#27) Co-authored-by: Johannes Konings --- src/extension.ts | 4 ++-- src/jsii/fetcher.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index da122a2..7996d09 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -341,14 +341,14 @@ async function findProjectInFolder(workspaceFolder?: vscode.WorkspaceFolder) { return []; } const exclusions: string[] = ["**/node_modules", "**/cdk.out", "**/dist"]; - const pattern: string = "**/.projen/deps.json"; + const pattern: string = "**/.projen/tasks.json"; const depFileList = await vscode.workspace.findFiles( new vscode.RelativePattern(workspaceFolder, pattern), `{${exclusions.join(",")}}` ); const cleanupList = depFileList.map((f) => { - return f.with({ path: f.path.replace("/.projen/deps.json", "") }); + return f.with({ path: f.path.replace("/.projen/tasks.json", "") }); }); return cleanupList; diff --git a/src/jsii/fetcher.ts b/src/jsii/fetcher.ts index 31d7168..f0ab0b3 100644 --- a/src/jsii/fetcher.ts +++ b/src/jsii/fetcher.ts @@ -1,9 +1,13 @@ import { Readable } from "stream"; import gunzip from "gunzip-maybe"; import { tarball } from "pacote"; -import registryUrl from "registry-url"; import { extract } from "tar-stream"; +async function getRegistryUrl(scope: string | undefined) { + const registryUrl = await import("registry-url"); + const url = registryUrl.default(scope); + return url; +} export interface RemoteProjenProjectInfo { typeName: string; pjid?: string; @@ -84,7 +88,7 @@ export async function getJSII(spec: string): Promise { } const tarballData = await tarball(spec, { - registry: registryUrl(scope), + registry: await getRegistryUrl(scope), }); const tarballStream = new Readable();