Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Blocksnmore committed Jul 5, 2024
1 parent fa45631 commit 9484269
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@studios/despace",
"description": "A CLI utility for polyfilling Deno's workspace feature while it's still in development",
"version": "0.1.7",
"version": "0.1.8",
"exports": "./cli.ts",
"fmt": {
"indentWidth": 4,
Expand Down
57 changes: 36 additions & 21 deletions options/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default async function Build(args: string[]) {
if (parsed.exports == undefined) {
console.warn(
`${prefix} ${
yellow(`No exports found in ${config.name}.`)
yellow(`No exports found in ${parsed.name}.`)
}`,
);
continue;
Expand Down Expand Up @@ -150,30 +150,42 @@ export default async function Build(args: string[]) {
moduleImports,
)
) {
try {
await Deno.stat(join(path, importPath));

if (
["http", "jsr:", "npm:"].some((p) =>
importPath.startsWith(p)
)
) {
imports.push({
name,
path: normalize(
relative(
cwd,
join(path, importPath),
),
),
path: importPath,
workspace: false,
});
} catch {
imports.push({
name,
path: normalize(
relative(
cwd,
join(path, path),
} else {
try {
await Deno.stat(join(path, importPath));

imports.push({
name,
path: normalize(
relative(
cwd,
join(path, importPath),
),
),
),
workspace: false,
});
workspace: false,
});
} catch {
imports.push({
name,
path: normalize(
relative(
cwd,
join(path, path),
),
),
workspace: false,
});
}
}
}
}
Expand Down Expand Up @@ -231,7 +243,10 @@ export default async function Build(args: string[]) {
despaceConfig["despace.prependJSR"] && i.workspace
? `jsr:${i.name}`
: i.name,
`../${i.path}`.replaceAll("\\", "/"),

["http", "jsr:", "npm:"].some((p) => i.path.startsWith(p))
? i.path
: `../${i.path}`.replaceAll("\\", "/"),
]),
...Object.entries(
config["despace.imports"] as Record<string, string>,
Expand Down

0 comments on commit 9484269

Please sign in to comment.