Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for types and CI/CD workflows #81

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package to NPM

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- id: checkout
name: Checkout code
uses: actions/checkout@v4
- id: setup-nodejs
name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- id: install-dependencies
name: Install dependencies
run: npm ci
- id: publish
name: Publish
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
26 changes: 16 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Testing CI

on: pull_request

concurrency:
group: "${{ github.workflow }} at ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
Expand All @@ -16,16 +20,18 @@ jobs:
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
- id: checkout
name: Checkout code
uses: actions/checkout@v4
- id: setup-nodejs
name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm test
cache: 'npm'
- id: install-dependencies
name: Install dependencies
run: npm ci
- id: test
name: Test
run: npm test
9 changes: 6 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules
*.log
.DS_Store
.github
.editorconfig
.eslintrc.json
.gitattributes
.prettierignore
.prettierrc
46 changes: 24 additions & 22 deletions concolor.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
type Strings = string | Array<string>;
type TagFuction = (strings: Strings, ...values: Array<any>) => string;
type TagFunctionString = string | TemplateStringsArray | ReadonlyArray<string>;
type TagFunction = (strings: TagFunctionString, ...values: ReadonlyArray<any>) => string;

interface Concolor {
b: TagFuction;
i: TagFuction;
u: TagFuction;
em: TagFuction;
error: TagFuction;
info: TagFuction;
warn: TagFuction;
debug: TagFuction;
succes: TagFuction;
fail: TagFuction;
red: TagFuction;
green: TagFuction;
yellow: TagFuction;
blue: TagFuction;
magenta: TagFuction;
cyan: TagFuction;
white: TagFuction;
declare function concolor(strings: string): TagFunction;
declare function concolor(strings: Record<string, string>): TagFunction;
declare function concolor(strings: TemplateStringsArray, ...values: ReadonlyArray<any>): string;
declare namespace concolor {
export const b: TagFunction;
export const i: TagFunction;
export const u: TagFunction;
export const em: TagFunction;
export const error: TagFunction;
export const info: TagFunction;
export const warn: TagFunction;
export const debug: TagFunction;
export const success: TagFunction;
export const fail: TagFunction;
export const red: TagFunction;
export const green: TagFunction;
export const yellow: TagFunction;
export const blue: TagFunction;
export const magenta: TagFunction;
export const cyan: TagFunction;
export const white: TagFunction;
}

export const concolor: TagFuction | Concolor;
export = concolor;
Loading