GithubHelp home page GithubHelp logo

gitpkg's Introduction

gitpkg

Publish packages as git tags

๐Ÿ”ง Works with projects with build steps.
๐Ÿ‘ฏ Works with projects with multiple packages (monorepos).
๐ŸŽ Lightweight git tags (only the files needed are included).

Table of Contents

Background

Both npm and yarn support installing packages from git tags.

But things can get difficult with packages that have a build step (eg babel) and monorepos with multiples packages (eg lerna).

gitpkg publish creates a git tag with the same files as if you were running npm publish or yarn publish and uploads the generated git tag to a git repository.

Also you can publish any gitpkg package to the same repository, so you can have only one repository used as common registry and you get away from your project git repository the git tags with the build code.

Terminology:

  • gitpkg package: git tag generated by gitpkg.
  • gitpkg registry: git repository used as common host for your gitpkg packages.

Install

Node.js v10.12 or newer is required.

npm registry

Via the yarn client:

$ yarn global add gitpkg

Via the npm client:

$ npm install -g gitpkg

gitpkg registry

Via the yarn client:

$ yarn global add ramasilveyra/public-registry#gitpkg-v1.0.0-beta.2-gitpkg

Via the npm client:

$ npm install -g ramasilveyra/public-registry#gitpkg-v1.0.0-beta.2-gitpkg

Usage

Publish

Publishes a package to a git repository, by default uploads the package to the git repository in the git remote origin (git remote -v to see your git remote origin url). The package published is defined by the package.json in the current directory.

$ gitpkg publish

See in action.

--registry, -r

$ gitpkg publish --registry [email protected]:org/private-registry.git

This flag tells gitpkg to publish the package to a specific gitpkg registry.

You can also set the gitpkg registry permanently by adding "gitpkg":{"registry":"[email protected]:org/private-registry.git"} to the package.json.

Configuration

You can also configure gitpkg with a config file. Create a file named gitpkg.config.js in the root of your project or in the root of a subpackage.

Available config settings

registry

Publish the package to a specific gitpkg registry. Same as the registry flag of the cli.

getTagName

Function used to create the git tags. The function receives one object pkg, which is the content of the package.json file.

// Example content of gitpkg.config.js
module.exports = () => ({
  registry: "[email protected]:org/private-registry.git",
  getTagName: (pkg) => `${pkg.name}-v${pkg.version}-gitpkg`,
});

Contribute

Feel free to dive in! Open an issue or submit PRs.

gitpkg follows the Contributor Covenant Code of Conduct.

License

MIT ยฉ Ramiro Silveyra d'Avila

gitpkg's People

Contributors

ramasilveyra avatar thejsn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.