@griddo/ax 12.3.0-beta.0 → 12.3.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.
@@ -1,5 +1,4 @@
1
1
  const fs = require("fs");
2
- const errorOverlayMiddleware = require("react-dev-utils/errorOverlayMiddleware");
3
2
  const evalSourceMapMiddleware = require("react-dev-utils/evalSourceMapMiddleware");
4
3
  const noopServiceWorkerMiddleware = require("react-dev-utils/noopServiceWorkerMiddleware");
5
4
  const ignoredFiles = require("react-dev-utils/ignoredFiles");
@@ -9,122 +8,93 @@ const getHttpsConfig = require("./getHttpsConfig");
9
8
 
10
9
  const host = process.env.HOST || "0.0.0.0";
11
10
  const sockHost = process.env.WDS_SOCKET_HOST;
12
- const sockPath = process.env.WDS_SOCKET_PATH; // default: '/sockjs-node'
11
+ const sockPath = process.env.WDS_SOCKET_PATH;
13
12
  const sockPort = process.env.WDS_SOCKET_PORT;
14
13
 
15
14
  module.exports = function (proxy, allowedHost) {
16
15
  // Merge `public` and `static` paths for development
17
16
  paths.prepareAssetsFolders();
18
17
 
18
+ const disableFirewall = !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === "true";
19
+
20
+ // Wire the WDS_SOCKET_* env vars into WDS4's client. In WDS3 these were read at
21
+ // runtime by CRA's `webpackHotDevClient` (now removed); WDS4 reads them from
22
+ // `client.webSocketURL` instead. Only override the fields that are actually set so
23
+ // WDS4 keeps auto-detecting the rest (host/port behind a proxy still works).
24
+ const webSocketURL = {};
25
+ if (sockHost) webSocketURL.hostname = sockHost;
26
+ if (sockPath) webSocketURL.pathname = sockPath;
27
+ if (sockPort) webSocketURL.port = sockPort;
28
+ const hasWebSocketOverrides = Object.keys(webSocketURL).length > 0;
29
+
19
30
  return {
20
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
21
- // websites from potentially accessing local content through DNS rebinding:
22
- // https://github.com/webpack/webpack-dev-server/issues/887
23
- // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
24
- // However, it made several existing use cases such as development in cloud
25
- // environment or subdomains in development significantly more complicated:
26
- // https://github.com/facebook/create-react-app/issues/2271
27
- // https://github.com/facebook/create-react-app/issues/2233
28
- // While we're investigating better solutions, for now we will take a
29
- // compromise. Since our WDS configuration only serves files in the `public`
30
- // folder we won't consider accessing them a vulnerability. However, if you
31
- // use the `proxy` feature, it gets more dangerous because it can expose
32
- // remote code execution vulnerabilities in backends like Django and Rails.
33
- // So we will disable the host check normally, but enable it if you have
34
- // specified the `proxy` setting. Finally, we let you override it if you
35
- // really know what you're doing with a special environment variable.
36
- disableHostCheck: !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === "true",
37
31
  // Enable gzip compression of generated files.
38
32
  compress: true,
39
- // Silence WebpackDevServer's own logs since they're generally not useful.
40
- // It will still show compile warnings and errors with this setting.
41
- clientLogLevel: "none",
42
- // By default WebpackDevServer serves physical files from current directory
43
- // in addition to all the virtual build products that it serves from memory.
44
- // This is confusing because those files won’t automatically be available in
45
- // production build folder unless we copy them. However, copying the whole
46
- // project directory is dangerous because we may expose sensitive files.
47
- // Instead, we establish a convention that only files in `public` directory
48
- // get served. Our build script will copy `public` into the `build` folder.
49
- // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
50
- // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
51
- // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
52
- // Note that we only recommend to use `public` folder as an escape hatch
53
- // for files like `favicon.ico`, `manifest.json`, and libraries that are
54
- // for some reason broken when imported through webpack. If you just want to
55
- // use an image, put it in `src` and `import` it from JavaScript instead.
56
- contentBase: paths.appStaticAssetsCache,
57
- contentBasePublicPath: paths.publicUrlOrPath,
58
- // By default files from `contentBase` will not trigger a page reload.
59
- watchContentBase: true,
60
- // Enable hot reloading server. It will provide WDS_SOCKET_PATH endpoint
61
- // for the WebpackDevServer client so it can learn when the files were
62
- // updated. The WebpackDevServer client is included as an entry point
63
- // in the webpack development configuration. Note that only changes
64
- // to CSS are currently hot reloaded. JS changes will refresh the browser.
65
- hot: true,
66
- // Use 'ws' instead of 'sockjs-node' on server since we're using native
67
- // websockets in `webpackHotDevClient`.
68
- transportMode: "ws",
69
- // Prevent a WS client from getting injected as we're already including
70
- // `webpackHotDevClient`.
71
- injectClient: false,
72
- // Enable custom sockjs pathname for websocket connection to hot reloading server.
73
- // Enable custom sockjs hostname, pathname and port for websocket connection
74
- // to hot reloading server.
75
- sockHost,
76
- sockPath,
77
- sockPort,
78
- // It is important to tell WebpackDevServer to use the same "publicPath" path as
79
- // we specified in the webpack config. When homepage is '.', default to serving
80
- // from the root.
81
- // remove last slash so user can land on `/test` instead of `/test/`
82
- publicPath: paths.publicUrlOrPath.slice(0, -1),
83
- // WebpackDevServer is noisy by default so we emit custom message instead
84
- // by listening to the compiler events with `compiler.hooks[...].tap` calls above.
85
- quiet: true,
86
- // Reportedly, this avoids CPU overload on some systems.
87
- // https://github.com/facebook/create-react-app/issues/293
88
- // src/node_modules is not ignored to support absolute imports
89
- // https://github.com/facebook/create-react-app/issues/1065
90
- watchOptions: {
91
- ignored: ignoredFiles(paths.appSrc),
33
+ allowedHosts: disableFirewall ? "all" : [allowedHost],
34
+ static: {
35
+ directory: paths.appStaticAssetsCache,
36
+ publicPath: paths.publicUrlOrPath,
37
+ watch: {
38
+ ignored: ignoredFiles(paths.appSrc),
39
+ },
40
+ },
41
+ client: {
42
+ logging: "none",
43
+ // WDS4's native error overlay is a separate implementation from CRA's
44
+ // `react-error-overlay` (which used to freeze the page/iframe on runtime
45
+ // errors that client is now removed). We keep the compile-error overlay,
46
+ // which is the useful one, and disable the runtime-error overlay to avoid
47
+ // blocking the iframe preview.
48
+ overlay: {
49
+ errors: true,
50
+ warnings: false,
51
+ runtimeErrors: false,
52
+ },
53
+ ...(hasWebSocketOverrides && { webSocketURL }),
54
+ },
55
+ devMiddleware: {
56
+ publicPath: paths.publicUrlOrPath.slice(0, -1),
57
+ // webpack-dev-middleware prints stats.toString() with a raw
58
+ // console.log (not the infrastructure logger), so this is the only
59
+ // switch that silences the per-build stats dump.
60
+ stats: "none",
92
61
  },
93
62
  https: getHttpsConfig(),
94
63
  host,
95
- overlay: false,
64
+ hot: true,
65
+ // Use 'ws' instead of 'sockjs-node' on server since we're using native websockets.
66
+ webSocketServer: "ws",
96
67
  historyApiFallback: {
97
68
  // Paths with dots should still use the history fallback.
98
69
  // See https://github.com/facebook/create-react-app/issues/387.
99
70
  disableDotRule: true,
100
71
  index: paths.publicUrlOrPath,
101
72
  },
102
- public: allowedHost,
103
- // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
104
73
  proxy,
105
- before(app, server) {
106
- // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware`
107
- // middlewares before `redirectServedPath` otherwise will not have any effect
108
- // This lets us fetch source contents from webpack for the error overlay
109
- app.use(evalSourceMapMiddleware(server));
110
- // This lets us open files from the runtime error overlay.
111
- app.use(errorOverlayMiddleware());
74
+ setupMiddlewares(middlewares, devServer) {
75
+ // `evalSourceMapMiddleware` must run BEFORE `historyApiFallback`, so unshift it.
76
+ // This lets us fetch source contents from webpack for the error overlay.
77
+ middlewares.unshift(evalSourceMapMiddleware(devServer));
112
78
 
113
79
  if (fs.existsSync(paths.proxySetup)) {
114
80
  // This registers user provided middleware for proxy reasons
115
- require(paths.proxySetup)(app);
81
+ require(paths.proxySetup)(devServer.app);
116
82
  }
117
- },
118
- after(app) {
119
- // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
120
- app.use(redirectServedPath(paths.publicUrlOrPath));
121
83
 
122
- // This service worker file is effectively a 'no-op' that will reset any
123
- // previous service worker registered for the same host:port combination.
124
- // We do this in development to avoid hitting the production cache if
125
- // it used the same host and port.
126
- // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
127
- app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
84
+ // These must run AFTER `historyApiFallback` (push to end), otherwise SPA routes
85
+ // loaded inside the preview iframe receive the raw JS bundle instead of index.html.
86
+ middlewares.push(
87
+ // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
88
+ redirectServedPath(paths.publicUrlOrPath),
89
+ // This service worker file is effectively a 'no-op' that will reset any
90
+ // previous service worker registered for the same host:port combination.
91
+ // We do this in development to avoid hitting the production cache if
92
+ // it used the same host and port.
93
+ // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
94
+ noopServiceWorkerMiddleware(paths.publicUrlOrPath),
95
+ );
96
+
97
+ return middlewares;
128
98
  },
129
99
  };
130
100
  };
@@ -6,7 +6,9 @@ const createConfig = ({ input, output }) => ({
6
6
  entry: input,
7
7
  output: {
8
8
  ...output,
9
- library: "griddo",
9
+ // No library name on purpose: webpack 4 ignored it for commonjs2, but webpack 5
10
+ // appends it to the prefix (module.exports.griddo = ...), which would break the
11
+ // `_griddoConfig.default` read in scripts/griddo-sync-schemas.js.
10
12
  libraryTarget: "commonjs2",
11
13
  },
12
14
  resolve: {
@@ -47,6 +49,9 @@ module.exports = (withExternalConfig) => {
47
49
 
48
50
  return new Promise((resolve, reject) => {
49
51
  compiler.run((err, stats) => {
52
+ // Flush webpack 5's persistent cache before resolving/rejecting.
53
+ compiler.close(() => {});
54
+
50
55
  if (err) {
51
56
  console.log(err);
52
57
  return reject(err);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "12.3.0-beta.0",
4
+ "version": "12.3.0",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -26,8 +26,8 @@
26
26
  "start:dev": "node --env-file=./env/.env.development ./scripts/start.js",
27
27
  "start:staging": "node --env-file=./env/.env.staging ./scripts/start.js",
28
28
  "// BUILD": "",
29
- "build": "NODE_OPTIONS=--openssl-legacy-provider node ./scripts/build.js",
30
- "build:dev": "NODE_OPTIONS=--openssl-legacy-provider node --env-file=./env/.env.development ./scripts/build.js",
29
+ "build": "node ./scripts/build.js",
30
+ "build:dev": "node --env-file=./env/.env.development ./scripts/build.js",
31
31
  "// TEST": "",
32
32
  "test": "jest",
33
33
  "test:watch": "jest --watch",
@@ -46,7 +46,7 @@
46
46
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.16",
47
47
  "@styled-system/prop-types": "5.1.5",
48
48
  "@styled-system/theme-get": "5.1.2",
49
- "@svgr/webpack": "5.5.0",
49
+ "@svgr/webpack": "^8.1.0",
50
50
  "@testing-library/jest-dom": "5.16.5",
51
51
  "@testing-library/react": "13.4.0",
52
52
  "@testing-library/user-event": "14.6.1",
@@ -68,7 +68,7 @@
68
68
  "@types/uuid": "8.3.4",
69
69
  "@types/webpack-env": "1.18.0",
70
70
  "axios": "0.19.0",
71
- "babel-loader": "8.2.2",
71
+ "babel-loader": "^9.2.1",
72
72
  "babel-plugin-named-asset-import": "0.3.8",
73
73
  "babel-plugin-require-context-hook": "1.0.0",
74
74
  "babel-plugin-root-import": "6.6.0",
@@ -77,8 +77,8 @@
77
77
  "case-sensitive-paths-webpack-plugin": "2.4.0",
78
78
  "compress.js": "1.2.2",
79
79
  "connected-react-router": "6.9.3",
80
- "css-loader": "4.3.0",
81
- "css-minimizer-webpack-plugin": "3.0.2",
80
+ "css-loader": "^6.11.0",
81
+ "css-minimizer-webpack-plugin": "^5.0.0",
82
82
  "date-fns": "2.30.0",
83
83
  "dotenv": "6.2.0",
84
84
  "dotenv-expand": "5.1.0",
@@ -87,12 +87,11 @@
87
87
  "draftjs-to-html": "0.9.1",
88
88
  "enhanced-resolve": "5.18.1",
89
89
  "env-cmd": "10.1.0",
90
- "file-loader": "6.2.0",
91
90
  "find-up": "5.0.0",
92
91
  "fs-extra": "7.0.1",
93
92
  "html-to-draftjs": "1.5.0",
94
93
  "html-to-image": "1.11.7",
95
- "html-webpack-plugin": "4.5.0",
94
+ "html-webpack-plugin": "^5.5.0",
96
95
  "identity-obj-proxy": "3.0.0",
97
96
  "ignore-loader": "0.1.2",
98
97
  "is-wsl": "3.1.0",
@@ -100,21 +99,19 @@
100
99
  "jsdom-global": "3.0.2",
101
100
  "lodash.isequal": "4.5.0",
102
101
  "markdown-draft-js": "2.4.0",
103
- "mini-css-extract-plugin": "0.11.3",
104
- "optimize-css-assets-webpack-plugin": "6.0.1",
102
+ "mini-css-extract-plugin": "^2.7.0",
103
+ "node-polyfill-webpack-plugin": "^3.0.0",
105
104
  "pkg-dir": "5.0.0",
106
- "pnp-webpack-plugin": "1.7.0",
107
105
  "polished": "3.4.1",
108
106
  "postcss": "8.5.3",
109
- "postcss-flexbugs-fixes": "4.1.0",
110
- "postcss-loader": "3.0.0",
107
+ "postcss-flexbugs-fixes": "^5.0.2",
108
+ "postcss-loader": "^7.3.0",
111
109
  "postcss-normalize": "7.0.1",
112
110
  "postcss-preset-env": "6.7.0",
113
- "postcss-safe-parser": "6.0.0",
114
111
  "react": "18.2.0",
115
112
  "react-app-polyfill": "1.0.6",
116
113
  "react-datepicker": "4.25.0",
117
- "react-dev-utils": "11.0.4",
114
+ "react-dev-utils": "^12.0.1",
118
115
  "react-dom": "18.2.0",
119
116
  "react-draft-wysiwyg": "1.15.0",
120
117
  "react-easy-crop": "5.5.7",
@@ -135,24 +132,21 @@
135
132
  "resolve": "1.22.10",
136
133
  "resolve-url-loader": "4.0.0",
137
134
  "sass-alias": "1.0.5",
138
- "sass-loader": "10.4.1",
135
+ "sass-loader": "^16.0.7",
139
136
  "semver": "7.6.3",
140
137
  "slick-carousel": "1.8.1",
141
138
  "source-map-loader": "1.1.3",
142
139
  "string-replace-loader": "3.1.0",
143
- "style-loader": "1.3.0",
140
+ "style-loader": "^3.3.0",
144
141
  "styled-components": "5.3.11",
145
142
  "styled-reset": "4.0.1",
146
143
  "styled-system": "5.1.5",
147
- "terser-webpack-plugin": "1.4.1",
148
- "ts-pnp": "1.1.4",
144
+ "terser-webpack-plugin": "^5.3.0",
149
145
  "typescript": "4.9.5",
150
- "url-loader": "4.1.1",
151
146
  "uuid": "8.3.2",
152
- "webpack": "4.47.0",
153
- "webpack-dev-server": "3.11.1",
154
- "webpack-manifest-plugin": "2.2.0",
155
- "workbox-webpack-plugin": "5.1.4"
147
+ "webpack": "^5.88.0",
148
+ "webpack-dev-server": "^4.15.0",
149
+ "webpack-manifest-plugin": "^5.0.0"
156
150
  },
157
151
  "devDependencies": {
158
152
  "@babel/core": "7.26.10",
@@ -219,5 +213,5 @@
219
213
  "publishConfig": {
220
214
  "access": "public"
221
215
  },
222
- "gitHead": "073925ad301a49b5b44f3d838fb4259cb9681a3c"
216
+ "gitHead": "3702a3da08742efbc21a68aaae6c4617bde86e11"
223
217
  }
package/scripts/build.js CHANGED
@@ -143,6 +143,10 @@ function build(previousFileSizes) {
143
143
  } else {
144
144
  messages = formatWebpackMessages(stats.toJson({ all: false, warnings: true, errors: true }));
145
145
  }
146
+
147
+ // Flush webpack 5's persistent filesystem cache to disk before resolving.
148
+ compiler.close(() => {});
149
+
146
150
  if (messages.errors.length) {
147
151
  // Only keep the first error. Others are often indicative
148
152
  // of the same problem, but confuse the reader with noise.
package/scripts/start.js CHANGED
@@ -62,29 +62,58 @@ checkBrowsers(paths.appPath, isInteractive)
62
62
  const useTypeScript = fs.existsSync(paths.appTsConfig);
63
63
  const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === "true";
64
64
  const urls = prepareUrls(protocol, HOST, port, paths.publicUrlOrPath.slice(0, -1));
65
- const devSocket = {
66
- warnings: (warnings) => devServer.sockWrite(devServer.sockets, "warnings", warnings),
67
- errors: (errors) => devServer.sockWrite(devServer.sockets, "errors", errors),
68
- };
69
65
  // Create a webpack compiler that is configured with custom messages.
70
66
  const compiler = createCompiler({
71
67
  appName,
72
68
  config,
73
- devSocket,
74
69
  urls,
75
70
  useYarn,
76
71
  useTypeScript,
77
72
  tscCompileOnError,
78
73
  webpack,
79
74
  });
75
+ // Replace CRA's "You can now view..." block with the Griddo banner.
76
+ // Registered after createCompiler so it runs after CRA's done-hook:
77
+ // clean builds clear that output, builds with warnings keep it visible.
78
+ const { version } = require(paths.appPackageJson);
79
+ const banner = [
80
+ chalk.cyan(" ██████╗ ██████╗ ██╗██████╗ ██████╗ ██████╗ █████╗ ██╗ ██╗"),
81
+ chalk.cyan("██╔════╝ ██╔══██╗██║██╔══██╗██╔══██╗██╔═══██╗ ██╔══██╗╚██╗██╔╝"),
82
+ chalk.cyan("██║ ███╗██████╔╝██║██║ ██║██║ ██║██║ ██║ ███████║ ╚███╔╝"),
83
+ chalk.cyan("██║ ██║██╔══██╗██║██║ ██║██║ ██║██║ ██║ ██╔══██║ ██╔██╗"),
84
+ chalk.cyan("╚██████╔╝██║ ██║██║██████╔╝██████╔╝╚██████╔╝ ██║ ██║██╔╝ ██╗"),
85
+ chalk.cyan(" ╚═════╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝"),
86
+ chalk.dim(`v${version}`),
87
+ "",
88
+ chalk.dim("─".repeat(63)),
89
+ "",
90
+ `${chalk.bold("Local:")} ${urls.localUrlForTerminal}`,
91
+ ...(urls.lanUrlForTerminal ? [`${chalk.bold("On Your Network:")} ${urls.lanUrlForTerminal}`] : []),
92
+ ]
93
+ .map((line) => ` ${line}`)
94
+ .join("\n");
95
+ compiler.hooks.done.tap("griddoStartBanner", (stats) => {
96
+ const statsData = stats.toJson({ all: false, errors: true, warnings: true });
97
+ if (statsData.errors.length) {
98
+ return;
99
+ }
100
+ if (isInteractive && !statsData.warnings.length) {
101
+ clearConsole();
102
+ }
103
+ console.log(`\n${banner}\n`);
104
+ });
80
105
  // Load proxy config
81
106
  const proxySetting = require(paths.appPackageJson).proxy;
82
107
  const proxyConfig = prepareProxy(proxySetting, paths.appPublic, paths.publicUrlOrPath);
83
108
  // Serve webpack assets generated by the compiler over a web server.
84
- const serverConfig = createDevServerConfig(proxyConfig, urls.lanUrlForConfig);
85
- const devServer = new WebpackDevServer(compiler, serverConfig);
86
- // Launch WebpackDevServer.
87
- devServer.listen(port, HOST, (err) => {
109
+ const serverConfig = {
110
+ ...createDevServerConfig(proxyConfig, urls.lanUrlForConfig),
111
+ host: HOST,
112
+ port,
113
+ };
114
+ const devServer = new WebpackDevServer(serverConfig, compiler);
115
+ // Launch WebpackDevServer (WDS4 replaces `listen(port, host, cb)` with `startCallback(cb)`).
116
+ devServer.startCallback((err) => {
88
117
  if (err) {
89
118
  return console.log(err);
90
119
  }
@@ -0,0 +1,67 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { join } from "node:path";
5
+
6
+ // GAINUP: la trazabilidad spec↔test es parte del contrato del paquete.
7
+ // El tooling GAINUP no vive en el repo: se instala aparte, en ~/.claude/gainup, y el repo
8
+ // solo lleva los artefactos (specs, config). Por eso este guardián se SALTA cuando el
9
+ // validador no está instalado: un clon sin el tooling no debe comerse rojos de una capa
10
+ // que no puede operar. Con el tooling presente corre igual que siempre.
11
+ // Corremos en --strict, como cx y render: errores (link-rot, UC active sin test,
12
+ // trace roto) y avisos (AC sin test, UC sin indexar en el README) ponen la suite
13
+ // en rojo. Sin --strict la red de este paquete sería más fina que la de sus
14
+ // vecinos sin que se viera.
15
+ const PKG_ROOT = join(__dirname, "..", ".."); // src/__tests__ -> griddo-ax
16
+ const TRACE = join(homedir(), ".claude", "gainup", "scripts", "gainup-trace.mjs");
17
+
18
+ // GAINUP se instala como plugin de Claude Code, y su ruta de instalación es versionada
19
+ // (…/plugins/cache/<marketplace>/gainup/<versión>/): el alias de arriba lo mantiene el hook
20
+ // SessionStart del plugin, porque este arnés corre desde `yarn` y no tiene ${CLAUDE_PLUGIN_ROOT}.
21
+ //
22
+ // «Sin instalar» es un estado legítimo y el guardián se salta. «Instalado pero sin resolver»
23
+ // no lo es: sería un verde por no haber validado nada — el verde falso contra el que está
24
+ // montada esta capa. Ese caso revienta nombrando el motivo en vez de saltarse en silencio.
25
+ const PLUGINS_DB = join(homedir(), ".claude", "plugins", "installed_plugins.json");
26
+ function gainupPluginInstalled(): boolean {
27
+ try {
28
+ const db = JSON.parse(readFileSync(PLUGINS_DB, "utf8")) as { plugins?: Record<string, unknown> };
29
+ return Object.keys(db.plugins ?? {}).some((key) => key.startsWith("gainup@"));
30
+ } catch {
31
+ return false; // sin fichero o ilegible: no hay plugin del que hablar
32
+ }
33
+ }
34
+
35
+ if (gainupPluginInstalled() && !existsSync(TRACE)) {
36
+ throw new Error(
37
+ `GAINUP consta instalado como plugin pero el validador no está en ${TRACE}. ` +
38
+ "Sin él este guardián se saltaría y la suite daría verde sin haber validado nada. " +
39
+ "Abre una sesión de Claude Code (el hook del plugin recrea el alias) o enlázalo a mano.",
40
+ );
41
+ }
42
+
43
+ // El validador deduce la raíz del monorepo subiendo desde el cwd; Jest corre desde el
44
+ // directorio del paquete, así que se la pasamos explícita.
45
+ const ENV = { ...process.env, GAINUP_REPO_ROOT: join(PKG_ROOT, "..", "..") };
46
+
47
+ // Jest no tiene `describe.skipIf` (es de Vitest): el ternario es su equivalente.
48
+ const describeIfInstalled = existsSync(TRACE) ? describe : describe.skip;
49
+
50
+ describeIfInstalled("GAINUP traceability", () => {
51
+ it("sin link-rot, UC sin test ni avisos (--strict)", () => {
52
+ let output = "";
53
+ let ok = true;
54
+ try {
55
+ output = execFileSync(process.execPath, [TRACE, "griddo-ax", "--strict"], {
56
+ encoding: "utf8",
57
+ env: ENV,
58
+ });
59
+ } catch (error) {
60
+ ok = false;
61
+ const e = error as { stdout?: string; stderr?: string };
62
+ output = `${e.stdout ?? ""}${e.stderr ?? ""}`;
63
+ }
64
+ if (!ok) console.error(output);
65
+ expect(ok).toBe(true);
66
+ });
67
+ });
@@ -9,7 +9,7 @@ import { Restricted } from "@ax/guards";
9
9
  import { type IRouter, multisite, site } from "@ax/routes";
10
10
  import type { ILanguage, IRootState, ISite, IStructuredData, IUser } from "@ax/types";
11
11
 
12
- import { version } from "./../../../../../package.json";
12
+ import packageJson from "./../../../../../package.json";
13
13
  import { NavProvider } from "./context";
14
14
  import NavItem from "./NavItem";
15
15
 
@@ -167,7 +167,9 @@ const NavMenu = (props: IProps) => {
167
167
  </S.GoBack>
168
168
  )}
169
169
  <S.NavLink>{config.logo}</S.NavLink>
170
- {isOpened && !isSite ? <Tag type="square" text={`V ${version}`} color="rgba(80, 87, 255, 0.16)" /> : null}
170
+ {isOpened && !isSite ? (
171
+ <Tag type="square" text={`V ${packageJson.version}`} color="rgba(80, 87, 255, 0.16)" />
172
+ ) : null}
171
173
  </S.Home>
172
174
  <S.Lists>
173
175
  <S.List>
package/config/pnpTs.js DELETED
@@ -1,15 +0,0 @@
1
- const { resolveModuleName } = require("ts-pnp");
2
-
3
- exports.resolveModuleName = (typescript, moduleName, containingFile, compilerOptions, resolutionHost) => {
4
- return resolveModuleName(moduleName, containingFile, compilerOptions, resolutionHost, typescript.resolveModuleName);
5
- };
6
-
7
- exports.resolveTypeReferenceDirective = (typescript, moduleName, containingFile, compilerOptions, resolutionHost) => {
8
- return resolveModuleName(
9
- moduleName,
10
- containingFile,
11
- compilerOptions,
12
- resolutionHost,
13
- typescript.resolveTypeReferenceDirective,
14
- );
15
- };
@@ -1,23 +0,0 @@
1
- import { execFileSync } from "node:child_process";
2
- import { join } from "node:path";
3
-
4
- const PKG_ROOT = join(__dirname, "..", ".."); // src/__tests__ -> griddo-ax
5
- const TRACE = join(PKG_ROOT, "..", "..", "scripts", "aiup-trace.mjs");
6
-
7
- describe("Griddo-AIUP traceability", () => {
8
- it("sin link-rot, traza rota ni UC active sin test", () => {
9
- let output = "";
10
- let ok = true;
11
- try {
12
- output = execFileSync(process.execPath, [TRACE, "griddo-ax"], {
13
- encoding: "utf8",
14
- });
15
- } catch (error) {
16
- ok = false;
17
- const e = error as { stdout?: string; stderr?: string };
18
- output = `${e.stdout ?? ""}${e.stderr ?? ""}`;
19
- }
20
- if (!ok) console.error(output);
21
- expect(ok).toBe(true);
22
- });
23
- });