Skip to content

Commit

Permalink
add scaffold for monorepo template
Browse files Browse the repository at this point in the history
  • Loading branch information
IMax153 committed Sep 5, 2024
1 parent af48851 commit e7b8f1c
Show file tree
Hide file tree
Showing 48 changed files with 778 additions and 5,439 deletions.
2 changes: 1 addition & 1 deletion templates/cli/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Template Effect CLI Application
# Effect CLI Application Template
5,438 changes: 0 additions & 5,438 deletions templates/cli/pnpm-lock.yaml

This file was deleted.

1 change: 1 addition & 0 deletions templates/monorepo/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake;
11 changes: 11 additions & 0 deletions templates/monorepo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage/
*.tsbuildinfo
node_modules/
.DS_Store
tmp/
dist/
build/
docs/
scratchpad/
.direnv/
.idea/
7 changes: 7 additions & 0 deletions templates/monorepo/.madgerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"detectiveOptions": {
"ts": {
"skipTypeImports": true
}
}
}
3 changes: 3 additions & 0 deletions templates/monorepo/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.js
*.ts
*.cjs
4 changes: 4 additions & 0 deletions templates/monorepo/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": false,
"trailingComma": "none"
}
46 changes: 46 additions & 0 deletions templates/monorepo/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.formatOnSave": true,
"eslint.format.enable": true,
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.semi": false,
"prettier.trailingComma": "none"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"eslint.validate": ["markdown", "javascript", "typescript"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
},
"editor.acceptSuggestionOnCommitCharacter": true,
"editor.acceptSuggestionOnEnter": "on",
"editor.quickSuggestionsDelay": 10,
"editor.suggestOnTriggerCharacters": true,
"editor.tabCompletion": "off",
"editor.suggest.localityBonus": true,
"editor.suggestSelection": "recentlyUsed",
"editor.wordBasedSuggestions": "matchingDocuments",
"editor.parameterHints.enabled": true,
"files.insertFinalNewline": true
}
1 change: 1 addition & 0 deletions templates/monorepo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Effect Monorepo Template
3 changes: 3 additions & 0 deletions templates/monorepo/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"unstable": ["byonm"]
}
122 changes: 122 additions & 0 deletions templates/monorepo/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import { fixupPluginRules } from "@eslint/compat"
import { FlatCompat } from "@eslint/eslintrc"
import js from "@eslint/js"
import tsParser from "@typescript-eslint/parser"
import codegen from "eslint-plugin-codegen"
import deprecation from "eslint-plugin-deprecation"
import _import from "eslint-plugin-import"
import simpleImportSort from "eslint-plugin-simple-import-sort"
import sortDestructureKeys from "eslint-plugin-sort-destructure-keys"
import path from "node:path"
import { fileURLToPath } from "node:url"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})

export default [
{
ignores: ["**/dist", "**/build", "**/docs", "**/*.md"]
},
...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@effect/recommended"
),
{
plugins: {
deprecation,
import: fixupPluginRules(_import),
"sort-destructure-keys": sortDestructureKeys,
"simple-import-sort": simpleImportSort,
codegen
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2018,
sourceType: "module"
},

settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},

"import/resolver": {
typescript: {
alwaysTryTypes: true
}
}
},

rules: {
"codegen/codegen": "error",
"no-fallthrough": "off",
"no-irregular-whitespace": "off",
"object-shorthand": "error",
"prefer-destructuring": "off",
"sort-imports": "off",

"no-restricted-syntax": ["error", {
selector: "CallExpression[callee.property.name='push'] > SpreadElement.arguments",
message: "Do not use spread arguments in Array.push"
}],

"no-unused-vars": "off",
"prefer-rest-params": "off",
"prefer-spread": "off",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-unresolved": "off",
"import/order": "off",
"simple-import-sort/imports": "off",
"sort-destructure-keys/sort-destructure-keys": "error",
"deprecation/deprecation": "off",

"@typescript-eslint/array-type": ["warn", {
default: "generic",
readonly: "generic"
}],

"@typescript-eslint/member-delimiter-style": 0,
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/consistent-type-imports": "warn",

"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
}],

"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-array-constructor": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-namespace": "off",

"@effect/dprint": ["error", {
config: {
indentWidth: 2,
lineWidth: 120,
semiColons: "asi",
quoteStyle: "alwaysDouble",
trailingCommas: "never",
operatorPosition: "maintain",
"arrowFunction.useParentheses": "force"
}
}]
}
}
]
27 changes: 27 additions & 0 deletions templates/monorepo/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions templates/monorepo/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = {nixpkgs, ...}: let
forAllSystems = function:
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
(system: function nixpkgs.legacyPackages.${system});
in {
formatter = forAllSystems (pkgs: pkgs.alejandra);
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
bun
corepack
deno
nodejs
python3
];
};
});
};
}
78 changes: 78 additions & 0 deletions templates/monorepo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"private": true,
"type": "module",
"packageManager": "[email protected]",
"workspaces": [
"packages/*"
],
"scripts": {
"clean": "node scripts/clean.mjs",
"codegen": "pnpm --recursive --parallel run codegen",
"build": "tsc -b tsconfig.build.json && pnpm --recursive --parallel run build",
"circular": "node scripts/circular.mjs",
"test": "vitest",
"coverage": "vitest --coverage",
"check": "tsc -b tsconfig.json",
"check-recursive": "pnpm --recursive exec tsc -b tsconfig.json",
"lint": "eslint \"**/{src,test,examples,scripts,dtslint}/**/*.{ts,mjs}\"",
"lint-fix": "pnpm lint --fix"
},
"resolutions": {
"dependency-tree": "^10.0.9",
"detective-amd": "^5.0.2",
"detective-cjs": "^5.0.1",
"detective-es6": "^4.0.1",
"detective-less": "^1.0.2",
"detective-postcss": "^6.1.3",
"detective-sass": "^5.0.3",
"detective-scss": "^4.0.3",
"detective-stylus": "^4.0.0",
"detective-typescript": "^11.1.0"
},
"devDependencies": {
"@babel/cli": "^7.24.8",
"@babel/core": "^7.25.2",
"@babel/plugin-transform-export-namespace-from": "^7.24.7",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@edge-runtime/vm": "^4.0.0",
"@effect/build-utils": "^0.7.7",
"@effect/eslint-plugin": "^0.2.0",
"@effect/language-service": "^0.1.0",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.1",
"@types/node": "^20.14.10",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"@vitest/browser": "^2.0.5",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/expect": "^2.0.5",
"@vitest/web-worker": "^2.0.5",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"eslint": "^9.9.1",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-codegen": "^0.28.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sort-destructure-keys": "^2.0.0",
"fast-check": "^3.21.0",
"glob": "^11.0.0",
"madge": "^8.0.0",
"playwright": "^1.46.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"vite": "^5.4.0",
"vitest": "^2.0.5"
},
"pnpm": {
"overrides": {
"vitest": "^2.0.5"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
}
}
1 change: 1 addition & 0 deletions templates/monorepo/packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Effect Monorepo Template - CLI Package
38 changes: 38 additions & 0 deletions templates/monorepo/packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@template/cli",
"version": "0.0.0",
"type": "module",
"private": true,
"scripts": {
"codegen": "build-utils prepare-v2",
"build": "pnpm build-esm && pnpm build-annotate && pnpm build-cjs && build-utils pack-v2",
"build-esm": "tsc -b tsconfig.build.json",
"build-cjs": "babel build/esm --plugins @babel/transform-export-namespace-from --plugins @babel/transform-modules-commonjs --out-dir build/cjs --source-maps",
"build-annotate": "babel build/esm --plugins annotate-pure-calls --out-dir build/esm --source-maps",
"check": "tsc -b tsconfig.json",
"test": "vitest",
"coverage": "vitest --coverage"
},
"devDependencies": {
"@effect/platform": "workspace:^",
"@effect/platform-node": "workspace:^",
"@effect/printer": "workspace:^",
"@effect/printer-ansi": "workspace:^",
"@effect/schema": "workspace:^",
"@types/ini": "^4.1.1",
"@types/node": "^20.14.10",
"effect": "workspace:^"
},
"effect": {
"generateExports": {
"include": [
"**/*.ts"
]
},
"generateIndex": {
"include": [
"**/*.ts"
]
}
}
}
7 changes: 7 additions & 0 deletions templates/monorepo/packages/cli/test/Dummy.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, expect, it } from "@effect/vitest"

describe("Dummy", () => {
it("should pass", () => {
expect(true).toBe(true)
})
})
Loading

0 comments on commit e7b8f1c

Please sign in to comment.