startx 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +0 -13
- package/.prettierrc.js +52 -52
- package/.vscode/launch.json +32 -0
- package/.vscode/settings.json +9 -3
- package/apps/core-server/.env.example +18 -24
- package/apps/core-server/Dockerfile +35 -61
- package/apps/core-server/eslint.config.ts +7 -0
- package/apps/core-server/package.json +41 -52
- package/apps/core-server/src/config/custom-type.ts +2 -40
- package/apps/core-server/src/events/index.ts +37 -37
- package/apps/core-server/src/index.ts +4 -13
- package/apps/core-server/src/middlewares/auth-middleware.ts +24 -7
- package/apps/core-server/src/middlewares/cors-middleware.ts +7 -6
- package/apps/core-server/src/middlewares/error-middleware.ts +7 -4
- package/apps/core-server/src/middlewares/logger-middleware.ts +81 -21
- package/apps/core-server/src/middlewares/notfound-middleware.ts +6 -14
- package/apps/core-server/src/middlewares/serve-static.ts +30 -24
- package/apps/core-server/src/routes/files/router.ts +9 -7
- package/apps/core-server/src/routes/server.ts +30 -36
- package/apps/core-server/tsdown.config.ts +4 -3
- package/biome.json +58 -60
- package/configs/eslint-config/package.json +16 -19
- package/configs/eslint-config/src/configs/base.ts +185 -225
- package/configs/eslint-config/src/configs/extend.ts +3 -0
- package/configs/eslint-config/src/configs/frontend.ts +81 -56
- package/configs/eslint-config/src/configs/node.ts +6 -6
- package/configs/eslint-config/src/plugin.ts +1 -0
- package/configs/eslint-config/src/rules/index.ts +8 -12
- package/configs/eslint-config/src/rules/no-json-parse-json-stringify.test.ts +30 -17
- package/configs/eslint-config/src/rules/no-json-parse-json-stringify.ts +52 -49
- package/configs/eslint-config/src/rules/no-uncaught-json-parse.ts +43 -45
- package/configs/tsdown-config/package.json +10 -3
- package/configs/typescript-config/package.json +10 -1
- package/configs/typescript-config/tsconfig.common.json +3 -3
- package/configs/vitest-config/dist/base.mjs +1 -0
- package/configs/vitest-config/dist/frontend.mjs +1 -0
- package/configs/vitest-config/dist/node.mjs +1 -0
- package/configs/vitest-config/package.json +12 -0
- package/configs/vitest-config/src/base.ts +17 -29
- package/configs/vitest-config/src/index.ts +1 -0
- package/package.json +15 -26
- package/packages/@repo/constants/eslint.config.ts +4 -0
- package/packages/@repo/constants/package.json +16 -0
- package/packages/@repo/constants/src/index.ts +8 -8
- package/packages/@repo/db/eslint.config.ts +4 -0
- package/packages/@repo/db/package.json +16 -8
- package/packages/@repo/db/src/index.ts +26 -20
- package/packages/@repo/db/src/schema/common.ts +45 -49
- package/packages/@repo/env/eslint.config.ts +4 -0
- package/packages/@repo/env/package.json +39 -0
- package/packages/@repo/env/src/default-env.ts +12 -0
- package/packages/@repo/env/src/define-env.ts +70 -0
- package/packages/@repo/env/src/index.ts +2 -0
- package/packages/@repo/env/src/utils.ts +52 -0
- package/packages/@repo/env/tsconfig.json +7 -0
- package/packages/@repo/lib/eslint.config.ts +4 -0
- package/packages/@repo/lib/package.json +34 -34
- package/packages/@repo/lib/src/bucket-module/file-storage.ts +50 -49
- package/packages/@repo/lib/src/bucket-module/index.ts +3 -0
- package/packages/@repo/lib/src/bucket-module/s3-storage.ts +120 -114
- package/packages/@repo/lib/src/bucket-module/utils.ts +10 -11
- package/packages/@repo/lib/src/{cookie-module.ts → cookie-module/cookie-module.ts} +48 -42
- package/packages/@repo/lib/src/cookie-module/index.ts +1 -0
- package/packages/@repo/lib/src/extra/index.ts +1 -0
- package/packages/@repo/lib/src/extra/pagination-module.ts +35 -0
- package/packages/@repo/lib/src/{token-module.ts → extra/token-module.ts} +12 -5
- package/packages/@repo/lib/src/file-system-module/index.ts +170 -0
- package/packages/@repo/lib/src/{hashing-module.ts → hashing-module/index.ts} +9 -9
- package/packages/@repo/lib/src/index.ts +0 -26
- package/packages/@repo/lib/src/mail-module/index.ts +2 -0
- package/packages/@repo/lib/src/mail-module/mock.ts +8 -8
- package/packages/@repo/lib/src/mail-module/nodemailer.ts +17 -7
- package/packages/@repo/lib/src/notification-module/index.ts +1 -172
- package/packages/@repo/lib/src/notification-module/push-notification.ts +97 -90
- package/packages/@repo/lib/src/{oauth2-client.ts → oauth2-module/index.ts} +107 -109
- package/packages/@repo/lib/src/otp-module/index.ts +91 -0
- package/packages/@repo/lib/src/session-module/index.ts +113 -0
- package/packages/@repo/lib/src/utils.ts +43 -42
- package/packages/@repo/lib/src/validation-module/index.ts +242 -0
- package/packages/@repo/logger/eslint.config.ts +4 -0
- package/packages/@repo/logger/package.json +40 -0
- package/packages/@repo/logger/src/index.ts +2 -0
- package/packages/@repo/logger/src/logger.ts +72 -0
- package/packages/@repo/{lib/src/logger-module → logger/src}/memory-profiler.ts +64 -65
- package/packages/@repo/logger/tsconfig.json +7 -0
- package/packages/@repo/mail/eslint.config.ts +4 -0
- package/packages/@repo/mail/package.json +10 -3
- package/packages/@repo/mail/src/emails/admin/OtpEmail.tsx +169 -168
- package/packages/@repo/mail/src/index.ts +1 -2
- package/packages/@repo/mail/tsconfig.json +3 -3
- package/packages/@repo/redis/dist/index.d.mts +3 -0
- package/packages/@repo/redis/dist/index.mjs +5 -0
- package/packages/@repo/redis/dist/lib/redis-client.d.mts +7 -0
- package/packages/@repo/redis/dist/lib/redis-client.mjs +25 -0
- package/packages/@repo/redis/dist/lib/redis-client.mjs.map +1 -0
- package/packages/@repo/redis/dist/lib/redis-module.d.mts +5 -0
- package/packages/@repo/redis/dist/lib/redis-module.mjs +6 -0
- package/packages/@repo/redis/dist/lib/redis-module.mjs.map +1 -0
- package/packages/@repo/redis/eslint.config.ts +4 -0
- package/packages/@repo/redis/package.json +13 -10
- package/packages/@repo/redis/src/index.ts +2 -2
- package/packages/@repo/redis/src/lib/redis-client.ts +36 -23
- package/packages/@repo/redis/src/lib/redis-module.ts +69 -3
- package/packages/cli/dist/index.mjs +203 -0
- package/packages/cli/eslint.config.ts +4 -0
- package/packages/cli/package.json +44 -0
- package/packages/cli/tsconfig.json +12 -0
- package/packages/cli/tsdown.config.ts +17 -0
- package/packages/ui/components.json +0 -1
- package/packages/ui/eslint.config.ts +4 -0
- package/packages/ui/package.json +16 -3
- package/packages/ui/postcss.config.mjs +9 -9
- package/packages/ui/src/components/lib/utils.ts +53 -53
- package/packages/ui/src/components/ui/alert-dialog.tsx +118 -116
- package/packages/ui/src/components/ui/avatar.tsx +52 -53
- package/packages/ui/src/components/ui/badge.tsx +45 -46
- package/packages/ui/src/components/ui/breadcrumb.tsx +108 -109
- package/packages/ui/src/components/ui/card.tsx +91 -92
- package/packages/ui/src/components/ui/carousel.tsx +243 -243
- package/packages/ui/src/components/ui/checkbox.tsx +32 -32
- package/packages/ui/src/components/ui/command.tsx +144 -155
- package/packages/ui/src/components/ui/dialog.tsx +124 -127
- package/packages/ui/src/components/ui/form.tsx +166 -165
- package/packages/ui/src/components/ui/input-otp.tsx +74 -76
- package/packages/ui/src/components/ui/input.tsx +19 -21
- package/packages/ui/src/components/ui/multiple-select.tsx +4 -4
- package/packages/ui/src/{components/lucide.tsx → lucide.ts} +3 -3
- package/packages/ui/tailwind.config.ts +94 -94
- package/packages/ui/tsconfig.json +7 -1
- package/pnpm-workspace.yaml +41 -1
- package/startx.json +22 -0
- package/turbo.json +20 -27
- package/apps/core-server/eslint.config.mjs +0 -47
- package/configs/eslint-config/src/rules/no-dynamic-import-template.ts +0 -32
- package/configs/eslint-config/src/rules/no-plain-errors.ts +0 -50
- package/configs/eslint-config/tsdown.config.ts +0 -11
- package/packages/@repo/constants/eslint.config.mjs +0 -21
- package/packages/@repo/db/eslint.config.mjs +0 -21
- package/packages/@repo/lib/eslint.config.mjs +0 -49
- package/packages/@repo/lib/src/command-module.ts +0 -77
- package/packages/@repo/lib/src/constants.ts +0 -3
- package/packages/@repo/lib/src/custom-type.ts +0 -54
- package/packages/@repo/lib/src/env.ts +0 -13
- package/packages/@repo/lib/src/file-system/index.ts +0 -90
- package/packages/@repo/lib/src/logger-module/log-config.ts +0 -16
- package/packages/@repo/lib/src/logger-module/logger.ts +0 -78
- package/packages/@repo/lib/src/mail-module/api.ts +0 -0
- package/packages/@repo/lib/src/otp-module.ts +0 -98
- package/packages/@repo/lib/src/pagination-module.ts +0 -49
- package/packages/@repo/lib/src/user-session.ts +0 -117
- package/packages/@repo/lib/src/validation-module.ts +0 -187
- package/packages/@repo/mail/tsconfig.build.json +0 -14
- package/packages/@repo/mail/tsdown.config.ts +0 -9
- package/packages/@repo/redis/eslint.config.mjs +0 -8
- package/packages/ui/eslint.config.mjs +0 -18
|
@@ -1,34 +1,47 @@
|
|
|
1
|
-
import { RuleTester } from
|
|
2
|
-
import { NoJsonParseJsonStringifyRule } from
|
|
1
|
+
import { RuleTester } from "@typescript-eslint/rule-tester";
|
|
2
|
+
import { NoJsonParseJsonStringifyRule } from "./no-json-parse-json-stringify.js";
|
|
3
3
|
|
|
4
|
-
const ruleTester = new RuleTester(
|
|
4
|
+
const ruleTester = new RuleTester({
|
|
5
|
+
languageOptions: {
|
|
6
|
+
parserOptions: {
|
|
7
|
+
ecmaVersion: 2022,
|
|
8
|
+
sourceType: "module",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
});
|
|
5
12
|
|
|
6
|
-
ruleTester.run(
|
|
13
|
+
ruleTester.run("no-json-parse-json-stringify", NoJsonParseJsonStringifyRule, {
|
|
7
14
|
valid: [
|
|
8
15
|
{
|
|
9
|
-
code:
|
|
16
|
+
code: "structuredClone(foo)",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
code: "JSON.parse(foo)",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
code: "JSON.stringify(foo)",
|
|
10
23
|
},
|
|
11
24
|
],
|
|
12
25
|
invalid: [
|
|
13
26
|
{
|
|
14
|
-
code:
|
|
15
|
-
errors: [{ messageId:
|
|
16
|
-
output:
|
|
27
|
+
code: "JSON.parse(JSON.stringify(foo))",
|
|
28
|
+
errors: [{ messageId: "noJsonParseJsonStringify" }],
|
|
29
|
+
output: "structuredClone(foo)",
|
|
17
30
|
},
|
|
18
31
|
{
|
|
19
|
-
code:
|
|
20
|
-
errors: [{ messageId:
|
|
21
|
-
output:
|
|
32
|
+
code: "JSON.parse(JSON.stringify(foo.bar))",
|
|
33
|
+
errors: [{ messageId: "noJsonParseJsonStringify" }],
|
|
34
|
+
output: "structuredClone(foo.bar)",
|
|
22
35
|
},
|
|
23
36
|
{
|
|
24
|
-
code:
|
|
25
|
-
errors: [{ messageId:
|
|
26
|
-
output:
|
|
37
|
+
code: "JSON.parse(JSON.stringify(foo.bar.baz))",
|
|
38
|
+
errors: [{ messageId: "noJsonParseJsonStringify" }],
|
|
39
|
+
output: "structuredClone(foo.bar.baz)",
|
|
27
40
|
},
|
|
28
41
|
{
|
|
29
|
-
code:
|
|
30
|
-
errors: [{ messageId:
|
|
31
|
-
output:
|
|
42
|
+
code: "JSON.parse(JSON.stringify(foo.bar[baz]))",
|
|
43
|
+
errors: [{ messageId: "noJsonParseJsonStringify" }],
|
|
44
|
+
output: "structuredClone(foo.bar[baz])",
|
|
32
45
|
},
|
|
33
46
|
],
|
|
34
47
|
});
|
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export const NoJsonParseJsonStringifyRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
5
|
-
name:
|
|
6
|
-
meta: {
|
|
7
|
-
type:
|
|
8
|
-
docs: {
|
|
9
|
-
description:
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
schema: [],
|
|
13
|
-
messages: {
|
|
14
|
-
noJsonParseJsonStringify:
|
|
15
|
-
},
|
|
16
|
-
fixable:
|
|
17
|
-
},
|
|
18
|
-
defaultOptions: [],
|
|
19
|
-
create(context) {
|
|
20
|
-
return {
|
|
21
|
-
CallExpression(node) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
1
|
+
import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
|
|
2
|
+
import { isJsonParseCall, isJsonStringifyCall } from "../utils/json.js";
|
|
3
|
+
|
|
4
|
+
export const NoJsonParseJsonStringifyRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
5
|
+
name: "no-json-parse-json-stringify",
|
|
6
|
+
meta: {
|
|
7
|
+
type: "problem",
|
|
8
|
+
docs: {
|
|
9
|
+
description:
|
|
10
|
+
"Calls to `JSON.parse(JSON.stringify(arg))` must be replaced with `structuredClone(arg)`.",
|
|
11
|
+
},
|
|
12
|
+
schema: [],
|
|
13
|
+
messages: {
|
|
14
|
+
noJsonParseJsonStringify: "Replace with `structuredClone({{ argText }})`",
|
|
15
|
+
},
|
|
16
|
+
fixable: "code",
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
return {
|
|
21
|
+
CallExpression(node) {
|
|
22
|
+
// Must be JSON.parse(...)
|
|
23
|
+
if (!isJsonParseCall(node)) return;
|
|
24
|
+
|
|
25
|
+
const [inner] = node.arguments;
|
|
26
|
+
|
|
27
|
+
// Must be JSON.stringify(...)
|
|
28
|
+
if (
|
|
29
|
+
!inner ||
|
|
30
|
+
inner.type !== TSESTree.AST_NODE_TYPES.CallExpression ||
|
|
31
|
+
!isJsonStringifyCall(inner)
|
|
32
|
+
) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (inner.arguments.length !== 1) return;
|
|
37
|
+
|
|
38
|
+
const arg = inner.arguments[0];
|
|
39
|
+
if (!arg) return;
|
|
40
|
+
|
|
41
|
+
const argText = context.sourceCode.getText(arg);
|
|
42
|
+
|
|
43
|
+
context.report({
|
|
44
|
+
node,
|
|
45
|
+
messageId: "noJsonParseJsonStringify",
|
|
46
|
+
data: { argText },
|
|
47
|
+
fix: fixer => fixer.replaceText(node, `structuredClone(${argText})`),
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -1,45 +1,43 @@
|
|
|
1
|
-
import { ESLintUtils } from
|
|
2
|
-
import { isJsonParseCall, isJsonStringifyCall } from
|
|
3
|
-
|
|
4
|
-
export const NoUncaughtJsonParseRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
5
|
-
name:
|
|
6
|
-
meta: {
|
|
7
|
-
type:
|
|
8
|
-
hasSuggestions: true,
|
|
9
|
-
docs: {
|
|
10
|
-
description:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
});
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
import { isJsonParseCall, isJsonStringifyCall } from "../utils/json.js";
|
|
3
|
+
|
|
4
|
+
export const NoUncaughtJsonParseRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
5
|
+
name: "no-uncaught-json-parse",
|
|
6
|
+
meta: {
|
|
7
|
+
type: "problem",
|
|
8
|
+
hasSuggestions: true,
|
|
9
|
+
docs: {
|
|
10
|
+
description: "Surrounded with a try/catch block.",
|
|
11
|
+
},
|
|
12
|
+
schema: [],
|
|
13
|
+
messages: {
|
|
14
|
+
noUncaughtJsonParse: "Surround the `JSON.parse()` call with a try/catch block.",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create({ report, sourceCode }) {
|
|
19
|
+
return {
|
|
20
|
+
CallExpression(node) {
|
|
21
|
+
if (!isJsonParseCall(node)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (isJsonStringifyCall(node)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (
|
|
30
|
+
sourceCode.getAncestors(node).find(node => node.type === "TryStatement") !== undefined
|
|
31
|
+
) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Found a JSON.parse() call not wrapped into a try/catch, so report it
|
|
36
|
+
report({
|
|
37
|
+
messageId: "noUncaughtJsonParse",
|
|
38
|
+
node,
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -3,12 +3,19 @@
|
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
6
|
"exports": "./src/config/tsdown.base.ts",
|
|
10
7
|
"scripts": {
|
|
11
8
|
"clean": "rimraf dist",
|
|
12
9
|
"deep:clean": "rimraf node_modules dist"
|
|
10
|
+
},
|
|
11
|
+
"startx": {
|
|
12
|
+
"tags": [
|
|
13
|
+
"tsdown"
|
|
14
|
+
],
|
|
15
|
+
"ignore": [
|
|
16
|
+
"eslint-config",
|
|
17
|
+
"typescript-config",
|
|
18
|
+
"vitest-config"
|
|
19
|
+
]
|
|
13
20
|
}
|
|
14
21
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2022",
|
|
4
4
|
"useDefineForClassFields": true,
|
|
5
|
-
"module": "
|
|
5
|
+
"module": "nodenext",
|
|
6
6
|
"lib": ["ES2022"],
|
|
7
7
|
"skipLibCheck": true,
|
|
8
8
|
|
|
9
|
-
"moduleResolution": "
|
|
10
|
-
"allowImportingTsExtensions":
|
|
9
|
+
"moduleResolution": "nodenext",
|
|
10
|
+
"allowImportingTsExtensions": false,
|
|
11
11
|
"resolveJsonModule": true,
|
|
12
12
|
"isolatedModules": true,
|
|
13
13
|
"noEmit": true,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineConfig as e}from"vitest/config";const t=process.env.npm_lifecycle_event===`test:dev`,n=(n={})=>e({test:{silent:!0,globals:!0,include:t?[`src/**/*.{test,spec}.{ts,tsx}`]:[`dist/**/*.{test,spec}.{js,mjs,cjs}`],exclude:t?[`**/node_modules/**`,`**/dist/**`]:[`**/node_modules/**`,`**/src/**`],coverage:process.env.COVERAGE_ENABLED===`true`?{enabled:!0,provider:`v8`,...n.coverage}:{enabled:!1},...n}});export{n as baseVitestConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{baseVitestConfig as e}from"./base.mjs";var t=e({environment:`jsdom`,setupFiles:[`./src/__tests__/setup.ts`],css:{modules:{classNameStrategy:`non-scoped`}},coverage:{reporter:[`text-summary`,`lcov`,`html`]}});export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{baseVitestConfig as e}from"./base.mjs";var t=e({environment:`node`});export{t as default};
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"vite": "catalog:"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
|
+
".": "./src/index.ts",
|
|
14
15
|
"./frontend": "./src/frontend.ts",
|
|
15
16
|
"./node": "./src/node.ts",
|
|
16
17
|
"./base": "./src/base.ts"
|
|
@@ -21,5 +22,16 @@
|
|
|
21
22
|
"typecheck": "tsc --noEmit",
|
|
22
23
|
"format": "biome format --write .",
|
|
23
24
|
"format:check": "biome ci ."
|
|
25
|
+
},
|
|
26
|
+
"startx": {
|
|
27
|
+
"tags": [
|
|
28
|
+
"vitest"
|
|
29
|
+
],
|
|
30
|
+
"requiredDevDeps": [
|
|
31
|
+
"typescript-config"
|
|
32
|
+
],
|
|
33
|
+
"ignore": [
|
|
34
|
+
"vitest-config"
|
|
35
|
+
]
|
|
24
36
|
}
|
|
25
37
|
}
|
|
@@ -1,34 +1,22 @@
|
|
|
1
1
|
import { defineConfig } from "vitest/config";
|
|
2
2
|
import type { InlineConfig } from "vitest/node";
|
|
3
3
|
|
|
4
|
-
// Detect if we are running in "dev" mode (npm run test:dev)
|
|
5
|
-
const isDev = process.env.npm_lifecycle_event === "test:dev";
|
|
6
4
|
export const baseVitestConfig = (options: InlineConfig = {}) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
defineConfig({
|
|
6
|
+
test: {
|
|
7
|
+
silent: true,
|
|
8
|
+
globals: true,
|
|
9
|
+
include: ["src/**/*.{test,spec}.{ts,tsx}"],
|
|
10
|
+
exclude: ["**/node_modules/**", "**/dist/**"],
|
|
11
|
+
coverage:
|
|
12
|
+
process.env.COVERAGE_ENABLED === "true"
|
|
13
|
+
? {
|
|
14
|
+
enabled: true,
|
|
15
|
+
provider: "v8",
|
|
16
|
+
...options.coverage,
|
|
17
|
+
}
|
|
18
|
+
: { enabled: false },
|
|
11
19
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
? ["src/**/*.{test,spec}.{ts,tsx}"]
|
|
16
|
-
: ["dist/**/*.{test,spec}.{js,mjs,cjs}"],
|
|
17
|
-
exclude: isDev
|
|
18
|
-
? ["**/node_modules/**", "**/dist/**"]
|
|
19
|
-
: ["**/node_modules/**", "**/src/**"],
|
|
20
|
-
|
|
21
|
-
// Standardized Coverage Logic
|
|
22
|
-
coverage:
|
|
23
|
-
process.env.COVERAGE_ENABLED === "true"
|
|
24
|
-
? {
|
|
25
|
-
enabled: true,
|
|
26
|
-
provider: "v8",
|
|
27
|
-
...options.coverage,
|
|
28
|
-
}
|
|
29
|
-
: { enabled: false },
|
|
30
|
-
|
|
31
|
-
// Merge whatever specific options are passed
|
|
32
|
-
...options,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
20
|
+
...options,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "vitest";
|
package/package.json
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "startx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/avinashid/startx.git"
|
|
7
7
|
},
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"build": "turbo run build",
|
|
11
|
-
"dev": "turbo run dev",
|
|
12
|
-
"lint": "turbo run lint",
|
|
13
|
-
"typecheck": "turbo run typecheck",
|
|
14
|
-
"clean": "turbo run clean",
|
|
15
|
-
"test": "turbo run test",
|
|
16
|
-
"test:dev": "turbo run test:dev",
|
|
17
|
-
"format": "turbo run format"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@biomejs/biome": "catalog:",
|
|
21
|
-
"@vitest/coverage-v8": "catalog:",
|
|
22
|
-
"prettier": "catalog:",
|
|
23
|
-
"rimraf": "catalog:",
|
|
24
|
-
"turbo": "catalog:",
|
|
25
|
-
"typescript": "catalog:",
|
|
26
|
-
"eslint": "catalog:",
|
|
27
|
-
"tsdown": "catalog:",
|
|
28
|
-
"unrun": "catalog:",
|
|
29
|
-
"vitest": "catalog:",
|
|
30
|
-
"@types/node": "catalog:"
|
|
8
|
+
"bin": {
|
|
9
|
+
"startx": "./packages/cli/dist/index.mjs"
|
|
31
10
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "turbo dev",
|
|
13
|
+
"build": "turbo build",
|
|
14
|
+
"start": "turbo start",
|
|
15
|
+
"startx": "node ./packages/cli/dist/index.mjs",
|
|
16
|
+
"backend": "turbo dev --filter=core-server -- ",
|
|
17
|
+
"cli": "turbo dev --filter=cli -- ",
|
|
18
|
+
"lint": "turbo lint",
|
|
19
|
+
"typecheck": "turbo typecheck",
|
|
20
|
+
"clean": "turbo clean",
|
|
21
|
+
"test": "turbo test",
|
|
22
|
+
"format": "turbo format"
|
|
34
23
|
},
|
|
35
24
|
"engines": {
|
|
36
25
|
"node": ">=22"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repo/constants",
|
|
3
3
|
"version": "0.12.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
|
|
4
6
|
"scripts": {
|
|
5
7
|
"clean": "rimraf dist .turbo",
|
|
6
8
|
"watch:dev": "pnpm watch",
|
|
@@ -15,5 +17,19 @@
|
|
|
15
17
|
"devDependencies": {
|
|
16
18
|
"typescript-config": "workspace:*",
|
|
17
19
|
"eslint-config": "workspace:*"
|
|
20
|
+
},
|
|
21
|
+
"startx": {
|
|
22
|
+
"tags": [
|
|
23
|
+
"common"
|
|
24
|
+
],
|
|
25
|
+
"requiredDeps": [
|
|
26
|
+
"@repo/env"
|
|
27
|
+
],
|
|
28
|
+
"requiredDevDeps": [
|
|
29
|
+
"typescript-config"
|
|
30
|
+
],
|
|
31
|
+
"ignore": [
|
|
32
|
+
"vitest-config"
|
|
33
|
+
]
|
|
18
34
|
}
|
|
19
35
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
|
|
3
|
-
export { Time } from "./time";
|
|
4
|
-
|
|
5
|
-
export const MIN_PASSWORD_CHAR_LENGTH = 8;
|
|
6
|
-
|
|
7
|
-
export const MAX_PASSWORD_CHAR_LENGTH = 64;
|
|
8
|
-
export const ping = "pong";
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
|
|
3
|
+
export { Time } from "./time.js";
|
|
4
|
+
|
|
5
|
+
export const MIN_PASSWORD_CHAR_LENGTH = 8;
|
|
6
|
+
|
|
7
|
+
export const MAX_PASSWORD_CHAR_LENGTH = 64;
|
|
8
|
+
export const ping = "pong";
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "@repo/db",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"private": true,
|
|
5
|
+
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"clean": "rimraf dist .turbo",
|
|
7
8
|
"watch:dev": "pnpm watch",
|
|
@@ -14,17 +15,24 @@
|
|
|
14
15
|
},
|
|
15
16
|
"exports": "./src/index.ts",
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@types/
|
|
18
|
-
"@types/node": "^20.16.5",
|
|
19
|
-
"@types/pg": "^8.16.0",
|
|
20
|
-
"eslint": "catalog:",
|
|
18
|
+
"@types/pg": "catalog:",
|
|
21
19
|
"eslint-config": "workspace:*",
|
|
22
|
-
"tsc-alias": "^1.8.10",
|
|
23
|
-
"typescript": "5.5.4",
|
|
24
20
|
"typescript-config": "workspace:*"
|
|
25
21
|
},
|
|
26
22
|
"dependencies": {
|
|
27
|
-
"drizzle-orm": "
|
|
28
|
-
"pg": "
|
|
23
|
+
"drizzle-orm": "catalog:",
|
|
24
|
+
"pg": "catalog:",
|
|
25
|
+
"@repo/env": "workspace:*"
|
|
26
|
+
},
|
|
27
|
+
"startx": {
|
|
28
|
+
"tags": [
|
|
29
|
+
"node"
|
|
30
|
+
],
|
|
31
|
+
"requiredDeps": [
|
|
32
|
+
"@repo/env"
|
|
33
|
+
],
|
|
34
|
+
"requiredDevDeps": [
|
|
35
|
+
"typescript-config"
|
|
36
|
+
]
|
|
29
37
|
}
|
|
30
38
|
}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { defineEnv } from "@repo/env";
|
|
2
|
+
import type { ExtractTablesWithRelations } from "drizzle-orm";
|
|
3
|
+
import { drizzle, type NodePgQueryResultHKT } from "drizzle-orm/node-postgres";
|
|
4
|
+
import { type PgTransaction } from "drizzle-orm/pg-core";
|
|
5
|
+
import Pg from "pg";
|
|
6
|
+
import z from "zod";
|
|
7
|
+
|
|
8
|
+
import * as schema from "./schema/index.js";
|
|
9
|
+
|
|
10
|
+
export const env = defineEnv({
|
|
11
|
+
DATABASE_URL: z.string(),
|
|
12
|
+
});
|
|
13
|
+
export const client = new Pg.Pool({
|
|
14
|
+
connectionString: env.DATABASE_URL,
|
|
15
|
+
});
|
|
16
|
+
const db = drizzle({ client, schema });
|
|
17
|
+
export type DrizzleTransaction = PgTransaction<
|
|
18
|
+
NodePgQueryResultHKT,
|
|
19
|
+
typeof schema,
|
|
20
|
+
ExtractTablesWithRelations<typeof schema>
|
|
21
|
+
>;
|
|
22
|
+
export type DrizzleDB = typeof db;
|
|
23
|
+
export { db };
|
|
24
|
+
export * from "drizzle-orm";
|
|
25
|
+
export * from "./functions.js";
|
|
26
|
+
export * from "./schema/index.js";
|