Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hashwarp committed Oct 15, 2024
1 parent 6dcc7f1 commit 67b63a5
Show file tree
Hide file tree
Showing 45 changed files with 3,975 additions and 347 deletions.
124 changes: 124 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"parser": "@typescript-eslint/parser",

"extends": [
"eslint:recommended",
//"plugin:react/recommended",
//"plugin:react/jsx-runtime",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"prettier"
],
"env": {
"browser": true,
"jest": true,
"node": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 2021,
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [/*"react",*/ "@typescript-eslint", "jest"],
"settings": {
"react": {
"version": "detect"
}
},
"ignorePatterns": ["dist/**/*.js"],
"rules": {
"semi": "off",
"no-unused-vars": "off",
"no-undef": "error",
"no-empty-pattern": "warn",
"react/prop-types": "warn",
// "no-console": ["warn", { "allow": ["info", "warn", "error"] }],
"no-plusplus": 0,
// "prefer-destructuring": ["warn", { "object": true, "array": false }],
"no-underscore-dangle": 0,
"no-alert": 0,
"prefer-destructuring": 0,
"react/no-danger": 0,
// Start temporary rules
// These rules are here just to keep the lint error to 0 during the migration to the new rule set
// They need to be removed and fixed as soon as possible
"@typescript-eslint/ban-ts-comment": [
1,
{ "ts-ignore": false, "ts-nocheck": false }
],
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-extra-semi": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-this-alias": 0,
"no-cond-assign": 0,
"func-names": 0,
"no-func-assign": 0,
"no-console": 0,
"import/order": 0,
"max-len": 0,
"max-lines": 0,
"react/display-name": 0,
"quotes": 0,
"radix": 0,
"import/no-extraneous-dependencies": 0,
"jsx-a11y/media-has-caption": 0,
"import/no-unresolved": 0,
"react/no-unescaped-entities": 0,
"react/self-closing-comp": 0,
"react/no-array-index-key": 0,
"interactions": 0,
"import/no-duplicates": 0,
"no-param-reassign": 0,
"no-multi-assign": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/no-noninteractive-tabindex": 0,
"no-unused-expressions": 0,
"jsx-a11y/click-events-have-key-events": 0,
"import/no-useless-path-segments": 0,
"prefer-template": 0,
"guard-for-in": 0,
"no-restricted-syntax": 0,
"react/button-has-type": 0,
"import/extensions": 0,
"react/jsx-curly-brace-presence": 0,
"spaced-comment": 0,
"no-debugger": 0,
"consistent-return": 0,
"no-continue": 0,
"import/prefer-default-export": 0,
"dot-notation": 0,
"no-await-in-loop": 0,
"no-nested-ternary": 0,
"no-unneeded-ternary": 0,
"react/require-default-props": 0,
"jsx-a11y/no-noninteractive-element-interactions": 0,
"jsx-a11y/alt-text": 0,
"react/destructuring-assignment": 0,
"no-irregular-whitespace": 0,
"jsx-a11y/no-redundant-roles": 0,
"max-classes-per-file": 0,
"class-methods-use-this": 0,
"default-case": 0,
"no-case-declarations": 0,
"react/jsx-no-bind": 0,
"import/no-named-as-default": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/anchor-has-content": 0,
"react/no-unknown-property": 0
// End temporary rules
},
"overrides": [
{
"files": ["*.ts", "*.tsx"]
}
]
}
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI
on:
push: {}

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- run: rush install
- run: rush update
- run: rushx build
- run: rushx lint
- run: rushx test
test_trpc_vnext:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- run: rush add -p @trpc/server@next
- run: rushx test e2e
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ node_modules

dist

coverage
coverage

.oldgit

.DS_Store
976 changes: 976 additions & 0 deletions .rush/temp/shrinkwrap-deps.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Arken Technologies, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Setup

Run `rush update`

## Using Commands

Try out:

```bash
./bin/arken config.list
./bin/arken config.set metaverse Arken
./bin/arken application.create ABC ABC
./bin/arken math.add 1 1
./bin/arken help.man cerebro
```
8 changes: 6 additions & 2 deletions arken.config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"option": {
"metaverse": "Omomu",
"metaverse": "Arken",
"applications": [
"OLA"
"OLA",
"ABC",
null,
"aa",
"bb"
]
}
}
54 changes: 38 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,51 @@
"version": "1.0.0",
"description": "",
"scripts": {
"build": "tsc",
"test": "jest --coverage --config=jest.unit.config.js",
"build": "tsc -p tsconfig.lib.json",
"test": "vitest run",
"test:jest": "jest --coverage --config=jest.unit.config.js",
"test:watch": "jest --watch --collect-coverage --config=jest.unit.config.js",
"test:coverage": "jest --coverage"
"test:coverage": "jest --coverage",
"lint": "eslint --max-warnings=0 .",
"dev": "cd test/fixtures && tsx",
"dev:math": "cd test/fixtures && tsx math.ts",
"dev:fs": "cd test/fixtures && tsx fs.ts",
"dev:diff": "cd test/fixtures && tsx diff.ts",
"dev:migrations": "cd test/fixtures && tsx migrations.ts",
"dev:application": "cd src/modules/application && tsx application.cli.ts",
"dev:config": "cd src/modules/config && tsx config.cli.ts"
},
"bin": {
"arken": "./bin/arken"
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "MIT",
"dependencies": {
"@types/jest": "~29.5.12",
"@types/node": "~22.5.1",
"jest": "~29.7.0",
"trpc": "~0.11.3",
"ts-node": "~10.9.2",
"typescript": "~5.5.4",
"yargs": "~17.7.2",
"zod": "~3.23.8",
"@types/yargs": "~17.0.33",
"@trpc/server": "~10.45.2",
"commander": "~12.1.0",
"enquirer": "~2.4.1"
"@types/jest": "^29",
"@types/node": "^20",
"jest": "^29",
"trpc": "^0",
"ts-node": "^10",
"typescript": "^5",
"yargs": "^17",
"zod": "^3",
"@types/yargs": "^17",
"@trpc/server": "next",
"commander": "^12",
"enquirer": "^2",
"cleye": "^1",
"picocolors": "^1",
"zod-to-json-schema": "^3",
"zod-validation-error": "^3",
"eslint-plugin-mmkal": "^0",
"execa": "^9",
"expect-type": "^0",
"fs-syncer": "^0",
"np": "^10",
"pkg-pr-new": "^0",
"strip-ansi": "^7",
"tsx": "^4",
"vitest": "^2"
}
}
30 changes: 17 additions & 13 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { Command } from "commander";
import { ConfigCommand } from "./commands/config";
import { ApplicationCommand } from "./commands/application";
const program = new Command();
import { createCli, type TrpcCliMeta, trpcServer, z } from "./";
import ApplicationService from "./modules/application/application.service";
import { createRouter as createApplicationRouter } from "./modules/application/application.router";
import ConfigService from "./modules/config/config.service";
import { createRouter as createConfigRouter } from "./modules/config/config.router";
import MathService from "./modules/math/math.service";
import { createRouter as createMathRouter } from "./modules/math/math.router";
import HelpService from "./modules/help/help.service";
import { createRouter as createHelpRouter } from "./modules/help/help.router";

program
.name("arken")
.description("A CLI tool for managing configurations")
.version("1.0.0");
const trpc = trpcServer.initTRPC.meta<TrpcCliMeta>().create();

// Register commands
program.addCommand(new ConfigCommand());
program.addCommand(new ApplicationCommand());
const router = trpc.router({
application: createApplicationRouter(new ApplicationService()),
config: createConfigRouter(new ConfigService()),
math: createMathRouter(new MathService()),
help: createHelpRouter(new HelpService()),
});

// Parse the arguments
program.parse(process.argv);
void createCli({ router }).run();
33 changes: 0 additions & 33 deletions src/commands/application/index.ts

This file was deleted.

Loading

0 comments on commit 67b63a5

Please sign in to comment.