Skip to content

Commit 46e32ab

Browse files
authored
chore: Dont require read access to cwd (#130)
1 parent 69cb847 commit 46e32ab

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

.github/workflows/master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Ensure Permissions Work
2727
run: |
2828
cd tests/integration/out-of-date-deps
29-
deno run --allow-read='.' --allow-write='deps.ts' --allow-net='x.nest.land,cdn.deno.land,api.deno.land,raw.githubusercontent.com,github.com,api.github.com' ../../../mod.ts update
29+
deno run --allow-read='deps.ts' --allow-write='deps.ts' --allow-net='x.nest.land,cdn.deno.land,api.deno.land,raw.githubusercontent.com,github.com,api.github.com' ../../../mod.ts update
3030
linting:
3131
# Doesn't need to be checked in all OS
3232
runs-on: ubuntu-latest

src/commands/update.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ export class UpdateSubcommand extends Line.Subcommand {
2626

2727
// Check for updates and rewrite `deps.ts` if needed
2828
ConsoleLogger.info("Checking if your modules can be updated...");
29-
const usersWorkingDir: string = Deno.realPathSync(".");
3029
let depsWereUpdated = false;
3130
let depsContent: string = new TextDecoder().decode(
32-
Deno.readFileSync(usersWorkingDir + "/" + depsLocation),
31+
Deno.readFileSync("./" + depsLocation),
3332
); // no need for a try/catch. The user needs a deps.ts file
3433

3534
// Update the file content
@@ -60,7 +59,7 @@ export class UpdateSubcommand extends Line.Subcommand {
6059

6160
// Re-write the file
6261
Deno.writeFileSync(
63-
usersWorkingDir + "/" + depsLocation,
62+
"./" + depsLocation,
6463
new TextEncoder().encode(depsContent),
6564
);
6665

src/services/module_service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ export default class ModuleService {
5858
): Promise<IModule[]> {
5959
// Solely read the users `deps.ts` file
6060
ConsoleLogger.info("Reading deps.ts to gather your dependencies...");
61-
const usersWorkingDir: string = Deno.realPathSync(".");
6261
const depsContent: string = new TextDecoder().decode(
63-
Deno.readFileSync(usersWorkingDir + "/" + depsLocation),
62+
Deno.readFileSync("./" + depsLocation),
6463
); // no need for a try/catch. The user needs a deps.ts file
6564

6665
// Only select lines we support eg versioning and an actual import line

0 commit comments

Comments
 (0)