Full Code of BentoumiTech/denox for AI

master bc6cfdfb30fa cached
131 files
66.6 KB
22.8k tokens
66 symbols
1 requests
Download .txt
Repository: BentoumiTech/denox
Branch: master
Commit: bc6cfdfb30fa
Files: 131
Total size: 66.6 KB

Directory structure:
gitextract_ms61bagw/

├── .editorconfig
├── .eslintrc.js
├── .github/
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       └── ci.yml
├── .vscode/
│   └── denox.code-workspace
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── denox.ts
├── deps.ts
├── dev_deps.ts
├── example/
│   ├── deno-workspace
│   ├── files/
│   │   └── test.txt
│   └── main.ts
├── src/
│   ├── const.ts
│   ├── deno_options/
│   │   ├── __tests__/
│   │   │   ├── build_cli_arguments.test.ts
│   │   │   ├── parse.test.ts
│   │   │   ├── utils.test.ts
│   │   │   └── validate.test.ts
│   │   ├── build_cli_arguments.ts
│   │   ├── const.ts
│   │   ├── parse.ts
│   │   ├── utils.ts
│   │   └── validate.ts
│   ├── interfaces.ts
│   ├── lib/
│   │   ├── semver.ts
│   │   └── upgrade_version.ts
│   ├── parser/
│   │   ├── __tests__/
│   │   │   └── deno_workspace.test.ts
│   │   └── deno_workspace.ts
│   ├── run.ts
│   └── utils/
│       ├── DenoXErrors.ts
│       ├── __tests__/
│       │   ├── file.test.ts
│       │   └── fixture/
│       │       ├── file.txt
│       │       └── list-files/
│       │           ├── second.txt
│       │           └── third.txt
│       ├── consolex.ts
│       └── file.ts
└── test/
    ├── e2e/
    │   ├── args.test.ts
    │   ├── deno_options/
    │   │   ├── options.test.ts
    │   │   └── scoped_global.test.ts
    │   └── scripts.test.ts
    ├── fixture/
    │   ├── args/
    │   │   ├── deno-workspace.ts
    │   │   └── main.ts
    │   ├── deno_options/
    │   │   ├── deno-workspace.yml
    │   │   ├── files/
    │   │   │   ├── import_map.json
    │   │   │   ├── test.cer
    │   │   │   ├── test.txt
    │   │   │   └── tsconfig.json
    │   │   ├── main.ts
    │   │   ├── permissions.ts
    │   │   ├── quiet.ts
    │   │   └── seed.ts
    │   ├── global_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── malformed_json/
    │   │   └── deno-workspace.json
    │   ├── malformed_ts/
    │   │   └── deno-workspace.ts
    │   ├── malformed_yaml/
    │   │   └── deno-workspace
    │   ├── merged_scoped_global__invalid_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── multiple_scripts/
    │   │   ├── deno-workspace
    │   │   ├── develop.ts
    │   │   └── main.ts
    │   ├── no_workspace/
    │   │   └── .keep
    │   ├── script_global_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── script_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── single_script/
    │   │   ├── deno-workspace
    │   │   └── main.ts
    │   └── workspace_multiple_names/
    │       ├── .deno-workspace/
    │       │   ├── .deno-workspace
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── .deno-workspace.json/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   └── deno-workspace.ts
    │       ├── .deno-workspace.ts/
    │       │   └── .deno-workspace.ts
    │       ├── .deno-workspace.yaml/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── .deno-workspace.yml/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── deno-workspace/
    │       │   ├── .deno-workspace
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace
    │       │   ├── deno-workspace.json
    │       │   ├── deno-workspace.ts
    │       │   └── deno-workspace.yaml
    │       ├── deno-workspace.json/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── deno-workspace.ts/
    │       │   ├── .deno-workspace.ts
    │       │   └── deno-workspace.ts
    │       ├── deno-workspace.yaml/
    │       │   ├── .deno-workspace
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace.json
    │       │   ├── deno-workspace.ts
    │       │   └── deno-workspace.yaml
    │       └── deno-workspace.yml/
    │           ├── .deno-workspace
    │           ├── .deno-workspace.json
    │           ├── .deno-workspace.ts
    │           ├── .deno-workspace.yaml
    │           ├── .deno-workspace.yml
    │           ├── deno-workspace
    │           ├── deno-workspace.json
    │           ├── deno-workspace.ts
    │           ├── deno-workspace.yaml
    │           └── deno-workspace.yml
    └── utils/
        ├── cwd.ts
        └── denox-run.ts

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
# See http://editorconfig.org/
# EditorConfig helps developers define and maintain consistent coding styles
# between different editors and IDEs. The EditorConfig project consists of a
# file format for defining coding styles and a collection of text editor plugins
# that enable editors to read the file format and adhere to defined styles.
# EditorConfig files are easily readable and they work nicely with version
# control systems.

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false


================================================
FILE: .eslintrc.js
================================================
module.exports = {
  root: true,
  parser: "@typescript-eslint/parser",
  plugins: [
    "@typescript-eslint",
  ],
  rules: {
    "@typescript-eslint/ban-ts-ignore": 0,
    "no-console": 0,
    "no-else-return": "error",
    "@typescript-eslint/no-use-before-define": 0,
    "@typescript-eslint/camelcase": 0,
    "no-prototype-builtins": 0,
    "max-lines-per-function": [
      "error",
      {
        "max": 20,
        "skipComments": true,
      },
    ],
    "no-shadow": "error",
    "max-params": [
      "error",
      3,
    ],
    "max-statements-per-line": [
      "error",
      {
        "max": 2,
      },
    ],
    "complexity": [
      "error",
      15,
    ],
    "no-undef": 0,
  },
  "overrides": [
    {
      "files": ["*.test.ts"],
      "rules": {
        "max-lines-per-function": 0,
      },
    },
  ],
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
  ],
};


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
## Issue Type

<!--
Keep the one that applies and remove the others
e.g. - Bug Report
-->

- Bug Report
- Feature Request
- Other

## Expected

<!-- Expected behavior -->

## Actual

<!-- Current behavior -->

## Possible Solutions

<!-- Maybe you can help with this bug or feature? -->

## Info

- DenoX version:


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
## Description
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.

**Types of changes**
What types of changes does your code introduce? Keep the one that applies:
- New feature (non-breaking change which adds functionality)
- Bugfix (non-breaking change which fixes an issue)
- Change of existing functionality
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- Docs

**Related links**
Related links section, that would have a link to issues and any other relevant information.

## Changelog
#### Added

#### Changed

#### Removed

#### Fixed


================================================
FILE: .github/workflows/ci.yml
================================================
name: CI

on: [push]

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        deno: [1.0.5, 1.1.3, 1.2.2]
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: '0'
    - uses: denolib/setup-deno@master
      with:
        deno-version: ${{ matrix.deno }}
    - uses: actions/setup-node@v1
      with:
        node-version: '12'
    - run: npm install typescript eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin tsc-silent --save-dev
    - run: ./node_modules/.bin/eslint **/**.ts --ext .ts
    - run: deno install -Af denox.ts
    - run: deno test -A --failfast src/ test/


================================================
FILE: .vscode/denox.code-workspace
================================================
{
	"folders": [
		{
			"path": ".."
		}
	],
	"settings": {
		"deno.enabled": true
	}
}


================================================
FILE: CONTRIBUTING.md
================================================
Contributing
----------------------------------

1. File an issue to notify the maintainers about what you're working on.
2. Fork the repo, develop and test your code changes, add docs.
3. Make sure that your commit messages clearly describe the changes.
4. Send a pull request.

File an Issue
----------------------------------

Use the issue tracker to start the discussion. It is possible that someone
else is already working on your idea, your approach is not quite right, or that
the functionality exists already. The ticket you file in the issue tracker will
be used to hash that all out.

Style Guides
-------------------
1. Write in UTF-8 in TypeScript
2. User modular architecture to group similar functions, classes, etc.
3. Always use 2 spaces for indentation (don't use tabs)
4. Try to limit line length to 80 characters
5. Class names should always be capitalized
6. Function names should always be camelCase
7. Look at the existing style and adhere accordingly
8. Run `deno fmt` before submitting your code

Fork the Repository
-------------------

Be sure to add the relevant tests before making the pull request.

Make the Pull Request
---------------------

Once you have made all your changes, tests, and updated the documentation,
make a pull request to move everything back into the main branch of the
`repository`. Be sure to reference the original issue in the pull request.
Expect some back-and-forth with regards to style and compliance of these
rules.


================================================
FILE: LICENSE.md
================================================
The MIT License

Copyright (c) 2020 Khaled Bentoumi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
<h1 align="center">
  <br>
  <a href="https://github.com/BentoumiTech/denox" alt="DenoX">
    <img height="100%" width="475px" src="https://raw.githubusercontent.com/BentoumiTech/denox/master/.github/img/denox-logo.png" alt="Deno script runner">
  </a>
  <br/>
</h1>
<p align="center">
  <img src="https://img.shields.io/github/workflow/status/BentoumiTech/denox/CI/master" alt="GitHub Workflow Status"/>
  <img src="https://img.shields.io/github/v/tag/bentoumitech/denox?style=flat-square" alt="latest SemVer"/>
  <img src="https://img.shields.io/badge/contribution-welcome-brightgreen.svg?style=flat-square" alt="Contribution welcome"/>
  <img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square" alt="Commitizen friendly"/>
  <img src="https://img.shields.io/badge/semantic-release-e10079.svg?style=flat-square" alt="Semantic release"/>
  <img src="https://img.shields.io/github/license/BentoumiTech/denox?logo=MIT&style=flat-square" alt="MIT License"/>
  <br />
  <br />
  <a href="#installupgrade">Install/Upgrade</a> •
  <a href="#overview">Overview</a> •
  <a href="#usage">Usage</a> •
  <a href="#getting-started">Getting started</a> •
  <a href="#contributing">Contributing</a>
  <br />
  <br />
  <img height="100%" width="600px" src="https://raw.githubusercontent.com/bentoumitech/denox/master/.github/img/screenshot-example.png" alt="DenoX screenshot example">
</p>

## Install/Upgrade

Prerequisites: [Deno](https://github.com/denoland/deno_install) (>=1.0.0)

```bash
$ deno install -Af -n denox https://denopkg.com/BentoumiTech/denox/denox.ts
```

## Overview

DenoX is a cross platform script runner and workspace wrapper for Deno

Using DenoX, you can set up your workspace scripts permissions and options in declarative code.

In short, it allows you to to replace this:

```bash
$ deno run --allow-read --allow-write --allow-net main.ts
```

with this:

```bash
$ denox run start
```

- **DRY** Only write your permissions and options once.
- **Packaged** Your code can run on a different machine with a short single command `denox run start`
- **Cross Platform** DenoX support and is tested on Linux, Mac OS and Windows.
- **Extensible** :soon:

## Usage

```bash
$ denox --help
denox v0.4.0

Usage:
  $ denox <command> [options]

Commands:
  run <script> [...args]  Run a script

For more info, run any command with the `--help` flag:
  $ denox run --help

Options:
  -h, --help     Display this message
  -v, --version  Display version number

Examples:
denox run start
```

## Getting Started

### `deno-workspace` file

Scripts and options need to be defined in a `deno-workspace` file at the root of your project.

DenoX supports YAML, JSON and typescript as format for `deno-workspace`.

In the following examples running `$ denox run start` will execute main.ts file with `example.com` networking permissions

#### YAML

`deno-workspace.yml`

```yaml
scripts:
  start:
    file: main.ts
    deno_options:
      allow-net: example.com
```

#### JSON

`deno-workspace.json`

```json
{
  "scripts": {
    "start": {
      "file": "main.ts",
      "deno_options": {
        "allow-net": "example.com"
      }
    }
  }
}
```

#### Typescript

`deno-workspace.ts`

```typescript
import { DenoWorkspace } from "https://denopkg.com/BentoumiTech/denox/src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "main.ts",
      "deno_options": {
        "allow-net": "example.com"
      }
    },
  },
};

export { workspace };
```

## Scripts

You can easily run scripts using denox by adding them to the "scripts" field in `deno-workspace` and run them with `denox run <script-name>`.

### Example:

```yaml
scripts:
  # "denox run start" will execute main.ts with example.com networking permissions
  start:
    file: main.ts
    deno_options:
      allow-net: example.com
  # "denox run develop" will execute main.ts with localhost networking permissions and source code cache reloaded
  develop:
    file: main.ts
    deno_options:
      allow-net: localhost
      reload: true
      v8-flags:
        - --regexp-tier-up
        - --adjust-os-scheduling-parameters true
```

## Options

Scripts can be extended with options.

### deno_options:

Deno options will add the corresponding deno argument with it's value to the deno command.

It supports string, array of strings and boolean.

### Example:

```yaml
scripts:
  # "denox run start" will execute "deno run --allow-net=example.com github.com --reload --allow-read=./files main.ts"
  start:
    file: main.ts
    deno_options:
      reload: true
      allow-net:
        - example.com
        - github.com
      allow-read: ./files
      allow-write: false
```

### Compatibility

It currently support all the options that are accepted by the `deno run` command. For more informations refer to `deno run --help`.

```
allow-all, allow-env, allow-hrtime, allow-net, allow-plugin, allow-read, allow-run,
allow-write, cached-only, cert, config, importmap, inspect, inspect-brk, lock, lock-write,
log-level, no-remote, quiet, reload, seed, unstable, v8-flags
```

## Globals

Options added in "globals" field gets added to all scripts.

> Note: If a same option is set in a script and also set globally the script scoped value overwrite the global one

### Example:

```yaml
scripts:
  # "denox run develop" inherit the --allow-read permission from the globals deno_options
  # "deno run --all-read main.ts"
  develop:
    file: main.ts
globals:
  deno_options:
    allow-read: true
```

## Contributing

Please take a look at our [contributing](./CONTRIBUTING.md) guidelines if you're interested in helping!


================================================
FILE: denox.ts
================================================
import { cac } from "./deps.ts";

import run from "./src/run.ts";
import { error } from "./src/utils/consolex.ts";
import { CURRENT_VERSION } from "./src/const.ts";

const cli = cac("denox");

cli
  .command(
    "run <script> [...args]",
    "Run a script",
    { allowUnknownOptions: true, ignoreOptionDefaultValue: true },
  )
  .example("denox run start arg1 arg2 --namedArg=value")
  .action(run);

// ToDO: remove '@ts-ignore' (and eslint directive) when vscode_deno is fixed to work with @deno_types; ref: <https://github.com/cacjs/cac/issues/75> , <https://github.com/denoland/vscode_deno/issues/21>
/* eslint @typescript-eslint/ban-ts-comment: "off" */
// deno-lint-ignore ban-ts-comment
// @ts-ignore
cli.on("command:*", () => {
  // deno-lint-ignore ban-ts-comment
  // @ts-ignore
  error(`Invalid command: ${cli.args.join(" ")}`);
});

cli.example("denox run start");

cli.help(() => ({}));

cli.version(CURRENT_VERSION);

cli.parse();


================================================
FILE: deps.ts
================================================
export { parse as parseYaml } from "https://deno.land/std@0.88.0/encoding/yaml.ts";
export { YAMLError } from "https://deno.land/std@0.88.0/encoding/_yaml/error.ts";
export { red } from "https://deno.land/std@0.50.0/fmt/colors.ts";
export { extname, resolve } from "https://deno.land/std@0.61.0/path/mod.ts";

// @deno-types="https://unpkg.com/cac@6.5.9/mod.d.ts"
export { cac } from "https://unpkg.com/cac@6.5.9/mod.js";


================================================
FILE: dev_deps.ts
================================================
export * from "./deps.ts";

export {
  assertEquals,
  assertArrayContains,
  assertThrows,
  assertStrContains,
  assertThrowsAsync,
} from "https://deno.land/std@0.50.0/testing/asserts.ts";

export { stripColor } from "https://deno.land/std@0.61.0/fmt/colors.ts";

export { join } from "https://deno.land/std@0.61.0/path/mod.ts";


================================================
FILE: example/deno-workspace
================================================
scripts:
  start:
    file: main.ts
globals:
  deno_options:
    allow-read:
      - './files'
    seed: 1
    reload: true





================================================
FILE: example/files/test.txt
================================================
Hello World


================================================
FILE: example/main.ts
================================================
const data = Deno.readFileSync("./files/test.txt");
const decoder = new TextDecoder("utf-8");

console.log(decoder.decode(data));


================================================
FILE: src/const.ts
================================================
const CURRENT_VERSION = "0.4.0";
const GITHUB_REPO_NAME = "BentoumiTech/denox";
const DENO_WORKSPACE_FILES = [
  "deno-workspace.yml",
  "deno-workspace",
  "deno-workspace.yaml",
  ".deno-workspace",
  ".deno-workspace.yml",
  ".deno-workspace.yaml",
  "deno-workspace.json",
  ".deno-workspace.json",
  "deno-workspace.ts",
  ".deno-workspace.ts",
];

export { CURRENT_VERSION, GITHUB_REPO_NAME, DENO_WORKSPACE_FILES };


================================================
FILE: src/deno_options/__tests__/build_cli_arguments.test.ts
================================================
import { assertEquals, assertArrayContains } from "../../../dev_deps.ts";
import { buildDenoCLIOptionsArgs } from "../build_cli_arguments.ts";

Deno.test("parse a single value CLI option", () => {
  assertEquals(
    buildDenoCLIOptionsArgs({ "allow-net": "example.com" }),
    ["--allow-net=example.com"],
  );
});

Deno.test("parse a truthy boolean value CLI option", () => {
  assertEquals(
    buildDenoCLIOptionsArgs({ "allow-env": true }),
    ["--allow-env"],
  );
});

Deno.test("parse a falsey boolean value CLI option", () => {
  assertEquals(
    buildDenoCLIOptionsArgs({ "allow-env": false }),
    [],
  );
});

Deno.test("parse an array of values CLI option", () => {
  assertEquals(
    buildDenoCLIOptionsArgs({ "allow-net": ["example.com", "google.com"] }),
    ["--allow-net=example.com,google.com"],
  );
});

Deno.test("parse mutliple CLI option", () => {
  const cliArgumentsArray = buildDenoCLIOptionsArgs(
    {
      "allow-net": ["example.com", "google.com"],
      "allow-env": true,
      "allow-read": ".",
      "seed": 1,
      "cert": "./certfile",
      "allow-write": false,
    },
  );

  assertArrayContains(
    cliArgumentsArray,
    [
      "--allow-net=example.com,google.com",
      "--allow-env",
      "--allow-read=.",
      "--seed",
      1,
      "--cert=./certfile",
    ],
  );

  assertEquals(cliArgumentsArray.length, 6);
});


================================================
FILE: src/deno_options/__tests__/parse.test.ts
================================================
import { assertEquals, assertThrows } from "../../../dev_deps.ts";
import { parseDenoOptions } from "../parse.ts";
import { DenoOptionIncorrectType } from "../../utils/DenoXErrors.ts";

Deno.test("deno_options not defined", () => {
  const script = { file: "" };
  const global = {};
  const denoOptions = parseDenoOptions(global, script);

  assertEquals(
    denoOptions,
    [],
  );
});

Deno.test("deno_options only defined in globals", () => {
  const script = { file: "" };
  const global = { deno_options: { "allow-read": true } };
  const denoOptions = parseDenoOptions(global, script);

  assertEquals(
    denoOptions,
    ["--allow-read"],
  );
});

Deno.test("deno_options only defined in script", () => {
  const script = { deno_options: { "allow-read": true }, file: "" };
  const global = {};
  const denoOptions = parseDenoOptions(global, script);

  assertEquals(
    denoOptions,
    ["--allow-read"],
  );
});

Deno.test("deno_options only defined in script and globals", () => {
  const script = { deno_options: { "allow-read": true }, file: "" };
  const global = { deno_options: { "allow-write": true } };
  const denoOptions = parseDenoOptions(global, script);

  assertEquals(
    denoOptions,
    ["--allow-write", "--allow-read"],
  );
});

Deno.test("deno_options script overwrite globals one", () => {
  const script = { deno_options: { "allow-read": false }, file: "" };
  const global = { deno_options: { "allow-read": true } };
  const denoOptions = parseDenoOptions(global, script);

  assertEquals(
    denoOptions,
    [],
  );
});

Deno.test("validation error get thrown", () => {
  const script = { deno_options: { "allow-read": false }, file: "" };
  const global = { deno_options: { "allow-hrtime": "string" } };

  assertThrows(() => {
    parseDenoOptions(global, script);
  }, DenoOptionIncorrectType);
});


================================================
FILE: src/deno_options/__tests__/utils.test.ts
================================================
import { assertEquals } from "../../../dev_deps.ts";
import { getOptionType } from "../utils.ts";

Deno.test("string[]", () => {
  const optionType = getOptionType(["first", "second"]);

  assertEquals(
    optionType,
    "string[]",
  );
});

Deno.test("string[] with numbers", () => {
  const optionType = getOptionType(["first", 2]);

  assertEquals(
    optionType,
    "string[]",
  );
});

Deno.test("mixed[]", () => {
  const optionType = getOptionType(["first", { "test": "string" }]);

  assertEquals(
    optionType,
    "mixed[]",
  );
});

Deno.test("object", () => {
  const optionType = getOptionType({ "test": "string" });

  assertEquals(
    optionType,
    "object",
  );
});

Deno.test("string", () => {
  const optionType = getOptionType("string");

  assertEquals(
    optionType,
    "string",
  );
});

Deno.test("number", () => {
  const optionType = getOptionType(1);

  assertEquals(
    optionType,
    "number",
  );
});

Deno.test("boolean", () => {
  const optionType = getOptionType(true);

  assertEquals(
    optionType,
    "boolean",
  );
});


================================================
FILE: src/deno_options/__tests__/validate.test.ts
================================================
import { assertThrows } from "../../../dev_deps.ts";
import { validateOptions } from "../validate.ts";
import {
  DenoOptionNotRecognized,
  DenoOptionIncorrectType,
} from "../../utils/DenoXErrors.ts";

Deno.test("invalid option name error get thrown", () => {
  const options = { "invalid-option": false };

  assertThrows(() => {
    validateOptions(options);
  }, DenoOptionNotRecognized);
});

Deno.test("invalid option value error get thrown", () => {
  const options = { "allow-hrtime": "string" };

  assertThrows(() => {
    validateOptions(options);
  }, DenoOptionIncorrectType);
});

Deno.test("not throw for valid values", () => {
  const options = {
    "allow-hrtime": true,
    "allow-read": ".",
    "allow-write": true,
    "allow-net": ["google.com", "github.com"],
  };
  validateOptions(options);
});


================================================
FILE: src/deno_options/build_cli_arguments.ts
================================================
import { DenoOptionsEntries, DenoOptionValue } from "../interfaces.ts";
import { getOptionType, OptionTypeValues } from "./utils.ts";
import { optionsDefinitions } from "./const.ts";

type CLIArgument = string | number | [string, number];
type hashCliArgType = { name: string; value: string | boolean | number };

function buildDenoCLIOptionsArgs(
  denoOptions: DenoOptionsEntries,
): CLIArgument[] {
  const argumentsOptions: CLIArgument[] = [];

  for (const [option, value] of Object.entries(denoOptions)) {
    const argumentOption = _transformToCLIArguments(option, value);
    argumentsOptions.push(argumentOption);
  }

  return argumentsOptions.filter((e) => e).flat(Infinity);
}

function _hashToCLIArg(
  hash: hashCliArgType,
): CLIArgument {
  if (hash.value === false) {
    return "";
  }

  const cliArgOptionName = `--${hash.name}`;
  const cliArgOptionDefinition = optionsDefinitions[hash.name];

  if (cliArgOptionDefinition.type === "number") {
    return [cliArgOptionName, hash.value as number];
  }

  if (hash.value === true) {
    return cliArgOptionName;
  }

  return `${cliArgOptionName}${cliArgOptionDefinition.spacer}${hash.value}`;
}

function _transformToCLIArguments(
  option: string,
  value: DenoOptionValue,
): CLIArgument {
  const optionType = getOptionType(value);
  const optionDefinitionType = optionsDefinitions[option].type.split("|");

  if (!optionDefinitionType.includes(optionType)) {
    throw new Error(
      `Deno option "${option}" value is incorrect, options supports string, array of strings and boolean.`,
    );
  }

  const argHash = _transformToArgHash(option, value, optionType);

  return _hashToCLIArg(argHash);
}

function _transformToArgHash(
  option: string,
  value: DenoOptionValue,
  optionType: OptionTypeValues,
): hashCliArgType {
  const argValue = optionType === "string[]"
    ? (value as string[]).join(",")
    : value as string | number | boolean;

  return {
    name: option,
    value: argValue,
  };
}

export { buildDenoCLIOptionsArgs };

export type { CLIArgument };


================================================
FILE: src/deno_options/const.ts
================================================
type OptionsDefinitionsType = {
  [key: string]: { type: string; spacer?: string };
};

const optionsDefinitions: OptionsDefinitionsType = {
  "allow-all": { type: "boolean" },
  "allow-env": { type: "boolean" },
  "allow-hrtime": { type: "boolean" },
  "allow-net": { type: "string|boolean|string[]", spacer: "=" },
  "allow-plugin": { type: "boolean" },
  "allow-read": { type: "string|boolean|string[]", spacer: "=" },
  "allow-run": { type: "boolean" },
  "allow-write": { type: "string|boolean|string[]", spacer: "=" },
  "cached-only": { type: "boolean" },
  "cert": { type: "string", spacer: "=" },
  "config": { type: "string", spacer: "=" },
  "importmap": { type: "string", spacer: "=" },
  "inspect": { type: "string", spacer: "=" },
  "inspect-brk": { type: "string", spacer: "=" },
  "lock": { type: "string", spacer: "=" },
  "lock-write": { type: "boolean" },
  "log-level": { type: "string", spacer: "=" },
  "no-remote": { type: "boolean" },
  "quiet": { type: "boolean" },
  "reload": { type: "string|boolean|string[]", spacer: "=" },
  "seed": { type: "number", spacer: " " },
  "unstable": { type: "boolean" },
  "v8-flags": { type: "string|string[]", spacer: "=" },
};

export { optionsDefinitions };


================================================
FILE: src/deno_options/parse.ts
================================================
import { validateOptions } from "./validate.ts";
import { buildDenoCLIOptionsArgs, CLIArgument } from "./build_cli_arguments.ts";
import { WorkspaceGlobal, WorkspaceScript } from "../interfaces.ts";

function parseDenoOptions(
  workspaceGlobal: WorkspaceGlobal,
  workspaceScript: WorkspaceScript,
): CLIArgument[] {
  const denoGlobalOptions = workspaceGlobal?.deno_options;
  const denoScriptOptions = workspaceScript?.deno_options;

  const options = {
    ...denoGlobalOptions,
    ...denoScriptOptions,
  };

  validateOptions(options);

  return buildDenoCLIOptionsArgs(options);
}

export { parseDenoOptions };


================================================
FILE: src/deno_options/utils.ts
================================================
import { DenoOptionValue } from "../interfaces.ts";

type TypeOfValues =
  | "string"
  | "number"
  | "bigint"
  | "boolean"
  | "symbol"
  | "undefined"
  | "object"
  | "function";
type OptionTypeValues = TypeOfValues | "string[]" | "mixed[]";

function getOptionType(value: DenoOptionValue): OptionTypeValues {
  if (Array.isArray(value)) {
    if (_isStringNumberArray(value)) {
      return "string[]";
    }

    return "mixed[]";
  }

  return typeof value;
}

function _isStringNumberArray(value: unknown[]): boolean {
  return value.reduce((accumulator: boolean, currentValue) => {
    return accumulator && _typeoffNumberAsString(currentValue) === "string";
  }, true);
}

function _typeoffNumberAsString(value: unknown): TypeOfValues {
  if (typeof value === "number") {
    return "string";
  }

  return typeof value;
}

export { getOptionType };

export type { OptionTypeValues };


================================================
FILE: src/deno_options/validate.ts
================================================
import { optionsDefinitions } from "./const.ts";
import {
  DenoOptionNotRecognized,
  DenoOptionIncorrectType,
} from "../utils/DenoXErrors.ts";
import { getOptionType } from "./utils.ts";
import { DenoOptionsEntries } from "../interfaces.ts";

function validateOptions(options: DenoOptionsEntries): void {
  for (const [optionName, optionValue] of Object.entries(options)) {
    _isOptionValid(optionName);
    _isOptionTypeValid(optionName, optionValue);
  }
}

function _isOptionValid(optionName: string): void {
  if (optionsDefinitions.hasOwnProperty(optionName) === false) {
    throw new DenoOptionNotRecognized(optionName);
  }
}

function _isOptionTypeValid(optionName: string, optionValue: unknown): void {
  const optionType = getOptionType(optionValue);

  const optionDefinition = optionsDefinitions[optionName];
  const optionDefinitionAllowedTypes = optionDefinition.type.split("|");

  if (optionDefinitionAllowedTypes.includes(optionType) === false) {
    throw new DenoOptionIncorrectType(
      optionName,
      optionDefinition.type,
      optionType,
    );
  }
}
export { validateOptions };


================================================
FILE: src/interfaces.ts
================================================
type DenoOptionValue = unknown;

type DenoOptionsEntries = {
  [key: string]: DenoOptionValue;
};

type WorkspaceOptions = {
  deno_options?: DenoOptionsEntries;
};

type WorkspaceScript = {
  file: string;
} & WorkspaceOptions;

type WorkspaceGlobal = WorkspaceOptions;

type DenoWorkspace = {
  scripts: {
    [key: string]: WorkspaceScript;
  };
  globals?: WorkspaceGlobal;
};

export type {
  DenoWorkspace,
  WorkspaceGlobal,
  WorkspaceScript,
  WorkspaceOptions,
  DenoOptionsEntries,
  DenoOptionValue,
};


================================================
FILE: src/lib/semver.ts
================================================
/* eslint-disable */
const regex =
  /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;

export function semver(version: string): Semver | undefined {
  try {
    return new Semver(version);
  } catch {
    return;
  }
}

export class Semver {
  version: string;
  major: number;
  minor: number;
  patch: number;
  prerelease?: string;
  buildmetadata?: string;

  constructor(version: string) {
    const m = version.match(regex);
    if (m === null) {
      throw new Error("Not valid semver");
    }
    const [_, major, minor, patch, prerelease, buildmetadata] = m!;
    this.version = version;
    this.major = parseInt(major)!;
    this.minor = parseInt(minor)!;
    this.patch = parseInt(patch)!;
    this.prerelease = prerelease;
    this.buildmetadata = buildmetadata;
  }

  caret(other: Semver): boolean {
    return this.major === other.major;
  }

  eq(other: Semver): boolean {
    return this.version == other.version;
  }

  lt(other: Semver): boolean {
    if (this.major < other.major) return true;
    if (this.major > other.major) return false;

    if (this.minor < other.minor) return true;
    if (this.minor > other.minor) return false;

    if (this.patch < other.patch) return true;
    if (this.patch > other.patch) return false;

    // This is clearly wrong...
    if (this.prerelease === undefined) return false;
    if (other.prerelease === undefined) return false;
    if (this.prerelease < other.prerelease) return true;
    if (this.prerelease > other.prerelease) return false;

    if (this.buildmetadata === undefined) return false;
    if (other.buildmetadata === undefined) return false;
    if (this.buildmetadata < other.buildmetadata) return true;
    if (this.buildmetadata > other.buildmetadata) return false;

    return false;
  }

  tilde(other: Semver): boolean {
    if (this.major !== other.major) return false;
    if (this.major === 0 && other.major === 0) return true;

    if (this.minor === other.minor) return true;
    // we're not supporting prerelease and buildmetadata?
    return false;
  }

  _(token: string, other: Semver): boolean {
    switch (token) {
      case "~":
        return this.tilde(other);
      case "^":
        return this.caret(other);
      case "<":
        return this.lt(other);
      // the rest of these are superfluous...
      case "<=":
        return this.eq(other) || this.lt(other);
      case ">":
        return !(this.eq(other) || this.lt(other));
      case ">=":
        return !this.lt(other);
      case "=":
        return this.eq(other);
      default:
        throw new Error(`modifier token not recognized: ${token}`);
    }
  }
}

export function fragment(
  url: string,
  version: string,
):
  | ((other: Semver) => boolean)
  | undefined {
  const tokens = /^(~|\^|<|<=|>|>=|=)\s*(.*?)$/;
  const f = url.split("#")[1];
  if (f === undefined) return;
  const m = f.trim().match(tokens);
  if (m === null) throw new SyntaxError(`invalid semver fragment: ${f}`);
  const [_, t, v] = m;
  try {
    const s = new Semver(v || version);
    // we have to reverse this due to the way fragments work...
    return (other: Semver) => other._(t, s);
  } catch (e) {
    throw new SyntaxError(`invalid semver version: ${v || version}`);
  }
}


================================================
FILE: src/lib/upgrade_version.ts
================================================
import { Semver } from "./semver.ts";

async function getLatestVersion(repoName: string): Promise<string> {
  const response = await fetch(`https://api.github.com/repos/${repoName}/tags`);
  const data = await response.json();
  return data[0].name;
}

function isCurrentLatestVersion(
  currentVersion: string,
  latestVersion: string,
): boolean {
  return new Semver(currentVersion)._(">=", new Semver(latestVersion));
}

async function upgradeVersionMessage(
  currentVersion: string,
  repoName: string,
): Promise<void> {
  try {
    const latestVersion = await getLatestVersion(repoName);

    if (!isCurrentLatestVersion(currentVersion, latestVersion)) {
      console.log(`
        denox update available from ${currentVersion} to ${latestVersion}
        To upgrade run deno install -Af -n denox https://denopkg.com/BentoumiTech/denox/denox.ts
      `);
    }
  } catch (error) {
    // continue regardless of error
  }
}

export { upgradeVersionMessage };


================================================
FILE: src/parser/__tests__/deno_workspace.test.ts
================================================
import {
  assertEquals,
  assertThrowsAsync,
} from "../../../dev_deps.ts";
import { loadDenoWorkspace } from "../deno_workspace.ts";
import {
  WorkspaceNotFoundError,
  WorkspaceFileIsMalformed,
} from "../../utils/DenoXErrors.ts";
import { changeAndRestoreCWD } from "../../../test/utils/cwd.ts";

Deno.test("throw WorkspaceNotFoundError when workspace file doesn't exist", async () => {
  await changeAndRestoreCWD("test/fixture/no_workspace", async () => {
    await assertThrowsAsync(async () => {
      await loadDenoWorkspace();
    }, WorkspaceNotFoundError);
  });
});

Deno.test("throw WorkspaceMalformed when yaml workspace file is not valid", async () => {
  await changeAndRestoreCWD("test/fixture/malformed_yaml", async () => {
    await assertThrowsAsync(async () => {
      await loadDenoWorkspace();
    }, WorkspaceFileIsMalformed);
  });
});

Deno.test("throw WorkspaceMalformed when json workspace file is not valid", async () => {
  await changeAndRestoreCWD("test/fixture/malformed_json", async () => {
    await assertThrowsAsync(async () => {
      await loadDenoWorkspace();
    }, WorkspaceFileIsMalformed);
  });
});

Deno.test("throw WorkspaceMalformed when ts workspace file is not valid", async () => {
  await changeAndRestoreCWD("test/fixture/malformed_ts", async () => {
    await assertThrowsAsync(async () => {
      await loadDenoWorkspace();
    }, WorkspaceFileIsMalformed);
  });
});

Deno.test("load valid workspaces with correct order of priority", async () => {
  const files = [
    "deno-workspace.yml",
    "deno-workspace",
    "deno-workspace.yaml",
    ".deno-workspace",
    ".deno-workspace.yml",
    ".deno-workspace.yaml",
    "deno-workspace.json",
    ".deno-workspace.json",
    "deno-workspace.ts",
    ".deno-workspace.ts",
  ];

  for (const file of files) {
    await changeAndRestoreCWD(
      `test/fixture/workspace_multiple_names/${file}`,
      async () => {
        assertEquals(await loadDenoWorkspace(), {
          scripts: {
            start: { file: `${file}.ts`, deno_options: { reload: true } },
          },
          globals: { deno_options: { "allow-read": ["./files"] } },
        });
      },
    );
  }
});


================================================
FILE: src/parser/deno_workspace.ts
================================================
import { parseYaml, YAMLError, extname } from "../../deps.ts";

import { DENO_WORKSPACE_FILES } from "../const.ts";
import { DenoWorkspace } from "../interfaces.ts";

import { getFirstExistingPath, getFileContent } from "../utils/file.ts";
import {
  WorkspaceNotFoundError,
  WorkspaceFileIsMalformed,
} from "../utils/DenoXErrors.ts";

async function loadDenoWorkspace(): Promise<DenoWorkspace> {
  try {
    const denoWorkspaceFilePath = await getFirstExistingPath(
      DENO_WORKSPACE_FILES,
    );

    if (extname(denoWorkspaceFilePath) === ".ts") {
      return await _loadTSWorkspace("file:///" + denoWorkspaceFilePath);
    }

    return await _loadYAMLWorkspace(denoWorkspaceFilePath) as DenoWorkspace;
  } catch (e) {
    throw _handleLoadDenoWorkspaceErrors(e);
  }
}

async function _loadTSWorkspace(
  denoWorkspaceFilePath: string,
): Promise<DenoWorkspace> {
  const { workspace } = await import(denoWorkspaceFilePath) as {
    workspace: DenoWorkspace;
  };
  return workspace;
}

async function _loadYAMLWorkspace(
  denoWorkspaceFilePath: string,
): Promise<DenoWorkspace> {
  const denoWorkspaceFileContent = await getFileContent(
    denoWorkspaceFilePath,
  );
  return parseYaml(denoWorkspaceFileContent) as DenoWorkspace;
}

function _handleLoadDenoWorkspaceErrors(e: unknown): Error {
  if (e instanceof Deno.errors.NotFound) {
    return new WorkspaceNotFoundError();
  }

  if (
    e instanceof YAMLError || e instanceof ReferenceError ||
    e instanceof TypeError
  ) {
    return new WorkspaceFileIsMalformed(e.message);
  }

  return e as Error;
}

export { loadDenoWorkspace };


================================================
FILE: src/run.ts
================================================
import { CURRENT_VERSION, GITHUB_REPO_NAME } from "./const.ts";

import * as consolex from "./utils/consolex.ts";
import { ScriptNotFoundError } from "./utils/DenoXErrors.ts";

import { upgradeVersionMessage } from "./lib/upgrade_version.ts";

import { loadDenoWorkspace } from "./parser/deno_workspace.ts";
import { parseDenoOptions } from "./deno_options/parse.ts";
import { CLIArgument } from "./deno_options/build_cli_arguments.ts";
import { WorkspaceOptions, WorkspaceScript } from "./interfaces.ts";

async function run(scriptName: string): Promise<void> {
  try {
    const args = Deno.args.slice(2);
    const { code } = await _runScript(scriptName, args);

    await upgradeVersionMessage(CURRENT_VERSION, GITHUB_REPO_NAME);

    Deno.exit(code);
  } catch (e) {
    if (e instanceof Deno.errors.PermissionDenied) {
      consolex.error(`
        Please reinstall denox with the correct permissions
        deno install -Af -n denox https://denopkg.com/BentoumiTech/denox/denox.ts
      `);
    } else {
      consolex.error(e.message);
    }
  }
}

async function _runScript(
  scriptName: string,
  args: string[],
): Promise<{ code: number }> {
  const workspace = await loadDenoWorkspace();

  const workspaceScript = workspace.scripts[scriptName];
  const workspaceGlobal = workspace?.globals || {};

  if (workspaceScript === undefined) {
    throw new ScriptNotFoundError(scriptName);
  }

  return await _runDenoFile(workspaceScript, workspaceGlobal, args);
}

async function _runDenoFile(
  workspaceScript: WorkspaceScript,
  workspaceGlobal: WorkspaceOptions,
  args: string[],
): Promise<{ code: number }> {
  const denoOptions = await _getDenoOptions(workspaceScript, workspaceGlobal);
  const process = Deno.run({
    // ToDO: remove '@ts-ignore' (and eslint directive) when vscode_deno is fixed to work with @deno_types; ref: <https://github.com/cacjs/cac/issues/75> , <https://github.com/denoland/vscode_deno/issues/21>
    /* eslint @typescript-eslint/ban-ts-comment: "off" */
    // deno-lint-ignore ban-ts-comment
    // @ts-ignore
    cmd: [
      "deno",
      "run",
      ...denoOptions,
      workspaceScript.file,
      ...args,
    ],
  });
  const { code } = await process.status();

  return { code };
}

async function _getDenoOptions(
  workspaceScript: WorkspaceScript,
  workspaceGlobal: WorkspaceOptions,
): Promise<CLIArgument[]> {
  return parseDenoOptions(
    workspaceGlobal,
    workspaceScript,
  );
}

export default run;


================================================
FILE: src/utils/DenoXErrors.ts
================================================
class DenoXError extends Error {
  constructor(message: string) {
    super(message);
    this.name = this.constructor.name;
  }
}

class WorkspaceNotFoundError extends DenoXError {
  constructor() {
    super(`
      deno-workspace file not found in "${Deno.cwd()}"
      Run "denox init" in your project root directory.
    `);
  }
}

class ScriptNotFoundError extends DenoXError {
  constructor(script: string) {
    super(
      `Script "${script}" not found please add it to your deno-workspace file`,
    );
  }
}

class WorkspaceFileIsMalformed extends DenoXError {
  constructor(parserMessage: string) {
    super(`
      deno-workspace file is not valid

      ${parserMessage}
    `);
  }
}

class DenoOptionNotRecognized extends DenoXError {
  constructor(option: string) {
    super(`
      The option: "${option}" in deno-workspace file is not valid.
      For a list of valid options enter "deno run --help"
    `);
  }
}

class DenoOptionIncorrectType extends DenoXError {
  constructor(
    optionName: string,
    optionDefinitionType: string,
    optionType: string,
  ) {
    super(`
      The option: "${optionName}" in deno-workspace type is not valid.
      Currently it's "${optionType}" but only "${optionDefinitionType}" is/are valid
    `);
  }
}

export {
  ScriptNotFoundError,
  WorkspaceNotFoundError,
  WorkspaceFileIsMalformed,
  DenoOptionNotRecognized,
  DenoOptionIncorrectType,
};


================================================
FILE: src/utils/__tests__/file.test.ts
================================================
import {
  assertEquals,
  assertThrowsAsync,
  resolve,
  assertStrContains,
} from "../../../dev_deps.ts";
import { getFileContent, getFirstExistingPath, exists } from "../file.ts";

Deno.test("read file", async () => {
  const fileContent = await getFileContent(
    "./src/utils/__tests__/fixture/file.txt",
  );

  assertStrContains(
    fileContent,
    "test file content",
  );
});

Deno.test("throw error if file doesn't exist", async () => {
  await assertThrowsAsync(async () => {
    await getFileContent("./src/utils/__tests__/fixture/no-found.txt");
  }, Deno.errors.NotFound);
});

Deno.test("return first existing path", async () => {
  const firstExistingPath = await getFirstExistingPath([
    "./src/utils/__tests__/fixture/list-files/first.txt",
    "./src/utils/__tests__/fixture/list-files/second.txt",
    "./src/utils/__tests__/fixture/list-files/third.txt",
  ]);

  assertEquals(
    firstExistingPath,
    resolve("./src/utils/__tests__/fixture/list-files/second.txt"),
  );
});

Deno.test("throw error if no file in list exist", async () => {
  await assertThrowsAsync(async () => {
    await getFirstExistingPath([
      "./src/utils/__tests__/fixture/list-files/fourth.txt",
      "./src/utils/__tests__/fixture/list-files/fifth.txt",
      "./src/utils/__tests__/fixture/list-files/sixth.txt",
    ]);
  }, Deno.errors.NotFound);
});

Deno.test("return true if file exist", async () => {
  const fileExist = await exists("./src/utils/__tests__/fixture/file.txt");

  assertEquals(
    fileExist,
    true,
  );
});

Deno.test("return false if file is not found", async () => {
  const fileExist = await exists(
    "./src/utils/__tests__/fixture/file-not-found.txt",
  );

  assertEquals(
    fileExist,
    false,
  );
});


================================================
FILE: src/utils/__tests__/fixture/file.txt
================================================
test file content


================================================
FILE: src/utils/__tests__/fixture/list-files/second.txt
================================================


================================================
FILE: src/utils/__tests__/fixture/list-files/third.txt
================================================


================================================
FILE: src/utils/consolex.ts
================================================
import { red } from "../../deps.ts";

function error(msg: string): void {
  console.error(`${red("error")} ${msg}`);
  Deno.exit(1);
}

export { error };


================================================
FILE: src/utils/file.ts
================================================
import { resolve } from "../../deps.ts";

async function getFileContent(
  filePath: string,
): Promise<string> {
  const fileBytes = await Deno.readFile(filePath);
  const decoder = new TextDecoder("utf-8");
  return decoder.decode(fileBytes);
}

async function getFirstExistingPath(
  files: string[],
): Promise<string> {
  const [firstFile, ...restFiles] = files;
  const firstFileFullPath = resolve(firstFile);
  const isfirstFileFullPathExist = await exists(firstFileFullPath);

  if (isfirstFileFullPathExist) {
    return firstFileFullPath;
  }

  if (restFiles.length > 0) {
    return await getFirstExistingPath(restFiles);
  }

  throw new Deno.errors.NotFound();
}

async function exists(filename: string): Promise<boolean> {
  try {
    await Deno.stat(filename);
    return true;
  } catch (error) {
    if (error instanceof Deno.errors.NotFound) {
      return false;
    }

    throw error;
  }
}

export { getFirstExistingPath, getFileContent, exists };


================================================
FILE: test/e2e/args.test.ts
================================================
import { testDenoXRun } from "../utils/denox-run.ts";
import { assertEquals } from "../../dev_deps.ts";

Deno.test("Args are passed to the denox script", async () => {
  const args = {
    parsed: {
      _: ["first", "second", "third"],
      s: "value",
      full: "value",
      "--": ["--test=arg", "fourth", "fifth"],
    },
    "raw": [
      "first",
      "second",
      "third",
      "-s=value",
      "--full=value",
      "--",
      "--test=arg",
      "fourth",
      "fifth",
    ],
  };

  await testDenoXRun(
    "start",
    "test/fixture/args",
    async ({ code, output }) => {
      assertEquals(code, 0);
      assertEquals(JSON.parse(output), args);
    },
    "first second third -s=value --full=value -- --test=arg fourth fifth".split(
      " ",
    ),
  );
});


================================================
FILE: test/e2e/deno_options/options.test.ts
================================================
import {
  assertEquals,
  assertStrContains,
  resolve,
  stripColor,
  join,
} from "../../../dev_deps.ts";
import { testDenoXRun } from "../../utils/denox-run.ts";
import { exists } from "../../../src/utils/file.ts";

Deno.test("permissions are applied", async () => {
  await testDenoXRun(
    "permissions",
    "test/fixture/deno_options",
    async ({ output, code }) => {
      assertEquals(code, 0);

      output = stripColor(output);
      assertStrContains(
        output,
        'allow-env: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-hrtime: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-net: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-plugin: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-read: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-run: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-write: PermissionStatus { state: "granted" }',
      );
    },
  );
});

Deno.test("allow-all permissions are applied", async () => {
  await testDenoXRun(
    "all-permissions",
    "test/fixture/deno_options",
    async ({ output, code }) => {
      assertEquals(code, 0);

      output = stripColor(output);
      assertStrContains(
        output,
        'allow-env: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-hrtime: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-net: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-plugin: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-read: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-run: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-write: PermissionStatus { state: "granted" }',
      );
    },
  );
});

Deno.test("false permissions are applied", async () => {
  await testDenoXRun(
    "false-permissions",
    "test/fixture/deno_options",
    async ({ output, code }) => {
      assertEquals(code, 0);

      output = stripColor(output);
      assertStrContains(
        output,
        'allow-env: PermissionStatus { state: "prompt" }',
      );
      assertStrContains(
        output,
        'allow-hrtime: PermissionStatus { state: "prompt" }',
      );
      assertStrContains(
        output,
        'allow-net: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-plugin: PermissionStatus { state: "prompt" }',
      );
      assertStrContains(
        output,
        'allow-read: PermissionStatus { state: "granted" }',
      );
      assertStrContains(
        output,
        'allow-run: PermissionStatus { state: "prompt" }',
      );
      assertStrContains(
        output,
        'allow-write: PermissionStatus { state: "granted" }',
      );
    },
  );
});

Deno.test("seed option is applied", async () => {
  await testDenoXRun(
    "seed",
    "test/fixture/deno_options",
    async ({ output, code }) => {
      assertEquals(code, 0);
      output = stripColor(output);
      assertStrContains(output, "seed: 0.147205063401058");
    },
  );
});

Deno.test("quiet option is applied", async () => {
  await testDenoXRun(
    "quiet",
    "test/fixture/deno_options",
    async ({ output, code }) => {
      assertEquals(code, 0);
      output = stripColor(output);
      assertStrContains(output, "Only console.log\n");
    },
  );
});

Deno.test("lock option is applied", async () => {
  await testDenoXRun("lock", "test/fixture/deno_options", async ({ code }) => {
    const lockFilePath = resolve("../../fixture/deno_options/files/lock.json");
    const isLockFilePresent = await exists(lockFilePath);

    assertEquals(code, 0);
    assertEquals(isLockFilePresent, true);

    await Deno.remove(lockFilePath);
  });
});

Deno.test("log-level option is applied", async () => {
  await testDenoXRun(
    "log-level",
    "test/fixture/deno_options",
    async ({ code, output }) => {
      assertEquals(code, 0);
      output = stripColor(output);
      assertStrContains(output, "DEBUG JS");
    },
  );
});

Deno.test("config option is applied", async () => {
  await testDenoXRun(
    "config",
    "test/fixture/deno_options",
    async ({ code, output }) => {
      assertEquals(code, 0);
      output = stripColor(output);
      assertStrContains(output, "tsconfig.json");
    },
  );
});

Deno.test("import map option is applied", async () => {
  await testDenoXRun(
    "import-map",
    "test/fixture/deno_options",
    async ({ code, errOutput }) => {
      assertEquals(code, 0);
      errOutput = stripColor(errOutput);
      assertStrContains(
        errOutput,
        'ModuleSpecifier("https://deno.land/std/http/"',
      );
    },
  );
});

Deno.test("v8-flags, cached-only, cert, no-remote, reload options do not crash", async () => {
  await testDenoXRun(
    "rest-options",
    "test/fixture/deno_options",
    async ({ code }) => {
      assertEquals(code, 0);
    },
  );
});


================================================
FILE: test/e2e/deno_options/scoped_global.test.ts
================================================
import {
  assertEquals,
  assertStrContains,
  stripColor,
} from "../../../dev_deps.ts";
import { testDenoXRun } from "../../utils/denox-run.ts";

Deno.test("run script with scoped options", async () => {
  await testDenoXRun(
    "start",
    "test/fixture/script_permission",
    async ({ code, output }) => {
      assertEquals(code, 0);
      output = stripColor(output);
      assertStrContains(output, "I'm text file content");
    },
  );
});

Deno.test("run script with global options", async () => {
  await testDenoXRun(
    "start",
    "test/fixture/global_permission",
    async ({ code, output }) => {
      assertEquals(code, 0);
      output = stripColor(output);
      assertStrContains(output, "I'm text file content");
    },
  );
});

Deno.test("run script with scoped and global options", async () => {
  await testDenoXRun(
    "start",
    "test/fixture/script_global_permission",
    async ({ code, output }) => {
      assertEquals(code, 0);
      output = stripColor(output);
      assertStrContains(output, "I'm text file content");
      assertStrContains(output, "seed: 0.147205063401058");
    },
  );
});

Deno.test("run script with erroneous merged scoped and global options", async () => {
  await testDenoXRun(
    "start",
    "test/fixture/merged_scoped_global__invalid_permission",
    async ({ code, errOutput }) => {
      assertEquals(code, 1);
      errOutput = stripColor(errOutput);
      assertStrContains(
        errOutput,
        'Uncaught PermissionDenied: network access to "https://jsonplaceho',
      );
    },
  );
});


================================================
FILE: test/e2e/scripts.test.ts
================================================
import { assertEquals, assertStrContains } from "../../dev_deps.ts";
import { testDenoXRun } from "../utils/denox-run.ts";

Deno.test("Return an error when script doesn't exist", async () => {
  await testDenoXRun(
    "not-found-script",
    "test/fixture/single_script",
    async ({ code, errOutput }) => {
      assertEquals(code, 1);
      assertStrContains(errOutput, '"not-found-script" not found');
    },
  );
});

Deno.test("execute existing script", async () => {
  await testDenoXRun(
    "start",
    "test/fixture/single_script",
    async ({ code, output }) => {
      assertEquals(code, 0);
      assertStrContains(output, "Hello World!");
    },
  );
});

Deno.test("execute existing script when multiple are specified", async () => {
  await testDenoXRun(
    "develop",
    "test/fixture/multiple_scripts",
    async ({ code, output }) => {
      assertEquals(code, 0);
      assertStrContains(output, "Hello World Develop!");
    },
  );
});


================================================
FILE: test/fixture/args/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "main.ts",
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/args/main.ts
================================================
import { parse } from "https://deno.land/std/flags/mod.ts";

console.log(JSON.stringify({
  parsed: parse(Deno.args, { "--": true }),
  raw: Deno.args,
}));


================================================
FILE: test/fixture/deno_options/deno-workspace.yml
================================================
scripts:
  permissions:
    file: permissions.ts
    deno_options:
      allow-env: true
      allow-hrtime: true
      allow-net: google.com
      allow-plugin: true
      allow-read: ./files
      allow-run: true
      allow-write: ./files
      unstable: true
  all-permissions:
    file: permissions.ts
    deno_options:
      allow-all: true
      unstable: true
  false-permissions:
    file: permissions.ts
    deno_options:
      allow-env: false
      allow-hrtime: false
      allow-net: google.com
      allow-plugin: false
      allow-read: ./files
      allow-run: false
      allow-write: ./files
      unstable: true
  seed:
    file: seed.ts
    deno_options:
      seed: 1
  quiet:
    file: quiet.ts
    deno_options:
      log-level: debug
      quiet: true
  lock:
    file: main.ts
    deno_options:
      lock: ./files/lock.json
      lock-write: true
  log-level:
    file: main.ts
    deno_options:
      log-level: debug
  config:
    file: main.ts
    deno_options:
      config: ./files/tsconfig.json
      log-level: debug
  import-map:
    file: main.ts
    deno_options:
      importmap: files/import_map.json
      log-level: debug
      unstable: true
  rest-options:
    file: main.ts
    deno_options:
      v8-flags:
        - --regexp-tier-up
        - --adjust-os-scheduling-parameters true
      cached-only: true
      cert: ./files/test.cer
      no-remote: true
      reload: true



================================================
FILE: test/fixture/deno_options/files/import_map.json
================================================
{
  "imports": {
     "http/": "https://deno.land/std/http/"
  }
}


================================================
FILE: test/fixture/deno_options/files/test.cer
================================================


================================================
FILE: test/fixture/deno_options/files/test.txt
================================================


================================================
FILE: test/fixture/deno_options/files/tsconfig.json
================================================
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}


================================================
FILE: test/fixture/deno_options/main.ts
================================================


================================================
FILE: test/fixture/deno_options/permissions.ts
================================================
console.log("allow-env:", await Deno.permissions.query({ name: "env" }));
console.log("allow-hrtime:", await Deno.permissions.query({ name: "hrtime" }));
console.log(
  "allow-net:",
  await Deno.permissions.query({ name: "net", url: "https://google.com" }),
);
console.log("allow-plugin:", await Deno.permissions.query({ name: "plugin" }));
console.log(
  "allow-read:",
  await Deno.permissions.query({ name: "read", path: "./files" }),
);
console.log("allow-run:", await Deno.permissions.query({ name: "run" }));
console.log(
  "allow-write:",
  await Deno.permissions.query({ name: "write", path: "./files" }),
);


================================================
FILE: test/fixture/deno_options/quiet.ts
================================================
console.log("Only console.log");


================================================
FILE: test/fixture/deno_options/seed.ts
================================================
console.log("seed:", Math.random());


================================================
FILE: test/fixture/global_permission/deno-workspace
================================================
scripts:
  start:
    file: main.ts
globals:
  deno_options:
    allow-read:
      - './files'


================================================
FILE: test/fixture/global_permission/files/test.txt
================================================
I'm text file content


================================================
FILE: test/fixture/global_permission/main.ts
================================================
const data = Deno.readFileSync("./files/test.txt");
const decoder = new TextDecoder("utf-8");

console.log(decoder.decode(data));


================================================
FILE: test/fixture/malformed_json/deno-workspace.json
================================================
{
  test,



================================================
FILE: test/fixture/malformed_ts/deno-workspace.ts
================================================
malformedts;


================================================
FILE: test/fixture/malformed_yaml/deno-workspace
================================================
maleformed/yaml: invalid:


================================================
FILE: test/fixture/merged_scoped_global__invalid_permission/deno-workspace
================================================
scripts:
  start:
    file: main.ts
    deno_options:
      allow-net: false
globals:
  deno_options:
    allow-read:
      - './files'
    allow-net: jsonplaceholder.typicode.com


================================================
FILE: test/fixture/merged_scoped_global__invalid_permission/files/test.txt
================================================
I'm text file content


================================================
FILE: test/fixture/merged_scoped_global__invalid_permission/main.ts
================================================
const data = Deno.readFileSync("./files/test.txt");
const decoder = new TextDecoder("utf-8");

console.log(decoder.decode(data));

const response = await fetch("https://jsonplaceholder.typicode.com/todos/1");
const json = await response.json();
console.log(json);


================================================
FILE: test/fixture/multiple_scripts/deno-workspace
================================================
scripts:
  start:
    file: main.ts
  develop:
    file: develop.ts



================================================
FILE: test/fixture/multiple_scripts/develop.ts
================================================
console.log("Hello World Develop!");


================================================
FILE: test/fixture/multiple_scripts/main.ts
================================================
console.log("Hello World!");


================================================
FILE: test/fixture/no_workspace/.keep
================================================


================================================
FILE: test/fixture/script_global_permission/deno-workspace
================================================
scripts:
  start:
    file: main.ts
    deno_options:
      seed: 1
globals:
  deno_options:
    allow-read:
      - './files'


================================================
FILE: test/fixture/script_global_permission/files/test.txt
================================================
I'm text file content


================================================
FILE: test/fixture/script_global_permission/main.ts
================================================
const data = Deno.readFileSync("./files/test.txt");
const decoder = new TextDecoder("utf-8");

console.log(decoder.decode(data));

console.log("seed:", Math.random());


================================================
FILE: test/fixture/script_permission/deno-workspace
================================================
scripts:
  start:
    file: main.ts
    deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/script_permission/files/test.txt
================================================
I'm text file content


================================================
FILE: test/fixture/script_permission/main.ts
================================================
const data = Deno.readFileSync("./files/test.txt");
const decoder = new TextDecoder("utf-8");

console.log(decoder.decode(data));


================================================
FILE: test/fixture/single_script/deno-workspace
================================================
scripts:
  start:
    file: main.ts



================================================
FILE: test/fixture/single_script/main.ts
================================================
console.log("Hello World!");


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace
================================================
scripts:
  start:
    file: .deno-workspace.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.yaml
================================================
scripts:
  start:
    file: .deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.yml
================================================
scripts:
  start:
    file: .deno-workspace.yml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace/deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": "deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.json/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.json/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.json/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.ts/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yaml/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yaml/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yaml/.deno-workspace.yaml
================================================
scripts:
  start:
    file: .deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yaml/deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": "deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yaml/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.yaml
================================================
scripts:
  start:
    file: .deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.yml
================================================
scripts:
  start:
    file: .deno-workspace.yml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yml/deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": "deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/.deno-workspace.yml/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace
================================================
scripts:
  start:
    file: .deno-workspace.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.yaml
================================================
scripts:
  start:
    file: .deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.yml
================================================
scripts:
  start:
    file: .deno-workspace.yml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/deno-workspace
================================================
scripts:
  start:
    file: deno-workspace.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": "deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace/deno-workspace.yaml
================================================
scripts:
  start:
    file: deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.json/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.json/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.json/deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": "deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.json/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.ts/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.ts/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace
================================================
scripts:
  start:
    file: .deno-workspace.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.yaml
================================================
scripts:
  start:
    file: .deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.yml
================================================
scripts:
  start:
    file: .deno-workspace.yml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": "deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yaml/deno-workspace.yaml
================================================
scripts:
  start:
    file: deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace
================================================
scripts:
  start:
    file: .deno-workspace.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": ".deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": ".deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.yaml
================================================
scripts:
  start:
    file: .deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.yml
================================================
scripts:
  start:
    file: .deno-workspace.yml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace
================================================
scripts:
  start:
    file: deno-workspace.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.json
================================================
{
	"scripts": {
		"start": {
			"file": "deno-workspace.json.ts",
			"deno_options": {
				"reload": true
			}
		}
	},
	"globals": {
		"deno_options": {
			"allow-read": [
				"./files"
			]
		}
	}
}


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.ts
================================================
import { DenoWorkspace } from "../../../../src/interfaces.ts";

const workspace: DenoWorkspace = {
  "scripts": {
    "start": {
      "file": "deno-workspace.ts.ts",
      "deno_options": {
        "reload": true,
      },
    },
  },
  "globals": {
    "deno_options": {
      "allow-read": [
        "./files",
      ],
    },
  },
};

export { workspace };


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.yaml
================================================
scripts:
  start:
    file: deno-workspace.yaml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.yml
================================================
scripts:
  start:
    file: deno-workspace.yml.ts
    deno_options:
      reload: true
globals:
  deno_options:
      allow-read:
        - './files'


================================================
FILE: test/utils/cwd.ts
================================================
import {
  resolve,
} from "../../dev_deps.ts";

async function changeAndRestoreCWD(
  directory: string,
  assertion: (denoxPath: string) => Promise<void>,
): Promise<void> {
  const cwd = Deno.cwd();
  const denoxPath = resolve("./denox.ts");
  Deno.chdir(resolve(directory));

  await assertion(denoxPath);

  Deno.chdir(cwd);
}

export { changeAndRestoreCWD };


================================================
FILE: test/utils/denox-run.ts
================================================
import { changeAndRestoreCWD } from "./cwd.ts";

type ProcessOutputs = { output: string; errOutput: string };

// eslint-disable-next-line max-params
async function testDenoXRun(
  scriptName: string,
  workspaceFolder: string,
  assertRunOutput: (
    denoxOutput: { output: string; errOutput: string; code: number },
  ) => Promise<void>,
  args: string[] = [],
): Promise<void> {
  await changeAndRestoreCWD(
    workspaceFolder,
    async (denoxPath) => {
      const process = _denoXRun(denoxPath, scriptName, args);
      const { output, errOutput } = await _getProcessOutputs(process);
      const { code } = await process.status();
      process.close();

      await assertRunOutput({ output, errOutput, code });
    },
  );
}

function _denoXRun(
  denoxPath: string,
  scriptName: string,
  args: string[],
): Deno.Process {
  return Deno.run({
    cmd: [
      "deno",
      "run",
      "-A",
      denoxPath,
      "run",
      scriptName,
      ...args,
    ],
    stdout: "piped",
    stderr: "piped",
  });
}

async function _getProcessOutputs(
  process: Deno.Process,
): Promise<ProcessOutputs> {
  const outputBuffer = await process.output();
  const errOutputBuffer = await process.stderrOutput();

  const output = new TextDecoder().decode(outputBuffer);
  const errOutput = new TextDecoder().decode(errOutputBuffer);

  return { output, errOutput };
}

export { testDenoXRun };
Download .txt
gitextract_ms61bagw/

├── .editorconfig
├── .eslintrc.js
├── .github/
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       └── ci.yml
├── .vscode/
│   └── denox.code-workspace
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── denox.ts
├── deps.ts
├── dev_deps.ts
├── example/
│   ├── deno-workspace
│   ├── files/
│   │   └── test.txt
│   └── main.ts
├── src/
│   ├── const.ts
│   ├── deno_options/
│   │   ├── __tests__/
│   │   │   ├── build_cli_arguments.test.ts
│   │   │   ├── parse.test.ts
│   │   │   ├── utils.test.ts
│   │   │   └── validate.test.ts
│   │   ├── build_cli_arguments.ts
│   │   ├── const.ts
│   │   ├── parse.ts
│   │   ├── utils.ts
│   │   └── validate.ts
│   ├── interfaces.ts
│   ├── lib/
│   │   ├── semver.ts
│   │   └── upgrade_version.ts
│   ├── parser/
│   │   ├── __tests__/
│   │   │   └── deno_workspace.test.ts
│   │   └── deno_workspace.ts
│   ├── run.ts
│   └── utils/
│       ├── DenoXErrors.ts
│       ├── __tests__/
│       │   ├── file.test.ts
│       │   └── fixture/
│       │       ├── file.txt
│       │       └── list-files/
│       │           ├── second.txt
│       │           └── third.txt
│       ├── consolex.ts
│       └── file.ts
└── test/
    ├── e2e/
    │   ├── args.test.ts
    │   ├── deno_options/
    │   │   ├── options.test.ts
    │   │   └── scoped_global.test.ts
    │   └── scripts.test.ts
    ├── fixture/
    │   ├── args/
    │   │   ├── deno-workspace.ts
    │   │   └── main.ts
    │   ├── deno_options/
    │   │   ├── deno-workspace.yml
    │   │   ├── files/
    │   │   │   ├── import_map.json
    │   │   │   ├── test.cer
    │   │   │   ├── test.txt
    │   │   │   └── tsconfig.json
    │   │   ├── main.ts
    │   │   ├── permissions.ts
    │   │   ├── quiet.ts
    │   │   └── seed.ts
    │   ├── global_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── malformed_json/
    │   │   └── deno-workspace.json
    │   ├── malformed_ts/
    │   │   └── deno-workspace.ts
    │   ├── malformed_yaml/
    │   │   └── deno-workspace
    │   ├── merged_scoped_global__invalid_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── multiple_scripts/
    │   │   ├── deno-workspace
    │   │   ├── develop.ts
    │   │   └── main.ts
    │   ├── no_workspace/
    │   │   └── .keep
    │   ├── script_global_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── script_permission/
    │   │   ├── deno-workspace
    │   │   ├── files/
    │   │   │   └── test.txt
    │   │   └── main.ts
    │   ├── single_script/
    │   │   ├── deno-workspace
    │   │   └── main.ts
    │   └── workspace_multiple_names/
    │       ├── .deno-workspace/
    │       │   ├── .deno-workspace
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── .deno-workspace.json/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   └── deno-workspace.ts
    │       ├── .deno-workspace.ts/
    │       │   └── .deno-workspace.ts
    │       ├── .deno-workspace.yaml/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── .deno-workspace.yml/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── deno-workspace/
    │       │   ├── .deno-workspace
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace
    │       │   ├── deno-workspace.json
    │       │   ├── deno-workspace.ts
    │       │   └── deno-workspace.yaml
    │       ├── deno-workspace.json/
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── deno-workspace.json
    │       │   └── deno-workspace.ts
    │       ├── deno-workspace.ts/
    │       │   ├── .deno-workspace.ts
    │       │   └── deno-workspace.ts
    │       ├── deno-workspace.yaml/
    │       │   ├── .deno-workspace
    │       │   ├── .deno-workspace.json
    │       │   ├── .deno-workspace.ts
    │       │   ├── .deno-workspace.yaml
    │       │   ├── .deno-workspace.yml
    │       │   ├── deno-workspace.json
    │       │   ├── deno-workspace.ts
    │       │   └── deno-workspace.yaml
    │       └── deno-workspace.yml/
    │           ├── .deno-workspace
    │           ├── .deno-workspace.json
    │           ├── .deno-workspace.ts
    │           ├── .deno-workspace.yaml
    │           ├── .deno-workspace.yml
    │           ├── deno-workspace
    │           ├── deno-workspace.json
    │           ├── deno-workspace.ts
    │           ├── deno-workspace.yaml
    │           └── deno-workspace.yml
    └── utils/
        ├── cwd.ts
        └── denox-run.ts
Download .txt
SYMBOL INDEX (66 symbols across 16 files)

FILE: src/const.ts
  constant CURRENT_VERSION (line 1) | const CURRENT_VERSION = "0.4.0";
  constant GITHUB_REPO_NAME (line 2) | const GITHUB_REPO_NAME = "BentoumiTech/denox";
  constant DENO_WORKSPACE_FILES (line 3) | const DENO_WORKSPACE_FILES = [

FILE: src/deno_options/build_cli_arguments.ts
  type CLIArgument (line 5) | type CLIArgument = string | number | [string, number];
  type hashCliArgType (line 6) | type hashCliArgType = { name: string; value: string | boolean | number };
  function buildDenoCLIOptionsArgs (line 8) | function buildDenoCLIOptionsArgs(
  function _hashToCLIArg (line 21) | function _hashToCLIArg(
  function _transformToCLIArguments (line 42) | function _transformToCLIArguments(
  function _transformToArgHash (line 60) | function _transformToArgHash(

FILE: src/deno_options/const.ts
  type OptionsDefinitionsType (line 1) | type OptionsDefinitionsType = {

FILE: src/deno_options/parse.ts
  function parseDenoOptions (line 5) | function parseDenoOptions(

FILE: src/deno_options/utils.ts
  type TypeOfValues (line 3) | type TypeOfValues =
  type OptionTypeValues (line 12) | type OptionTypeValues = TypeOfValues | "string[]" | "mixed[]";
  function getOptionType (line 14) | function getOptionType(value: DenoOptionValue): OptionTypeValues {
  function _isStringNumberArray (line 26) | function _isStringNumberArray(value: unknown[]): boolean {
  function _typeoffNumberAsString (line 32) | function _typeoffNumberAsString(value: unknown): TypeOfValues {

FILE: src/deno_options/validate.ts
  function validateOptions (line 9) | function validateOptions(options: DenoOptionsEntries): void {
  function _isOptionValid (line 16) | function _isOptionValid(optionName: string): void {
  function _isOptionTypeValid (line 22) | function _isOptionTypeValid(optionName: string, optionValue: unknown): v...

FILE: src/interfaces.ts
  type DenoOptionValue (line 1) | type DenoOptionValue = unknown;
  type DenoOptionsEntries (line 3) | type DenoOptionsEntries = {
  type WorkspaceOptions (line 7) | type WorkspaceOptions = {
  type WorkspaceScript (line 11) | type WorkspaceScript = {
  type WorkspaceGlobal (line 15) | type WorkspaceGlobal = WorkspaceOptions;
  type DenoWorkspace (line 17) | type DenoWorkspace = {

FILE: src/lib/semver.ts
  function semver (line 5) | function semver(version: string): Semver | undefined {
  class Semver (line 13) | class Semver {
    method constructor (line 21) | constructor(version: string) {
    method caret (line 35) | caret(other: Semver): boolean {
    method eq (line 39) | eq(other: Semver): boolean {
    method lt (line 43) | lt(other: Semver): boolean {
    method tilde (line 67) | tilde(other: Semver): boolean {
    method _ (line 76) | _(token: string, other: Semver): boolean {
  function fragment (line 99) | function fragment(

FILE: src/lib/upgrade_version.ts
  function getLatestVersion (line 3) | async function getLatestVersion(repoName: string): Promise<string> {
  function isCurrentLatestVersion (line 9) | function isCurrentLatestVersion(
  function upgradeVersionMessage (line 16) | async function upgradeVersionMessage(

FILE: src/parser/deno_workspace.ts
  function loadDenoWorkspace (line 12) | async function loadDenoWorkspace(): Promise<DenoWorkspace> {
  function _loadTSWorkspace (line 28) | async function _loadTSWorkspace(
  function _loadYAMLWorkspace (line 37) | async function _loadYAMLWorkspace(
  function _handleLoadDenoWorkspaceErrors (line 46) | function _handleLoadDenoWorkspaceErrors(e: unknown): Error {

FILE: src/run.ts
  function run (line 13) | async function run(scriptName: string): Promise<void> {
  function _runScript (line 33) | async function _runScript(
  function _runDenoFile (line 49) | async function _runDenoFile(
  function _getDenoOptions (line 73) | async function _getDenoOptions(

FILE: src/utils/DenoXErrors.ts
  class DenoXError (line 1) | class DenoXError extends Error {
    method constructor (line 2) | constructor(message: string) {
  class WorkspaceNotFoundError (line 8) | class WorkspaceNotFoundError extends DenoXError {
    method constructor (line 9) | constructor() {
  class ScriptNotFoundError (line 17) | class ScriptNotFoundError extends DenoXError {
    method constructor (line 18) | constructor(script: string) {
  class WorkspaceFileIsMalformed (line 25) | class WorkspaceFileIsMalformed extends DenoXError {
    method constructor (line 26) | constructor(parserMessage: string) {
  class DenoOptionNotRecognized (line 35) | class DenoOptionNotRecognized extends DenoXError {
    method constructor (line 36) | constructor(option: string) {
  class DenoOptionIncorrectType (line 44) | class DenoOptionIncorrectType extends DenoXError {
    method constructor (line 45) | constructor(

FILE: src/utils/consolex.ts
  function error (line 3) | function error(msg: string): void {

FILE: src/utils/file.ts
  function getFileContent (line 3) | async function getFileContent(
  function getFirstExistingPath (line 11) | async function getFirstExistingPath(
  function exists (line 29) | async function exists(filename: string): Promise<boolean> {

FILE: test/utils/cwd.ts
  function changeAndRestoreCWD (line 5) | async function changeAndRestoreCWD(

FILE: test/utils/denox-run.ts
  type ProcessOutputs (line 3) | type ProcessOutputs = { output: string; errOutput: string };
  function testDenoXRun (line 6) | async function testDenoXRun(
  function _denoXRun (line 27) | function _denoXRun(
  function _getProcessOutputs (line 47) | async function _getProcessOutputs(
Condensed preview — 131 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (84K chars).
[
  {
    "path": ".editorconfig",
    "chars": 625,
    "preview": "# See http://editorconfig.org/\n# EditorConfig helps developers define and maintain consistent coding styles\n# between di"
  },
  {
    "path": ".eslintrc.js",
    "chars": 978,
    "preview": "module.exports = {\n  root: true,\n  parser: \"@typescript-eslint/parser\",\n  plugins: [\n    \"@typescript-eslint\",\n  ],\n  ru"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 314,
    "preview": "## Issue Type\n\n<!--\nKeep the one that applies and remove the others\ne.g. - Bug Report\n-->\n\n- Bug Report\n- Feature Reques"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 662,
    "preview": "## Description\nDescribe the big picture of your changes here to communicate to the maintainers why we should accept this"
  },
  {
    "path": ".github/workflows/ci.yml",
    "chars": 695,
    "preview": "name: CI\n\non: [push]\n\njobs:\n  build:\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix:\n        os: [ubuntu-lates"
  },
  {
    "path": ".vscode/denox.code-workspace",
    "chars": 87,
    "preview": "{\n\t\"folders\": [\n\t\t{\n\t\t\t\"path\": \"..\"\n\t\t}\n\t],\n\t\"settings\": {\n\t\t\"deno.enabled\": true\n\t}\n}\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 1477,
    "preview": "Contributing\n----------------------------------\n\n1. File an issue to notify the maintainers about what you're working on"
  },
  {
    "path": "LICENSE.md",
    "chars": 1076,
    "preview": "The MIT License\n\nCopyright (c) 2020 Khaled Bentoumi\n\nPermission is hereby granted, free of charge, to any person obtaini"
  },
  {
    "path": "README.md",
    "chars": 5661,
    "preview": "<h1 align=\"center\">\n  <br>\n  <a href=\"https://github.com/BentoumiTech/denox\" alt=\"DenoX\">\n    <img height=\"100%\" width=\""
  },
  {
    "path": "denox.ts",
    "chars": 948,
    "preview": "import { cac } from \"./deps.ts\";\n\nimport run from \"./src/run.ts\";\nimport { error } from \"./src/utils/consolex.ts\";\nimpor"
  },
  {
    "path": "deps.ts",
    "chars": 422,
    "preview": "export { parse as parseYaml } from \"https://deno.land/std@0.88.0/encoding/yaml.ts\";\nexport { YAMLError } from \"https://d"
  },
  {
    "path": "dev_deps.ts",
    "chars": 332,
    "preview": "export * from \"./deps.ts\";\n\nexport {\n  assertEquals,\n  assertArrayContains,\n  assertThrows,\n  assertStrContains,\n  asser"
  },
  {
    "path": "example/deno-workspace",
    "chars": 127,
    "preview": "scripts:\n  start:\n    file: main.ts\nglobals:\n  deno_options:\n    allow-read:\n      - './files'\n    seed: 1\n    reload: t"
  },
  {
    "path": "example/files/test.txt",
    "chars": 12,
    "preview": "Hello World\n"
  },
  {
    "path": "example/main.ts",
    "chars": 130,
    "preview": "const data = Deno.readFileSync(\"./files/test.txt\");\nconst decoder = new TextDecoder(\"utf-8\");\n\nconsole.log(decoder.decod"
  },
  {
    "path": "src/const.ts",
    "chars": 422,
    "preview": "const CURRENT_VERSION = \"0.4.0\";\nconst GITHUB_REPO_NAME = \"BentoumiTech/denox\";\nconst DENO_WORKSPACE_FILES = [\n  \"deno-w"
  },
  {
    "path": "src/deno_options/__tests__/build_cli_arguments.test.ts",
    "chars": 1376,
    "preview": "import { assertEquals, assertArrayContains } from \"../../../dev_deps.ts\";\nimport { buildDenoCLIOptionsArgs } from \"../bu"
  },
  {
    "path": "src/deno_options/__tests__/parse.test.ts",
    "chars": 1849,
    "preview": "import { assertEquals, assertThrows } from \"../../../dev_deps.ts\";\nimport { parseDenoOptions } from \"../parse.ts\";\nimpor"
  },
  {
    "path": "src/deno_options/__tests__/utils.test.ts",
    "chars": 1079,
    "preview": "import { assertEquals } from \"../../../dev_deps.ts\";\nimport { getOptionType } from \"../utils.ts\";\n\nDeno.test(\"string[]\","
  },
  {
    "path": "src/deno_options/__tests__/validate.test.ts",
    "chars": 822,
    "preview": "import { assertThrows } from \"../../../dev_deps.ts\";\nimport { validateOptions } from \"../validate.ts\";\nimport {\n  DenoOp"
  },
  {
    "path": "src/deno_options/build_cli_arguments.ts",
    "chars": 2051,
    "preview": "import { DenoOptionsEntries, DenoOptionValue } from \"../interfaces.ts\";\nimport { getOptionType, OptionTypeValues } from "
  },
  {
    "path": "src/deno_options/const.ts",
    "chars": 1222,
    "preview": "type OptionsDefinitionsType = {\n  [key: string]: { type: string; spacer?: string };\n};\n\nconst optionsDefinitions: Option"
  },
  {
    "path": "src/deno_options/parse.ts",
    "chars": 619,
    "preview": "import { validateOptions } from \"./validate.ts\";\nimport { buildDenoCLIOptionsArgs, CLIArgument } from \"./build_cli_argum"
  },
  {
    "path": "src/deno_options/utils.ts",
    "chars": 896,
    "preview": "import { DenoOptionValue } from \"../interfaces.ts\";\n\ntype TypeOfValues =\n  | \"string\"\n  | \"number\"\n  | \"bigint\"\n  | \"boo"
  },
  {
    "path": "src/deno_options/validate.ts",
    "chars": 1115,
    "preview": "import { optionsDefinitions } from \"./const.ts\";\nimport {\n  DenoOptionNotRecognized,\n  DenoOptionIncorrectType,\n} from \""
  },
  {
    "path": "src/interfaces.ts",
    "chars": 515,
    "preview": "type DenoOptionValue = unknown;\n\ntype DenoOptionsEntries = {\n  [key: string]: DenoOptionValue;\n};\n\ntype WorkspaceOptions"
  },
  {
    "path": "src/lib/semver.ts",
    "chars": 3377,
    "preview": "/* eslint-disable */\nconst regex =\n  /^v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA"
  },
  {
    "path": "src/lib/upgrade_version.ts",
    "chars": 967,
    "preview": "import { Semver } from \"./semver.ts\";\n\nasync function getLatestVersion(repoName: string): Promise<string> {\n  const resp"
  },
  {
    "path": "src/parser/__tests__/deno_workspace.test.ts",
    "chars": 2188,
    "preview": "import {\n  assertEquals,\n  assertThrowsAsync,\n} from \"../../../dev_deps.ts\";\nimport { loadDenoWorkspace } from \"../deno_"
  },
  {
    "path": "src/parser/deno_workspace.ts",
    "chars": 1612,
    "preview": "import { parseYaml, YAMLError, extname } from \"../../deps.ts\";\n\nimport { DENO_WORKSPACE_FILES } from \"../const.ts\";\nimpo"
  },
  {
    "path": "src/run.ts",
    "chars": 2472,
    "preview": "import { CURRENT_VERSION, GITHUB_REPO_NAME } from \"./const.ts\";\n\nimport * as consolex from \"./utils/consolex.ts\";\nimport"
  },
  {
    "path": "src/utils/DenoXErrors.ts",
    "chars": 1417,
    "preview": "class DenoXError extends Error {\n  constructor(message: string) {\n    super(message);\n    this.name = this.constructor.n"
  },
  {
    "path": "src/utils/__tests__/file.test.ts",
    "chars": 1755,
    "preview": "import {\n  assertEquals,\n  assertThrowsAsync,\n  resolve,\n  assertStrContains,\n} from \"../../../dev_deps.ts\";\nimport { ge"
  },
  {
    "path": "src/utils/__tests__/fixture/file.txt",
    "chars": 18,
    "preview": "test file content\n"
  },
  {
    "path": "src/utils/__tests__/fixture/list-files/second.txt",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/utils/__tests__/fixture/list-files/third.txt",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/utils/consolex.ts",
    "chars": 154,
    "preview": "import { red } from \"../../deps.ts\";\n\nfunction error(msg: string): void {\n  console.error(`${red(\"error\")} ${msg}`);\n  D"
  },
  {
    "path": "src/utils/file.ts",
    "chars": 971,
    "preview": "import { resolve } from \"../../deps.ts\";\n\nasync function getFileContent(\n  filePath: string,\n): Promise<string> {\n  cons"
  },
  {
    "path": "test/e2e/args.test.ts",
    "chars": 790,
    "preview": "import { testDenoXRun } from \"../utils/denox-run.ts\";\nimport { assertEquals } from \"../../dev_deps.ts\";\n\nDeno.test(\"Args"
  },
  {
    "path": "test/e2e/deno_options/options.test.ts",
    "chars": 5449,
    "preview": "import {\n  assertEquals,\n  assertStrContains,\n  resolve,\n  stripColor,\n  join,\n} from \"../../../dev_deps.ts\";\nimport { t"
  },
  {
    "path": "test/e2e/deno_options/scoped_global.test.ts",
    "chars": 1574,
    "preview": "import {\n  assertEquals,\n  assertStrContains,\n  stripColor,\n} from \"../../../dev_deps.ts\";\nimport { testDenoXRun } from "
  },
  {
    "path": "test/e2e/scripts.test.ts",
    "chars": 962,
    "preview": "import { assertEquals, assertStrContains } from \"../../dev_deps.ts\";\nimport { testDenoXRun } from \"../utils/denox-run.ts"
  },
  {
    "path": "test/fixture/args/deno-workspace.ts",
    "chars": 189,
    "preview": "import { DenoWorkspace } from \"../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"star"
  },
  {
    "path": "test/fixture/args/main.ts",
    "chars": 157,
    "preview": "import { parse } from \"https://deno.land/std/flags/mod.ts\";\n\nconsole.log(JSON.stringify({\n  parsed: parse(Deno.args, { \""
  },
  {
    "path": "test/fixture/deno_options/deno-workspace.yml",
    "chars": 1423,
    "preview": "scripts:\n  permissions:\n    file: permissions.ts\n    deno_options:\n      allow-env: true\n      allow-hrtime: true\n      "
  },
  {
    "path": "test/fixture/deno_options/files/import_map.json",
    "chars": 67,
    "preview": "{\n  \"imports\": {\n     \"http/\": \"https://deno.land/std/http/\"\n  }\n}\n"
  },
  {
    "path": "test/fixture/deno_options/files/test.cer",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/fixture/deno_options/files/test.txt",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/fixture/deno_options/files/tsconfig.json",
    "chars": 101,
    "preview": "{\n  \"compilerOptions\": {\n    \"experimentalDecorators\": true,\n    \"emitDecoratorMetadata\": true\n  }\n}\n"
  },
  {
    "path": "test/fixture/deno_options/main.ts",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/fixture/deno_options/permissions.ts",
    "chars": 618,
    "preview": "console.log(\"allow-env:\", await Deno.permissions.query({ name: \"env\" }));\nconsole.log(\"allow-hrtime:\", await Deno.permis"
  },
  {
    "path": "test/fixture/deno_options/quiet.ts",
    "chars": 33,
    "preview": "console.log(\"Only console.log\");\n"
  },
  {
    "path": "test/fixture/deno_options/seed.ts",
    "chars": 37,
    "preview": "console.log(\"seed:\", Math.random());\n"
  },
  {
    "path": "test/fixture/global_permission/deno-workspace",
    "chars": 95,
    "preview": "scripts:\n  start:\n    file: main.ts\nglobals:\n  deno_options:\n    allow-read:\n      - './files'\n"
  },
  {
    "path": "test/fixture/global_permission/files/test.txt",
    "chars": 22,
    "preview": "I'm text file content\n"
  },
  {
    "path": "test/fixture/global_permission/main.ts",
    "chars": 130,
    "preview": "const data = Deno.readFileSync(\"./files/test.txt\");\nconst decoder = new TextDecoder(\"utf-8\");\n\nconsole.log(decoder.decod"
  },
  {
    "path": "test/fixture/malformed_json/deno-workspace.json",
    "chars": 11,
    "preview": "{\n  test,\n\n"
  },
  {
    "path": "test/fixture/malformed_ts/deno-workspace.ts",
    "chars": 13,
    "preview": "malformedts;\n"
  },
  {
    "path": "test/fixture/malformed_yaml/deno-workspace",
    "chars": 26,
    "preview": "maleformed/yaml: invalid:\n"
  },
  {
    "path": "test/fixture/merged_scoped_global__invalid_permission/deno-workspace",
    "chars": 180,
    "preview": "scripts:\n  start:\n    file: main.ts\n    deno_options:\n      allow-net: false\nglobals:\n  deno_options:\n    allow-read:\n  "
  },
  {
    "path": "test/fixture/merged_scoped_global__invalid_permission/files/test.txt",
    "chars": 22,
    "preview": "I'm text file content\n"
  },
  {
    "path": "test/fixture/merged_scoped_global__invalid_permission/main.ts",
    "chars": 264,
    "preview": "const data = Deno.readFileSync(\"./files/test.txt\");\nconst decoder = new TextDecoder(\"utf-8\");\n\nconsole.log(decoder.decod"
  },
  {
    "path": "test/fixture/multiple_scripts/deno-workspace",
    "chars": 69,
    "preview": "scripts:\n  start:\n    file: main.ts\n  develop:\n    file: develop.ts\n\n"
  },
  {
    "path": "test/fixture/multiple_scripts/develop.ts",
    "chars": 37,
    "preview": "console.log(\"Hello World Develop!\");\n"
  },
  {
    "path": "test/fixture/multiple_scripts/main.ts",
    "chars": 29,
    "preview": "console.log(\"Hello World!\");\n"
  },
  {
    "path": "test/fixture/no_workspace/.keep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/fixture/script_global_permission/deno-workspace",
    "chars": 127,
    "preview": "scripts:\n  start:\n    file: main.ts\n    deno_options:\n      seed: 1\nglobals:\n  deno_options:\n    allow-read:\n      - './"
  },
  {
    "path": "test/fixture/script_global_permission/files/test.txt",
    "chars": 22,
    "preview": "I'm text file content\n"
  },
  {
    "path": "test/fixture/script_global_permission/main.ts",
    "chars": 168,
    "preview": "const data = Deno.readFileSync(\"./files/test.txt\");\nconst decoder = new TextDecoder(\"utf-8\");\n\nconsole.log(decoder.decod"
  },
  {
    "path": "test/fixture/script_permission/deno-workspace",
    "chars": 92,
    "preview": "scripts:\n  start:\n    file: main.ts\n    deno_options:\n      allow-read:\n        - './files'\n"
  },
  {
    "path": "test/fixture/script_permission/files/test.txt",
    "chars": 22,
    "preview": "I'm text file content\n"
  },
  {
    "path": "test/fixture/script_permission/main.ts",
    "chars": 130,
    "preview": "const data = Deno.readFileSync(\"./files/test.txt\");\nconst decoder = new TextDecoder(\"utf-8\");\n\nconsole.log(decoder.decod"
  },
  {
    "path": "test/fixture/single_script/deno-workspace",
    "chars": 37,
    "preview": "scripts:\n  start:\n    file: main.ts\n\n"
  },
  {
    "path": "test/fixture/single_script/main.ts",
    "chars": 29,
    "preview": "console.log(\"Hello World!\");\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace",
    "chars": 147,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      allow"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.yaml",
    "chars": 152,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      "
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace/.deno-workspace.yml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace/deno-workspace.json",
    "chars": 200,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \"deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n\t"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.json/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.json/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.json/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.ts/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yaml/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yaml/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yaml/.deno-workspace.yaml",
    "chars": 152,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      "
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yaml/deno-workspace.json",
    "chars": 200,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \"deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n\t"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yaml/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.yaml",
    "chars": 152,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      "
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yml/.deno-workspace.yml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yml/deno-workspace.json",
    "chars": 200,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \"deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n\t"
  },
  {
    "path": "test/fixture/workspace_multiple_names/.deno-workspace.yml/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace",
    "chars": 147,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      allow"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.yaml",
    "chars": 152,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      "
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/.deno-workspace.yml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/deno-workspace",
    "chars": 146,
    "preview": "scripts:\n  start:\n    file: deno-workspace.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      allow-"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/deno-workspace.json",
    "chars": 200,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \"deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n\t"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace/deno-workspace.yaml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.json/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.json/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.json/deno-workspace.json",
    "chars": 200,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \"deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n\t"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.json/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.ts/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.ts/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace",
    "chars": 147,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      allow"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.yaml",
    "chars": 152,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      "
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/.deno-workspace.yml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/deno-workspace.json",
    "chars": 200,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \"deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n\t"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yaml/deno-workspace.yaml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace",
    "chars": 147,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      allow"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.json",
    "chars": 201,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \".deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.ts",
    "chars": 362,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.yaml",
    "chars": 152,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      "
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/.deno-workspace.yml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: .deno-workspace.yml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace",
    "chars": 146,
    "preview": "scripts:\n  start:\n    file: deno-workspace.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      allow-"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.json",
    "chars": 200,
    "preview": "{\n\t\"scripts\": {\n\t\t\"start\": {\n\t\t\t\"file\": \"deno-workspace.json.ts\",\n\t\t\t\"deno_options\": {\n\t\t\t\t\"reload\": true\n\t\t\t}\n\t\t}\n\t},\n\t"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.ts",
    "chars": 361,
    "preview": "import { DenoWorkspace } from \"../../../../src/interfaces.ts\";\n\nconst workspace: DenoWorkspace = {\n  \"scripts\": {\n    \"s"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.yaml",
    "chars": 151,
    "preview": "scripts:\n  start:\n    file: deno-workspace.yaml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      a"
  },
  {
    "path": "test/fixture/workspace_multiple_names/deno-workspace.yml/deno-workspace.yml",
    "chars": 150,
    "preview": "scripts:\n  start:\n    file: deno-workspace.yml.ts\n    deno_options:\n      reload: true\nglobals:\n  deno_options:\n      al"
  },
  {
    "path": "test/utils/cwd.ts",
    "chars": 365,
    "preview": "import {\n  resolve,\n} from \"../../dev_deps.ts\";\n\nasync function changeAndRestoreCWD(\n  directory: string,\n  assertion: ("
  },
  {
    "path": "test/utils/denox-run.ts",
    "chars": 1401,
    "preview": "import { changeAndRestoreCWD } from \"./cwd.ts\";\n\ntype ProcessOutputs = { output: string; errOutput: string };\n\n// eslint"
  }
]

About this extraction

This page contains the full source code of the BentoumiTech/denox GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 131 files (66.6 KB), approximately 22.8k tokens, and a symbol index with 66 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!