• Stars
    star
    274
  • Rank 150,237 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Publish packages as git tags

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`
});

Troubleshooting

Usage with Gerrit

gitpkg works by publishing tags that contain only the files in a package. The commits in these tags don't appear on any branch, so Gerrit will reject them by default:

! [remote rejected] …
    (prohibited by Gerrit: update for creating new commit object not permitted)

To gain the permission gitpkg needs, add Create Reference and Push entries to the refs/tags/* reference in the Access settings of your repository.

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

More Repositories

1

stylelint-images

Check your CSS images to improve the performance and avoid common mistakes (plugin pack).
JavaScript
34
star
2

mjml-loader

MJML loader for webpack
JavaScript
27
star
3

unreact

Convert React Components to EJS or Pug [Alpha][Unreleased]
JavaScript
14
star
4

styled-jsx-in-place

JavaScript
5
star
5

templatize-css

Templatize CSS files
JavaScript
4
star
6

gynoid

Auth0 NodeJs ChatOps Service
JavaScript
4
star
7

test-repo-transfer

2
star
8

public-registry

gitpkg public registry
2
star
9

dir2pkg

JavaScript
2
star
10

solid-webapp

[DEPRECATED] Basic and solid boilerplate front-end for web apps.
JavaScript
2
star
11

domando-arduino

Mis inicios con arduino
JavaScript
1
star
12

bug-repro-next-lazy-compilation

JavaScript
1
star
13

test-repo-transfer-2

1
star
14

bug-repro-next-w5-worker

JavaScript
1
star
15

last-successful-gh-commit

Get last successful GitHub commit
JavaScript
1
star
16

send-to-git-cli

Keeps in sync a folder and their files with a folder of a git repository.
JavaScript
1
star
17

gulp-avoidfoit

Scans your css files and generates the JS code to load all the webfonts with Fonts Events to avoid FOIT (Flash of Invisible Text) and to improve performance.
JavaScript
1
star
18

bug-repro-next-big-page

Bug repro of next.js problem with pages with many files
JavaScript
1
star
19

babel-plugin-react-element-to-jsx-string

Turn a ReactElement into the corresponding JSX string at build time.
JavaScript
1
star
20

bug-repro-next-styled-jsx-jest

JavaScript
1
star
21

bug-repro-next-w5-inline-worker

JavaScript
1
star
22

send-to-git

Keeps in sync a folder and their files with a folder of a git repository.
JavaScript
1
star
23

bug-repro-next-global-css

JavaScript
1
star