Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions docs/04-api-reference/debug-flags/debug-flags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"front-commerce:adobe-b2b:companyCredit": "DESCRIPITON OF <code>front-commerce:adobe-b2b:companyCredit</code>",
"front-commerce:adobe-b2b:permissions": "DESCRIPITON OF front-commerce:adobe-b2b:permissions",
"front-commerce:attraqt": "DESCRIPITON OF front-commerce:attraqt",
"front-commerce:authorization": "DESCRIPITON OF front-commerce:authorization",
"front-commerce:big-commerce:address": "DESCRIPITON OF front-commerce:big-commerce:address",
"front-commerce:big-commerce:cache": "DESCRIPITON OF front-commerce:big-commerce:cache",
"front-commerce:big-commerce:cart": "DESCRIPITON OF front-commerce:big-commerce:cart",
"front-commerce:big-commerce:category": "DESCRIPITON OF front-commerce:big-commerce:category",
"front-commerce:big-commerce:checkout": "DESCRIPITON OF front-commerce:big-commerce:checkout",
"front-commerce:big-commerce:core": "DESCRIPITON OF front-commerce:big-commerce:core",
"front-commerce:big-commerce:customer": "DESCRIPITON OF front-commerce:big-commerce:customer",
"front-commerce:big-commerce:hacks": "DESCRIPITON OF front-commerce:big-commerce:hacks",
"front-commerce:big-commerce:layer": "DESCRIPITON OF front-commerce:big-commerce:layer",
"front-commerce:big-commerce:navigation": "DESCRIPITON OF front-commerce:big-commerce:navigation",
"front-commerce:big-commerce:order": "DESCRIPITON OF front-commerce:big-commerce:order",
"front-commerce:big-commerce:product": "DESCRIPITON OF front-commerce:big-commerce:product",
"front-commerce:big-commerce:reset-password": "DESCRIPITON OF front-commerce:big-commerce:reset-password",
"front-commerce:big-commerce:url": "DESCRIPITON OF front-commerce:big-commerce:url",
"front-commerce:big-commerce:wishlist": "DESCRIPITON OF front-commerce:big-commerce:wishlist",
"front-commerce:cache": "DESCRIPITON OF front-commerce:cache",
"front-commerce:cart": "DESCRIPITON OF front-commerce:cart",
"front-commerce:cart:cache": "DESCRIPITON OF front-commerce:cart:cache",
"front-commerce:cluster": "DESCRIPITON OF front-commerce:cluster",
"front-commerce:config": "DESCRIPITON OF front-commerce:config",
"front-commerce:contentful": "DESCRIPITON OF front-commerce:contentful",
"front-commerce:contentful:BlocksContentType": "DESCRIPITON OF front-commerce:contentful:BlocksContentType",
"front-commerce:contentful:preview": "DESCRIPITON OF front-commerce:contentful:preview",
"front-commerce:contribution-mode": "DESCRIPITON OF front-commerce:contribution-mode",
"front-commerce:core:graphql-codegen": "DESCRIPITON OF front-commerce:core:graphql-codegen",
"front-commerce:core:rate-limiter:limitRateByClientIp": "DESCRIPITON OF front-commerce:core:rate-limiter:limitRateByClientIp",
"front-commerce:country": "DESCRIPITON OF front-commerce:country",
"front-commerce:customer": "DESCRIPITON OF front-commerce:customer",
"front-commerce:customer:cache": "DESCRIPITON OF front-commerce:customer:cache",
"front-commerce:dynamic-routes": "DESCRIPITON OF front-commerce:dynamic-routes",
"front-commerce:elasticsearch": "DESCRIPITON OF front-commerce:elasticsearch",
"front-commerce:express": "DESCRIPITON OF front-commerce:express",
"front-commerce:graphql": "DESCRIPITON OF front-commerce:graphql",
"front-commerce:hipay": "DESCRIPITON OF front-commerce:hipay",
"front-commerce:httpauth": "DESCRIPITON OF front-commerce:httpauth",
"front-commerce:image": "DESCRIPITON OF front-commerce:image",
"front-commerce:in-stock-alert": "DESCRIPITON OF front-commerce:in-stock-alert",
"front-commerce:magento2:admin": "DESCRIPITON OF front-commerce:magento2:admin",
"front-commerce:magento2:search": "DESCRIPITON OF front-commerce:magento2:search",
"front-commerce:magento2:user": "DESCRIPITON OF front-commerce:magento2:user",
"front-commerce:maintenance-mode": "DESCRIPITON OF front-commerce:maintenance-mode",
"front-commerce:payment": "DESCRIPITON OF front-commerce:payment",
"front-commerce:payment:adyen": "DESCRIPITON OF front-commerce:payment:adyen",
"front-commerce:payment:buybox": "DESCRIPITON OF front-commerce:payment:buybox",
"front-commerce:payment:stripe": "DESCRIPITON OF front-commerce:payment:stripe",
"front-commerce:performance": "DESCRIPITON OF front-commerce:performance",
"front-commerce:prismic": "DESCRIPITON OF front-commerce:prismic",
"front-commerce:prismic:cache": "DESCRIPITON OF front-commerce:prismic:cache",
"front-commerce:prismic:fetch": "DESCRIPITON OF front-commerce:prismic:fetch",
"front-commerce:prismic:webhook": "DESCRIPITON OF front-commerce:prismic:webhook",
"front-commerce:remix:server:dynamic-routes": "DESCRIPITON OF front-commerce:remix:server:dynamic-routes",
"front-commerce:remote-schemas": "DESCRIPITON OF front-commerce:remote-schemas",
"front-commerce:rma": "DESCRIPITON OF front-commerce:rma",
"front-commerce:routes": "DESCRIPITON OF front-commerce:routes",
"front-commerce:scripts": "DESCRIPITON OF front-commerce:scripts",
"front-commerce:server": "DESCRIPITON OF front-commerce:server",
"front-commerce:server-events:cli": "DESCRIPITON OF front-commerce:server-events:cli",
"front-commerce:server-events:integrations:analytics": "DESCRIPITON OF front-commerce:server-events:integrations:analytics",
"front-commerce:server-events:integrations:webhook": "DESCRIPITON OF front-commerce:server-events:integrations:webhook",
"front-commerce:services:RateLimiter": "DESCRIPITON OF front-commerce:services:RateLimiter",
"front-commerce:services:events": "DESCRIPITON OF front-commerce:services:events",
"front-commerce:services:events:redis": "DESCRIPITON OF front-commerce:services:events:redis",
"front-commerce:shipping:chronorelais": "DESCRIPITON OF front-commerce:shipping:chronorelais",
"front-commerce:shipping:mondialrelay": "DESCRIPITON OF front-commerce:shipping:mondialrelay",
"front-commerce:smart-forms:capency": "DESCRIPITON OF front-commerce:smart-forms:capency",
"front-commerce:store-credit": "DESCRIPITON OF front-commerce:store-credit"
}
23 changes: 23 additions & 0 deletions docs/04-api-reference/debug-flags/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Debug flags

Use `DEBUG=xxxx` to add debug flags.

Available flags are detailed below.

:::warning

This is verbose, please don't use in production

import flags from "./debug-flags.json"

```mdx-code-block
export const JSONList = () => {
return Object.entries(flags).map(([key, value]) => (
<>
<h2><code>{key}</code></h2>
<p>{value}</p>
</>
))};
```

<JSONList />
49 changes: 49 additions & 0 deletions genfromcode.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const CODE_PATH = "/home/pierre/Code/core/main";

import { execSync } from "node:child_process";
// const command = `rg -iF '"front-commerce:' | awk -F'd\\\\("' '{print $2}' | awk -F'"' '{print $1}' | sort -u`;
const command = `rg -F '"front-commerce:' .`;
// run the command and get output as array
const result = execSync(command, {
cwd: CODE_PATH,
encoding: "utf-8",
stdio: "pipe",
});

const lines = result.split("\n");

// extract the namespace of d() function
const res = lines
.map((line) => {
const match = line.match(/\("([^"]+)"/);
return match && match[1];
})
.filter(Boolean)
.sort();

// unique scopes
const unique = [...new Set(res)];

// read existing debug flags from docs/04-api-reference/debug-flags.json and update with the new ones
// warn if one doesn't exist
import { readFileSync, writeFileSync } from "node:fs";
const debugFlags = JSON.parse(
readFileSync(
`${process.cwd()}/docs/04-api-reference/debug-flags/debug-flags.json`,
"utf-8"
)
);

const newFlags = unique.filter((flag) => {
if (debugFlags[flag]) {
return false;
}
return true;
});
if (newFlags.length) {
console.log("New flags must be documented:");
console.log(newFlags);
process.exit(1);
}

console.log(unique);
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"predev": "pnpm run genfromcode",
"dev": "pnpm run start",
"start": "pnpm run docusaurus start",
"genfromcode": "node ./genfromcode.mjs",
"build": "pnpm run docusaurus build",
"swizzle": "pnpm run docusaurus swizzle",
"deploy": "pnpm run docusaurus deploy",
Expand Down