Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Add a comment about references being auto-generated
Mateusz Burzyński03eab06fa95c
diff --git a/apps/designer/tsconfig.json b/apps/designer/tsconfig.jsonindex 0ebdf04343..a94926beec 100644--- a/apps/designer/tsconfig.json+++ b/apps/designer/tsconfig.json@@ -7,6 +7,7 @@"baseUrl": ".","rootDir": "./app"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../../packages/asset-uploader"diff --git a/bin/update-ts-project-references.ts b/bin/update-ts-project-references.tsindex cfdaf0af5b..565f2f72d4 100644--- a/bin/update-ts-project-references.ts+++ b/bin/update-ts-project-references.ts@@ -49,7 +49,7 @@ const getDependencyGraph = (};const updateFile = async (filePath: string, content: string) => {- await fsP.writeFile(filePath, await format(filePath, content));+ await fsP.writeFile(filePath, content);cp.spawnSync("git", ["add", filePath]);};@@ -77,13 +77,49 @@ const updateTsConfig = async (return;}- await updateFile(+ const formatted = await format(tsConfigPath,fleece.patch(tsConfigContent, {...tsConfig,references: dependencyPaths.map((path) => ({ path })),}));++ const ast = fleece.parse(formatted);+ if (ast.type !== "ObjectExpression") {+ throw new Error("Expected ObjectExpression");+ }+ const referencesPropIndex = ast.properties.findIndex(+ (prop) => prop.key.name === "references"+ );+ if (referencesPropIndex === -1) {+ throw new Error(+ "Expected to find 'references' property and for it to not be the first property"+ );+ }+ if (referencesPropIndex === 0) {+ throw new Error(+ "Expected 'references' property to not be the first property"+ );+ }+ const referencesProp = ast.properties[referencesPropIndex];+ const previousProp = ast.properties[referencesPropIndex - 1];+ const indent = formatted.match(/.*{\n(\s+)[^\s]/)?.[1];++ if (!indent) {+ throw new Error(`Couldn't determine indentation`);+ }++ await updateFile(+ tsConfigPath,+ // this works on the assumption that there are no comments between the references and the previous property+ // if there are any comments there then they might be lost+ formatted.slice(0, previousProp.end) ++ `,\n${indent}// this is auto-generated by ${path.basename(+ __filename+ )}\n${indent}` ++ formatted.slice(referencesProp.start)+ );};(async () => {diff --git a/packages/asset-uploader/tsconfig.json b/packages/asset-uploader/tsconfig.jsonindex 4c5d95f800..67e711a955 100644--- a/packages/asset-uploader/tsconfig.json+++ b/packages/asset-uploader/tsconfig.json@@ -10,6 +10,7 @@"outDir": "./lib","rootDir": "./src"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../fonts"diff --git a/packages/css-vars/tsconfig.json b/packages/css-vars/tsconfig.jsonindex d55df5e9ec..f298e02ab1 100644--- a/packages/css-vars/tsconfig.json+++ b/packages/css-vars/tsconfig.json@@ -10,5 +10,6 @@"outDir": "./lib","rootDir": "./src"},+ // this is auto-generated by update-ts-project-references.ts"references": []}diff --git a/packages/design-system/tsconfig.json b/packages/design-system/tsconfig.jsonindex 85a26e6aba..60e1d1b132 100644--- a/packages/design-system/tsconfig.json+++ b/packages/design-system/tsconfig.json@@ -13,6 +13,7 @@"rootDir": "./src","outDir": "./lib"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../icons"diff --git a/packages/fonts/tsconfig.json b/packages/fonts/tsconfig.jsonindex 1cebedf18d..522b277be1 100644--- a/packages/fonts/tsconfig.json+++ b/packages/fonts/tsconfig.json@@ -10,6 +10,7 @@"rootDir": "./src","outDir": "./lib"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../design-system"diff --git a/packages/http-client/tsconfig.json b/packages/http-client/tsconfig.jsonindex 277a466f24..1110884745 100644--- a/packages/http-client/tsconfig.json+++ b/packages/http-client/tsconfig.json@@ -13,6 +13,7 @@"outDir": "./lib","rootDir": "./src"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../prisma-client"diff --git a/packages/icons/tsconfig.json b/packages/icons/tsconfig.jsonindex 2c34b2b415..1cf9259fda 100644--- a/packages/icons/tsconfig.json+++ b/packages/icons/tsconfig.json@@ -13,6 +13,7 @@"outDir": "./lib","rootDir": "./src"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../css-vars"diff --git a/packages/project/tsconfig.json b/packages/project/tsconfig.jsonindex 17ed87b947..95beb1f253 100644--- a/packages/project/tsconfig.json+++ b/packages/project/tsconfig.json@@ -10,6 +10,7 @@"outDir": "./lib","rootDir": "./src"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../asset-uploader"diff --git a/packages/react-sdk/tsconfig.json b/packages/react-sdk/tsconfig.jsonindex 466f588bed..94967c0358 100644--- a/packages/react-sdk/tsconfig.json+++ b/packages/react-sdk/tsconfig.json@@ -13,6 +13,7 @@"outDir": "./lib","rootDir": "./src"},+ // this is auto-generated by update-ts-project-references.ts"references": [{"path": "../asset-uploader"diff --git a/tsconfig.json b/tsconfig.jsonindex 0e3f6f7052..17d272b593 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -1,5 +1,6 @@{"files": [],+ // this is auto-generated by update-ts-project-references.ts"references": [{ "path": "apps/designer" },{ "path": "packages/asset-uploader" },