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
50 changes: 25 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on: push

jobs:
lint-test:
lint-test-build-publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
Expand Down Expand Up @@ -40,31 +40,31 @@ jobs:
- name: Run unit tests
run: yarn test

# - name: Build library
# run: yarn build
- name: Build library
run: yarn build

# - name: Publish library
# if: ${{ github.ref == 'refs/heads/main' }}
# run: yarn publish --access=public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish library
if: ${{ github.ref == 'refs/heads/main' }}
run: yarn publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# notify:
# needs: lint-test-build-publish
# if: github.ref == 'refs/heads/main'
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
notify:
needs: lint-test-build-publish
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2

# - name: Get package info
# id: package
# uses: codex-team/action-nodejs-package-info@v1
- name: Get package info
id: package
uses: codex-team/action-nodejs-package-info@v1

# - name: Send a message
# uses: codex-team/action-codexbot-notify@v1
# with:
# webhook: ${{ secrets.CODEX_BOT_WEBHOOK }}
# message: '📦 [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) ${{ steps.package.outputs.version }} was published'
# parse_mode: 'markdown'
# disable_web_page_preview: true
- name: Send a message
uses: codex-team/action-codexbot-notify@v1
with:
webhook: ${{ secrets.CODEX_BOT_WEBHOOK_HAWK }}
message: '📦 [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) ${{ steps.package.outputs.version }} was published'
parse_mode: 'markdown'
disable_web_page_preview: true
220 changes: 199 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

66 changes: 37 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
# @codexteam/typescript-lib-template
A quick start template for a new TypeScript library

[![NPM version](https://img.shields.io/npm/v/@codexteam/typescript-lib-template?style=flat-square)](https://www.npmjs.com/package/@codexteam/typescript-lib-template)
[![License](https://img.shields.io/npm/l/@codexteam/typescript-lib-template?style=flat-square)](https://www.npmjs.com/package/@codexteam/typescript-lib-template)

## Features

- 💄 Yarn 4
- 🛍️ Yarn Workspaces
- 💎 ESLint 9 with [eslint-config-codex](http://github.com/codex-team/eslint-config/)
- 🥃 Typescript 5
- 🥊 npx only-allow yarn
- 🌶️ Tests with [Vitest](https://vitest.dev)
- 🍀 GitHub Actions for test/lint/build/publish purposes

## How to use
1. Click [here](https://github.com/codex-team/typescript-lib-template/generate) and fill setting for new repository
2. Update root package `package.json`, change main package name
3. Update "core" package `package.json`:
1. Change `name`
2. Adjust `main`, `types`, `exports`
5. Change name of `packages/core` to your main package name
5. Go to `packages/utils` and adjust its name or remove the package if you don't need it
3. Change NPM package scope from [workflow file](./.github/workflows/main.yml) or remove it
4. Fill `NPM_TOKEN` and `CODEX_BOT_WEBHOOK` secrets in your repository or organization settings
5. Start writing your new library!

# About CodeX
# @hawk.so/kit

Set of packages for Hawk services development (monorepo).

## Packages

- **[@hawk.so/utils](./packages/utils)** — shared utilities for Hawk packages.
- `hasValue` — check that a value is not `undefined`, `null`, or empty string.
- `TimeMs` — enum of time intervals in milliseconds (Second, Minute, Hour, Day, Week).

- **[@hawk.so/github-sdk](./packages/github)** — GitHub API client for Hawk.
- `GitHubService` — GitHub App (installation, installations, repositories).
- Create and manage issues, assign Copilot to an issue.
- OAuth: exchange code for token, refresh token, validate user token.
- `normalizeGitHubPrivateKey` — normalize PEM key from env (base64, quotes, `\n`).
- Types: `GitHubServiceConfig`, `OAuthTokens`, `GitHubUser`, `ValidateUserTokenResult`, `Repository`, `Installation`, `GitHubIssue`, `IssueData`.

## Requirements

- Node.js >= 22.0.0
- Yarn 4 (Corepack enabled in repo)

## Commands

```bash
yarn install # install dependencies
yarn build # build all packages
yarn lint # lint (build + eslint across packages)
yarn test # run tests
yarn clean # remove dist and tsbuildinfo
```

## License

AGPL-3.0

## About CodeX

<img align="right" width="120" height="120" src="https://codex.so/public/app/img/codex-logo.svg" hspace="50">

Expand Down
12 changes: 10 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const __dirname = path.dirname(__filename);
export default [
...CodeX,
...EslintTestsConfig,
/* n/no-missing-import resolves from file dir and misses workspace deps; TypeScript validates imports via projectService */
{
name: 'codex-lib-ts-workspace-resolve',
files: ['packages/**/*.ts'],
rules: {
'n/no-missing-import': 'off',
},
},
{
name: 'codex-lib-ts',
ignores: [
Expand All @@ -25,8 +33,8 @@ export default [
languageOptions: {
parser: TsParser,
parserOptions: {
project: path.resolve(__dirname, 'tsconfig.json'),
tsconfigRootDir: './',
project: path.join(__dirname, 'tsconfig.eslint.json'),
tsconfigRootDir: __dirname,
sourceType: 'module',
},
},
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"name": "@codexteam/typescript-lib-template",
"version": "2.0.0",
"description": "A quick start template for a new TypeScript library",
"repository": "https://github.com/codex-team/typescript-lib-template.git",
"name": "@hawk.so/kit",
"private": true,
"description": "Set of utils for Hawk services development",
"repository": "https://github.com/codex-team/hawk.kit",
"author": "CodeX <team@codex.so>",
"license": "MIT",
"license": "AGPL-3.0",
"engines": {
"node": ">=22.0.0"
},
"workspaces": [
"packages/*"
],
"scripts": {
"build": "yarn workspaces foreach -At run build",
"clean": "rimraf -g \"packages/**/dist\" \"packages/**/*.tsbuildinfo\"",
"lint": "yarn workspaces foreach -A run lint",
"lint:fix": "yarn workspaces foreach -A run lint --fix",
"lint": "yarn workspaces foreach -At run build && yarn workspaces foreach -A run lint",
"lint:fix": "yarn workspaces foreach -At run build && yarn workspaces foreach -A run lint --fix",
"test": "vitest --watch=false",
"coverage": "vitest --watch=false --coverage",
"preinstall": "npx only-allow yarn"
Expand Down
3 changes: 0 additions & 3 deletions packages/core/README.md

This file was deleted.

36 changes: 0 additions & 36 deletions packages/core/package.json

This file was deleted.

8 changes: 0 additions & 8 deletions packages/core/src/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/core/tests/index.test.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/core/tsconfig.build.json

This file was deleted.

Loading
Loading