Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
cooldown:
default-days: 7
groups:
all:
patterns:
- "*"
commit-message: # force conventional commits standard
prefix: fix
prefix-development: chore
include: scope
14 changes: 0 additions & 14 deletions .github/workflows/ci.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: commitlint

on:
workflow_call:
push:
pull_request:
branches: ["master"]

jobs:
commitlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install required dependencies
run: |
sudo apt update
sudo apt install -y sudo
sudo apt install -y git curl

- uses: actions/setup-node@v3
with:
node-version: 20
- name: node setup
run: npm i
- name: Print versions
run: |
git --version
node --version
npm --version
npx commitlint --version

- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: publish

on:
push:
tags:
- "v*"

jobs:
tests:
uses: ./.github/workflows/tests.yml
publish-npm:
needs: [tests]
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish to npm
run: | # npm 11.15.1 for OIDC support
npm install -g npm@11
npm ci
npm install
npm publish --access public
62 changes: 56 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,61 @@
name: Release
# TODO: ENABLE / UNCOMMENT WHEN NPM_TOKEN IS SET in secrets REPO
name: release

on:
push:
branches: [master]
branches: ["master"]
paths-ignore:
- '.devcontainer/**'
tags-ignore: ['**']

jobs:
release:
uses: brickhouse-tech/.github/.github/workflows/release.yml@main
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
tests:
uses: ./.github/workflows/tests.yml
tag-release:
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/checkout@v4
with:
# important, must be defined on checkout to kick publish
token: ${{ secrets.GH_TOKEN }}
# Full history needed for conventional-changelog to detect breaking changes
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: tag release
run: |
# ignore if commit message is chore(release): ...
if [[ $(git log -1 --pretty=%B) =~ ^chore\(release\):.* ]]; then
echo "Commit message starts with 'chore(release):', skipping release"
exit 0
fi

git config --local user.email "creadbot@github.com"
git config --local user.name "creadbot_github"

npm install

# Check for breaking changes in commits since last tag
# Look for feat!:, fix!:, or BREAKING CHANGE in commit messages
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
RANGE="$LAST_TAG..HEAD"
else
RANGE="HEAD"
fi

# Check all commits (not just first-parent) for breaking changes
if git log $RANGE --format="%B" | grep -qE "(^[a-z]+!:|BREAKING CHANGE:)"; then
echo "Breaking change detected, forcing major version bump"
npx commit-and-tag-version --release-as major
else
npx commit-and-tag-version
fi

git push
git push --tags
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: tests

on:
workflow_call:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
test:
strategy:
matrix:
node-version: ['18.x', '20.x', '22.x']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# cache: "npm" # needs lockfile if enabled

- run: npm install
- run: npm run lint
- run: npm test
6 changes: 6 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"spec": "test/**/*.test.js",
"timeout": 5000,
"recursive": true,
"reporter": "spec"
}
13 changes: 0 additions & 13 deletions Cakefile

This file was deleted.

1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ['@commitlint/config-conventional'] };
38 changes: 38 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from '@eslint/js';

export default [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
setTimeout: 'readonly',
setImmediate: 'readonly',
clearTimeout: 'readonly'
}
},
rules: {
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-constant-condition': ['error', { checkLoops: false }]
}
},
{
files: ['test/**/*.js'],
languageOptions: {
globals: {
describe: 'readonly',
it: 'readonly',
before: 'readonly',
after: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly'
}
}
}
];
19 changes: 7 additions & 12 deletions lib/bom.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
// Generated by CoffeeScript 1.12.7
(function() {
"use strict";
exports.stripBOM = function(str) {
if (str[0] === '\uFEFF') {
return str.substring(1);
} else {
return str;
}
};

}).call(this);
export function stripBOM(str) {
if (str[0] === '\uFEFF') {
return str.substring(1);
} else {
return str;
}
}
Loading