@gxp-dev/tools 2.0.71 → 2.0.72
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/README.md +108 -81
- package/bin/lib/cli.js +18 -0
- package/bin/lib/commands/index.js +2 -0
- package/bin/lib/commands/init.js +23 -0
- package/bin/lib/commands/lint.js +77 -0
- package/bin/lib/constants.js +12 -0
- package/bin/lib/lint/formatter.js +91 -0
- package/bin/lib/lint/index.js +284 -0
- package/bin/lib/lint/schemas/app-manifest.schema.json +124 -0
- package/bin/lib/lint/schemas/card.schema.json +165 -0
- package/bin/lib/lint/schemas/common.schema.json +62 -0
- package/bin/lib/lint/schemas/configuration.schema.json +19 -0
- package/bin/lib/lint/schemas/field.schema.json +230 -0
- package/mcp/gxp-api-server.js +56 -127
- package/mcp/lib/api-tools.js +456 -0
- package/mcp/lib/config-ops.js +234 -0
- package/mcp/lib/config-tools.js +549 -0
- package/mcp/lib/docs-tools.js +142 -0
- package/mcp/lib/docs.js +263 -0
- package/mcp/lib/specs.js +135 -0
- package/mcp/lib/test-tools.js +358 -0
- package/package.json +3 -1
- package/runtime/vite.config.js +5 -3
- package/template/.prettierrc +10 -0
- package/template/README.md +205 -240
- package/template/app-instructions.md +91 -0
- package/template/eslint.config.js +32 -0
- package/template/githooks/pre-commit +37 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint flat config (ESLint v10+) for GxP plugin projects.
|
|
3
|
+
* Mirrors the toolkit's own config: JS + Vue + TS.
|
|
4
|
+
* Extend or override in your own project as needed.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import js from "@eslint/js"
|
|
8
|
+
import vue from "eslint-plugin-vue"
|
|
9
|
+
import globals from "globals"
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
js.configs.recommended,
|
|
13
|
+
...vue.configs["flat/recommended"],
|
|
14
|
+
{
|
|
15
|
+
ignores: ["dist/**", "node_modules/**", "coverage/**", ".certs/**"],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
files: ["**/*.{js,mjs,cjs,vue}"],
|
|
19
|
+
languageOptions: {
|
|
20
|
+
ecmaVersion: "latest",
|
|
21
|
+
sourceType: "module",
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.browser,
|
|
24
|
+
...globals.node,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
29
|
+
"vue/multi-word-component-names": "off",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# Runs on every `git commit` in a GxP plugin project.
|
|
3
|
+
# Enabled via `git config core.hooksPath .githooks` (set by the `prepare` npm script).
|
|
4
|
+
#
|
|
5
|
+
# Workflow (staged files only):
|
|
6
|
+
# 1. Format staged files with Prettier.
|
|
7
|
+
# 2. Fix lintable JS/Vue with ESLint --fix.
|
|
8
|
+
# 3. Validate staged GxP config JSON with `gxdev lint`.
|
|
9
|
+
#
|
|
10
|
+
# Any non-zero exit aborts the commit.
|
|
11
|
+
|
|
12
|
+
set -e
|
|
13
|
+
|
|
14
|
+
staged=$(git diff --cached --name-only --diff-filter=ACMR)
|
|
15
|
+
[ -z "$staged" ] && exit 0
|
|
16
|
+
|
|
17
|
+
# Prettier — everything it can format
|
|
18
|
+
prettier_targets=$(echo "$staged" | grep -Ei '\.(js|jsx|ts|tsx|vue|css|scss|json|md|yml|yaml|html)$' || true)
|
|
19
|
+
if [ -n "$prettier_targets" ]; then
|
|
20
|
+
echo "$prettier_targets" | xargs ./node_modules/.bin/prettier --write --ignore-unknown
|
|
21
|
+
echo "$prettier_targets" | xargs git add
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# ESLint — JS and Vue only, with --fix so formatting fixes don't block the commit
|
|
25
|
+
eslint_targets=$(echo "$staged" | grep -Ei '\.(js|jsx|mjs|cjs|vue)$' || true)
|
|
26
|
+
if [ -n "$eslint_targets" ]; then
|
|
27
|
+
echo "$eslint_targets" | xargs ./node_modules/.bin/eslint --fix --no-warn-ignored
|
|
28
|
+
echo "$eslint_targets" | xargs git add
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# GxP template linter — configuration.json and app-manifest.json
|
|
32
|
+
gxp_targets=$(echo "$staged" | grep -Ei '(configuration\.json|app-manifest\.json)$' || true)
|
|
33
|
+
if [ -n "$gxp_targets" ]; then
|
|
34
|
+
echo "$gxp_targets" | xargs npx --no-install gxdev lint
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
exit 0
|