Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
prantlf committed Oct 26, 2023
0 parents commit 4d06113
Show file tree
Hide file tree
Showing 12 changed files with 2,455 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .denolint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"tags": ["recommended"]
}
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build and Test or Release

on:
push:
branches:
- master
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
- LICENSE
pull_request:

jobs:

macos:
runs-on: macos-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --no-verify-store-integrity

windows:
runs-on: windows-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --no-verify-store-integrity

linux-and-release:
needs:
- macos
- windows
runs-on: ubuntu-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install PNPM
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
run: pnpm i --frozen-lockfile --no-verify-store-integrity
- name: Publish
if: ${{ github.ref_name == 'master' }}
uses: cycjimmy/semantic-release-action@v4
with:
branches: master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
newchanges
newchanges.exe
node_modules
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.exclude": {
"newchanges": true,
"node_modules": true,
}
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changes

## 2023-10-26 (0.0.1)

Initial release
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Ferdinand Prantl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# New Changes (Changelog) Generator for Node.js

[![Latest version](https://img.shields.io/npm/v/newchanges)
![Dependency status](https://img.shields.io/librariesio/release/npm/newchanges)
](https://www.npmjs.com/package/newchanges)
[![Coverage](https://codecov.io/gh/prantlf/node-newchanges/branch/master/graph/badge.svg)](https://codecov.io/gh/prantlf/node-newchanges)

Creates or updates the changelog file from commit messages formatted according to [Conventional Commits]. Installs [newchanges] in [Node.js] environments.

## Installation

This package is usually installed globally, so that you can use the `newchanges` executable:

```sh
$ npm i -g newchanges
```

Make sure, that you use [Node.js] version 18 or newer.

## Usage

Usage: newchanges [options] [commands]

Commands:
init generate a config file with defaults

Options:
-c|--config <name> file name or path of the config file
-l|--log <file> file to read from and write to (default: to find)
-t|--tag-prefix <prefix> expect git tags prefixed (default: "v")
-h|--heading <level> level of the log entry headings (default: 2)
-l|--logged-types <types> change types to include in the log
-f|--from <hash> start at a specific commit (default: last change)
-t|--to <hash> end at a specific commit (default: HEAD)
-u|--try-unshallow try fetch missing commits and tags if not found
-p|--path <path> consider only specific path (default: git root)
-r|--repo-url <url> URL of the git repository (default: from git)
-o|--override-version <v> set the new version to the specified value
-e|--write-changes <file> write the new changes to the specified file
-w|--write-version <file> write the version numnber to the specified file
-a|--assume-patch assume a patch release for insignificant commits
-0|--bump-major-0 bump the major version also if it is 0
-d|--dry-run print the new changes on the console only
-N|--no-failure do not fail if the change log was not updated
-i|--print-last print changes for the last version on the console
-q|--quiet omit the summary note on the standard output
-v|--verbose print the new changes on the console too
-V|--version print the version of the executable and exits
-h|--help print the usage information and exits

Default change types to include in the log: "feat", "fix", "perf". If
the commit message includes the note "BREAKING CHANGE", it will be
included in the log regardless of its type.

Examples:
$ newchanges -f v0.1.0 -t v0.2.0
$ newchanges -d

## Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

## License

Copyright (c) 2023 Ferdinand Prantl

Licensed under the MIT license.

[Conventional Commits]: https://www.conventionalcommits.org/
[newchanges]: https://github.com/prantlf/node-newchanges
[Node.js]: http://nodejs.org/
3 changes: 3 additions & 0 deletions bin/newchanges.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

console.error('installation failed')
34 changes: 34 additions & 0 deletions install.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import debug from 'debug'
import { access, symlink, unlink } from 'fs/promises'
import { basename, dirname, join } from 'path'
import { fileURLToPath } from 'url'
import grab from 'grab-github-release'

const __dirname = dirname(fileURLToPath(import.meta.url))
const exists = file => access(file).then(() => true, () => false)
const log = debug('newchanges')

const repository = 'prantlf/v-newchanges'
const platformSuffixes = {
linux: 'linux',
darwin: 'macos',
win32: 'windows'
}

try {
const { INIT_CWD: root } = process.env
if (!root) throw new Error('not running during npm install')
const { executable, version } = await grab(
{ repository, platformSuffixes, targetDirectory: __dirname, unpackExecutable: true })
console.log('downloaded and unpacked "%s" version %s', executable, version)
const link = join(root, 'node_modules', '.bin', basename(executable))
if (await exists(link)) {
log('unlink "%s"', link)
await unlink(link)
}
log('link "%s"', link)
await symlink (executable, link, 'junction')
} catch (err) {
console.error(err)
process.exitCode = 1
}
71 changes: 71 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "newchanges",
"version": "0.0.1",
"description": "Creates or updates the changelog file from commit messages formatted according to Conventional Commits.",
"author": {
"name": "Ferdinand Prantl",
"email": "prantlf@gmail.com",
"url": "http://prantl.tk"
},
"license": "MIT",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/prantlf/node-newchanges/blob/master/LICENSE"
}
],
"homepage": "https://github.com/prantlf/node-newchanges#readme",
"repository": {
"type": "git",
"url": "https://github.com/prantlf/node-newchanges.git"
},
"bugs": {
"url": "https://github.com/prantlf/node-newchanges/issues"
},
"engines": {
"node": ">=18"
},
"type": "module",
"bin": {
"newchanges": "bin/newchanges.js"
},
"files": [
"bin",
"install.js"
],
"scripts": {
"postinstall": "node install",
"test": "denolint"
},
"release": {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
[
"@semantic-release/github",
{
"failComment": false
}
],
"@semantic-release/git"
]
},
"dependencies": {
"debug": "^4.3.4",
"grab-github-release": "^0.1.0"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"denolint": "2.0.14"
},
"keywords": [
"changes",
"changes",
"changelog",
"generate",
"conventional"
]
}
Loading

0 comments on commit 4d06113

Please sign in to comment.