All Projects â†’ crewdevio â†’ Trex

crewdevio / Trex

Licence: mit
Package Manager for deno 🦕

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Trex

Gitpkg
Publish packages as git tags
Stars: ✭ 208 (-51.96%)
Mutual labels:  package, modules
cati
Cati Unix Package Manager
Stars: ✭ 19 (-95.61%)
Mutual labels:  package-manager, package
Setup Miniconda
Set up your GitHub Actions workflow with conda via miniconda
Stars: ✭ 222 (-48.73%)
Mutual labels:  package, package-manager
Pip Check
pip-check gives you a quick overview of all installed packages and their update status.
Stars: ✭ 134 (-69.05%)
Mutual labels:  package, package-manager
get-installed-path
Get locally or globally installation path of given package name.
Stars: ✭ 39 (-90.99%)
Mutual labels:  package, modules
Laravel Paket
Composer GUI. Manage Laravel dependencies from web interface without switching to command line!
Stars: ✭ 143 (-66.97%)
Mutual labels:  package, package-manager
MGM-Ability
No description or website provided.
Stars: ✭ 64 (-85.22%)
Mutual labels:  package-manager, package
Npm Git Install
Clones and (re)installs packages from remote git repos. See npm/npm#3055
Stars: ✭ 49 (-88.68%)
Mutual labels:  package, package-manager
react-native-value-picker
Cross-Platform iOS(ish) style picker for react native.
Stars: ✭ 18 (-95.84%)
Mutual labels:  package, npm-package
get-bin-path
Get the current package's binary path
Stars: ✭ 25 (-94.23%)
Mutual labels:  package-manager, package
Gitdependencyresolverforunity
This plugin resolves git url dependencies in the package for Unity Package Manager. You can use a git url as a package dependency!
Stars: ✭ 126 (-70.9%)
Mutual labels:  package, package-manager
A To Z List Of Useful Node.js Modules
Collection of most awesome node modules that will extend the capability of your node.js application.
Stars: ✭ 315 (-27.25%)
Mutual labels:  modules, npm-package
Unityasync
Task and Async Utility Package for Unity. Start co-routines from anywhere.
Stars: ✭ 58 (-86.61%)
Mutual labels:  package, package-manager
Boss
Dependency Manager for Delphi
Stars: ✭ 188 (-56.58%)
Mutual labels:  package, package-manager
Github
a module for building, searching, installing, managing, and mining Stata packages from GitHub
Stars: ✭ 56 (-87.07%)
Mutual labels:  package, package-manager
jean
Bored from installing tiny shell scripts and .dotfiles manually? Huh! Missing Shell Package Manager For Linux
Stars: ✭ 21 (-95.15%)
Mutual labels:  package-manager, package
Projeny
A project and package manager for Unity
Stars: ✭ 656 (+51.5%)
Mutual labels:  package, package-manager
Unity Package Tools
A set of developer tools to make it easier to create and distribute packages for the native Unity Package Manager.
Stars: ✭ 44 (-89.84%)
Mutual labels:  package, package-manager
lint-deps
Lint for unused or missing dependencies in your node.js projects. Customize with plugins or configuration.
Stars: ✭ 48 (-88.91%)
Mutual labels:  package, modules
Universe
The Mesosphere Universe package repository.
Stars: ✭ 308 (-28.87%)
Mutual labels:  package, package-manager

Trex 🦕

Package management for deno (pronounced "tee rex")

GitHub issues GitHub forks GitHub stars GitHub license

Use Trex

About

Trex is a package management tool for deno similar to npm but keeping close to the deno philosophy. Packages are cached and only one import_map.json file is generated.

// import_map.json

{
  "imports":  {
    "http/":  "https://deno.land/std/http/"
  }
}

For more information about the import maps in deno see import maps.

Additional topics

Installation

deno install -A --unstable -n trex --no-check https://deno.land/x/trex/cli.ts

note: Works with deno >= 1.2.0

Trex imports

This is a version that does not use import maps as a central hub, it can be used to handle dependencies for libraries and packages. you can see the documentation here

deno install -A --unstable -n trex https://denopkg.com/crewdevio/[email protected]/cli.ts

note: if you try to install this version with the name trex it will replace the current version, if you want to have both versions you can use another name in the installation -n [otherName]

we shorten the install command so it's not that long

The permissions that Trex uses are:

  • --allow-net
  • --allow-read
  • --allow-write
  • --allow-run
  • --allow-env

You can give those permissions explicitly.

Updating Trex

Install new version with the -f flag:

deno install -f -A --unstable -n trex https://deno.land/x/trex/cli.ts

Or use the upgrade command:

trex upgrade

Note: available for versions 0.2.0 or higher.

Verify the installation of Trex:

trex --version

and the console should print the Trex version.

For help on the commands that Trex provides, use:

trex --help

For a better implementation of this tool you can use the Commands utility.

Usage

Installing from deno.land

Install the fs, http and fmt modules from std:

trex install --map fs http fmt

note: you can use trex i --map fs http fmt

--map installs packages from the standard library and those hosted at deno.land/x

Installing from nest.land

Install a package hosted on nest.land:

trex install --nest [email protected]

note: if you want to install a package using nest.land you must specify a version explicitly as above

You can install packages from std hosted in nest.land by specifying the package and the version:

trex install --nest [email protected]

Installing from a repository

trex install --pkg [user]/[repo or [email protected]/branch]/[path/to/file] [packageName]

Example:

trex install --pkg oakserver/[email protected]/mod.ts oak

note: In the event that the repository uses a branch other than master as the main branch, this must be specified

The above downloads oak directly from its repository.

Example import map

All installation methods produce an import_map.json file:

{
  "imports": {
    "fs/": "https://deno.land/std/fs/",
    "http/": "https://deno.land/std/http/",
    "fmt/": "https://deno.land/std/fmt/"
  }
}

Downloading packages

Download all the packages listed in the import_map.json similar to npm install:

trex install

Adding custom packages

Install a package from a custom URL source:

trex --custom React=https://dev.jspm.io/react/index.js

import_map.json:

{
  "imports": {
    "http/": "https://deno.land/std/http/",
    "fmt/": "https://deno.land/std/fmt/",
    "oak": "https://deno.land/x/oak/mod.ts",
    "React": "https://dev.jspm.io/react/index.js"
  }
}

Deleting packages

trex delete React

Remove a specific version from the cache and the import_map.json file:

trex delete [email protected]

import_map.json:

{
  "imports": {
    "fs/": "https://deno.land/std/fs/",
    "http/": "https://deno.land/std/http/",
    "fmt/": "https://deno.land/std/fmt/",
    "oak": "https://deno.land/x/oak/mod.ts"
  }
}

Removing from cache only works with standard packages and those installed from deno.land/x

Selecting a specific version of a package

Specify a package's version:

trex install --map [email protected]

import_map.json

{
  "imports": {
    "fs/": "https://deno.land/[email protected]/fs/"
  }
}

note: can be used with third party packages.

Run Scripts (experimental)

now you can create command aliases similar to npm run, you just have to create a run.json file with the following structure:

// example
{
  "scripts": {
    "welcome": "deno run https://deno.land/[email protected]/examples/welcome.ts"
  }
}

note: to run command aliases you must use the command trex run <aliases>

now you can call a command within another or call a deno script like denopack or eggs within a command alias

// example
{
  "scripts": {
    "start": "trex run welcome",
    "welcome": "deno run https://deno.land/[email protected]/examples/welcome.ts",
    "bundler": "denopack -i mod.ts -o bundle.mod.js",
    "publish": "eggs publish"
  }
}

note: you can use the --watch flag to monitor the changes and rerun the script, example: deno run --watch --unstable https://deno.land/[email protected]/examples/welcome.ts

you can pass arguments in the command alias and these will be resisted by the file to execute

imports run start --port=3000 --env
console.log(Deno.args); // ["--port=3000", "--env"]

Reboot script alias protocol (rsap)

with trex you can create script aliases that are reloaded every time a file is changed, this can be done using deno's --watch flag. If you would like to have this same functionality but with any command alias you want, you can use trex reboot script protocol which reruns the command alias every time changes are detected in the files and folders you specify

example:

{
  "scripts": {
    "start": "trex run welcome",
    "welcome": "deno run https://deno.land/[email protected]/examples/welcome.ts",
    "bundler": "denopack -i mod.ts -o bundle.mod.js",
    "publish": "eggs publish"
  },
  "files": ["./app.ts"]
}

You only have to add the files option in the run.json file and it will only observe the files and folders that you specify, if you leave the array empty it will observe all the files.

for the script alias to use rsap you just need to add the --watch or -w flag to the end of the command alias.

example:

{
  "scripts": {
    "dev": "go build"
  },
  "files": ["./main.go"]
}
trex run dev --watch ...args

and of course it can be used with any cli tool, compiler or interpreter.

note: you can create the run file in yaml format

- scripts:
    dev: go build

- files:
    - ./main.go

Purge a package or URL

if you want delete a package or url package from cache memory in deno, you can use the purge command to remove from cache memory.

example:

trex purge oak

this finds the oak package in the import_map.json file and removes it from the cache.

trex purge https://deno.land/x/[email protected]/mod.ts

also can be used with urls

Checking a package's dependency tree

trex tree fs

This prints out something like:

local: C:\Users\trex\AppData\Local\deno\deps\https\deno.land\434fe4a7be02d187573484b382f4c1fec5b023d27d1dcf4f768f300799a073e0
type: TypeScript
compiled: C:\Users\trex\AppData\Local\deno\gen\https\deno.land\std\fs\mod.ts.js
map: C:\Users\trex\AppData\Local\deno\gen\https\deno.land\std\fs\mod.ts.js.map
deps:
https://deno.land/std/fs/mod.ts
  ├─┬ https://deno.land/std/fs/empty_dir.ts
  │ └─┬ https://deno.land/std/path/mod.ts
  │   ├── https://deno.land/std/path/_constants.ts
  │   ├─┬ https://deno.land/std/path/win32.ts
  │   │ ├── https://deno.land/std/path/_constants.ts
  │   │ ├─┬ https://deno.land/std/path/_util.ts
  │   │ │ └── https://deno.land/std/path/_constants.ts
  │   │ └── https://deno.land/std/_util/assert.ts
  │   ├─┬ https://deno.land/std/path/posix.ts
  │   │ ├── https://deno.land/std/path/_constants.ts
  │   │ └── https://deno.land/std/path/_util.ts
  │   ├─┬ https://deno.land/std/path/common.ts
  │   │ └─┬ https://deno.land/std/path/separator.ts
  │   │   └── https://deno.land/std/path/_constants.ts
  │   ├── https://deno.land/std/path/separator.ts
  │   ├── https://deno.land/std/path/_interface.ts
  │   └─┬ https://deno.land/std/path/glob.ts
  │     ├── https://deno.land/std/path/separator.ts
  │     ├─┬ https://deno.land/std/path/_globrex.ts
  │     │ └── https://deno.land/std/path/_constants.ts
  │     ├── https://deno.land/std/path/mod.ts
  │     └── https://deno.land/std/_util/assert.ts
  ├─┬ https://deno.land/std/fs/ensure_dir.ts
  │ └─┬ https://deno.land/std/fs/_util.ts
  │   └── https://deno.land/std/path/mod.ts
  ├─┬ https://deno.land/std/fs/ensure_file.ts
  │ ├── https://deno.land/std/path/mod.ts
  │ ├── https://deno.land/std/fs/ensure_dir.ts
  │ └── https://deno.land/std/fs/_util.ts
  ├─┬ https://deno.land/std/fs/ensure_link.ts
  │ ├── https://deno.land/std/path/mod.ts
  │ ├── https://deno.land/std/fs/ensure_dir.ts
  │ ├── https://deno.land/std/fs/exists.ts
  │ └── https://deno.land/std/fs/_util.ts
  ├─┬ https://deno.land/std/fs/ensure_symlink.ts
  │ ├── https://deno.land/std/path/mod.ts
  │ ├── https://deno.land/std/fs/ensure_dir.ts
  │ ├── https://deno.land/std/fs/exists.ts
  │ └── https://deno.land/std/fs/_util.ts
  ├── https://deno.land/std/fs/exists.ts
  ├─┬ https://deno.land/std/fs/expand_glob.ts
  │ ├── https://deno.land/std/path/mod.ts
  │ ├─┬ https://deno.land/std/fs/walk.ts
  │ │ ├── https://deno.land/std/_util/assert.ts
  │ │ └── https://deno.land/std/path/mod.ts
  │ └── https://deno.land/std/_util/assert.ts
  ├─┬ https://deno.land/std/fs/move.ts
  │ ├── https://deno.land/std/fs/exists.ts
  │ └── https://deno.land/std/fs/_util.ts
  ├─┬ https://deno.land/std/fs/copy.ts
  │ ├── https://deno.land/std/path/mod.ts
  │ ├── https://deno.land/std/fs/ensure_dir.ts
  │ ├── https://deno.land/std/fs/_util.ts
  │ └── https://deno.land/std/_util/assert.ts
  ├── https://deno.land/std/fs/read_file_str.ts
  ├── https://deno.land/std/fs/write_file_str.ts
  ├── https://deno.land/std/fs/read_json.ts
  ├── https://deno.land/std/fs/write_json.ts
  ├── https://deno.land/std/fs/walk.ts
  └── https://deno.land/std/fs/eol.ts

Integrity checking & lock files

Let's say your module depends on a remote module. When you compile your module for the first time, it is retrieved, compiled and cached. It will remain this way until you run your module on a new machine (e.g. in production) or reload the cache.

But what happens if the content in the remote url is changed? This could lead to your production module running with different dependency code than your local module. Deno's solution to avoid this is to use integrity checking and lock files.

Create a lockfile:

deno cache --lock=lock.json --lock-write file.ts

The above generates a lock.json file.

If you use import_map.json in input file, you can specify it:

deno cache --lock=lock.json --lock-write --import-map=import_map.json --unstable file.ts

See deno document for more info.

Complete example

A simple std server

Install http and fmt:

trex install --map http fmt

Create a simple server:

// server.ts
import { serve } from "http/server.ts";
import { green } from "fmt/colors.ts";

const server = serve({ port: 8000 });
console.log(green("http://localhost:8000/"));

for await (const req of server) {
  req.respond({ body: "Hello World\n" });
}

Run the server:

deno run --allow-net --import-map=import_map.json --unstable server.ts

note: it is important to use --import-map=import_map.json --unstable

Adding third party packages

Example using oak

Add the master version of oak:

trex i --map oak

This adds oak to the import_map.json file:

{
  "imports": {
    "http/": "https://deno.land/std/http/",
    "fmt/": "https://deno.land/std/fmt/",
    "oak": "https://deno.land/x/oak/mod.ts"
  }
}

note: third party packages are added using mod.ts

Then create an oak application. Note the import statement.

// app.ts
import { Application } from "oak";

const app = new Application();

app.use((ctx) => {
  ctx.response.body = "Hello World!";
});

await app.listen({ port: 8000 });

Run the server:

deno run --allow-net --import-map=import_map.json --unstable app.ts

Contributing

Contributions are welcome, see CONTRIBUTING GUIDELINES.

Licensing

Trex is licensed under the MIT license.

Trex is powered by

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].