Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
lib/
node_modules/
jest.config.js
77 changes: 77 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"plugins": [
"jest",
"@typescript-eslint"
],
"extends": [
"plugin:github/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"github/array-foreach": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/func-call-spacing": [
"error",
"never"
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": [
"error",
"never"
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
52 changes: 52 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at siarhei.krukau@gmail.com.
All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
49 changes: 49 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
repository:
name: semver-utils
description: One-stop shop for working with semantic versions in your GitHub Actions workflows
topics: github-actions, actions, semver, semantic-versions, utils
private: false
has_wiki: false
has_issues: true
has_projects: false
default_branch: main
allow_merge_commit: true
allow_squash_merge: false
allow_rebase_merge: true
labels:
- name: bug
color: '#D73A4A'
description: Something isn't working
- name: chore
color: '#C49307'
description: Boring, unpleasant, but easy tasks
- name: CI/CD
color: '#95CD57'
description: Continious integration & delivery
- name: dependencies
color: '#0366D6'
description: Pull requests that update a dependency file
- name: documentation
color: '#0075CA'
description: Improvements or additions to documentation
- name: duplicate
color: '#CFD3D7'
description: This issue or pull request already exists
- name: enhancement
color: '#A2EEEF'
description: New feature or request
- name: good first issue
color: '#7057FF'
description: Good for newcomers
- name: help wanted
color: '#008672'
description: Extra attention is needed
- name: invalid
color: '#E4E669'
description: This doesn't seem right
- name: question
color: '#D876E3'
description: Further information is requested
- name: wontfix
color: '#FFFFFF'
description: This will not be worked on
78 changes: 78 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "0 0 * * 1"

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["javascript", "typescript"]
# CodeQL supports [ $supported-codeql-languages ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
with:
category: "/language:${{matrix.language}}"
116 changes: 116 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Default

on:
push:
branches-ignore:
- main

jobs:
default:
name: Default
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- uses: actions/checkout@v3

- run: npm install
- run: npm run all

- uses: ./
id: test-1
with:
version: wrong
lenient: false
continue-on-error: true
- run: '[[ "failure" == "${{ steps.test-1.outcome }}" ]]'
- run: '[[ "success" == "${{ steps.test-1.conclusion }}" ]]'

- uses: ./
id: test-2
with:
version: wrong
lenient: 'false'
continue-on-error: true
- run: '[[ "failure" == "${{ steps.test-2.outcome }}" ]]'
- run: '[[ "success" == "${{ steps.test-2.conclusion }}" ]]'

- uses: ./
id: test-3
with:
version: wrong
- run: '[[ "" == "${{ steps.test-3.outputs.release }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.major }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.minor }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.patch }}" ]]'
- run: '[[ "" == "${{ steps.test-3.outputs.any_other_property }}" ]]'

- uses: ./
id: test-4
with:
version: wrong
lenient: true
- run: '[[ "" == "${{ steps.test-4.outputs.release }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.major }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.minor }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.patch }}" ]]'
- run: '[[ "" == "${{ steps.test-4.outputs.any_other_property }}" ]]'

- uses: ./
id: test-5
with:
version: 1.2.3-alpha.gamma+4.5.6
- run: '[[ "1.2.3" == "${{ steps.test-5.outputs.release }}" ]]'
- run: '[[ "1" == "${{ steps.test-5.outputs.major }}" ]]'
- run: '[[ "2" == "${{ steps.test-5.outputs.minor }}" ]]'
- run: '[[ "3" == "${{ steps.test-5.outputs.patch }}" ]]'
- run: '[[ "alpha.gamma" == "${{ steps.test-5.outputs.prerelease }}" ]]'
- run: '[[ "2" == "${{ steps.test-5.outputs.prerelease-parts }}" ]]'
- run: '[[ "alpha" == "${{ steps.test-5.outputs.prerelease-0 }}" ]]'
- run: '[[ "gamma" == "${{ steps.test-5.outputs.prerelease-1 }}" ]]'
- run: '[[ "4.5.6" == "${{ steps.test-5.outputs.build }}" ]]'
- run: '[[ "3" == "${{ steps.test-5.outputs.build-parts }}" ]]'
- run: '[[ "4" == "${{ steps.test-5.outputs.build-0 }}" ]]'
- run: '[[ "5" == "${{ steps.test-5.outputs.build-1 }}" ]]'
- run: '[[ "6" == "${{ steps.test-5.outputs.build-2 }}" ]]'

- uses: ./
id: test-6
with:
version: 1.0.0
compare-to: 2.0.0
- run: '[[ "<" == "${{ steps.test-6.outputs.comparison-result }}" ]]'

- uses: ./
id: test-7
with:
version: 1.2.3
satisfies: 1.x
- run: '[[ "true" == "${{ steps.test-7.outputs.satisfies }}" ]]'

- uses: ./
id: test-8
with:
version: 1.2.3
- run: '[[ "2.0.0" == "${{ steps.test-8.outputs.inc-major }}" ]]'
- run: '[[ "2.0.0-0" == "${{ steps.test-8.outputs.inc-premajor }}" ]]'
- run: '[[ "1.3.0" == "${{ steps.test-8.outputs.inc-minor }}" ]]'
- run: '[[ "1.3.0-0" == "${{ steps.test-8.outputs.inc-preminor }}" ]]'
- run: '[[ "1.2.4" == "${{ steps.test-8.outputs.inc-patch }}" ]]'
- run: '[[ "1.2.4-0" == "${{ steps.test-8.outputs.inc-prepatch }}" ]]'
- run: '[[ "1.2.4-0" == "${{ steps.test-8.outputs.inc-prerelease }}" ]]'

actions-typing:
name: Validate actions typing
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- uses: actions/checkout@v3
- uses: krzema12/github-actions-typing@v1
Loading