Coder Social home page Coder Social logo

yalc-release's Introduction

Intro

This little script is used for setting versions for yalc.lock in a other repository in gitlab.

Required dependency

  • ts-node

Usage

Create a command in your package.json where you also link up the config.json

...
"scripts": {
  ...
  "set-yalcversion": "ts-node build/set-version.ts config.json",
  ...
}
...

Now you can use npm or yarn to run this command

yarn set-yalcversion

Creating a config.json

First create a config.json this can also be done in a gitlab-ci.yml.

Example files:

{
    "baseUrl": "https://mygitlab.com/api/v4",
    "token": "xxxxxxxxxxxx",
    "projectId": "xxxx",
    "branch": "release",
    "remoteYalcPath": "yalc.lock",
    "currentYalcPath": "yalc.lock",
    "packageName": "@test/myyalcpackage",
    "version": "1.0.0",
    "copyPackages": ["@test/myreferencepackage", "@test/myotherreferencepackage"]
}

Generating config.json:

If you want to create the config.json in a gitlab-ci.yml you can add the following commands to your gitlab-ci.yml:

json='{"baseUrl": "${CI_API_V4_URL}", "token": "${CI_JOB_TOKEN}", "projectId": "xxxx", "branch": "${CI_COMMIT_REF_NAME}", "remoteYalcPath": "yalc.lock", "currentYalcPath": "yalc.lock", "packageName": "@test/myyalcpackage", "version": "${CI_JOB_ID}", "copyPackages:" ["@test/myreferencepackage", "@test/myotherreferencepackage"] }'
echo "$json" > config.json
yarn setversion config.json

Some of these variables are out of the box in gitlab like

baseUrl

This can be set to your own instance of gitlab, this must include the api version /api/v4 (can not end with a /, this may cause issues) See: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/54621#note_155205894

token

Your access token to connect with gitlab (you must have api and read_repository permissions) See https://docs.gitlab.com/ee/api/repository_files.html for more information

branch

The name of the branch you want to change access of the remote repository

remoteYalcPath

This is the location of the yalc.lock on your remote repository

currentYalcPath

This is the location of the yalc.lock on your current repository

projectId

The projectId of the project in gitlab, this can NOT be the project name, use the Id (that is visible under the name in gitlab)

packageName

The name of the package in yalc.lock

version

The version that the packageName must be set to

copyPackages

This allows you to copy the versions of packages defined in the current yalc.lock to a remote repository so you can copy dependencies to a other project. Make sure the dependency tree is completly update for the project.

yalc-release's People

Contributors

jajvisser avatar

Watchers

 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.