Skip to content

Commit

Permalink
Merge pull request #1 from codex-team/2.0
Browse files Browse the repository at this point in the history
feat: 2.0
  • Loading branch information
neSpecc authored Nov 9, 2024
2 parents a060a6c + 6ca3742 commit 09cb818
Show file tree
Hide file tree
Showing 25 changed files with 4,788 additions and 4,910 deletions.
8 changes: 0 additions & 8 deletions .eslintrc

This file was deleted.

70 changes: 36 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,68 @@ name: CI
on: push

jobs:
lint-test-build-publish:
lint-test:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 14
node-version-file: .nvmrc
registry-url: 'https://registry.npmjs.org'
scope: '@codexteam'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore Yarn cache
uses: actions/cache@v2
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
path: .yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Enable Corepack
run: corepack enable

- name: Use specified Yarn version
run: corepack prepare yarn@4.5.1 --activate

- name: Install dependecies
run: yarn install

- name: Test Eslint
run: yarn lint:test
run: yarn lint

- 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 }}
# message: '📦 [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) ${{ steps.package.outputs.version }} was published'
# parse_mode: 'markdown'
# disable_web_page_preview: true
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ tests/
.git
.github
yarn.lock
eslint.config.mjs
vitest.config.ts
vitest.workspace.ts
*.test.ts
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.1.0
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
# typescript-lib-template
# @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. Change package name in `package.json` and other fields if necessary
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!

## Features

- TypeScript support
- ESlint support with [eslint-config-codex](http://github.com/codex-team/eslint-config/)
- Unit testing with [Jest](http://jestjs.io)
- GitHub Actions configuration for test/lint/build/publish purposes

## About team
# About CodeX

We are CodeX and we build products for developers and makers.
<img align="right" width="120" height="120" src="https://codex.so/public/app/img/codex-logo.svg" hspace="50">

Follow us on Twitter: [twitter.com/codex_team](https://twitter.com/codex_team)
CodeX is a team of digital specialists around the world interested in building high-quality open source products on a global market. We are [open](https://codex.so/join) for young people who want to constantly improve their skills and grow professionally with experiments in cutting-edge technologies.

Feel free to contact: <a href="mailto:team@codex.so?subject=Editor.js feedback">team@codex.so</a>
| 🌐 | Join 👋 | Twitter | Instagram |
| -- | -- | -- | -- |
| [codex.so](https://codex.so) | [codex.so/join](https://codex.so/join) |[@codex_team](http://twitter.com/codex_team) | [@codex_team](http://instagram.com/codex_team/) |

[codex.so](https://codex.so)
37 changes: 37 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import CodeX from 'eslint-config-codex';
import { plugin as TsPlugin, parser as TsParser } from 'typescript-eslint';
import path from 'path';
import { fileURLToPath } from 'url';
import EslintTestsConfig from './eslint.config.test.mjs';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export default [
...CodeX,
...EslintTestsConfig,
{
name: 'codex-lib-ts',
ignores: [
// 'eslint.config.mjs',
],
plugins: {
'@typescript-eslint': TsPlugin,
},

/**
* This are the options for typescript files
*/
languageOptions: {
parser: TsParser,
parserOptions: {
project: path.resolve(__dirname, 'tsconfig.json'),
tsconfigRootDir: './',
sourceType: 'module',
},
},

rules: {
},
},
];
11 changes: 11 additions & 0 deletions eslint.config.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default [
{
name: 'codex-lib-tests',
files: [
'packages/**/*.test.ts',
],
rules: {
'n/no-missing-import': 'off',
},
},
];
Loading

0 comments on commit 09cb818

Please sign in to comment.