From 5ca534bd9cd22043a5425c70e8559d478dd18e0d Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Thu, 2 Sep 2021 12:16:40 +1000 Subject: [PATCH] get project name from package.json --- craco.config.js | 9 +++++++++ package.json | 3 ++- src/components/BuilderInstaller.tsx | 5 ++--- src/components/Navigation/UserMenu.tsx | 4 ++-- src/components/Navigation/index.tsx | 9 ++++++--- src/components/ProjectSettings/form.tsx | 3 ++- .../ColumnMenu/FieldSettings/DefaultValueInput.tsx | 5 +++-- .../Table/ColumnMenu/FieldSettings/index.tsx | 2 +- .../TableHeader/Extensions/ExtensionModal.tsx | 2 +- src/components/TableSettings/form.tsx | 3 ++- src/components/TableSettings/index.tsx | 3 ++- .../Wizards/ImportCsvWizard/Step1Columns.tsx | 2 +- .../Wizards/ImportCsvWizard/Step2NewColumns.tsx | 2 +- .../Wizards/ImportWizard/Step1Columns.tsx | 2 +- src/components/Wizards/ImportWizard/Step3Types.tsx | 2 +- src/components/Wizards/ImportWizard/index.tsx | 2 +- src/components/fields/Email/index.tsx | 2 +- src/components/fields/Phone/index.tsx | 3 +-- src/components/fields/Url/index.tsx | 2 +- src/constants/fields.ts | 2 +- tsconfig.extend.json | 8 ++++++++ tsconfig.json | 14 ++++++++++++-- yarn.lock | 5 +++++ 23 files changed, 66 insertions(+), 28 deletions(-) create mode 100644 tsconfig.extend.json diff --git a/craco.config.js b/craco.config.js index 8b70a80b5..46000fac9 100644 --- a/craco.config.js +++ b/craco.config.js @@ -1,7 +1,16 @@ +const CracoAlias = require("craco-alias"); const CracoSwcPlugin = require("craco-swc"); module.exports = { plugins: [ + { + plugin: CracoAlias, + options: { + source: "tsconfig", + baseUrl: "./src", + tsConfigPath: "./tsconfig.extend.json", + }, + }, { plugin: CracoSwcPlugin, options: { diff --git a/package.json b/package.json index b14b673fd..3a8695f45 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "rowy", + "name": "Rowy", "version": "2.0.0", "homepage": "https://rowy.io/", "repository": { @@ -106,6 +106,7 @@ "@types/react-dom": "^17.0.8", "@types/react-router-dom": "^5.1.7", "@types/use-persisted-state": "^0.3.0", + "craco-alias": "^3.0.1", "firebase-tools": "^8.12.1", "husky": "^4.2.5", "monaco-editor": "^0.21.2", diff --git a/src/components/BuilderInstaller.tsx b/src/components/BuilderInstaller.tsx index cf1f72244..64ae93adf 100644 --- a/src/components/BuilderInstaller.tsx +++ b/src/components/BuilderInstaller.tsx @@ -1,8 +1,7 @@ import useDoc from "hooks/useDoc"; import Modal from "components/Modal"; -import { Box, Button, CircularProgress, Typography } from "@material-ui/core"; +import { Box, CircularProgress, Typography } from "@material-ui/core"; import { IFormDialogProps } from "./Table/ColumnMenu/NewColumn"; -import OpenInNewIcon from "@material-ui/icons/OpenInNew"; import CheckCircleIcon from "@material-ui/icons/CheckCircle"; export interface IProjectSettings @@ -29,7 +28,7 @@ export default function BuilderInstaller({ handleClose }: IProjectSettings) { children={ - You will be redirected to Google Cloud Shell to deploy Rowy Function + You will be redirected to Google Cloud Shell to deploy Function Builder to Cloud Run.
diff --git a/src/components/Navigation/UserMenu.tsx b/src/components/Navigation/UserMenu.tsx index 9a9575935..caf5aef0c 100644 --- a/src/components/Navigation/UserMenu.tsx +++ b/src/components/Navigation/UserMenu.tsx @@ -22,8 +22,8 @@ import ArrowRightIcon from "@material-ui/icons/ArrowRight"; import UpdateChecker, { useLatestUpdateState } from "./UpdateChecker"; import { useAppContext } from "contexts/AppContext"; import routes from "constants/routes"; -import { projectId } from "../../firebase"; -import meta from "../../../package.json"; +import { projectId } from "@src/firebase"; +import meta from "@root/package.json"; const useStyles = makeStyles((theme) => createStyles({ diff --git a/src/components/Navigation/index.tsx b/src/components/Navigation/index.tsx index a2dcff3fe..8a1c331f6 100644 --- a/src/components/Navigation/index.tsx +++ b/src/components/Navigation/index.tsx @@ -12,6 +12,9 @@ import NavDrawer from "./NavDrawer"; import { useRowyContext } from "contexts/RowyContext"; import UserMenu from "./UserMenu"; +import { name } from "@root/package.json"; +import { projectId } from "@src/firebase"; + export const APP_BAR_HEIGHT = 56; const useStyles = makeStyles((theme) => @@ -56,12 +59,12 @@ export default function Navigation({ const currentTable = tableCollection?.split("/")[0]; useEffect(() => { - const name = + const tableName = _find(tables, ["collection", currentTable])?.name || currentTable; - document.title = `${name} | Rowy`; + document.title = `${tableName} | ${projectId} | ${name}`; return () => { - document.title = "Rowy"; + document.title = `${projectId} | ${name}`; }; }, [currentTable]); diff --git a/src/components/ProjectSettings/form.tsx b/src/components/ProjectSettings/form.tsx index 2aa7ca205..f7a651fe6 100644 --- a/src/components/ProjectSettings/form.tsx +++ b/src/components/ProjectSettings/form.tsx @@ -5,6 +5,7 @@ import { authOptions } from "firebase/firebaseui"; import { Link } from "@material-ui/core"; import OpenInNewIcon from "@material-ui/icons/OpenInNew"; import WIKI_LINKS from "constants/wikiLinks"; +import { name } from "@root/package.json"; export const projectSettingsForm = [ { @@ -54,7 +55,7 @@ export const projectSettingsForm = [ format: "url", assistiveText: ( <> - A Cloud Run instance is required to build and deploy Rowy Cloud + A Cloud Run instance is required to build and deploy {name} Cloud Functions. Learn more diff --git a/src/components/Table/ColumnMenu/FieldSettings/DefaultValueInput.tsx b/src/components/Table/ColumnMenu/FieldSettings/DefaultValueInput.tsx index 9ab1342ed..4b2941a38 100644 --- a/src/components/Table/ColumnMenu/FieldSettings/DefaultValueInput.tsx +++ b/src/components/Table/ColumnMenu/FieldSettings/DefaultValueInput.tsx @@ -19,6 +19,7 @@ import CodeEditor from "components/Table/editors/CodeEditor"; import FormAutosave from "./FormAutosave"; import { FieldType } from "constants/fields"; import WIKI_LINKS from "constants/wikiLinks"; +import { name } from "@root/package.json"; const useStyles = makeStyles((theme) => createStyles({ @@ -104,8 +105,8 @@ export default function DefaultValueInput({ diff --git a/src/components/Table/ColumnMenu/FieldSettings/index.tsx b/src/components/Table/ColumnMenu/FieldSettings/index.tsx index 0599d8245..2867264ac 100644 --- a/src/components/Table/ColumnMenu/FieldSettings/index.tsx +++ b/src/components/Table/ColumnMenu/FieldSettings/index.tsx @@ -134,7 +134,7 @@ export default function FieldSettings(props: IMenuModalProps) { const buildUrl = settingsDoc.get("buildUrl"); if (!buildUrl) { snack.open({ - message: `Rowy functions builder is not yet setup`, + message: `Functions Builder is not yet setup`, variant: "error", action: (