Skip to main content

GPM

Git Package Manager: Simple Deno library to download git packages.

Motivation

I just want to download assets from git repositories without depending on any package registry like npm. For example, css packages, javascript polyfills, etc. But, at the same time, I want semantic versioning using the git tags.

Usage

This is a Deno package, written in typescript:

import gpm from "https://deno.land/x/gpm/mod.ts";

const packages = [
  // Use the github repository name (it download the latest tag)
  "necolas/normalize.css",

  // Or you can specify a version (tags)
  {
    name: "GoogleChrome/dialog-polyfill",
    version: "0.5",
  },

  // And also configure the files/folders to copy
  // (it uses package.json as fallback)
  {
    name: "oom-components/page-loader",
    files: ["src"],
    filter: (path) => path.endsWith(".js"),
  },

  // Use full urls to download files directly
  "https://unpkg.com/react@17.0.2/umd/react.production.min.js",

  // Custom destination folder
  {
    name: "oom-components/carousel",
    dest: "./vendors/components/carousel",
  },
];

const destination = "./vendors";

gpm(packages, destination);

Cli

# Install
deno install --unstable -A https://deno.land/x/gpm/mod.ts

# Download necolas/normalize.css
gpm necolas/normalize.css

# Use the latest 7.x version
gpm necolas/normalize.css@7

# Set a different destination path
gpm necolas/normalize.css@7 --dest=./packages