Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Konfik #127

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .eslintrc

This file was deleted.

70 changes: 70 additions & 0 deletions .konfik/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { prettierKonfik } from '@schickling/konfik-base'
import * as eslintBase from '@schickling/konfik-base/eslint/base'
import * as eslintReact from '@schickling/konfik-base/eslint/react'
import { PackageJsonKonfik } from '@konfik-plugin/package-json'

export { prettyPrint } from '@schickling/konfik-base'

const packageKonfik = PackageJsonKonfik({
name: 'contentlayer-monorepo',
private: true,
workspaces: ['./packages/@contentlayer/*', './packages/*', './examples/*'],
scripts: {
postinstall: 'ts-patch install && ts-patch --persist',
test: 'yarn workspaces foreach --no-private --parallel run test',
build: 'run build:clean && run build:ts && yarn workspace next-contentlayer run prepack',
'build:konfik': 'konfik build -c ./.konfik/index.ts',
'dev:konfik': 'konfik dev -c ./.konfik/index.ts',
'build:ts': 'tsc --build tsconfig.all.json',
'dev:ts': 'run build:ts --watch',
'build:clean': "bash -c 'rm -rf packages/*/dist packages/@contentlayer/*/dist'",
'examples:postinstall':
'yarn workspaces foreach --verbose --include "examples-*" exec yarn contentlayer postinstall',
'release:prerelease':
'yarn build && yarn workspaces foreach --verbose --topological-dev --no-private exec npm version prerelease --preid=dev && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish --tag=dev',
'release:patch':
'yarn build && yarn workspaces foreach --verbose --topological-dev --no-private exec npm version patch && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish',
'release:minor':
'yarn build && yarn workspaces foreach --verbose --topological-dev --no-private exec npm version minor && yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish',
'lint:check': 'run lint:eslint:check && run lint:prettier:check',
'lint:fix': 'run lint:eslint:fix & run lint:prettier:fix',
'lint:eslint:fix': 'eslint packages --ext .ts --fix',
'lint:eslint:check': 'eslint packages --ext .ts --max-warnings=0',
'lint:prettier:fix': 'prettier packages --write',
'lint:prettier:check': 'prettier packages --check',
},
devDependencies: {
...eslintBase.eslintDeps,
...eslintReact.eslintDeps,
'@changesets/cli': '2.19.0-temp.0',
'@effect-ts/tracing-plugin': '^0.18.0',
'@konfik-plugin/package-json': 'latest',
'@schickling/konfik-base':
'https://github.com/schickling/konfik-base.git#workspace=@schickling/konfik-base&commit=99398ffce7d6f8464a2d9c5fa78f604b2c83592f',
'@types/prettier': '^2.3.2',
konfik: '^0.0.12',
prettier: '^2.5.1',
'ts-patch': '^1.4.5',
typescript: '^4.5.5',
},
resolutions: {
esbuild: '0.13.12',
contentlayer: 'workspace:*',
'@contentlayer/*': 'workspace:*',
'contentlayer-stackbit-yaml-generator': 'workspace:*',
'next-contentlayer': 'workspace:*',
rxjs: '^7.1.0',
},
packageManager: 'yarn@3.1.1',
})

export default {
'prettier.config.js': prettierKonfik,
'package.json': packageKonfik,
packages: {
'.eslintrc': eslintBase.eslintKonfik,
},
examples: {
'.eslintrc': eslintReact.eslintKonfik,
},
}
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@
"showReuseMessage": true,
"clear": false
}
},
{
"label": "lint",
"type": "shell",
"command": "yarn lint:eslint:check",
"problemMatcher": "$eslint-stylish",
"presentation": {
"focus": false,
"panel": "shared",
"group": "dev",
"showReuseMessage": true,
"clear": true
}
}
]
}
47 changes: 47 additions & 0 deletions examples/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"env": { "browser": true, "es6": true },
"ignorePatterns": ["!.konfik", "**/dist/*", "**/.nyc_output/*", "node_modules/*"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "simple-import-sort", "import", "prefer-arrow"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:unicorn/recommended",
"prettier",
"plugin:react-hooks/recommended"
],
"rules": {
"unicorn/prevent-abbreviations": "off",
"unicorn/filename-case": "off",
"unicorn/prefer-optional-catch-binding": "off",
"unicorn/catch-error-name": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/prefer-ternary": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-null": "off",
"func-style": ["warn", "expression"],
"prefer-arrow-callback": "warn",
"prefer-arrow/prefer-arrow-functions": [
"warn",
{ "classPropertiesAllowed": true, "disallowPrototype": true, "singleReturnOnly": false }
],
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": "off",
"simple-import-sort/imports": "error",
"import/no-extraneous-dependencies": "error",
"import/no-named-as-default": "warn",
"import/no-named-as-default-member": "warn",
"import/no-duplicates": "warn",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
"react/no-children-prop": "off"
}
}
25 changes: 16 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"postinstall": "ts-patch install && ts-patch --persist",
"test": "yarn workspaces foreach --no-private --parallel run test",
"build": "run build:clean && run build:ts && yarn workspace next-contentlayer run prepack",
"build:konfik": "konfik build -c ./.konfik/index.ts",
"dev:konfik": "konfik dev -c ./.konfik/index.ts",
"build:ts": "tsc --build tsconfig.all.json",
"dev:ts": "run build:ts --watch",
"build:clean": "bash -c 'rm -rf packages/*/dist packages/@contentlayer/*/dist'",
Expand All @@ -25,19 +27,24 @@
"lint:prettier:check": "prettier packages --check"
},
"devDependencies": {
"@changesets/cli": "2.19.0-temp.0",
"@effect-ts/tracing-plugin": "^0.18.0",
"@types/prettier": "^2.3.2",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.21.0",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-unicorn": "^40.1.0",
"typescript": "^4.5.5",
"eslint-plugin-react-hooks": "^4.3.0",
"@changesets/cli": "2.19.0-temp.0",
"@effect-ts/tracing-plugin": "^0.18.0",
"@konfik-plugin/package-json": "latest",
"@schickling/konfik-base": "https://github.com/schickling/konfik-base.git#workspace=@schickling/konfik-base&commit=99398ffce7d6f8464a2d9c5fa78f604b2c83592f",
"@types/prettier": "^2.3.2",
"konfik": "^0.0.12",
"prettier": "^2.5.1",
"ts-patch": "^1.4.5",
"typescript": "^4.5.5"
"ts-patch": "^1.4.5"
},
"resolutions": {
"esbuild": "0.13.12",
Expand Down
41 changes: 41 additions & 0 deletions packages/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"env": { "es6": true },
"ignorePatterns": ["!.konfik", "**/dist/*", "**/.nyc_output/*", "node_modules/*"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "simple-import-sort", "import", "prefer-arrow"],
"extends": ["plugin:@typescript-eslint/recommended", "plugin:unicorn/recommended", "prettier"],
"rules": {
"unicorn/prevent-abbreviations": "off",
"unicorn/filename-case": "off",
"unicorn/prefer-optional-catch-binding": "off",
"unicorn/catch-error-name": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/prefer-ternary": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-null": "off",
"func-style": ["warn", "expression"],
"prefer-arrow-callback": "warn",
"prefer-arrow/prefer-arrow-functions": [
"warn",
{ "classPropertiesAllowed": true, "disallowPrototype": true, "singleReturnOnly": false }
],
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": "off",
"simple-import-sort/imports": "error",
"import/no-extraneous-dependencies": "error",
"import/no-named-as-default": "warn",
"import/no-named-as-default-member": "warn",
"import/no-duplicates": "warn",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type * as core from '@contentlayer/core'
import type { PosixFilePath } from '@contentlayer/utils'
import { capitalizeFirstLetter, singleItem, unknownToPosixFilePath } from '@contentlayer/utils'
import faker from 'faker'
import * as path from 'path'
import * as path from 'node:path'

import { FetchDataError } from '../../errors/index.js'

Expand Down
Loading