Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid Deno namespace #39

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ on:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
defaults:
run:
shell: bash

runs-on: ${{ matrix.os }}
timeout-minutes: 1
steps:
- uses: actions/checkout@v3
- run: npm install --ignore-scripts
Expand Down
4 changes: 2 additions & 2 deletions src/emit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Diagnostic, MemoryEmitResultFile, Project } from "./deps.deno.ts";
import { chmod } from "node:fs/promises";

const anyShebang = /^#![^\n]*\n/;
const denoShebang = /^#!\/usr\/bin\/env -S deno run\b[^\n]*\n/;
Expand All @@ -11,9 +12,8 @@ function transpileShebang(file: MemoryEmitResultFile) {
}

async function markExecutableIfNeeded(file: MemoryEmitResultFile) {
if (Deno.build.os === "windows") return;
if (!file.text.startsWith(nodeShebang)) return;
await Deno.chmod(file.filePath, 0o755);
await chmod(file.filePath, 0o755);
}

/**
Expand Down
8 changes: 2 additions & 6 deletions src/shim.node.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// Node-only, see https://github.com/fromdeno/deno2node#shimming
import { chmod, readFile } from "node:fs/promises";
import process from "node:process";
import { readFile } from "node:fs/promises";
import * as process from "node:process";
import { isatty } from "node:tty";

const os = process.platform === "win32" ? "windows" : process.platform;

export const Deno = {
// please keep sorted
args: process.argv.slice(2),
build: { os },
chmod,
exit: process.exit,
isatty,
noColor: process.env.NO_COLOR !== undefined,
Expand Down
Loading