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.
Files changed (36) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/apps/cli/package.json +11 -5
  3. package/apps/cli/src/utils/inquirer.ts +1 -1
  4. package/apps/cli/vitest.config.ts +3 -0
  5. package/apps/core-server/package.json +4 -3
  6. package/apps/core-server/vitest.config.ts +3 -0
  7. package/apps/startx-cli/dist/index.mjs +203 -0
  8. package/apps/startx-cli/package.json +9 -2
  9. package/apps/startx-cli/src/commands/init.ts +6 -2
  10. package/apps/startx-cli/src/configs/files.ts +2 -3
  11. package/apps/startx-cli/src/configs/scripts.ts +1 -1
  12. package/apps/startx-cli/vitest.config.ts +3 -0
  13. package/configs/eslint-config/package.json +5 -3
  14. package/configs/eslint-config/src/rules/no-json-parse-json-stringify.test.ts +8 -9
  15. package/configs/eslint-config/src/rules/no-json-parse-json-stringify.ts +18 -8
  16. package/configs/tsdown-config/package.json +4 -1
  17. package/configs/vitest-config/package.json +2 -1
  18. package/configs/vitest-config/src/base.ts +1 -0
  19. package/configs/vitest-config/src/frontend.ts +11 -11
  20. package/configs/vitest-config/src/node.ts +2 -2
  21. package/configs/vitest-config/tsconfig.json +3 -1
  22. package/package.json +1 -1
  23. package/packages/@repo/constants/package.json +2 -1
  24. package/packages/@repo/constants/vitest.config.ts +3 -0
  25. package/packages/@repo/db/package.json +1 -0
  26. package/packages/@repo/db/vitest.config.ts +3 -0
  27. package/packages/@repo/env/vitest.config.ts +3 -0
  28. package/packages/@repo/lib/vitest.config.ts +3 -0
  29. package/packages/@repo/logger/vitest.config.ts +3 -0
  30. package/packages/@repo/mail/package.json +4 -3
  31. package/packages/@repo/mail/vitest.config.ts +3 -0
  32. package/packages/@repo/redis/package.json +1 -0
  33. package/packages/@repo/redis/vitest.config.ts +3 -0
  34. package/packages/ui/package.json +2 -1
  35. package/packages/ui/vitest.config.ts +3 -0
  36. 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 => props.tags.includes(e))) continue;
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: !props.tags.includes("vitest") ? /\.test\.tsx?$/ : undefined,
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: ["never"],
42
+ tags: ["eslint", "node"],
44
43
  },
45
44
  "vitest.config.ts": {
46
- tags: ["never"],
45
+ tags: ["vitest", "node"],
47
46
  },
48
47
  "package.json": {
49
48
  tags: ["never"],
@@ -49,7 +49,7 @@ export const scripts: SCRIPT = {
49
49
  ],
50
50
  "cli": [
51
51
  {
52
- script: "turbo run cli",
52
+ script: "turbo run cli -- ",
53
53
  tags: ["runnable", "node", "cli", "root"],
54
54
  },
55
55
  {
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/node";
2
+
3
+ export default vitestConfig;
@@ -10,7 +10,9 @@
10
10
  "./extend": "./src/configs/extend.ts"
11
11
  },
12
12
  "scripts": {
13
- "clean": "rimraf dist .turbo",
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
- code: "structuredClone(foo)",
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
- // Must be JSON.parse(...)
23
- if (!isJsonParseCall(node)) return;
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 [inner] = node.arguments;
32
+ const inner = node.arguments[0];
26
33
 
27
- // Must be JSON.stringify(...)
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
- !isJsonStringifyCall(inner)
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": [
@@ -31,7 +31,8 @@
31
31
  "typescript-config"
32
32
  ],
33
33
  "ignore": [
34
- "vitest-config"
34
+ "vitest-config",
35
+ "eslint-config"
35
36
  ]
36
37
  }
37
38
  }
@@ -4,6 +4,7 @@ import type { InlineConfig } from "vitest/node";
4
4
  export const baseVitestConfig = (options: InlineConfig = {}) =>
5
5
  defineConfig({
6
6
  test: {
7
+ passWithNoTests: true,
7
8
  silent: true,
8
9
  globals: true,
9
10
  include: ["src/**/*.{test,spec}.{ts,tsx}"],
@@ -1,15 +1,15 @@
1
- import { baseVitestConfig } from "./base.js";
1
+ import { baseVitestConfig } from "./base.ts";
2
2
 
3
3
  export default baseVitestConfig({
4
- environment: "jsdom",
5
- setupFiles: ["./src/__tests__/setup.ts"],
6
- css: {
7
- modules: {
8
- classNameStrategy: "non-scoped",
9
- },
10
- },
4
+ environment: "jsdom",
5
+ setupFiles: ["./src/__tests__/setup.ts"],
6
+ css: {
7
+ modules: {
8
+ classNameStrategy: "non-scoped",
9
+ },
10
+ },
11
11
 
12
- coverage: {
13
- reporter: ["text-summary", "lcov", "html"],
14
- }
12
+ coverage: {
13
+ reporter: ["text-summary", "lcov", "html"],
14
+ },
15
15
  });
@@ -1,5 +1,5 @@
1
- import { baseVitestConfig } from "./base.js";
1
+ import { baseVitestConfig } from "./base.ts";
2
2
 
3
3
  export default baseVitestConfig({
4
- environment: "node",
4
+ environment: "node",
5
5
  });
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "extends": "typescript-config/tsconfig.node.json",
3
3
  "compilerOptions": {
4
- "baseUrl": "./src"
4
+ "baseUrl": "./src",
5
+ "allowImportingTsExtensions": true
5
6
  },
7
+
6
8
  "include": ["src/**/*.ts"]
7
9
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "startx",
3
3
  "description": "",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/avinashid/startx.git"
@@ -16,7 +16,8 @@
16
16
  "exports": "./src/index.ts",
17
17
  "devDependencies": {
18
18
  "typescript-config": "workspace:*",
19
- "eslint-config": "workspace:*"
19
+ "eslint-config": "workspace:*",
20
+ "vitest-config": "workspace:*"
20
21
  },
21
22
  "startx": {
22
23
  "iTags": [
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/node";
2
+
3
+ export default vitestConfig;
@@ -17,6 +17,7 @@
17
17
  "devDependencies": {
18
18
  "@types/pg": "catalog:",
19
19
  "eslint-config": "workspace:*",
20
+ "vitest-config": "workspace:*",
20
21
  "typescript-config": "workspace:*"
21
22
  },
22
23
  "dependencies": {
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/node";
2
+
3
+ export default vitestConfig;
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/node";
2
+
3
+ export default vitestConfig;
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/node";
2
+
3
+ export default vitestConfig;
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/node";
2
+
3
+ export default vitestConfig;
@@ -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": [
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/frontend";
2
+
3
+ export default vitestConfig;
@@ -16,6 +16,7 @@
16
16
  "exports": "./src/index.ts",
17
17
  "devDependencies": {
18
18
  "eslint-config": "workspace:*",
19
+ "vitest-config": "workspace:*",
19
20
  "typescript-config": "workspace:*"
20
21
  },
21
22
  "dependencies": {
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/node";
2
+
3
+ export default vitestConfig;
@@ -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",
@@ -0,0 +1,3 @@
1
+ import vitestConfig from "vitest-config/frontend";
2
+
3
+ export default vitestConfig;
package/startx.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "@biomejs/biome": "catalog:",
5
5
  "prettier": "catalog:",
6
6
  "eslint": "catalog:",
7
+ "vitest": "catalog:",
7
8
  "rimraf": "catalog:",
8
9
  "turbo": "catalog:",
9
10
  "typescript": "catalog:",