Giter VIP home page Giter VIP logo

vercel-submodules's Introduction

Vercel Submodules

vercel-submodules:
The CLI to handle
Private Git Submodules
in your Vercel Project

This project is community-driven and not affiliated with Vercel in any way. However, I'd love to contribute!

The Status Quo

@vercel Support for private Git Submodules #44

With Git Submodules, you can add other repositories as a subdirectory of another repository. The experimental.externalDir option in Next.js makes it even more magical by directly transpiling external libraries.

However, Vercel does not support private Git Submodules for now. There have been many community-made workarounds, like calling Vercel CLI inside GitHub Actions (not a fundamental solution) or using shell scripts (it works, but it cannot fit general needs like cloning multiple repositories, auto-response for newly added submodules), having their own set of limitations.

๐Ÿ“ฆ Installation and Usage

yarn add -D vercel-submodules

Go to the Build & Development Settings section and override Install Command with vercel-submodules --all && (...). Such as vercel-submodules --all && yarn install.

Once configured, vercel-submodules take care of everything. It detects the indicated commit hashes with all or configured submodules; you don't have to update anything again!

Usage information for vercel-submodules

Clone all Submodules

npx vercel-submodules --all

This command clones all submodules inside the repository.

Clone only specific Submodules

npx vercel-submodules --paths packages/module-a ./packages/module-b docs

This command above will clone submodules with the following path:

  • ./packages/module-a
  • ./packages/module-b
  • ./docs

Configure clone depth

npx vercel-submodules --depth 10

The default value is 1.

Set GitHub Token

You'll need to configure your GitHub token in order to clone private repositories in Vercel. Follow these steps:

  1. Go to your GitHub Developer settings > Personal access tokens.
  2. Click "Generate new token".
  3. Give the token a name and select the repo (Full control of private repositories) permission.
  4. Click "Generate token". You will then be presented with a token that you can use to authenticate with GitHub.
  5. Add the resulting token as an Environment Variable in Vercel called GITHUB_TOKEN.

Alternatively, you can explicitly set the token argument:

npx vercel-submodules --token 7777777141f111cf9f0308a63dbd9d0cad3010c4

FYI, that's my Ethereum address ๐Ÿ’Ž

If the GITHUB_TOKEN environment variable is not set, the CLI will attempt to use the default value of $GITHUB_TOKEN.

You can also use the new fine-graned PAT using the --fg-token flag, too.

npx vercel-submodules --fg-token 7777777141f111cf9f0308a63dbd9d0cad3010c4

vercel-submodules's People

Contributors

achrafash avatar anaclumos avatar dependabot[bot] avatar harumaxy avatar imgbot[bot] avatar junhoyeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vercel-submodules's Issues

Build getting failed after the latest version release

I had install the package in my project day before yesterday using this command
npm i -D vercel-submodules && npx vercel-submodules --all && npm install and everything worked fine but after the latest update the same workflow seems to be broken and build is getting failed with just a message that
image

Getting not our ref error

Error! fatal: remote error: upload-pack: not our ref 360580bfd5f75d775b4e14552c0d442882f652d0
at file:///vercel/path0/project/node_modules/vercel-submodules/lib/commands/clone.js:36:24
exit code: 128 (Invalid exit argument)
Error: Command "npm i -D [email protected] && npx vercel-submodules --all && npm install" exited with 1
BUILD_FAILED: Command "npm i -D [email protected] && npx vercel-submodules --all && npm install" exited with 1

image

Add accepting branch name support for submodules

Sometimes, the projects have to user submodule for a particular branch and not with the commmitHash, because everytime we merge the submodule PR

  1. There might not be a change in main repo's codebase, so you might not want to do a commit just for the sake of adding latest commit hash of refference in main repo
  2. it generates a new commit ID (of merge commit). So, for fast development and bigger teams, we have to make sure manually,that the build triggered for the main repo, was with the latest commit hash or not.

Hence, having an option to give branch name, will make sure that the build is generated with sync of a particular branch only.

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.