startx 0.6.0 → 0.7.0
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/.github/workflows/publish.yml +1 -1
- package/apps/cli/package.json +11 -5
- package/apps/cli/src/utils/inquirer.ts +1 -1
- package/apps/cli/vitest.config.ts +3 -0
- package/apps/core-server/package.json +4 -3
- package/apps/core-server/vitest.config.ts +3 -0
- package/apps/startx-cli/dist/index.mjs +203 -0
- package/apps/startx-cli/package.json +9 -2
- package/apps/startx-cli/src/commands/init.ts +6 -2
- package/apps/startx-cli/src/configs/files.ts +2 -3
- package/apps/startx-cli/src/configs/scripts.ts +1 -1
- package/apps/startx-cli/vitest.config.ts +3 -0
- package/configs/eslint-config/package.json +5 -3
- package/configs/eslint-config/src/rules/no-json-parse-json-stringify.test.ts +8 -9
- package/configs/eslint-config/src/rules/no-json-parse-json-stringify.ts +18 -8
- package/configs/tsdown-config/package.json +4 -1
- package/configs/vitest-config/package.json +2 -1
- package/configs/vitest-config/src/base.ts +1 -0
- package/configs/vitest-config/src/frontend.ts +11 -11
- package/configs/vitest-config/src/node.ts +2 -2
- package/configs/vitest-config/tsconfig.json +3 -1
- package/package.json +1 -1
- package/packages/@repo/constants/package.json +2 -1
- package/packages/@repo/constants/vitest.config.ts +3 -0
- package/packages/@repo/db/package.json +1 -0
- package/packages/@repo/db/vitest.config.ts +3 -0
- package/packages/@repo/env/vitest.config.ts +3 -0
- package/packages/@repo/lib/vitest.config.ts +3 -0
- package/packages/@repo/logger/vitest.config.ts +3 -0
- package/packages/@repo/mail/package.json +4 -3
- package/packages/@repo/mail/vitest.config.ts +3 -0
- package/packages/@repo/redis/package.json +1 -0
- package/packages/@repo/redis/vitest.config.ts +3 -0
- package/packages/ui/package.json +2 -1
- package/packages/ui/vitest.config.ts +3 -0
- package/startx.json +1 -0
|
@@ -5,9 +5,16 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
8
|
"build": "tsdown --config-loader unrun",
|
|
10
|
-
"cli": "cross-env STARTX_ENV=development tsx src/index.ts"
|
|
9
|
+
"cli": "cross-env STARTX_ENV=development tsx src/index.ts",
|
|
10
|
+
"lint": "eslint .",
|
|
11
|
+
"lint:fix": "eslint . src/**/*.ts --fix",
|
|
12
|
+
"clean": "rimraf dist .turbo dist",
|
|
13
|
+
"deep:clean": "rimraf node_modules dist .turbo",
|
|
14
|
+
"typecheck": "tsc --noEmit",
|
|
15
|
+
"format": "prettier --write .",
|
|
16
|
+
"format:check": "prettier --check .",
|
|
17
|
+
"test": "vitest run"
|
|
11
18
|
},
|
|
12
19
|
"keywords": [],
|
|
13
20
|
"author": "",
|
|
@@ -320,6 +320,10 @@ export class InitCommand {
|
|
|
320
320
|
dependencies: Record<string, string>;
|
|
321
321
|
}) {
|
|
322
322
|
const tags = new Set(props.tags.concat(props.packages.packageJson?.startx?.tags || []));
|
|
323
|
+
if (props.packages.packageJson?.startx?.ignore?.find(e => e === "eslint-config"))
|
|
324
|
+
tags.delete("eslint");
|
|
325
|
+
if (props.packages.packageJson?.startx?.ignore?.find(e => e === "vitest-config"))
|
|
326
|
+
tags.delete("vitest");
|
|
323
327
|
const { packageJson, isWorkspace } = FileHandler.handlePackageJson({
|
|
324
328
|
app: props.packages.packageJson!,
|
|
325
329
|
tags: Array.from(tags),
|
|
@@ -348,7 +352,7 @@ export class InitCommand {
|
|
|
348
352
|
const files = await fsTool.listFiles({ dir: iTemplate });
|
|
349
353
|
for (const file of files) {
|
|
350
354
|
const checked = FileCheck[file];
|
|
351
|
-
if (checked && !checked.tags.every(e =>
|
|
355
|
+
if (checked && !checked.tags.every(e => tags.has(e))) continue;
|
|
352
356
|
try {
|
|
353
357
|
await fsTool.copyFile({
|
|
354
358
|
from: path.join(iTemplate, file),
|
|
@@ -363,7 +367,7 @@ export class InitCommand {
|
|
|
363
367
|
await fsTool.copyDirectory({
|
|
364
368
|
from: path.join(iTemplate, "src"),
|
|
365
369
|
to: path.join(iDirectory, "src"),
|
|
366
|
-
exclude: !
|
|
370
|
+
exclude: !tags.has("vitest") ? /\.test\.tsx?$/ : undefined,
|
|
367
371
|
});
|
|
368
372
|
logger.info(`Successfully installed ${props.packages.name}`);
|
|
369
373
|
}
|
|
@@ -38,12 +38,11 @@ export const FileCheck: WHITELIST_FILES = {
|
|
|
38
38
|
"tsdown.config.ts": {
|
|
39
39
|
tags: ["tsdown"],
|
|
40
40
|
},
|
|
41
|
-
// Handled manually
|
|
42
41
|
"eslint.config.ts": {
|
|
43
|
-
tags: ["
|
|
42
|
+
tags: ["eslint", "node"],
|
|
44
43
|
},
|
|
45
44
|
"vitest.config.ts": {
|
|
46
|
-
tags: ["
|
|
45
|
+
tags: ["vitest", "node"],
|
|
47
46
|
},
|
|
48
47
|
"package.json": {
|
|
49
48
|
tags: ["never"],
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"./extend": "./src/configs/extend.ts"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"lint:fix": "eslint . src/**/*.ts --fix",
|
|
15
|
+
"clean": "rimraf dist .turbo dist",
|
|
14
16
|
"deep:clean": "rimraf node_modules dist .turbo",
|
|
15
17
|
"typecheck": "tsc --noEmit",
|
|
16
18
|
"format": "biome format --write .",
|
|
@@ -30,10 +32,10 @@
|
|
|
30
32
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
31
33
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
32
34
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
33
|
-
"globals": "^15.9.0"
|
|
34
|
-
"typescript-eslint": "^8.54.0"
|
|
35
|
+
"globals": "^15.9.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
38
|
+
"typescript-eslint": "^8.54.0",
|
|
37
39
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
38
40
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
39
41
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { RuleTester } from "@typescript-eslint/rule-tester";
|
|
2
|
+
import { afterAll, describe, it } from "vitest";
|
|
2
3
|
import { NoJsonParseJsonStringifyRule } from "./no-json-parse-json-stringify.js";
|
|
3
4
|
|
|
5
|
+
RuleTester.afterAll = afterAll;
|
|
6
|
+
RuleTester.describe = describe;
|
|
7
|
+
RuleTester.it = it;
|
|
8
|
+
|
|
4
9
|
const ruleTester = new RuleTester({
|
|
5
10
|
languageOptions: {
|
|
6
11
|
parserOptions: {
|
|
@@ -12,15 +17,9 @@ const ruleTester = new RuleTester({
|
|
|
12
17
|
|
|
13
18
|
ruleTester.run("no-json-parse-json-stringify", NoJsonParseJsonStringifyRule, {
|
|
14
19
|
valid: [
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
code: "JSON.parse(foo)",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
code: "JSON.stringify(foo)",
|
|
23
|
-
},
|
|
20
|
+
{ code: "structuredClone(foo)" },
|
|
21
|
+
{ code: "JSON.parse(foo)" },
|
|
22
|
+
{ code: "JSON.stringify(foo)" },
|
|
24
23
|
],
|
|
25
24
|
invalid: [
|
|
26
25
|
{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
|
|
2
|
-
import { isJsonParseCall, isJsonStringifyCall } from "../utils/json.js";
|
|
3
2
|
|
|
4
3
|
export const NoJsonParseJsonStringifyRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
5
4
|
name: "no-json-parse-json-stringify",
|
|
@@ -19,25 +18,36 @@ export const NoJsonParseJsonStringifyRule = ESLintUtils.RuleCreator.withoutDocs(
|
|
|
19
18
|
create(context) {
|
|
20
19
|
return {
|
|
21
20
|
CallExpression(node) {
|
|
22
|
-
//
|
|
23
|
-
if (
|
|
21
|
+
// 1. Explicitly check if the outer call is exactly JSON.parse(...)
|
|
22
|
+
if (
|
|
23
|
+
node.callee.type !== TSESTree.AST_NODE_TYPES.MemberExpression ||
|
|
24
|
+
node.callee.object.type !== TSESTree.AST_NODE_TYPES.Identifier ||
|
|
25
|
+
node.callee.object.name !== "JSON" ||
|
|
26
|
+
node.callee.property.type !== TSESTree.AST_NODE_TYPES.Identifier ||
|
|
27
|
+
node.callee.property.name !== "parse"
|
|
28
|
+
) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
24
31
|
|
|
25
|
-
const
|
|
32
|
+
const inner = node.arguments[0];
|
|
26
33
|
|
|
27
|
-
//
|
|
34
|
+
// 2. Explicitly check if the inner call is exactly JSON.stringify(...)
|
|
28
35
|
if (
|
|
29
36
|
!inner ||
|
|
30
37
|
inner.type !== TSESTree.AST_NODE_TYPES.CallExpression ||
|
|
31
|
-
|
|
38
|
+
inner.callee.type !== TSESTree.AST_NODE_TYPES.MemberExpression ||
|
|
39
|
+
inner.callee.object.type !== TSESTree.AST_NODE_TYPES.Identifier ||
|
|
40
|
+
inner.callee.object.name !== "JSON" ||
|
|
41
|
+
inner.callee.property.type !== TSESTree.AST_NODE_TYPES.Identifier ||
|
|
42
|
+
inner.callee.property.name !== "stringify"
|
|
32
43
|
) {
|
|
33
44
|
return;
|
|
34
45
|
}
|
|
35
46
|
|
|
36
|
-
if (inner.arguments.length !== 1) return;
|
|
37
|
-
|
|
38
47
|
const arg = inner.arguments[0];
|
|
39
48
|
if (!arg) return;
|
|
40
49
|
|
|
50
|
+
// 3. Extract the text and report/fix
|
|
41
51
|
const argText = context.sourceCode.getText(arg);
|
|
42
52
|
|
|
43
53
|
context.report({
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
"exports": "./src/config/tsdown.base.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"clean": "rimraf dist",
|
|
9
|
-
"deep:clean": "rimraf node_modules dist"
|
|
9
|
+
"deep:clean": "rimraf node_modules dist",
|
|
10
|
+
"typecheck": "tsc --noEmit",
|
|
11
|
+
"format": "biome format --write .",
|
|
12
|
+
"format:check": "biome ci ."
|
|
10
13
|
},
|
|
11
14
|
"startx": {
|
|
12
15
|
"gTags": [
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { baseVitestConfig } from "./base.
|
|
1
|
+
import { baseVitestConfig } from "./base.ts";
|
|
2
2
|
|
|
3
3
|
export default baseVitestConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
environment: "jsdom",
|
|
5
|
+
setupFiles: ["./src/__tests__/setup.ts"],
|
|
6
|
+
css: {
|
|
7
|
+
modules: {
|
|
8
|
+
classNameStrategy: "non-scoped",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
coverage: {
|
|
13
|
+
reporter: ["text-summary", "lcov", "html"],
|
|
14
|
+
},
|
|
15
15
|
});
|
package/package.json
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"@react-email/preview-server": "catalog:",
|
|
15
15
|
"@types/react": "catalog:",
|
|
16
16
|
"@types/react-dom": "catalog:",
|
|
17
|
-
"react-email": "catalog:"
|
|
17
|
+
"react-email": "catalog:",
|
|
18
|
+
"typescript-config": "workspace:*",
|
|
19
|
+
"vitest-config": "workspace:^"
|
|
18
20
|
},
|
|
19
21
|
"dependencies": {
|
|
20
22
|
"@react-email/components": "catalog:",
|
|
@@ -22,8 +24,7 @@
|
|
|
22
24
|
"@react-email/tailwind": "catalog:",
|
|
23
25
|
"eslint-config": "workspace:*",
|
|
24
26
|
"react": "catalog:",
|
|
25
|
-
"react-dom": "catalog:"
|
|
26
|
-
"typescript-config": "workspace:*"
|
|
27
|
+
"react-dom": "catalog:"
|
|
27
28
|
},
|
|
28
29
|
"startx": {
|
|
29
30
|
"iTags": [
|
package/packages/ui/package.json
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"postcss": "^8.4.49",
|
|
25
25
|
"postcss-load-config": "^6",
|
|
26
26
|
"tailwindcss": "catalog:",
|
|
27
|
-
"typescript-config": "workspace:*"
|
|
27
|
+
"typescript-config": "workspace:*",
|
|
28
|
+
"vitest-config": "workspace:*"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@hookform/resolvers": "^3.9.1",
|