mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-16 11:47:50 +01:00
migrate to vite and vitest from cra and jest
This commit is contained in:
4
.github/workflows/deploy-preview.yml
vendored
4
.github/workflows/deploy-preview.yml
vendored
@@ -6,8 +6,8 @@ on:
|
|||||||
# paths:
|
# paths:
|
||||||
# - "website/**"
|
# - "website/**"
|
||||||
env:
|
env:
|
||||||
REACT_APP_FIREBASE_PROJECT_ID: rowyio
|
VITE_APP_FIREBASE_PROJECT_ID: rowyio
|
||||||
REACT_APP_FIREBASE_PROJECT_WEB_API_KEY:
|
VITE_APP_FIREBASE_PROJECT_WEB_API_KEY:
|
||||||
"${{ secrets.FIREBASE_WEB_API_KEY_TRYROWY }}"
|
"${{ secrets.FIREBASE_WEB_API_KEY_TRYROWY }}"
|
||||||
CI: ""
|
CI: ""
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
# production
|
# production
|
||||||
/build
|
/build
|
||||||
|
/dist
|
||||||
cloud_functions/functions/lib
|
cloud_functions/functions/lib
|
||||||
|
|
||||||
# firebase
|
# firebase
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ const main = (
|
|||||||
) => {
|
) => {
|
||||||
return fs.writeFileSync(
|
return fs.writeFileSync(
|
||||||
".env",
|
".env",
|
||||||
`REACT_APP_FIREBASE_PROJECT_ID = ${projectID}
|
`VITE_APP_FIREBASE_PROJECT_ID = ${projectID}
|
||||||
REACT_APP_FIREBASE_PROJECT_WEB_API_KEY = ${firebaseWebApiKey}
|
VITE_APP_FIREBASE_PROJECT_WEB_API_KEY = ${firebaseWebApiKey}
|
||||||
REACT_APP_ALGOLIA_APP_ID = ${algoliaAppId}
|
VITE_APP_ALGOLIA_APP_ID = ${algoliaAppId}
|
||||||
REACT_APP_ALGOLIA_SEARCH_API_KEY = ${algoliaSearhApiKey}`
|
VITE_APP_ALGOLIA_SEARCH_API_KEY = ${algoliaSearhApiKey}`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"hosting": {
|
"hosting": {
|
||||||
"public": "build",
|
"public": "dist",
|
||||||
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
|
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,30 +15,30 @@
|
|||||||
<link
|
<link
|
||||||
rel="apple-touch-icon"
|
rel="apple-touch-icon"
|
||||||
sizes="180x180"
|
sizes="180x180"
|
||||||
href="%PUBLIC_URL%/favicon/apple-touch-icon.png"
|
href="/favicon/apple-touch-icon.png"
|
||||||
/>
|
/>
|
||||||
<link
|
<link
|
||||||
rel="icon"
|
rel="icon"
|
||||||
type="image/png"
|
type="image/png"
|
||||||
sizes="32x32"
|
sizes="32x32"
|
||||||
href="%PUBLIC_URL%/favicon/favicon-32x32.png"
|
href="/favicon/favicon-32x32.png"
|
||||||
/>
|
/>
|
||||||
<link
|
<link
|
||||||
rel="icon"
|
rel="icon"
|
||||||
type="image/png"
|
type="image/png"
|
||||||
sizes="16x16"
|
sizes="16x16"
|
||||||
href="%PUBLIC_URL%/favicon/favicon-16x16.png"
|
href="/favicon/favicon-16x16.png"
|
||||||
/>
|
/>
|
||||||
<link
|
<link
|
||||||
rel="icon"
|
rel="icon"
|
||||||
type="image/svg+xml"
|
type="image/svg+xml"
|
||||||
href="%PUBLIC_URL%/favicon/icon.svg"
|
href="/favicon/icon.svg"
|
||||||
id="favicon-svg"
|
id="favicon-svg"
|
||||||
/>
|
/>
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/site.webmanifest" />
|
<link rel="manifest" href="/site.webmanifest" />
|
||||||
<link
|
<link
|
||||||
rel="mask-icon"
|
rel="mask-icon"
|
||||||
href="%PUBLIC_URL%/favicon/safari-pinned-tab.svg"
|
href="/favicon/safari-pinned-tab.svg"
|
||||||
color="#4200FF"
|
color="#4200FF"
|
||||||
/>
|
/>
|
||||||
<meta name="msapplication-TileColor" content="#4200FF" />
|
<meta name="msapplication-TileColor" content="#4200FF" />
|
||||||
@@ -47,13 +47,13 @@
|
|||||||
manifest.json provides metadata used when your web app is installed on a
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
-->
|
-->
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
<link rel="manifest" href="/manifest.json" />
|
||||||
<!--
|
<!--
|
||||||
Notice the use of %PUBLIC_URL% in the tags above.
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
It will be replaced with the URL of the `public` folder during the build.
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
Only files inside the `public` folder can be referenced from the HTML.
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
Unlike "/favicon.ico" or "favicon.ico", "/favicon.ico" will
|
||||||
work correctly both with client-side routing and a non-root public URL.
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
property="og:description"
|
property="og:description"
|
||||||
content="Build on the Google Cloud Platform in minutes. Manage Firestore data in a spreadsheet-like UI, write Cloud Functions effortlessly in the browser, and connect to third-party apps. Rowy is open source!"
|
content="Build on the Google Cloud Platform in minutes. Manage Firestore data in a spreadsheet-like UI, write Cloud Functions effortlessly in the browser, and connect to third-party apps. Rowy is open source!"
|
||||||
/>
|
/>
|
||||||
<meta property="og:image" content="%PUBLIC_URL%/static/meta.png" />
|
<meta property="og:image" content="/static/meta.png" />
|
||||||
|
|
||||||
<meta property="twitter:card" content="summary_large_image" />
|
<meta property="twitter:card" content="summary_large_image" />
|
||||||
<meta property="twitter:url" content="https://rowy.io/" />
|
<meta property="twitter:url" content="https://rowy.io/" />
|
||||||
@@ -96,11 +96,12 @@
|
|||||||
property="twitter:description"
|
property="twitter:description"
|
||||||
content="Build on the Google Cloud Platform in minutes. Manage Firestore data in a spreadsheet-like UI, write Cloud Functions effortlessly in the browser, and connect to third-party apps. Rowy is open source!"
|
content="Build on the Google Cloud Platform in minutes. Manage Firestore data in a spreadsheet-like UI, write Cloud Functions effortlessly in the browser, and connect to third-party apps. Rowy is open source!"
|
||||||
/>
|
/>
|
||||||
<meta property="twitter:image" content="%PUBLIC_URL%/static/meta.png" />
|
<meta property="twitter:image" content="/static/meta.png" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/index.tsx"></script>
|
||||||
<!--
|
<!--
|
||||||
This HTML file is a template.
|
This HTML file is a template.
|
||||||
If you open it directly in the browser, you will see an empty page.
|
If you open it directly in the browser, you will see an empty page.
|
||||||
24
package.json
24
package.json
@@ -10,6 +10,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.10.5",
|
"@emotion/react": "^11.10.5",
|
||||||
"@emotion/styled": "^11.10.5",
|
"@emotion/styled": "^11.10.5",
|
||||||
|
"@json2csv/plainjs": "^7.0.1",
|
||||||
"@mdi/js": "^6.6.96",
|
"@mdi/js": "^6.6.96",
|
||||||
"@monaco-editor/react": "^4.4.4",
|
"@monaco-editor/react": "^4.4.4",
|
||||||
"@mui/icons-material": "^5.10.16",
|
"@mui/icons-material": "^5.10.16",
|
||||||
@@ -33,7 +34,6 @@
|
|||||||
"firebaseui": "^6.0.1",
|
"firebaseui": "^6.0.1",
|
||||||
"jotai": "^1.8.4",
|
"jotai": "^1.8.4",
|
||||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||||
"json2csv": "^5.0.7",
|
|
||||||
"jszip": "^3.10.0",
|
"jszip": "^3.10.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"match-sorter": "^6.3.1",
|
"match-sorter": "^6.3.1",
|
||||||
@@ -62,7 +62,6 @@
|
|||||||
"react-markdown": "^8.0.3",
|
"react-markdown": "^8.0.3",
|
||||||
"react-router-dom": "6.3.0",
|
"react-router-dom": "6.3.0",
|
||||||
"react-router-hash-link": "^2.4.3",
|
"react-router-hash-link": "^2.4.3",
|
||||||
"react-scripts": "^5.0.1",
|
|
||||||
"react-usestateref": "^1.0.8",
|
"react-usestateref": "^1.0.8",
|
||||||
"react-virtual": "^2.10.4",
|
"react-virtual": "^2.10.4",
|
||||||
"remark-gfm": "^3.0.1",
|
"remark-gfm": "^3.0.1",
|
||||||
@@ -74,17 +73,18 @@
|
|||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.3",
|
||||||
"use-algolia": "^1.5.3",
|
"use-algolia": "^1.5.3",
|
||||||
"use-async-memo": "^1.2.4",
|
"use-async-memo": "^1.2.4",
|
||||||
"use-debounce": "^8.0.0",
|
"use-debounce": "^9.0.4",
|
||||||
"use-memo-value": "^1.0.1",
|
"use-memo-value": "^1.0.1",
|
||||||
"web-vitals": "^2.1.4",
|
"web-vitals": "^2.1.4",
|
||||||
"workbox-webpack-plugin": "^6.5.4"
|
"workbox-webpack-plugin": "^6.5.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cross-env PORT=7699 craco start",
|
"start": "vite --port 7699",
|
||||||
"startWithEmulators": "cross-env PORT=7699 REACT_APP_FIREBASE_EMULATORS=true craco start",
|
"startWithEmulators": "VITE_APP_FIREBASE_EMULATORS=true vite --port 7699",
|
||||||
"emulators": "firebase emulators:start --only firestore,auth --import ./emulators/ --export-on-exit",
|
"emulators": "firebase emulators:start --only firestore,auth --import ./emulators/ --export-on-exit",
|
||||||
"test": "craco test --env ./src/test/custom-jest-env.js --verbose --detectOpenHandles",
|
"test": "vitest",
|
||||||
"build": "craco build",
|
"build": "tsc && vite build",
|
||||||
|
"preview": "vite preview --port 7699",
|
||||||
"analyze": "source-map-explorer ./build/static/js/*.js",
|
"analyze": "source-map-explorer ./build/static/js/*.js",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"env": "node createDotEnv",
|
"env": "node createDotEnv",
|
||||||
@@ -154,7 +154,6 @@
|
|||||||
"@types/dompurify": "^2.3.3",
|
"@types/dompurify": "^2.3.3",
|
||||||
"@types/file-saver": "^2.0.5",
|
"@types/file-saver": "^2.0.5",
|
||||||
"@types/jest": "^27.4.1",
|
"@types/jest": "^27.4.1",
|
||||||
"@types/json2csv": "^5.0.3",
|
|
||||||
"@types/lodash-es": "^4.17.6",
|
"@types/lodash-es": "^4.17.6",
|
||||||
"@types/node": "^17.0.23",
|
"@types/node": "^17.0.23",
|
||||||
"@types/react": "^18.0.25",
|
"@types/react": "^18.0.25",
|
||||||
@@ -167,6 +166,8 @@
|
|||||||
"@types/seedrandom": "^3.0.2",
|
"@types/seedrandom": "^3.0.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||||
"@typescript-eslint/parser": "^5.45.0",
|
"@typescript-eslint/parser": "^5.45.0",
|
||||||
|
"@vitejs/plugin-react": "^4.0.0",
|
||||||
|
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||||
"craco-alias": "^3.0.1",
|
"craco-alias": "^3.0.1",
|
||||||
"craco-swc": "^0.5.1",
|
"craco-swc": "^0.5.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
@@ -176,6 +177,7 @@
|
|||||||
"eslint-plugin-local-rules": "^1.1.0",
|
"eslint-plugin-local-rules": "^1.1.0",
|
||||||
"eslint-plugin-no-relative-import-paths": "^1.2.0",
|
"eslint-plugin-no-relative-import-paths": "^1.2.0",
|
||||||
"eslint-plugin-tsdoc": "^0.2.16",
|
"eslint-plugin-tsdoc": "^0.2.16",
|
||||||
|
"happy-dom": "^9.20.3",
|
||||||
"husky": ">=7.0.4",
|
"husky": ">=7.0.4",
|
||||||
"lint-staged": ">=12.3.7",
|
"lint-staged": ">=12.3.7",
|
||||||
"monaco-editor": "^0.33.0",
|
"monaco-editor": "^0.33.0",
|
||||||
@@ -183,7 +185,11 @@
|
|||||||
"raw-loader": "^4.0.2",
|
"raw-loader": "^4.0.2",
|
||||||
"source-map-explorer": "^2.5.2",
|
"source-map-explorer": "^2.5.2",
|
||||||
"ts-jest": "^28.0.2",
|
"ts-jest": "^28.0.2",
|
||||||
"typedoc": "^0.23.21"
|
"typedoc": "^0.23.21",
|
||||||
|
"vite": "^4.3.9",
|
||||||
|
"vite-plugin-svgr": "^3.2.0",
|
||||||
|
"vite-tsconfig-paths": "^4.2.0",
|
||||||
|
"vitest": "^0.31.4"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@types/react": "^18"
|
"@types/react": "^18"
|
||||||
|
|||||||
@@ -12,13 +12,12 @@ import type { languages } from "monaco-editor/esm/vs/editor/editor.api";
|
|||||||
import { useTheme } from "@mui/material";
|
import { useTheme } from "@mui/material";
|
||||||
import type { SystemStyleObject, Theme } from "@mui/system";
|
import type { SystemStyleObject, Theme } from "@mui/system";
|
||||||
|
|
||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
import firestoreDefs from "./firestore.d.ts?raw";
|
||||||
import firestoreDefs from "!!raw-loader!./firestore.d.ts";
|
import firebaseAuthDefs from "./firebaseAuth.d.ts?raw";
|
||||||
import firebaseAuthDefs from "!!raw-loader!./firebaseAuth.d.ts";
|
import firebaseStorageDefs from "./firebaseStorage.d.ts?raw";
|
||||||
import firebaseStorageDefs from "!!raw-loader!./firebaseStorage.d.ts";
|
import utilsDefs from "./utils.d.ts?raw";
|
||||||
import utilsDefs from "!!raw-loader!./utils.d.ts";
|
import rowyUtilsDefs from "./rowy.d.ts?raw";
|
||||||
import rowyUtilsDefs from "!!raw-loader!./rowy.d.ts";
|
import extensionsDefs from "./extensions.d.ts?raw";
|
||||||
import extensionsDefs from "!!raw-loader!./extensions.d.ts";
|
|
||||||
import { runRoutes } from "@src/constants/runRoutes";
|
import { runRoutes } from "@src/constants/runRoutes";
|
||||||
import { rowyRunAtom, projectScope } from "@src/atoms/projectScope";
|
import { rowyRunAtom, projectScope } from "@src/atoms/projectScope";
|
||||||
import { getFieldProp } from "@src/components/fields";
|
import { getFieldProp } from "@src/components/fields";
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ import CodeEditorHelper from "@src/components/CodeEditor/CodeEditorHelper";
|
|||||||
import { FieldType } from "@src/constants/fields";
|
import { FieldType } from "@src/constants/fields";
|
||||||
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
||||||
|
|
||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
import defaultValueDefs from "./defaultValue.d.ts?raw";
|
||||||
import defaultValueDefs from "!!raw-loader!./defaultValue.d.ts";
|
|
||||||
import {
|
import {
|
||||||
projectScope,
|
projectScope,
|
||||||
compatibleRowyRunVersionAtom,
|
compatibleRowyRunVersionAtom,
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ import "tinymce/themes/silver";
|
|||||||
import "tinymce/icons/default";
|
import "tinymce/icons/default";
|
||||||
// Editor styles
|
// Editor styles
|
||||||
/* eslint import/no-webpack-loader-syntax: off */
|
/* eslint import/no-webpack-loader-syntax: off */
|
||||||
import skinCss from "!!raw-loader!tinymce/skins/ui/oxide/skin.min.css";
|
import skinCss from "tinymce/skins/ui/oxide/skin.min.css?inline";
|
||||||
import skinDarkCss from "!!raw-loader!tinymce/skins/ui/oxide-dark/skin.min.css";
|
import skinDarkCss from "tinymce/skins/ui/oxide-dark/skin.min.css?inline";
|
||||||
// Content styles, including inline UI like fake cursors
|
// Content styles, including inline UI like fake cursors
|
||||||
/* eslint import/no-webpack-loader-syntax: off */
|
/* eslint import/no-webpack-loader-syntax: off */
|
||||||
import contentCss from "!!raw-loader!tinymce/skins/content/default/content.min.css";
|
import contentCss from "tinymce/skins/content/default/content.min.css?inline";
|
||||||
import contentUiCss from "!!raw-loader!tinymce/skins/ui/oxide/content.min.css";
|
import contentUiCss from "tinymce/skins/ui/oxide/content.min.css?inline";
|
||||||
import contentCssDark from "!!raw-loader!tinymce/skins/content/dark/content.min.css";
|
import contentCssDark from "tinymce/skins/content/dark/content.min.css?inline";
|
||||||
import contentUiCssDark from "!!raw-loader!tinymce/skins/ui/oxide-dark/content.min.css";
|
import contentUiCssDark from "tinymce/skins/ui/oxide-dark/content.min.css?inline";
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
import "tinymce/plugins/autoresize";
|
import "tinymce/plugins/autoresize";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { parse as json2csv } from "json2csv";
|
import { Parser } from "@json2csv/plainjs";
|
||||||
import { saveAs } from "file-saver";
|
import { saveAs } from "file-saver";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
import { getDocs } from "firebase/firestore";
|
import { getDocs } from "firebase/firestore";
|
||||||
@@ -150,10 +150,10 @@ export default function Export({
|
|||||||
const csvData = docs.map((doc: any) =>
|
const csvData = docs.map((doc: any) =>
|
||||||
columns.reduce(selectedColumnsCsvReducer(doc), {})
|
columns.reduce(selectedColumnsCsvReducer(doc), {})
|
||||||
);
|
);
|
||||||
const csv = json2csv(
|
const parser = new Parser(
|
||||||
csvData,
|
|
||||||
exportType === "tsv" ? { delimiter: "\t" } : undefined
|
exportType === "tsv" ? { delimiter: "\t" } : undefined
|
||||||
);
|
);
|
||||||
|
const csv = parser.parse(csvData);
|
||||||
const csvBlob = new Blob([csv], {
|
const csvBlob = new Blob([csv], {
|
||||||
type: `text/${exportType};charset=utf-8`,
|
type: `text/${exportType};charset=utf-8`,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useCallback, useRef, useEffect } from "react";
|
import { useState, useCallback, useRef, useEffect } from "react";
|
||||||
import { useAtom, useSetAtom } from "jotai";
|
import { useAtom, useSetAtom } from "jotai";
|
||||||
import { parse } from "csv-parse/browser/esm";
|
import { parse } from "csv-parse/browser/esm";
|
||||||
import { parse as parseJSON } from "json2csv";
|
import { Parser, ParserOptions } from "@json2csv/plainjs";
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
import { useDebouncedCallback } from "use-debounce";
|
import { useDebouncedCallback } from "use-debounce";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
@@ -78,7 +78,8 @@ function convertJSONToCSV(rawData: string): string | false {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const csv = parseJSON(rawDataJSONified, opts);
|
const parser = new Parser(opts as ParserOptions);
|
||||||
|
const csv = parser.parse(rawDataJSONified);
|
||||||
return csv;
|
return csv;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ import {
|
|||||||
import { tableScope, tableColumnsOrderedAtom } from "@src/atoms/tableScope";
|
import { tableScope, tableColumnsOrderedAtom } from "@src/atoms/tableScope";
|
||||||
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
||||||
|
|
||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
import actionDefs from "./action.d.ts?raw";
|
||||||
import actionDefs from "!!raw-loader!./action.d.ts";
|
|
||||||
import { RUN_ACTION_TEMPLATE, UNDO_ACTION_TEMPLATE } from "./templates";
|
import { RUN_ACTION_TEMPLATE, UNDO_ACTION_TEMPLATE } from "./templates";
|
||||||
import { ROUTES } from "@src/constants/routes";
|
import { ROUTES } from "@src/constants/routes";
|
||||||
import { ISettingsProps } from "@src/components/fields/types";
|
import { ISettingsProps } from "@src/components/fields/types";
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import {
|
|||||||
import FieldSkeleton from "@src/components/SideDrawer/FieldSkeleton";
|
import FieldSkeleton from "@src/components/SideDrawer/FieldSkeleton";
|
||||||
import CodeEditorHelper from "@src/components/CodeEditor/CodeEditorHelper";
|
import CodeEditorHelper from "@src/components/CodeEditor/CodeEditorHelper";
|
||||||
import InlineOpenInNewIcon from "@src/components/InlineOpenInNewIcon";
|
import InlineOpenInNewIcon from "@src/components/InlineOpenInNewIcon";
|
||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
import connectorDefs from "./connector.d.ts?raw";
|
||||||
import connectorDefs from "!!raw-loader!./connector.d.ts";
|
|
||||||
|
|
||||||
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
||||||
import { baseFunction } from "./utils";
|
import { baseFunction } from "./utils";
|
||||||
@@ -26,7 +25,7 @@ import {
|
|||||||
rowyRunModalAtom,
|
rowyRunModalAtom,
|
||||||
} from "@src/atoms/projectScope";
|
} from "@src/atoms/projectScope";
|
||||||
|
|
||||||
//import typeDefs from "!!raw-loader!./types.d.ts";
|
//import typeDefs from "./types.d.ts?raw";
|
||||||
const CodeEditor = lazy(
|
const CodeEditor = lazy(
|
||||||
() =>
|
() =>
|
||||||
import("@src/components/CodeEditor" /* webpackChunkName: "CodeEditor" */)
|
import("@src/components/CodeEditor" /* webpackChunkName: "CodeEditor" */)
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ import { FieldType } from "@src/constants/fields";
|
|||||||
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
||||||
|
|
||||||
import { getFieldProp } from "@src/components/fields";
|
import { getFieldProp } from "@src/components/fields";
|
||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
import derivativeDefs from "./derivative.d.ts?raw";
|
||||||
import derivativeDefs from "!!raw-loader!./derivative.d.ts";
|
|
||||||
|
|
||||||
const CodeEditor = lazy(
|
const CodeEditor = lazy(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ import { defaultFn, listenerFieldTypes, outputFieldTypes } from "./util";
|
|||||||
import PreviewTable from "./PreviewTable";
|
import PreviewTable from "./PreviewTable";
|
||||||
import { getFieldProp } from "..";
|
import { getFieldProp } from "..";
|
||||||
|
|
||||||
/* eslint-disable import/no-webpack-loader-syntax */
|
import formulaDefs from "./formula.d.ts?raw";
|
||||||
import formulaDefs from "!!raw-loader!./formula.d.ts";
|
|
||||||
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
import { WIKI_LINKS } from "@src/constants/externalLinks";
|
||||||
import CodeEditorHelper from "@src/components/CodeEditor/CodeEditorHelper";
|
import CodeEditorHelper from "@src/components/CodeEditor/CodeEditorHelper";
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import { useEffect } from "react";
|
|||||||
|
|
||||||
const DOCUMENT_TITLE_BASE =
|
const DOCUMENT_TITLE_BASE =
|
||||||
"Rowy" +
|
"Rowy" +
|
||||||
(process.env.NODE_ENV === "production"
|
(import.meta.env.MODE === "production"
|
||||||
? ""
|
? ""
|
||||||
: ` (${
|
: ` (${
|
||||||
process.env.REACT_APP_FIREBASE_EMULATORS ? "Emulator • " : ""
|
import.meta.env.VITE_APP_FIREBASE_EMULATORS ? "Emulator • " : ""
|
||||||
}${process.env.NODE_ENV.replace("development", "dev")})`);
|
}${import.meta.env.MODE.replace("development", "dev")})`);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the document/tab title and resets when the page is changed
|
* Sets the document/tab title and resets when the page is changed
|
||||||
|
|||||||
1
src/react-app-env.d.ts
vendored
1
src/react-app-env.d.ts
vendored
@@ -1 +0,0 @@
|
|||||||
/// <reference types="react-scripts" />
|
|
||||||
@@ -10,17 +10,19 @@ import { getStorage, connectStorageEmulator } from "firebase/storage";
|
|||||||
import { getFunctions } from "firebase/functions";
|
import { getFunctions } from "firebase/functions";
|
||||||
|
|
||||||
export const envConfig = {
|
export const envConfig = {
|
||||||
apiKey: process.env.REACT_APP_FIREBASE_PROJECT_WEB_API_KEY,
|
apiKey: import.meta.env.VITE_APP_FIREBASE_PROJECT_WEB_API_KEY,
|
||||||
authDomain: `${process.env.REACT_APP_FIREBASE_PROJECT_ID}.firebaseapp.com`,
|
authDomain: `${import.meta.env.VITE_APP_FIREBASE_PROJECT_ID}.firebaseapp.com`,
|
||||||
databaseURL: `https://${process.env.REACT_APP_FIREBASE_PROJECT_ID}.firebaseio.com`,
|
databaseURL: `https://${
|
||||||
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
|
import.meta.env.VITE_APP_FIREBASE_PROJECT_ID
|
||||||
storageBucket: `${process.env.REACT_APP_FIREBASE_PROJECT_ID}.appspot.com`,
|
}.firebaseio.com`,
|
||||||
|
projectId: import.meta.env.VITE_APP_FIREBASE_PROJECT_ID,
|
||||||
|
storageBucket: `${import.meta.env.VITE_APP_FIREBASE_PROJECT_ID}.appspot.com`,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Connect emulators based on env vars
|
// Connect emulators based on env vars
|
||||||
const envConnectEmulators =
|
const envConnectEmulators =
|
||||||
process.env.NODE_ENV === "test" ||
|
import.meta.env.NODE_ENV === "test" ||
|
||||||
process.env.REACT_APP_FIREBASE_EMULATORS === "true";
|
import.meta.env.VITE_APP_FIREBASE_EMULATORS === "true";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store Firebase config here so it can be set programmatically.
|
* Store Firebase config here so it can be set programmatically.
|
||||||
|
|||||||
1
src/vite-env.d.ts
vendored
Normal file
1
src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2021",
|
"target": "es2021",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"types": ["vite/client", "vite-plugin-svgr/client"],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
|||||||
37
vite.config.ts
Normal file
37
vite.config.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
import viteTsconfigPaths from "vite-tsconfig-paths";
|
||||||
|
import svgrPlugin from "vite-plugin-svgr";
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
resolve: {
|
||||||
|
// Explicitly setting mainFields to default value. For some reason, Vitest isn't
|
||||||
|
// respecting the 'module' field in package.json without specifying it explicitly
|
||||||
|
mainFields: ["module", "jsnext:main", "jsnext"],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
react({
|
||||||
|
babel: {
|
||||||
|
plugins: [
|
||||||
|
"jotai/babel/plugin-react-refresh",
|
||||||
|
"jotai/babel/plugin-debug-label",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
// To enable import '@src/' type of imports
|
||||||
|
viteTsconfigPaths(),
|
||||||
|
// To enable import of SVG as React component
|
||||||
|
svgrPlugin(),
|
||||||
|
],
|
||||||
|
test: {
|
||||||
|
globals: true,
|
||||||
|
environment: "happy-dom",
|
||||||
|
setupFiles: "src/test/setupTests.ts",
|
||||||
|
deps: {
|
||||||
|
// According to vitest, clsx exports ES Module code in a CommonJS package.
|
||||||
|
// This fixes it.
|
||||||
|
inline: ["clsx"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user