From 2610869fd692b3a0b53dcf3c28464612704e4000 Mon Sep 17 00:00:00 2001 From: Omri Levy Date: Fri, 28 Oct 2022 18:33:11 +0300 Subject: [PATCH 1/3] feat(project): initial commit --- .changeset/strange-buttons-prove.md | 5 + .github/actions/build-action/action.yml | 2 +- .github/actions/format-action/action.yml | 2 +- .github/actions/lint-action/action.yml | 2 +- .github/actions/test-action/action.yml | 2 +- .gitignore | 1 + .nvmrc | 1 + .prettierrc.cjs | 1 + .prettierrc.js | 7 - README.md | 30 ++ commitlint.config.js => commitlint.config.cjs | 0 jest.setup.js | 3 - package.json | 110 ++++--- packages/cli/.eslintrc.cjs | 9 + packages/cli/.prettierrc.cjs | 1 + packages/cli/.turbo/turbo-build.log | 16 + packages/cli/.turbo/turbo-dev.log | 0 packages/cli/.turbo/turbo-start.log | 6 + packages/cli/.turbo/turbo-start:dev.log | 0 packages/cli/README.md | 30 ++ packages/cli/jest.config.cjs | 4 + packages/cli/package.json | 57 ++++ packages/cli/src/index.ts | 77 +++++ packages/cli/src/utils/index.ts | 1 + packages/cli/src/utils/is-tty-error/index.ts | 2 + .../cli/src/utils/is-tty-error/interfaces.ts | 3 + .../src/utils/is-tty-error/is-tty-error.ts | 9 + packages/cli/src/validation/index.ts | 2 + packages/cli/src/validation/methods.ts | 21 ++ packages/cli/src/validation/schemas.ts | 20 ++ packages/cli/tsconfig.cjs.json | 8 + packages/cli/tsconfig.json | 16 + .../config/eslintrc.base.cjs | 1 - packages/config/eslintrc.cli.cjs | 1 + .../config/jest.base.cjs | 2 +- packages/config/jest.cli.cjs | 8 + packages/config/prettierrc.base.cjs | 7 + packages/config/prettierrc.cli.cjs | 1 + packages/tsconfig/tsconfig.base.json | 136 +++++++++ packages/tsconfig/tsconfig.cli.json | 7 + pnpm-lock.yaml | 274 ++++++++++++------ pnpm-workspace.yaml | 2 + src/env/config-env.ts | 3 - src/env/env.ts | 14 - src/env/format-errors.ts | 12 - src/env/index.ts | 1 - src/env/schema.ts | 5 - src/index.ts | 3 - tsconfig.json | 137 +-------- turbo.json | 24 ++ 50 files changed, 751 insertions(+), 335 deletions(-) create mode 100644 .changeset/strange-buttons-prove.md create mode 100644 .nvmrc create mode 100644 .prettierrc.cjs delete mode 100644 .prettierrc.js create mode 100644 README.md rename commitlint.config.js => commitlint.config.cjs (100%) delete mode 100644 jest.setup.js create mode 100644 packages/cli/.eslintrc.cjs create mode 100644 packages/cli/.prettierrc.cjs create mode 100644 packages/cli/.turbo/turbo-build.log create mode 100644 packages/cli/.turbo/turbo-dev.log create mode 100644 packages/cli/.turbo/turbo-start.log create mode 100644 packages/cli/.turbo/turbo-start:dev.log create mode 100644 packages/cli/README.md create mode 100644 packages/cli/jest.config.cjs create mode 100644 packages/cli/package.json create mode 100644 packages/cli/src/index.ts create mode 100644 packages/cli/src/utils/index.ts create mode 100644 packages/cli/src/utils/is-tty-error/index.ts create mode 100644 packages/cli/src/utils/is-tty-error/interfaces.ts create mode 100644 packages/cli/src/utils/is-tty-error/is-tty-error.ts create mode 100644 packages/cli/src/validation/index.ts create mode 100644 packages/cli/src/validation/methods.ts create mode 100644 packages/cli/src/validation/schemas.ts create mode 100644 packages/cli/tsconfig.cjs.json create mode 100644 packages/cli/tsconfig.json rename .eslintrc.js => packages/config/eslintrc.base.cjs (92%) create mode 100644 packages/config/eslintrc.cli.cjs rename jest.config.js => packages/config/jest.base.cjs (96%) create mode 100644 packages/config/jest.cli.cjs create mode 100644 packages/config/prettierrc.base.cjs create mode 100644 packages/config/prettierrc.cli.cjs create mode 100644 packages/tsconfig/tsconfig.base.json create mode 100644 packages/tsconfig/tsconfig.cli.json create mode 100644 pnpm-workspace.yaml delete mode 100644 src/env/config-env.ts delete mode 100644 src/env/env.ts delete mode 100644 src/env/format-errors.ts delete mode 100644 src/env/index.ts delete mode 100644 src/env/schema.ts delete mode 100644 src/index.ts create mode 100644 turbo.json diff --git a/.changeset/strange-buttons-prove.md b/.changeset/strange-buttons-prove.md new file mode 100644 index 0000000..a5b95a7 --- /dev/null +++ b/.changeset/strange-buttons-prove.md @@ -0,0 +1,5 @@ +--- +"@branchlint/cli": patch +--- + +initial release diff --git a/.github/actions/build-action/action.yml b/.github/actions/build-action/action.yml index 1e72d22..83fab2f 100644 --- a/.github/actions/build-action/action.yml +++ b/.github/actions/build-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Build shell: bash - run: pnpm build + run: turbo build diff --git a/.github/actions/format-action/action.yml b/.github/actions/format-action/action.yml index 93d1583..517483d 100644 --- a/.github/actions/format-action/action.yml +++ b/.github/actions/format-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Format shell: bash - run: pnpm format + run: turbo format diff --git a/.github/actions/lint-action/action.yml b/.github/actions/lint-action/action.yml index 09fbfb7..b2b4c42 100644 --- a/.github/actions/lint-action/action.yml +++ b/.github/actions/lint-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Lint shell: bash - run: pnpm lint + run: turbo lint diff --git a/.github/actions/test-action/action.yml b/.github/actions/test-action/action.yml index 3ebf639..dd53a04 100644 --- a/.github/actions/test-action/action.yml +++ b/.github/actions/test-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Test shell: bash - run: pnpm test + run: turbo test diff --git a/.gitignore b/.gitignore index 8ee855e..133af69 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ node_modules *.tgz logs coverage +.turbo diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..d6b2404 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +19 diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 0000000..77cc70c --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1 @@ +module.exports = require('./packages/config/prettierrc.base.cjs') diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 77fee91..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - jsxSingleQuote: true, - trailingComma: "all", - semi: true, - bracketSameLine: false, - singleQuote: true, -} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5833bbf --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# branchlint + +## Description + +A CLI tool to enforce version control branch naming format and structure. Currently uses a format of name/type/subject +transformed to kebab-case. The ability to create and consume different configurations is planned for the future. + +### Example + +john-doe/feat/add-branchlint + +### Installation + +#### pnpm + +```bash +pnpm install @branchlint/cli -D +``` + +#### yarn + +```bash +yarn add @branchlint/cli -D +``` + +#### npm + +```bash +npm install @branchlint/cli --save-dev +``` diff --git a/commitlint.config.js b/commitlint.config.cjs similarity index 100% rename from commitlint.config.js rename to commitlint.config.cjs diff --git a/jest.setup.js b/jest.setup.js deleted file mode 100644 index d03f12b..0000000 --- a/jest.setup.js +++ /dev/null @@ -1,3 +0,0 @@ -import { config } from 'dotenv'; - -config({ path: `.env.test` }); diff --git a/package.json b/package.json index 1c16257..0fdab22 100644 --- a/package.json +++ b/package.json @@ -1,60 +1,50 @@ -{ - "license": "ISC", - "private": false, - "publishConfig": { - "access": "public" - }, - "author": "Omri Levy", - "repository": { - "type": "git", - "url": "https://github.com/Omri-Levy/starter" - }, - "description": "", - "keywords": [], - "name": "starter", - "version": "0.0.0", - "main": "dist/index.js", - "scripts": { - "test": "echo \"will add tests soon\"", - "changeset": "changeset", - "version-packages": "changeset version", - "release": "pnpm build && changeset publish", - "format": "prettier --write './src/**/*.{js,ts}'", - "lint": "eslint './src/**/*.{js,ts}' --fix", - "start": "node dist/index.js", - "dev": "NODE_ENV=development nodemon dist/index.js", - "start:dev": "concurrently -k \"pnpm watch\" \"pnpm dev\"", - "clean": "rimraf dist", - "build": "pnpm clean && tsc", - "watch": "tsc -w", - "prepare": "husky install", - "commit": "git add . && git-cz", - "typecheck": "tsc --noEmit" - }, - "devDependencies": { - "@changesets/changelog-git": "^0.1.12", - "@changesets/cli": "^2.22.0", - "@commitlint/cli": "^17.0.3", - "@commitlint/config-conventional": "^17.0.3", - "@typescript-eslint/eslint-plugin": "^5.0.0", - "commitizen": "^4.2.5", - "concurrently": "^7.3.0", - "cz-conventional-changelog": "^3.3.0", - "editorconfig": "^0.15.3", - "eslint": "^8.0.1", - "eslint-config-prettier": "^8.5.0", - "eslint-config-standard-with-typescript": "^22.0.0", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0", - "eslint-plugin-promise": "^6.0.0", - "husky": "^8.0.1", - "nodemon": "^2.0.19", - "prettier": "^2.7.1", - "rimraf": "^3.0.2", - "typescript": "^4.7.4" - }, - "dependencies": { - "dotenv": "^16.0.1", - "zod": "^3.18.0" - } -} +{ + "license": "ISC", + "private": true, + "name": "branchlint", + "version": "0.0.0", + "scripts": { + "test": "turbo test", + "format": "turbo format", + "lint": "turbo lint", + "start": "turbo start", + "dev": "turbo dev", + "cli:test": "turbo test --filter=cli", + "cli:format": "turbo format --filter=cli", + "cli:lint": "turbo lint --filter=cli", + "cli:build": "turbo build --filter=cli", + "cli:start": "turbo start --filter=cli", + "cli:dev": "turbo dev --filter=cli", + "clean": "turbo clean", + "build": "turbo build", + "prepare": "husky install", + "commit": "git add . && git-cz", + "typecheck": "turbo typecheck", + "changeset": "changeset", + "version-packages": "changeset version", + "release": "pnpm build && changeset publish" + }, + "devDependencies": { + "@changesets/changelog-git": "^0.1.12", + "@changesets/cli": "^2.22.0", + "@commitlint/cli": "^17.0.3", + "@commitlint/config-conventional": "^17.0.3", + "@typescript-eslint/eslint-plugin": "^5.0.0", + "commitizen": "^4.2.5", + "concurrently": "^7.3.0", + "cz-conventional-changelog": "^3.3.0", + "editorconfig": "^0.15.3", + "eslint": "^8.0.1", + "eslint-config-prettier": "^8.5.0", + "eslint-config-standard-with-typescript": "^22.0.0", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0", + "husky": "^8.0.1", + "nodemon": "^2.0.19", + "prettier": "^2.7.1", + "rimraf": "^3.0.2", + "turbo": "^1.6.2", + "typescript": "^4.7.4" + } +} diff --git a/packages/cli/.eslintrc.cjs b/packages/cli/.eslintrc.cjs new file mode 100644 index 0000000..06d37f2 --- /dev/null +++ b/packages/cli/.eslintrc.cjs @@ -0,0 +1,9 @@ +const {parserOptions, ...config} = require('../config/eslintrc.cli.cjs'); + +module.exports = { + ...config, + parserOptions: { + ...parserOptions, + project: `./tsconfig.json`, + } +} diff --git a/packages/cli/.prettierrc.cjs b/packages/cli/.prettierrc.cjs new file mode 100644 index 0000000..42632fa --- /dev/null +++ b/packages/cli/.prettierrc.cjs @@ -0,0 +1 @@ +module.exports = require(`../config/prettierrc.cli.cjs`); diff --git a/packages/cli/.turbo/turbo-build.log b/packages/cli/.turbo/turbo-build.log new file mode 100644 index 0000000..1a961b7 --- /dev/null +++ b/packages/cli/.turbo/turbo-build.log @@ -0,0 +1,16 @@ + +> @branchlint/cli@0.0.0 build /home/o/projects/branchlint/packages/cli +> pnpm clean && pnpm build:cjs && pnpm build:esm + + +> @branchlint/cli@0.0.0 clean /home/o/projects/branchlint/packages/cli +> rimraf dist + + +> @branchlint/cli@0.0.0 build:cjs /home/o/projects/branchlint/packages/cli +> tsc --project tsconfig.cjs.json + + +> @branchlint/cli@0.0.0 build:esm /home/o/projects/branchlint/packages/cli +> tsc --project tsconfig.json + diff --git a/packages/cli/.turbo/turbo-dev.log b/packages/cli/.turbo/turbo-dev.log new file mode 100644 index 0000000..e69de29 diff --git a/packages/cli/.turbo/turbo-start.log b/packages/cli/.turbo/turbo-start.log new file mode 100644 index 0000000..5e995e5 --- /dev/null +++ b/packages/cli/.turbo/turbo-start.log @@ -0,0 +1,6 @@ + +> @branchlint/cli@0.0.0 start /home/o/projects/branchlint/packages/cli +> node dist/cjs/index.js + +22 +👋 What is your name?  diff --git a/packages/cli/.turbo/turbo-start:dev.log b/packages/cli/.turbo/turbo-start:dev.log new file mode 100644 index 0000000..e69de29 diff --git a/packages/cli/README.md b/packages/cli/README.md new file mode 100644 index 0000000..5833bbf --- /dev/null +++ b/packages/cli/README.md @@ -0,0 +1,30 @@ +# branchlint + +## Description + +A CLI tool to enforce version control branch naming format and structure. Currently uses a format of name/type/subject +transformed to kebab-case. The ability to create and consume different configurations is planned for the future. + +### Example + +john-doe/feat/add-branchlint + +### Installation + +#### pnpm + +```bash +pnpm install @branchlint/cli -D +``` + +#### yarn + +```bash +yarn add @branchlint/cli -D +``` + +#### npm + +```bash +npm install @branchlint/cli --save-dev +``` diff --git a/packages/cli/jest.config.cjs b/packages/cli/jest.config.cjs new file mode 100644 index 0000000..e3acab4 --- /dev/null +++ b/packages/cli/jest.config.cjs @@ -0,0 +1,4 @@ +module.exports = { + ...require('../config/jest.cli.cjs'), + rootDir: '.', +} diff --git a/packages/cli/package.json b/packages/cli/package.json new file mode 100644 index 0000000..2b0bf74 --- /dev/null +++ b/packages/cli/package.json @@ -0,0 +1,57 @@ +{ + "license": "ISC", + "private": false, + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "author": "Omri Levy", + "repository": { + "type": "git", + "url": "https://github.com/Omri-Levy/branchlint" + }, + "types": "./dist/cjs/index.d.ts", + "description": "Enforce version control branch naming conventions using a CLI", + "keywords": [ + "cli", + "inquirer", + "git", + "version control", + "branch", + "branch naming conventions", + "lint", + "commitlint", + "conventional commits", + "oss", + "open-source", + "enforce", + "code guidelines" + ], + "name": "@branchlint/cli", + "version": "0.0.0", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "scripts": { + "test": "echo \"will add tests soon\"", + "format": "prettier --write './src/**/*.{js,ts}'", + "lint": "eslint './src/**/*.{js,ts}' --fix", + "prestart": "pnpm build", + "start": "node dist/cjs/index.js", + "dev": "NODE_ENV=development nodemon dist/cjs/index.js", + "clean": "rimraf dist", + "build:cjs": "tsc --project tsconfig.cjs.json", + "build:esm": "tsc --project tsconfig.json", + "build": "pnpm clean && pnpm build:cjs && pnpm build:esm", + "watch": "tsc -w", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "inquirer": "8.0.1", + "lodash": "^4.17.21", + "zod": "^3.19.1" + }, + "devDependencies": { + "@types/inquirer": "^9.0.2", + "@types/lodash": "^4.14.186" + } +} diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts new file mode 100644 index 0000000..39b374a --- /dev/null +++ b/packages/cli/src/index.ts @@ -0,0 +1,77 @@ +import inquirer from 'inquirer'; +import { kebabCase } from 'lodash'; +import { exec } from 'child_process'; +import { isTtyError } from './utils'; +import { nameValidate, subjectValidate } from './validation'; + +void (async () => { + try { + const name = { + type: `input`, + name: `name`, + message: `What is your name?`, + prefix: `👋`, + validate: nameValidate, + }; + const typeOfChange = { + type: `list`, + name: `typeOfChange`, + message: `Select the type of change that you're committing:`, + prefix: `🚧`, + choices: [ + `feat`, + `fix`, + `docs`, + `style`, + `refactor`, + `perf`, + `test`, + `build`, + `ci`, + `chore`, + `revert`, + ], + }; + const branchSubject = { + type: `input`, + name: `branchSubject`, + message: `What is the branch's main subject? (i.e feature's name)`, + prefix: `🏷️`, + validate: subjectValidate, + }; + const shouldCheckout = { + type: `confirm`, + name: `checkout`, + message: `Checkout to new branch?`, + default: true, + prefix: `🍻`, + }; + const { checkout, ...answers } = await inquirer.prompt([ + name, + typeOfChange, + branchSubject, + shouldCheckout, + ]); + const branchName = Object.values(answers as Record) + ?.map(kebabCase) + ?.join(`/`); + const command = (checkout as boolean) + ? `git checkout -b ${branchName}` + : `git branch ${branchName}`; + + exec(command); + console.log(`🎉 Created a branch named ${branchName}`); + } catch (error) { + if (!isTtyError(error)) { + console.error(`💥 Failed to create a branch...`); + + process.exit(1); + } + + if (error.isTtyError) { + console.error( + `Prompt couldn't be rendered in the current environment`, + ); + } + } +})(); diff --git a/packages/cli/src/utils/index.ts b/packages/cli/src/utils/index.ts new file mode 100644 index 0000000..37a5522 --- /dev/null +++ b/packages/cli/src/utils/index.ts @@ -0,0 +1 @@ +export { isTtyError } from './is-tty-error'; diff --git a/packages/cli/src/utils/is-tty-error/index.ts b/packages/cli/src/utils/is-tty-error/index.ts new file mode 100644 index 0000000..c1532e3 --- /dev/null +++ b/packages/cli/src/utils/is-tty-error/index.ts @@ -0,0 +1,2 @@ +export { ITtyError } from './interfaces'; +export { isTtyError } from './is-tty-error'; diff --git a/packages/cli/src/utils/is-tty-error/interfaces.ts b/packages/cli/src/utils/is-tty-error/interfaces.ts new file mode 100644 index 0000000..6c9ef2d --- /dev/null +++ b/packages/cli/src/utils/is-tty-error/interfaces.ts @@ -0,0 +1,3 @@ +export interface ITtyError extends Error { + isTtyError: boolean; +} diff --git a/packages/cli/src/utils/is-tty-error/is-tty-error.ts b/packages/cli/src/utils/is-tty-error/is-tty-error.ts new file mode 100644 index 0000000..e3e6904 --- /dev/null +++ b/packages/cli/src/utils/is-tty-error/is-tty-error.ts @@ -0,0 +1,9 @@ +import { ITtyError } from './interfaces'; + +export const isTtyError = (error: unknown): error is ITtyError => { + return ( + error instanceof Error && + `isTtyError` in error && + typeof (error as any).isTtyError === `boolean` + ); +}; diff --git a/packages/cli/src/validation/index.ts b/packages/cli/src/validation/index.ts new file mode 100644 index 0000000..80819d4 --- /dev/null +++ b/packages/cli/src/validation/index.ts @@ -0,0 +1,2 @@ +export { nameSchema, subjectSchema } from './schemas'; +export { nameValidate, validate, subjectValidate } from './methods'; diff --git a/packages/cli/src/validation/methods.ts b/packages/cli/src/validation/methods.ts new file mode 100644 index 0000000..49b8287 --- /dev/null +++ b/packages/cli/src/validation/methods.ts @@ -0,0 +1,21 @@ +import { nameSchema, subjectSchema } from './schemas'; +import { ZodSchema } from 'zod'; + +export const validate = ( + schema: ZodSchema, + input: string, +): boolean | string => { + const result = schema.safeParse(input); + + if (!result.success) { + return result.error.format()._errors.join(`\n`); + } + + return true; +}; + +export const nameValidate = (input: string): boolean | string => + validate(nameSchema, input); + +export const subjectValidate = (input: string): boolean | string => + validate(subjectSchema, input); diff --git a/packages/cli/src/validation/schemas.ts b/packages/cli/src/validation/schemas.ts new file mode 100644 index 0000000..5cdedfe --- /dev/null +++ b/packages/cli/src/validation/schemas.ts @@ -0,0 +1,20 @@ +import z, { ZodEffects, ZodString } from 'zod'; +import lodash from 'lodash'; + +export const kebabCasePreprocess = ( + min: number, + max: number, + field: string, +): ZodEffects => + z.preprocess((val) => { + if (typeof val !== `string`) { + return val; + } + + return lodash.kebabCase(val); + }, z.string().min(min, `${field} must include at least ${min} character(s)`).max(max, `Name must include at most ${max} character(s)`)); + +export const nameSchema = kebabCasePreprocess(1, 70, `Name`); + +export const subjectSchema = kebabCasePreprocess(1, 24, `Branch subject`); +console.log(`twenty-four-characters`.length); diff --git a/packages/cli/tsconfig.cjs.json b/packages/cli/tsconfig.cjs.json new file mode 100644 index 0000000..04ef986 --- /dev/null +++ b/packages/cli/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "target": "es2015", + "outDir": "./dist/cjs" + } +} diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json new file mode 100644 index 0000000..1ebb6d1 --- /dev/null +++ b/packages/cli/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../tsconfig/tsconfig.cli.json", + "compilerOptions": { + /* Specify what module code is generated. */ + "rootDir": "src", + "baseUrl": ".", + /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "dist/esm" + }, + "include": [ + "./src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/.eslintrc.js b/packages/config/eslintrc.base.cjs similarity index 92% rename from .eslintrc.js rename to packages/config/eslintrc.base.cjs index 2872abb..e8d52db 100644 --- a/.eslintrc.js +++ b/packages/config/eslintrc.base.cjs @@ -1,7 +1,6 @@ module.exports = { env: { es2021: true, - node: true, }, extends: [`standard-with-typescript`, `prettier`], overrides: [], diff --git a/packages/config/eslintrc.cli.cjs b/packages/config/eslintrc.cli.cjs new file mode 100644 index 0000000..f577a45 --- /dev/null +++ b/packages/config/eslintrc.cli.cjs @@ -0,0 +1 @@ +module.exports = require('./eslintrc.base.cjs'); diff --git a/jest.config.js b/packages/config/jest.base.cjs similarity index 96% rename from jest.config.js rename to packages/config/jest.base.cjs index 7103723..cf1fab0 100644 --- a/jest.config.js +++ b/packages/config/jest.base.cjs @@ -132,7 +132,7 @@ export default { // runner: "jest-runner", // The paths to modules that run some code to configure or set up the testing environment before each test - setupFiles: [`/jest.setup.js`], + // setupFiles: [`/jest.setup.js`], // A list of paths to modules that run some code to configure or set up the testing framework before each test // setupFilesAfterEnv: [], diff --git a/packages/config/jest.cli.cjs b/packages/config/jest.cli.cjs new file mode 100644 index 0000000..5c32870 --- /dev/null +++ b/packages/config/jest.cli.cjs @@ -0,0 +1,8 @@ +/* + * For a detailed explanation regarding each configuration property and type check, visit: + * https://jestjs.io/docs/configuration + */ + +export default { + ...require(`./jest.base.cjs`), +}; diff --git a/packages/config/prettierrc.base.cjs b/packages/config/prettierrc.base.cjs new file mode 100644 index 0000000..faeab29 --- /dev/null +++ b/packages/config/prettierrc.base.cjs @@ -0,0 +1,7 @@ +module.exports = { + jsxSingleQuote: true, + trailingComma: "all", + semi: true, + bracketSameLine: false, + singleQuote: true, +}; diff --git a/packages/config/prettierrc.cli.cjs b/packages/config/prettierrc.cli.cjs new file mode 100644 index 0000000..5397e3b --- /dev/null +++ b/packages/config/prettierrc.cli.cjs @@ -0,0 +1 @@ +module.exports = require('./prettierrc.base.cjs'); diff --git a/packages/tsconfig/tsconfig.base.json b/packages/tsconfig/tsconfig.base.json new file mode 100644 index 0000000..5eb6852 --- /dev/null +++ b/packages/tsconfig/tsconfig.base.json @@ -0,0 +1,136 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2015", + /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": [ + "dom", + "dom.iterable", + "es2015" + ], + /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "react-jsx", + /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", + /* Specify what module code is generated. */ + // "rootDir": "src", + /* Specify the root folder within your source files. */ + "moduleResolution": "node", + /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, + /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, + /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true, + /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "dist", + /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + "isolatedModules": false, + /* Ensure that each file can be safely transpiled without relying on other imports. */ + "allowSyntheticDefaultImports": true, + /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, + /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, + /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, + /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + "noUnusedLocals": false, + /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": false, + /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, + /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, + /* Enforces using indexed accessors for keys declared using an indexed type. */ + "allowUnusedLabels": false, + /* Disable error reporting for unused labels. */ + "allowUnreachableCode": true, + /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true + /* Skip type checking all .d.ts files. */ + } + // "include": [ + // "./src/**/*.ts", + // "./src/**/*.tsx" + // ], + // "exclude": [ + // "node_modules" + // ] +} diff --git a/packages/tsconfig/tsconfig.cli.json b/packages/tsconfig/tsconfig.cli.json new file mode 100644 index 0000000..d0e2f13 --- /dev/null +++ b/packages/tsconfig/tsconfig.cli.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "ESNext", + "target": "ESNext" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3f1f2df..d745486 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,54 +1,67 @@ lockfileVersion: 5.4 -specifiers: - '@changesets/changelog-git': ^0.1.12 - '@changesets/cli': ^2.22.0 - '@commitlint/cli': ^17.0.3 - '@commitlint/config-conventional': ^17.0.3 - '@typescript-eslint/eslint-plugin': ^5.0.0 - commitizen: ^4.2.5 - concurrently: ^7.3.0 - cz-conventional-changelog: ^3.3.0 - dotenv: ^16.0.1 - editorconfig: ^0.15.3 - eslint: ^8.0.1 - eslint-config-prettier: ^8.5.0 - eslint-config-standard-with-typescript: ^22.0.0 - eslint-plugin-import: ^2.25.2 - eslint-plugin-n: ^15.0.0 - eslint-plugin-promise: ^6.0.0 - husky: ^8.0.1 - nodemon: ^2.0.19 - prettier: ^2.7.1 - rimraf: ^3.0.2 - typescript: ^4.7.4 - zod: ^3.18.0 - -dependencies: - dotenv: 16.0.1 - zod: 3.18.0 - -devDependencies: - '@changesets/changelog-git': 0.1.12 - '@changesets/cli': 2.24.3 - '@commitlint/cli': 17.0.3 - '@commitlint/config-conventional': 17.0.3 - '@typescript-eslint/eslint-plugin': 5.33.1_vsoshirnpb7xw6mr7xomgfas2i - commitizen: 4.2.5 - concurrently: 7.3.0 - cz-conventional-changelog: 3.3.0 - editorconfig: 0.15.3 - eslint: 8.22.0 - eslint-config-prettier: 8.5.0_eslint@8.22.0 - eslint-config-standard-with-typescript: 22.0.0_3h5ldndkk65qnwn3f43n6efjze - eslint-plugin-import: 2.26.0_3bh5nkk7utn7e74vrwtv6rxmt4 - eslint-plugin-n: 15.2.4_eslint@8.22.0 - eslint-plugin-promise: 6.0.0_eslint@8.22.0 - husky: 8.0.1 - nodemon: 2.0.19 - prettier: 2.7.1 - rimraf: 3.0.2 - typescript: 4.7.4 +importers: + + .: + specifiers: + '@changesets/changelog-git': ^0.1.12 + '@changesets/cli': ^2.22.0 + '@commitlint/cli': ^17.0.3 + '@commitlint/config-conventional': ^17.0.3 + '@typescript-eslint/eslint-plugin': ^5.0.0 + commitizen: ^4.2.5 + concurrently: ^7.3.0 + cz-conventional-changelog: ^3.3.0 + editorconfig: ^0.15.3 + eslint: ^8.0.1 + eslint-config-prettier: ^8.5.0 + eslint-config-standard-with-typescript: ^22.0.0 + eslint-plugin-import: ^2.25.2 + eslint-plugin-n: ^15.0.0 + eslint-plugin-promise: ^6.0.0 + husky: ^8.0.1 + nodemon: ^2.0.19 + prettier: ^2.7.1 + rimraf: ^3.0.2 + turbo: ^1.6.2 + typescript: ^4.7.4 + devDependencies: + '@changesets/changelog-git': 0.1.12 + '@changesets/cli': 2.24.3 + '@commitlint/cli': 17.0.3 + '@commitlint/config-conventional': 17.0.3 + '@typescript-eslint/eslint-plugin': 5.33.1_vsoshirnpb7xw6mr7xomgfas2i + commitizen: 4.2.5 + concurrently: 7.3.0 + cz-conventional-changelog: 3.3.0 + editorconfig: 0.15.3 + eslint: 8.22.0 + eslint-config-prettier: 8.5.0_eslint@8.22.0 + eslint-config-standard-with-typescript: 22.0.0_3h5ldndkk65qnwn3f43n6efjze + eslint-plugin-import: 2.26.0_3bh5nkk7utn7e74vrwtv6rxmt4 + eslint-plugin-n: 15.2.4_eslint@8.22.0 + eslint-plugin-promise: 6.0.0_eslint@8.22.0 + husky: 8.0.1 + nodemon: 2.0.19 + prettier: 2.7.1 + rimraf: 3.0.2 + turbo: 1.6.2 + typescript: 4.7.4 + + packages/cli: + specifiers: + '@types/inquirer': ^9.0.2 + '@types/lodash': ^4.14.186 + inquirer: 8.0.1 + lodash: ^4.17.21 + zod: ^3.19.1 + dependencies: + inquirer: 8.0.1 + lodash: 4.17.21 + zod: 3.19.1 + devDependencies: + '@types/inquirer': 9.0.2 + '@types/lodash': 4.14.186 packages: @@ -348,7 +361,7 @@ packages: '@types/node': 18.7.8 chalk: 4.1.2 cosmiconfig: 7.0.1 - cosmiconfig-typescript-loader: 2.0.2_itmtyrrie7wpjnrpwbb5uqyzwa + cosmiconfig-typescript-loader: 2.0.2_e7d25i5hlmrd6vr2w5ev5wf7xy lodash: 4.17.21 resolve-from: 5.0.0 typescript: 4.7.4 @@ -539,6 +552,13 @@ packages: resolution: {integrity: sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==} dev: true + /@types/inquirer/9.0.2: + resolution: {integrity: sha512-MQc3adiIh/rDxLkjnvL03rSvuHg+/dKif4dn/MRsnE+oU1bAdyuDbW0w+ewR1M/M/u/Z0YAbw7NZYCpgQ5SW8A==} + dependencies: + '@types/through': 0.0.30 + rxjs: 7.5.7 + dev: true + /@types/is-ci/3.0.0: resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==} dependencies: @@ -553,6 +573,10 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true + /@types/lodash/4.14.186: + resolution: {integrity: sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==} + dev: true + /@types/minimist/1.2.2: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true @@ -561,6 +585,10 @@ packages: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: true + /@types/node/18.11.7: + resolution: {integrity: sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ==} + dev: true + /@types/node/18.7.8: resolution: {integrity: sha512-/YP55EMK2341JkODUb8DM9O0x1SIz2aBvyF33Uf1c76St3VpsMXEIW0nxuKkq/5cxnbz0RD9cfwNZHEAZQD3ag==} dev: true @@ -577,6 +605,12 @@ packages: resolution: {integrity: sha512-KQf+QAMWKMrtBMsB8/24w53tEsxllMj6TuA80TT/5igJalLI/zm0L3oXRbIAl4Ohfc85gyHX/jhMwsVkmhLU4A==} dev: true + /@types/through/0.0.30: + resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} + dependencies: + '@types/node': 18.11.7 + dev: true + /@typescript-eslint/eslint-plugin/5.33.1_vsoshirnpb7xw6mr7xomgfas2i: resolution: {integrity: sha512-S1iZIxrTvKkU3+m63YUOxYPKaP+yWDQrdhxTglVDVEVBf+aCSw85+BmJnyUaQQsk5TXFG/LpBu9fa+LrAQ91fQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -762,12 +796,10 @@ packages: engines: {node: '>=8'} dependencies: type-fest: 0.21.3 - dev: true /ansi-regex/5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - dev: true /ansi-styles/3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} @@ -781,7 +813,6 @@ packages: engines: {node: '>=8'} dependencies: color-convert: 2.0.1 - dev: true /anymatch/3.1.2: resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} @@ -952,11 +983,9 @@ packages: dependencies: ansi-styles: 4.3.0 supports-color: 7.2.0 - dev: true /chardet/0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} - dev: true /chokidar/3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} @@ -982,7 +1011,6 @@ packages: engines: {node: '>=8'} dependencies: restore-cursor: 3.1.0 - dev: true /cli-spinners/2.7.0: resolution: {integrity: sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw==} @@ -992,7 +1020,6 @@ packages: /cli-width/3.0.0: resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==} engines: {node: '>= 10'} - dev: true /cliui/6.0.0: resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==} @@ -1026,7 +1053,6 @@ packages: engines: {node: '>=7.0.0'} dependencies: color-name: 1.1.4 - dev: true /color-name/1.1.3: resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} @@ -1034,10 +1060,10 @@ packages: /color-name/1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - dev: true /commander/2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + requiresBuild: true dev: true /commitizen/4.2.5: @@ -1117,19 +1143,20 @@ packages: engines: {node: '>=10'} hasBin: true dependencies: - is-text-path: 1.0.1 JSONStream: 1.3.5 + is-text-path: 1.0.1 lodash: 4.17.21 meow: 8.1.2 split2: 3.2.2 through2: 4.0.2 dev: true - /cosmiconfig-typescript-loader/2.0.2_itmtyrrie7wpjnrpwbb5uqyzwa: + /cosmiconfig-typescript-loader/2.0.2_e7d25i5hlmrd6vr2w5ev5wf7xy: resolution: {integrity: sha512-KmE+bMjWMXJbkWCeY4FJX/npHuZPNr9XF9q9CIQ/bpFwi1qHfCmSiKarrCcRa0LO4fWjk93pVoeRtJAkTGcYNw==} engines: {node: '>=12', npm: '>=6'} peerDependencies: '@types/node': '*' + cosmiconfig: '>=7' typescript: '>=3' dependencies: '@types/node': 18.7.8 @@ -1346,11 +1373,6 @@ packages: is-obj: 2.0.0 dev: true - /dotenv/16.0.1: - resolution: {integrity: sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==} - engines: {node: '>=12'} - dev: false - /editorconfig/0.15.3: resolution: {integrity: sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==} hasBin: true @@ -1363,7 +1385,6 @@ packages: /emoji-regex/8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - dev: true /enquirer/2.3.6: resolution: {integrity: sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==} @@ -1430,7 +1451,6 @@ packages: /escape-string-regexp/1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} - dev: true /escape-string-regexp/4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} @@ -1761,7 +1781,6 @@ packages: chardet: 0.7.0 iconv-lite: 0.4.24 tmp: 0.0.33 - dev: true /fast-deep-equal/3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -1797,7 +1816,6 @@ packages: engines: {node: '>=8'} dependencies: escape-string-regexp: 1.0.5 - dev: true /file-entry-cache/6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} @@ -2074,7 +2092,6 @@ packages: /has-flag/4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - dev: true /has-property-descriptors/1.0.0: resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} @@ -2139,7 +2156,6 @@ packages: engines: {node: '>=0.10.0'} dependencies: safer-buffer: 2.1.2 - dev: true /ieee754/1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} @@ -2187,6 +2203,25 @@ packages: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} dev: true + /inquirer/8.0.1: + resolution: {integrity: sha512-BwZ5KPT4cY1Hg6nzhFA0NBx4ae8n1T4zCD0vr1qQMo8EsO+bLLtwfwSyhi7E1i+Dcpi8UNuCQYC7H8QpvOFZzg==} + engines: {node: '>=8.0.0'} + dependencies: + ansi-escapes: 4.3.2 + chalk: 4.1.2 + cli-cursor: 3.1.0 + cli-width: 3.0.0 + external-editor: 3.1.0 + figures: 3.2.0 + lodash: 4.17.21 + mute-stream: 0.0.8 + run-async: 2.4.1 + rxjs: 6.6.7 + string-width: 4.2.3 + strip-ansi: 6.0.1 + through: 2.3.8 + dev: false + /inquirer/8.2.4: resolution: {integrity: sha512-nn4F01dxU8VeKfq192IjLsxu0/OmMZ4Lg3xKAns148rCaXP6ntAoEkVYZThWjwON8AlzdZZi6oqnhNbxUG9hVg==} engines: {node: '>=12.0.0'} @@ -2275,7 +2310,6 @@ packages: /is-fullwidth-code-point/3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} - dev: true /is-glob/4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} @@ -2508,7 +2542,6 @@ packages: /lodash/4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - dev: true /log-symbols/4.1.0: resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} @@ -2609,7 +2642,6 @@ packages: /mimic-fn/2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} - dev: true /min-indent/1.0.1: resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} @@ -2650,7 +2682,6 @@ packages: /mute-stream/0.0.8: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} - dev: true /natural-compare/1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -2751,7 +2782,6 @@ packages: engines: {node: '>=6'} dependencies: mimic-fn: 2.1.0 - dev: true /optionator/0.9.1: resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} @@ -2783,7 +2813,6 @@ packages: /os-tmpdir/1.0.2: resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} engines: {node: '>=0.10.0'} - dev: true /outdent/0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} @@ -3076,7 +3105,6 @@ packages: dependencies: onetime: 5.1.2 signal-exit: 3.0.7 - dev: true /reusify/1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} @@ -3093,7 +3121,6 @@ packages: /run-async/2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} engines: {node: '>=0.12.0'} - dev: true /run-parallel/1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} @@ -3101,19 +3128,31 @@ packages: queue-microtask: 1.2.3 dev: true + /rxjs/6.6.7: + resolution: {integrity: sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==} + engines: {npm: '>=2.0.0'} + dependencies: + tslib: 1.14.1 + dev: false + /rxjs/7.5.6: resolution: {integrity: sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==} dependencies: tslib: 2.4.0 dev: true + /rxjs/7.5.7: + resolution: {integrity: sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==} + dependencies: + tslib: 2.4.0 + dev: true + /safe-buffer/5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} dev: true /safer-buffer/2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: true /semver/5.7.1: resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} @@ -3179,7 +3218,6 @@ packages: /signal-exit/3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - dev: true /simple-update-notifier/1.0.7: resolution: {integrity: sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==} @@ -3262,7 +3300,6 @@ packages: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - dev: true /string.prototype.trimend/1.0.5: resolution: {integrity: sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==} @@ -3291,7 +3328,6 @@ packages: engines: {node: '>=8'} dependencies: ansi-regex: 5.0.1 - dev: true /strip-bom/3.0.0: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} @@ -3332,7 +3368,6 @@ packages: engines: {node: '>=8'} dependencies: has-flag: 4.0.0 - dev: true /supports-color/8.1.1: resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} @@ -3362,7 +3397,6 @@ packages: /through/2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} - dev: true /through2/4.0.2: resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} @@ -3375,7 +3409,6 @@ packages: engines: {node: '>=0.6.0'} dependencies: os-tmpdir: 1.0.2 - dev: true /to-regex-range/5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} @@ -3443,7 +3476,6 @@ packages: /tslib/1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - dev: true /tslib/2.4.0: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} @@ -3473,6 +3505,67 @@ packages: yargs: 17.5.1 dev: true + /turbo-darwin-64/1.6.2: + resolution: {integrity: sha512-qzqVdJZcVeu1d0mzeSxffgeOToSgM+Hl1y9yDiJQ4QQjiR/WGCzS9FtydLnk0ori8T1j/lxiiQz2sHjHYfLCTg==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-darwin-arm64/1.6.2: + resolution: {integrity: sha512-EJvgWSjLwzJbAsqRuqeaYSdXNKwyiUfOfEOPerYCvwxC+ILiqpladjteMCzzF/z2OmIbPzuqZpyik30TfpIC9A==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-64/1.6.2: + resolution: {integrity: sha512-SJ5ThDApOyOavjvkYb6a1MKJbOvX4JEvSYxoZv+ZpN8g7A7x1SE9b7EnxFl26S4eyy0J4+r+YJBDBZ7sFkqRWQ==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-arm64/1.6.2: + resolution: {integrity: sha512-0vHojVlvAelsYZo6p/xE9H9Dg8spNjXx+PO5RwP12ui8GuEqHb3Vomdb7AKDnWkIH7bpysNb9GbKEk7awQpGSg==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-64/1.6.2: + resolution: {integrity: sha512-j4mJmY5pEt7OaBXDM99BpDnJuSpiLVbVbUl4Ezp8w3gyIcGuxy3wAfLbQyZSLu8ke6R9SdmXIBAM2Y0MjS/Z1g==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-arm64/1.6.2: + resolution: {integrity: sha512-AlDYjxPU21YSefP3qMl/Zys5spglXtaBt2ZF5N2+OWcjiJZ/0mIIc69oFdzuAuiyoYkyWMdkoCSGwuljtl31vg==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo/1.6.2: + resolution: {integrity: sha512-a6UM9HaAjM5ai+vxDFI/z0l4Bf6zWjf7wCf9Ip2iyd4XZkZZnhRtM6FpaUWzorjz9Dsqnfwu3nkWY3wPdH02IQ==} + hasBin: true + requiresBuild: true + optionalDependencies: + turbo-darwin-64: 1.6.2 + turbo-darwin-arm64: 1.6.2 + turbo-linux-64: 1.6.2 + turbo-linux-arm64: 1.6.2 + turbo-windows-64: 1.6.2 + turbo-windows-arm64: 1.6.2 + dev: true + /type-check/0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -3498,7 +3591,6 @@ packages: /type-fest/0.21.3: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} - dev: true /type-fest/0.6.0: resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==} @@ -3714,6 +3806,6 @@ packages: engines: {node: '>=10'} dev: true - /zod/3.18.0: - resolution: {integrity: sha512-gwTm8RfUCe8l9rDwN5r2A17DkAa8Ez4Yl4yXqc5VqeGaXaJahzYYXbTwvhroZi0SNBqTwh/bKm2N0mpCzuw4bA==} + /zod/3.19.1: + resolution: {integrity: sha512-LYjZsEDhCdYET9ikFu6dVPGp2YH9DegXjdJToSzD9rO6fy4qiRYFoyEYwps88OseJlPyl2NOe2iJuhEhL7IpEA==} dev: false diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..833a27f --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - 'packages/*' diff --git a/src/env/config-env.ts b/src/env/config-env.ts deleted file mode 100644 index 6e5d036..0000000 --- a/src/env/config-env.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { config } from 'dotenv'; - -config({ path: `.env.${process.env.NODE_ENV}` }); diff --git a/src/env/env.ts b/src/env/env.ts deleted file mode 100644 index 79a4df4..0000000 --- a/src/env/env.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { envSchema } from './schema'; -import { formatErrors } from './format-errors'; - -const result = envSchema.safeParse(process.env); - -if (!result.success) { - console.error( - `❌ Invalid environment variables:\n`, - ...formatErrors(result.error.format()), - ); - throw new Error(`Invalid environment variables`); -} - -export const env = result.data; diff --git a/src/env/format-errors.ts b/src/env/format-errors.ts deleted file mode 100644 index c0ec48f..0000000 --- a/src/env/format-errors.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ZodFormattedError } from 'zod'; - -export const formatErrors = ( - errors: ZodFormattedError, string>, -): Array => - Object.entries(errors) - .map(([name, value]) => { - if (!(`_errors` in value)) return; - - return `${name}: ${value._errors.join(`, `)}\n`; - }) - .filter(Boolean); diff --git a/src/env/index.ts b/src/env/index.ts deleted file mode 100644 index b0047a4..0000000 --- a/src/env/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { env } from './env'; diff --git a/src/env/schema.ts b/src/env/schema.ts deleted file mode 100644 index bd7fc12..0000000 --- a/src/env/schema.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { z } from 'zod'; - -export const envSchema = z.object({ - NODE_ENV: z.enum([`development`, `test`, `production`]), -}); diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index ab5f3ea..0000000 --- a/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// Allows calling dotenv config before importing env.ts, otherwise formatting pushes imports to the top of the file. -import './config-env'; -import './env'; diff --git a/tsconfig.json b/tsconfig.json index 0045ce3..6e6d118 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,133 +1,10 @@ { + "extends": "./packages/tsconfig/tsconfig.base.json", "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "es2015", - /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": [ - "dom", - "dom.iterable", - "es2015" - ], - /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - "jsx": "react-jsx", - /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "commonjs", - /* Specify what module code is generated. */ - "rootDir": "src", - /* Specify the root folder within your source files. */ - "moduleResolution": "node", - /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "dist", - /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - "isolatedModules": false, - /* Ensure that each file can be safely transpiled without relying on other imports. */ - "allowSyntheticDefaultImports": true, - /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, - /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, - /* Ensure that casing is correct in imports. */ - - /* Type Checking */ - "strict": true, - /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - "noUnusedLocals": false, - /* Enable error reporting when local variables aren't read. */ - "noUnusedParameters": false, - /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - "noUncheckedIndexedAccess": true, - /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, - /* Enforces using indexed accessors for keys declared using an indexed type. */ - "allowUnusedLabels": false, - /* Disable error reporting for unused labels. */ - "allowUnreachableCode": true, - /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true - /* Skip type checking all .d.ts files. */ - }, - "include": [ - "./src/**/*.ts", - "./src/**/*.tsx" - ], - "exclude": [ - "node_modules" - ] + "paths": { + "@branchlint/cli": [ + "./packages/cli" + ], + } + } } diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..811c8f5 --- /dev/null +++ b/turbo.json @@ -0,0 +1,24 @@ +{ + "pipeline": { + "build": { + "outputs": [ + "dist/**" + ] + }, + "dev": { + "outputs": [] + }, + "start": { + "outputs": [] + }, + "lint": { + "outputs": [] + }, + "format": { + "outputs": [] + }, + "test": { + "outputs": [] + } + } +} From af8bcb81cd291d2942f7cce9dcb4862ff893842b Mon Sep 17 00:00:00 2001 From: Omri Levy Date: Fri, 28 Oct 2022 18:39:54 +0300 Subject: [PATCH 2/3] feat(project): initial commit --- .changeset/ninety-bags-guess.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ninety-bags-guess.md diff --git a/.changeset/ninety-bags-guess.md b/.changeset/ninety-bags-guess.md new file mode 100644 index 0000000..a5b95a7 --- /dev/null +++ b/.changeset/ninety-bags-guess.md @@ -0,0 +1,5 @@ +--- +"@branchlint/cli": patch +--- + +initial release From 81b4d1270e4c27f80e36b0ef98dcde3a29d13e21 Mon Sep 17 00:00:00 2001 From: Omri Levy Date: Fri, 28 Oct 2022 18:42:02 +0300 Subject: [PATCH 3/3] fix(github actions): now using pnpm scripts instead of turbo directly i.e pnpm build --- .github/actions/build-action/action.yml | 2 +- .github/actions/format-action/action.yml | 2 +- .github/actions/lint-action/action.yml | 2 +- .github/actions/test-action/action.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-action/action.yml b/.github/actions/build-action/action.yml index 83fab2f..1e72d22 100644 --- a/.github/actions/build-action/action.yml +++ b/.github/actions/build-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Build shell: bash - run: turbo build + run: pnpm build diff --git a/.github/actions/format-action/action.yml b/.github/actions/format-action/action.yml index 517483d..93d1583 100644 --- a/.github/actions/format-action/action.yml +++ b/.github/actions/format-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Format shell: bash - run: turbo format + run: pnpm format diff --git a/.github/actions/lint-action/action.yml b/.github/actions/lint-action/action.yml index b2b4c42..09fbfb7 100644 --- a/.github/actions/lint-action/action.yml +++ b/.github/actions/lint-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Lint shell: bash - run: turbo lint + run: pnpm lint diff --git a/.github/actions/test-action/action.yml b/.github/actions/test-action/action.yml index dd53a04..3ebf639 100644 --- a/.github/actions/test-action/action.yml +++ b/.github/actions/test-action/action.yml @@ -20,4 +20,4 @@ runs: - name: Test shell: bash - run: turbo test + run: pnpm test