Skip to content

Commit

Permalink
refactor: big cleanup plus updates
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Correa Casablanca <[email protected]>
  • Loading branch information
castarco committed Aug 8, 2024
1 parent 0fa900b commit 86e0ab7
Show file tree
Hide file tree
Showing 63 changed files with 1,351 additions and 3,083 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ trim_trailing_whitespace = true
[*.md]
indent_style = space
indent_size = 2

[package.json]
indent_style = space
indent_size = 2
7 changes: 4 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
build:
strategy:
matrix:
node-version: [ 18, 20 ]
os: [ubuntu-22.04, ubuntu-20.04, windows-latest, macos-12, macos-11]
node-version: [ 18, 20, 22 ]
os: [ubuntu-latest, windows-latest, macos-latest]
pnpm: ['9.7.0']

runs-on: ${{ matrix.os }}

Expand All @@ -31,7 +32,7 @@ jobs:
- name: Install PNPM # v3.0.0
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d
with:
version: '9.0.6'
version: ${{ matrix.pnpm }}
- name: Use Node.js ${{ matrix.node-version }} # v4.0.2
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
Expand Down
26 changes: 20 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
# Macos
.DS_Store

# Caches & Artifacts
.turbo/
coverage/
dist/
# Vendored Packages
node_modules/
.eslintcache

# Build Artifacts
.rollup.cache/
.tsbuildinfo
.turbo/
.turbo-build.log
tsconfig.tsbuildinfo
dist/

# Tests Coverage
coverage/

# Local .env files
.env

# Logs
*.log

# IDEs
.idea
this.code-workspace
2 changes: 1 addition & 1 deletion .hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -eu
set -o pipefail

pnpm turbo lint
pnpm turbo all
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.8.1
22.6.0
1 change: 1 addition & 0 deletions @coderspirit/dev-configs/.node-version
68 changes: 68 additions & 0 deletions @coderspirit/dev-configs/biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"include": [
"*.json",
"*.jsonc",
"*.js",
"*.mjs",
"*.cjs",
"*.jsx",
"*.ts",
"*.mts",
"*.cts",
"*.tsx",
"*.d.ts",
"*.d.mts",
"*.d.cts",
"*.md",
"*.mdx",
"*.astro",
"*.vue",
"*.svelte"
],
"ignore": ["coverage/**/*", "dist/**/*", "node_modules/**/*"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"all": true,
"noNodejsModules": "off"
},
"performance": { "all": true },
"security": { "all": true },
"style": { "all": true, "useNamingConvention": "off" },
"suspicious": { "all": true }
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 80,
"lineEnding": "lf"
},
"javascript": {
"formatter": {
"enabled": true,
"arrowParentheses": "asNeeded",
"semicolons": "asNeeded",
"trailingCommas": "all",
"quoteProperties": "asNeeded",
"quoteStyle": "single",
"jsxQuoteStyle": "single"
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"defaultBranch": "main",
"useIgnoreFile": true
}
}
18 changes: 18 additions & 0 deletions @coderspirit/dev-configs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@coderspirit/dev-configs",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
"./biome": "./biome.jsonc",
"./tsconfig": "./tsconfig.json"
},
"scripts": {
"format": "pnpm biome check --write --files-ignore-unknown=true .",
"format-staged": "biome-check-staged",
"lint": "pnpm biome check --files-ignore-unknown=true ."
},
"devDependencies": {
"@biomejs/biome": "1.8.3"
}
}
52 changes: 52 additions & 0 deletions @coderspirit/dev-configs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */

/* Projects */
"incremental": true,

/* Language and Environment */
"target": "es2020",
"lib": ["es2020", "DOM", "DOM.Iterable"],

/* Modules */
"module": "es2020",
"moduleResolution": "Bundler",
"allowArbitraryExtensions": true,
"allowImportingTsExtensions": true,
"resolvePackageJsonExports": true,
"resolvePackageJsonImports": true,
"resolveJsonModule": true,

/* JavaScript Support */
"allowJs": false,
"checkJs": false,

/* Emit */
"noEmit": true,
"tsBuildInfoFile": ".tsbuildinfo",

/* Interop Constraints */
"isolatedModules": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,

/* Declarations */
"declaration": false,
"isolatedDeclarations": false,

/* Type Checking */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,

/* Completeness */
"skipLibCheck": true
}
}
1 change: 1 addition & 0 deletions @coderspirit/internal-tools/.node-version
6 changes: 6 additions & 0 deletions @coderspirit/internal-tools/biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["@coderspirit/dev-configs/biome"],
"files": {
"ignore": [".turbo/**/*", "coverage-unit/**/*", "node_modules/**/*"]
}
}
17 changes: 17 additions & 0 deletions @coderspirit/internal-tools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@coderspirit/internal-tools",
"private": true,
"type": "module",
"bin": {
"biome-check-staged": "./src/biome-check-staged.ts"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@coderspirit/dev-configs": "workspace:*"
},
"scripts": {
"format": "pnpm biome check --write --files-ignore-unknown=true .",
"format-staged": "biome-check-staged",
"lint": "pnpm biome check --files-ignore-unknown=true ."
}
}
47 changes: 47 additions & 0 deletions @coderspirit/internal-tools/src/biome-check-staged.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env -S deno run --no-config --allow-env --allow-read --allow-sys --allow-run
import process from 'node:process'
import { $ } from 'npm:[email protected]'

const JSON_EXT = 'json|jsonc'
const JS_EXT = 'js|mjs|cjs|jsx'
const TS_EXT = 'ts|mts|cts|tsx|d.ts'
const MARKUP_EXT = 'md|mdx|astro|vue|svelte'
const BIOME_EXTENSIONS = `(${JSON_EXT}|${JS_EXT}|${TS_EXT}|${MARKUP_EXT})`

const extsRegex = new RegExp(BIOME_EXTENSIONS)

const runGitDiffStaged = async (): Promise<string[]> => {
return (
await $`git diff --staged --relative --name-only --diff-filter=ACMR`
).lines()
}

export const main = async () => {
const stagedFiles = (await runGitDiffStaged()).filter(file =>
extsRegex.test(file),
)

if (stagedFiles.length === 0) {
return
}

const processOutput =
await $`pnpm biome check --write --no-errors-on-unmatched --files-ignore-unknown=true ${stagedFiles}`.stdio(
'inherit',
'inherit',
'inherit',
)

if (processOutput.exitCode !== null && processOutput.exitCode !== 0) {
process.exit(processOutput.exitCode)
}

await $`git add ${stagedFiles}`
}

try {
await main()
} catch (err) {
console.error(err)
process.exit(1)
}
1 change: 1 addition & 0 deletions @coderspirit/lambda-ioc/.node-version
29 changes: 29 additions & 0 deletions @coderspirit/lambda-ioc/biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"extends": ["@coderspirit/dev-configs/biome"],
"overrides": [
{
"include": ["*.ts", "*.mts", "*.cts", "*.tsx"],
"linter": {
"rules": {
"complexity": { "useLiteralKeys": "off" }
}
}
},
{
"include": ["*.test.ts", "*.test.mts"],
"linter": {
"rules": {
"style": { "noParameterProperties": "off" }
}
}
},
{
"include": ["rollup.config.mjs", "vitest.config.mts"],
"linter": {
"rules": {
"style": { "noDefaultExport": "off" }
}
}
}
]
}
41 changes: 23 additions & 18 deletions @coderspirit/lambda-ioc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@
"name": "@coderspirit/lambda-ioc",
"version": "2.2.1",
"description": "Super type safe dependency injection 💉 for TypeScript",
"keywords": [
"typescript",
"functional",
"ioc",
"di",
"dependency injection"
],
"keywords": ["typescript", "functional", "ioc", "di", "dependency injection"],
"author": "Andres Correa Casablanca <[email protected]>",
"private": false,
"license": "MIT",
"main": "./dist/main.cjs",
"module": "./dist/main.mjs",
"types": "./dist/main.d.cts",
"files": [
"dist"
],
"files": ["dist"],
"exports": {
"import": {
"types": "./dist/main.d.mts",
Expand All @@ -29,18 +21,31 @@
}
},
"scripts": {
"build": "rm -rf dist && rollup --config rollup.config.prod.mjs",
"lint:_all": "pnpm run lint:tsc && pnpm run lint:biome && pnpm run lint:publint",
"lint:biome": "biome lint .",
"build": "rm -rf dist/* && rollup --config rollup.config.mjs",
"format": "pnpm biome check --write --files-ignore-unknown=true .",
"format-staged": "biome-check-staged",
"lint": "pnpm lint:biome",
"lint:biome": "pnpm biome check --files-ignore-unknown=true .",
"lint:publint": "publint",
"lint:tsc": "tsc",
"test": "vitest run",
"prepublishOnly": "pnpm run build"
"prepublishOnly": "turbo lint && turbo build",
"test": "vitest -c vitest.config.mts run",
"test:cov": "vitest -c vitest.config.mts run --coverage",
"typecheck": "tsc --incremental true --tsBuildInfoFile .tsbuildinfo --noEmit -p ./tsconfig.json"
},
"devDependencies": {
"@coderspirit/eslint-config": "^2.0.0",
"@arethetypeswrong/cli": "^0.15.4",
"@biomejs/biome": "1.8.3",
"@coderspirit/dev-configs": "workspace:*",
"@coderspirit/internal-tools": "workspace:*",
"get-tsconfig": "^4.7.6",
"publint": "^0.2.9",
"rollup": "^4.20.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"tslib": "^2.6.3",
"turbo": "^2.0.12",
"typescript": "^5.5.4",
"vitest": "^1.6.0"
"vitest": "^2.0.5"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 86e0ab7

Please sign in to comment.