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
63 changes: 0 additions & 63 deletions .eslintrc.js

This file was deleted.

59 changes: 10 additions & 49 deletions .github/workflows/deploy-release.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,17 @@
name: Release deploy
name: Deploy release

on:
release:
types:
- published

jobs:
deploy-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |-
npm ci
rm -rf ~/.npmrc

- name: Build package
run: |-
npm run build

- name: Prepare release
run: |-
cp package.json README.md build/
cd build
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json

- name: Publish pre-release to NPM
if: ${{ github.event.release.prerelease }}
run: |-
cd build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public --tag next
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish release to NPM
if: ${{ !github.event.release.prerelease }}
run: |-
cd build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy:
uses: croct-tech/shared-public-configs/.github/workflows/publish-public-npm-package.yml@master
with:
prepare-script: >-
cp package.json README.md build/ &&
cd build &&
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release Drafter
name: Draft release

on:
push:
Expand All @@ -8,7 +8,7 @@ on:
- '**'

jobs:
release-draft:
draft:
runs-on: ubuntu-latest
steps:
- name: Update release draft
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Guidelines
name: Notify guidelines

on:
pull_request:
types:
- opened
jobs:
send-guidelines:
notify:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/auto-comment@v1
Expand Down
97 changes: 6 additions & 91 deletions .github/workflows/validate-branch.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Validations
name: Validate branch

on:
push:
tags-ignore:
- "**"
- '**'
branches:
- master
pull_request:
Expand All @@ -16,92 +16,7 @@ concurrency:
cancel-in-progress: true

jobs:
check-vulnerabilities:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Check dependency vulnerabilities
run: |-
npm i -g npm-audit-resolver@3.0.0-7
npx check-audit --omit dev

validate-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Check compilation errors
run: npm run validate

check-code-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Check coding standard violations
run: npm run lint

run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Run tests
run: npm run test
validate:
uses: croct-tech/shared-public-configs/.github/workflows/javascript-validations.yml@master
with:
use-private-registry: false
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Commit style
name: Validate commits

on:
pull_request:
Expand All @@ -13,7 +13,7 @@ on:
- 'dev/*'

jobs:
check-commit-style:
validate:
runs-on: ubuntu-latest
steps:
- name: Check
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Label requirements
name: Validate labels
on:
pull_request:
types:
Expand All @@ -9,8 +9,7 @@ on:
- unlabeled

jobs:
check-labels:
name: Check labels
validate:
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
Expand Down
57 changes: 57 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { defineConfig } from 'eslint/config';
import { configs } from '@croct/eslint-plugin';

export default defineConfig(
configs.typescript,
{
files: ['src/**/*.ts'],
rules: {
'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[arguments.length=0] '
+ "> MemberExpression[object.name='Instant'][property.name='now']",
message: 'Do not use Instant.now without a clock.',
},
{
selector: 'CallExpression[arguments.length=0] '
+ "> MemberExpression[object.name='LocalDateTime'][property.name='now']",
message: 'Do not use LocalDateTime.now without a clock.',
},
{
selector: 'CallExpression[arguments.length=1] '
+ "> MemberExpression[object.name='LocalDateTime'][property.name='nowIn']",
message: 'Do not use LocalDateTime.nowIn without a clock.',
},
{
selector: 'CallExpression[arguments.length=0] '
+ "> MemberExpression[object.name='Date'][property.name='now']",
message: 'Do not use Date.now, use a clock.',
},
{
selector: "NewExpression[callee.name='Date']",
message: 'Do not create a Date instance, use a clock.',
},
],
'@typescript-eslint/unbound-method': 'off',
},
},
{
files: ['test/**/*.ts'],
rules: {
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.object.name='jest'][callee.property.name='spyOn'] "
+ "> Identifier[name='Instant'] ~ Literal[value='now']",
message: 'Do not mock Instant.now, use a FixedClock.',
},
{
selector: "CallExpression[callee.object.name='jest'][callee.property.name='spyOn'] "
+ "> Identifier[name='LocalDateTime'] ~ Literal[value='now']",
message: 'Do not mock LocalDateTime.now, use a FixedClock.',
},
],
},
}
);
Loading
Loading