chore: initial setup

That sweet sweet bunch of JS dotfiles
This commit is contained in:
Gustavo "Guz" L. de Mello
2024-01-18 00:20:38 -03:00
parent f00b271799
commit e167378d27
17 changed files with 4387 additions and 0 deletions

8
.changeset/README.md Normal file
View File

@@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

11
.changeset/config.json Normal file
View File

@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}

16
.editorconfig Normal file
View File

@@ -0,0 +1,16 @@
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_style = space

49
.github/actions/pnpm-setup/action.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
name: PNPM Setup
inputs:
node-version:
required: false
type: number
default: 18
pnpm-version:
required: false
type: number
default: 8
install-deps:
required: false
type: boolean
default: true
runs:
using: composite
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: Install PNPM
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: ${{ inputs.pnpm-version }}
run_install: false
- name: Get store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
if: inputs.install-deps
run: pnpm install
shell: bash

51
.github/workflows/checks.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: 🧪 Code checking
on:
push:
branches:
- dev
- main
- changeset-release/main
pull_request:
branches:
- dev
- main
- changeset-release/main
types:
- opened
- synchronize
- reopened
jobs:
linting:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup environment
uses: ./.github/actions/pnpm-setup
- name: Run ESLint
run: pnpm run lint
vitest:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup environment
uses: ./.github/actions/pnpm-setup
- name: Run Vitests
run: pnpm run test

15
.github/workflows/mirror.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: 🪞 Repository Mirrors
on:
push:
branches:
- main
- dev
jobs:
mirror:
if: github.repository == 'loreddev/lilbetter.js'
uses: loreddev/.github/.github/workflows/mirrors.yml@main
secrets: inherit
with:
codeberg-repo: https://codeberg.org/LoredDev/lilbetter.js

49
.github/workflows/release-branch.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
name: 🦋 Release branch
on:
push:
branches:
- dev
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
update-release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
name: Update/Create release branch
env:
HUSKY: 0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/pnpm-setup
- name: Update release PR
id: changesets
uses: loreddev/changeset-action@main
with:
branch: main
commit: 'ci: 👷🦋 version packages'
title: 🦋 Release branch
publish: pnpm run release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update dev branch
if: steps.changesets.outputs.hasChangesets == 'false'
uses: devmasx/merge-branch@master
with:
type: now
from_branch: changeset-release/main
target_branch: dev
message: 'ci: 👷 update dev branch'
github_token: ${{ secrets.GITHUB_TOKEN }}

34
.github/workflows/release-preview.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: 👷 Release preview
on:
workflow_run:
workflows:
- 🧪 Code checking
types:
- completed
branches:
- dev
jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'loreddev/marknow' }}
name: Release preview
env:
HUSKY: 0
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/pnpm-setup
- name: Update versions
run: pnpm changeset version --snapshot next
- name: Release packages
run: pnpm run release --tag next
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

6
.husky/pre-commit Normal file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm dlx commitlint --edit ${1}
pnpm dlx lint-staged

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm dlx devmoji -e --lint

6
commitlint.config.cjs Normal file
View File

@@ -0,0 +1,6 @@
/* eslint-disable import/no-commonjs */
/** @type {import('@commitlint/types').UserConfig) */
const config = { extends: ['@commitlint/config-conventional'] };
module.exports = config;

8
eslint.config.js Normal file
View File

@@ -0,0 +1,8 @@
import { configs, defineConfig, presets } from '@eslegant/js';
export default defineConfig([
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
...presets.strict,
configs.environments.node.strict.default,
]);

23
jsconfig.json Normal file
View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"checkJs": true,
"allowJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"module": "ES2022",
"target": "ES2022",
"alwaysStrict": true
},
"include": [
"./src/**/*.js",
"./eslint.config.js"
],
"exclude": [
"./node_modules/**",
".dist"
]
}

29
package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "lilbetter.js",
"version": "0.0.0",
"description": "",
"main": "./src/index.js",
"scripts": {
"test": "vitest",
"prepare": "husky install",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"release": "changeset publish"
},
"type": "module",
"keywords": [],
"author": "",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@commitlint/config-conventional": "^18.4.4",
"@commitlint/types": "^18.4.4",
"@eslegant/js": "0.0.0-next-20230910004746",
"eslint": "^8.56.0",
"husky": "^8.0.3",
"vitest": "^1.2.1"
}
}

4072
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

0
src/index.js Normal file
View File

6
test/placeholder.test.js Normal file
View File

@@ -0,0 +1,6 @@
import { expect, test } from 'vitest';
test('placeholder', () => {
expect(1).toBe(1);
});