semantic-release / semantic-release/git

Add TypeScript declarations for plugin options

Open
#514 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
339
Forks
75
Avg merge
5h 15m
Merged PRs (30d)
6

Description

For TypeScript users, this would allow easier configuration of the plugin in TS/JS files.

Semantic Release added a declaration file for index.js last year. Its Options type provides partial support for IntelliSense and type validation.

// index.d.ts
declare module "@semantic-release/git" {
    export type MicromatchGlob = string
    export interface AssetObject { path: MicromatchGlob }
    export type AssetEntry = AssetObject | MicromatchGlob;
    export interface Options {
        /**
         * Files to include in the release commit. Set to `false` to disable adding files to the release commit.
         * @default ['CHANGELOG.md', 'package.json', 'package-lock.json', 'npm-shrinkwrap.json']
         * @description
         * Can be an Array or a single entry. Each entry can be either:
         * - a glob
         * - or an Object with a path property containing a glob.
         * 
         * Each entry in the assets Array is globbed individually. A glob can be a String ("dist/\*\*\/\*.js" or "dist/mylib.js") or an Array of Strings that will be globbed together (["dist/\*\*", "!\*\*\/\*.css"]).
         * 
         * If a directory is configured, all the files under this directory and its children will be included.
         * 
         * Note: If a file has a match in assets it will be included even if it also has a match in .gitignore.
         * 
         * @example
         * // include all js files in the dist directory, but not in its sub-directories.
         * 'dist/*.js'
         * // include all js files in the dist directory and its sub-directories.
         * 'dist/**\/*.js'
         * // include all files in the dist directory and its sub-directories excluding the css files.
         * [['dist', '!**\/*.css']]
         * // include package.json and all files in the dist directory and its sub-directories excluding the css files.
         * [['dist', '!**\/*.css'], 'package.json']
         * // include all js and css files in the dist directory and its sub-directories excluding the minified version.
         * [['dist/**\/*.{js,css}', '!**\/*.min.*']]
         */
        assets?: AssetEntry | AssetEntry[] | false
        /**
         * The message for the release commit.
         * @default `chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}`
         * @description
         * The message for the release commit is generated with Lodash template. The following variables are available:
         * | Parameter         | Description |
         * | ----------------- | ----------- |
         * | branch            | The branch from which the release is done. |
         * | branch.name       | The branch name. |
         * | branch.type       | The type of branch. |
         * | branch.channel    | The distribution channel on which to publish releases from this branch. |
         * | branch.range      | The range of semantic versions to support on this branch. |
         * | branch.prerelease | The pre-release detonation to append to semantic versions released from this branch. |
         * | lastRelease       | Object with version, gitTag and gitHead of the last release. |
         * | nextRelease       | Object with version, gitTag, gitHead and notes of the release being done. |
         * 
         * Note: It is recommended to include `[skip ci]` in the commit message to not trigger a new build. Some CI service support the `[skip ci]` keyword only in the subject of the message.
         * 
         * #### `message` examples
         * The `message` `Release <%= nextRelease.version %> - <%= new Date().toLocaleDateString('en-US', {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' }) %> [skip ci]\n\n<%= nextRelease.notes %>` will generate the commit message:
         * > Release v1.0.0 - Oct. 21, 2015 1:24 AM [skip ci]
         * >
         * > ## 1.0.0
         * > 
         * > ### Features
         * > * Generate 1.21 gigawatts of electricity
         * > 
         * > ...
         * 
         */
        message?: string,
    }
}

image


I'd add labels if I was allowed to.
labels: feature, plugin:git

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the proposed index.d.ts declaration and compare it with the index.js plugin entry point referenced in the issue. Confirm that the declared Options type matches the plugin's supported configuration, then add the declaration file and verify that TypeScript users receive option completion and validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
release, tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.