Skip to content

Commit

Permalink
chore: find projects via tasks (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: Johannes Konings <[email protected]>
  • Loading branch information
JohannesKonings and Johannes Konings authored May 23, 2024
1 parent ed722fb commit 33f6d24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/jsii/fetcher.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -84,7 +88,7 @@ export async function getJSII(spec: string): Promise<any> {
}

const tarballData = await tarball(spec, {
registry: registryUrl(scope),
registry: await getRegistryUrl(scope),
});

const tarballStream = new Readable();
Expand Down

0 comments on commit 33f6d24

Please sign in to comment.