From 9c2a87616026e36542ee6cb18584cc747ef3099d Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Fri, 20 Sep 2024 08:54:29 -0500 Subject: Move node packages to src/ At least pretend to make it clean Signed-off-by: Matt Strapp --- src/packages/eslint-config/README.md | 3 +++ src/packages/eslint-config/library.js | 34 +++++++++++++++++++++++++++++ src/packages/eslint-config/package.json | 17 +++++++++++++++ src/packages/locusts/.eslintrc.js | 9 ++++++++ src/packages/locusts/package.json | 32 +++++++++++++++++++++++++++ src/packages/locusts/src/index.ts | 15 +++++++++++++ src/packages/locusts/tests/locusts.test.ts | 9 ++++++++ src/packages/locusts/tsconfig.json | 13 +++++++++++ src/packages/typescript-config/base.json | 20 +++++++++++++++++ src/packages/typescript-config/package.json | 9 ++++++++ 10 files changed, 161 insertions(+) create mode 100644 src/packages/eslint-config/README.md create mode 100644 src/packages/eslint-config/library.js create mode 100644 src/packages/eslint-config/package.json create mode 100644 src/packages/locusts/.eslintrc.js create mode 100644 src/packages/locusts/package.json create mode 100644 src/packages/locusts/src/index.ts create mode 100644 src/packages/locusts/tests/locusts.test.ts create mode 100644 src/packages/locusts/tsconfig.json create mode 100644 src/packages/typescript-config/base.json create mode 100644 src/packages/typescript-config/package.json (limited to 'src') diff --git a/src/packages/eslint-config/README.md b/src/packages/eslint-config/README.md new file mode 100644 index 0000000..8b42d90 --- /dev/null +++ b/src/packages/eslint-config/README.md @@ -0,0 +1,3 @@ +# `@turbo/eslint-config` + +Collection of internal eslint configurations. diff --git a/src/packages/eslint-config/library.js b/src/packages/eslint-config/library.js new file mode 100644 index 0000000..9b59cc0 --- /dev/null +++ b/src/packages/eslint-config/library.js @@ -0,0 +1,34 @@ +const { resolve } = require("node:path"); + +const project = resolve(process.cwd(), "tsconfig.json"); + +/** @type {import("eslint").Linter.Config} */ +module.exports = { + extends: ["eslint:recommended", "prettier", "turbo"], + plugins: ["only-warn"], + globals: { + React: true, + JSX: true, + }, + env: { + node: true, + }, + settings: { + "import/resolver": { + typescript: { + project, + }, + }, + }, + ignorePatterns: [ + // Ignore dotfiles + ".*.js", + "node_modules/", + "dist/", + ], + overrides: [ + { + files: ["*.js?(x)", "*.ts?(x)"], + }, + ], +}; diff --git a/src/packages/eslint-config/package.json b/src/packages/eslint-config/package.json new file mode 100644 index 0000000..395c345 --- /dev/null +++ b/src/packages/eslint-config/package.json @@ -0,0 +1,17 @@ +{ + "name": "@repo/eslint-config", + "version": "0.0.0", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "8.6.0", + "@typescript-eslint/parser": "8.6.0", + "@vercel/style-guide": "6.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-config-turbo": "^2.1.2", + "eslint-plugin-only-warn": "^1.1.0", + "typescript": "^5.6.2" + }, + "files": [ + "library.js" + ], + "private": true +} diff --git a/src/packages/locusts/.eslintrc.js b/src/packages/locusts/.eslintrc.js new file mode 100644 index 0000000..1de713c --- /dev/null +++ b/src/packages/locusts/.eslintrc.js @@ -0,0 +1,9 @@ +/** @type {import("eslint").Linter.Config} */ +module.exports = { + root: true, + extends: ["@repo/eslint-config/library.js"], + parser: "@typescript-eslint/parser", + parserOptions: { + project: true, + }, +}; \ No newline at end of file diff --git a/src/packages/locusts/package.json b/src/packages/locusts/package.json new file mode 100644 index 0000000..5a3a75d --- /dev/null +++ b/src/packages/locusts/package.json @@ -0,0 +1,32 @@ +{ + "name": "locusts", + "description": "An npm package that introduces locusts into your codebase.", + "version": "1.0.0", + "author": "Matt Strapp (https://mattstrapp.net)", + "bugs": "https://github.com/locusts-r-us/locusts/issues", + "devDependencies": { + "@repo/eslint-config": "workspace:*", + "@repo/typescript-config": "workspace:*", + "@types/node": "^22.5.5", + "tsup": "^8.3.0", + "tsx": "^4.19.1", + "typescript": "^5.6.2" + }, + "keywords": [], + "license": "0BSD", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "repository": { + "type": "git", + "url": "git+https://github.com/locusts-r-us/locusts.git", + "directory": "packages/locusts" + }, + "scripts": { + "build": "tsup src/index.ts --format cjs,esm --dts", + "dev": "tsup src/index.ts --format cjs,esm --dts --watch", + "lint": "eslint src --fix", + "lint:ci": "eslint src", + "test": "node --test --import tsx ./tests/locusts.test.ts" + }, + "types": "./dist/index.d.ts" +} diff --git a/src/packages/locusts/src/index.ts b/src/packages/locusts/src/index.ts new file mode 100644 index 0000000..d78bab8 --- /dev/null +++ b/src/packages/locusts/src/index.ts @@ -0,0 +1,15 @@ +/** + * Introduce locusts into your codebase. + * @remarks + * Locusts are not included in this package. You must provide your own locusts. + * @public + * @example + * ```js + * import introduceLocusts from 'locusts'; + * introduceLocusts(); + * ``` + * @returns void + */ +export default function introduceLocusts() { + // This space intentionally left blank +} \ No newline at end of file diff --git a/src/packages/locusts/tests/locusts.test.ts b/src/packages/locusts/tests/locusts.test.ts new file mode 100644 index 0000000..7875cbd --- /dev/null +++ b/src/packages/locusts/tests/locusts.test.ts @@ -0,0 +1,9 @@ +import { describe, it } from "node:test"; +import introduceLocusts from "../src/index.ts"; + +describe("Locusts", () => { + it("should be able to be introduced to the environment", () => { + introduceLocusts(); + // Test code here + }); +}); diff --git a/src/packages/locusts/tsconfig.json b/src/packages/locusts/tsconfig.json new file mode 100644 index 0000000..0a5c316 --- /dev/null +++ b/src/packages/locusts/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "@repo/typescript-config/base.json", + "compilerOptions": { + "outDir": "dist" + }, + "include": [ + "src" + ], + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/src/packages/typescript-config/base.json b/src/packages/typescript-config/base.json new file mode 100644 index 0000000..0f80cfd --- /dev/null +++ b/src/packages/typescript-config/base.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Default", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "incremental": false, + "isolatedModules": true, + "lib": ["es2022", "DOM", "DOM.Iterable"], + "module": "NodeNext", + "moduleDetection": "force", + "moduleResolution": "NodeNext", + "noUncheckedIndexedAccess": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "ES2022" + } +} diff --git a/src/packages/typescript-config/package.json b/src/packages/typescript-config/package.json new file mode 100644 index 0000000..d658269 --- /dev/null +++ b/src/packages/typescript-config/package.json @@ -0,0 +1,9 @@ +{ + "name": "@repo/typescript-config", + "version": "0.0.0", + "license": "MIT", + "private": true, + "publishConfig": { + "access": "public" + } +} -- cgit v1.2.3