From 6b1eb35ad069580fce907b38ef4bcf6e4547b5d2 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Fri, 3 Oct 2025 16:58:26 +0800 Subject: [PATCH 01/11] feat: add square brackets to curly braces converter --- constants/data.ts | 5 +++++ pages/square-to-curly.tsx | 23 +++++++++++++++++++++++ utils/routes.tsx | 6 +++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 pages/square-to-curly.tsx diff --git a/constants/data.ts b/constants/data.ts index 23832fd2..c3c9c766 100644 --- a/constants/data.ts +++ b/constants/data.ts @@ -530,3 +530,8 @@ pub contract Example { } } `; +export const square = `[ + [1, 2, 3], + [2, 3, 1], + [3, 1, 2], +]`; diff --git a/pages/square-to-curly.tsx b/pages/square-to-curly.tsx new file mode 100644 index 00000000..1084c950 --- /dev/null +++ b/pages/square-to-curly.tsx @@ -0,0 +1,23 @@ +import ConversionPanel from "@components/ConversionPanel"; +import { useCallback } from "react"; +import * as React from "react"; + +export default function SquareToCurly() { + const transformer = useCallback(async ({ value }) => { + if (typeof value === "string") { + return value.replace(/\[/g, "{").replace(/\]/g, "}"); + } + return ""; + }, []); + + return ( + + ); +} diff --git a/utils/routes.tsx b/utils/routes.tsx index cb19f16f..8922887f 100644 --- a/utils/routes.tsx +++ b/utils/routes.tsx @@ -222,7 +222,7 @@ export const categorizedRoutes = [ label: "to Typescript", path: "/js-object-to-typescript", desc: "An online REPL for converting JS Object to Typescript." - }, + } ] }, { @@ -393,6 +393,10 @@ export const categorizedRoutes = [ { label: "Cadence to Go", path: "/cadence-to-go" + }, + { + label: "[] to {}", + path: "/square-to-curly" } ] } From 36fd6fe6e474cf67b10c210c7329b96d21365ae4 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sat, 3 Jan 2026 14:54:41 +0800 Subject: [PATCH 02/11] feat: add index.html --- index.html | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 00000000..70929735 --- /dev/null +++ b/index.html @@ -0,0 +1,11 @@ + + + + + + Document + + + Hello World + + From b619513f0a6d668254c37567e07bfaef6ff3e017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=81=E6=96=AF=E5=85=8B?= <736090467@qq.com> Date: Sat, 3 Jan 2026 15:55:05 +0800 Subject: [PATCH 03/11] Add GitHub Actions workflow for Next.js deployment This workflow builds and deploys a Next.js site to GitHub Pages, handling package manager detection, caching, and artifact uploading. --- .github/workflows/nextjs.yml | 93 ++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/nextjs.yml diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml new file mode 100644 index 00000000..974fcb99 --- /dev/null +++ b/.github/workflows/nextjs.yml @@ -0,0 +1,93 @@ +# Sample workflow for building and deploying a Next.js site to GitHub Pages +# +# To get started with Next.js see: https://nextjs.org/docs/getting-started +# +name: Deploy Next.js site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Detect package manager + id: detect-package-manager + run: | + if [ -f "${{ github.workspace }}/yarn.lock" ]; then + echo "manager=yarn" >> $GITHUB_OUTPUT + echo "command=install" >> $GITHUB_OUTPUT + echo "runner=yarn" >> $GITHUB_OUTPUT + exit 0 + elif [ -f "${{ github.workspace }}/package.json" ]; then + echo "manager=npm" >> $GITHUB_OUTPUT + echo "command=ci" >> $GITHUB_OUTPUT + echo "runner=npx --no-install" >> $GITHUB_OUTPUT + exit 0 + else + echo "Unable to determine package manager" + exit 1 + fi + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: ${{ steps.detect-package-manager.outputs.manager }} + - name: Setup Pages + uses: actions/configure-pages@v5 + with: + # Automatically inject basePath in your Next.js configuration file and disable + # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). + # + # You may remove this line if you want to manage the configuration yourself. + static_site_generator: next + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + .next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- + - name: Install dependencies + run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + - name: Build with Next.js + run: ${{ steps.detect-package-manager.outputs.runner }} next build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./out + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 985e033e20fba8930c35b9fe2a601268457b345d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=81=E6=96=AF=E5=85=8B?= <736090467@qq.com> Date: Sat, 3 Jan 2026 15:57:03 +0800 Subject: [PATCH 04/11] Change Node.js version from 20 to 16 --- .github/workflows/nextjs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 974fcb99..3c30ddf6 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -51,7 +51,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "16" cache: ${{ steps.detect-package-manager.outputs.manager }} - name: Setup Pages uses: actions/configure-pages@v5 From f32ad0657e01b0b479a40b1950168a5d595c3045 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sat, 3 Jan 2026 16:00:56 +0800 Subject: [PATCH 05/11] feat: add next config output --- index.html | 11 ----------- next.config.js | 2 ++ 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index 70929735..00000000 --- a/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Document - - - Hello World - - diff --git a/next.config.js b/next.config.js index 7900a6a6..2c17a2d5 100644 --- a/next.config.js +++ b/next.config.js @@ -43,4 +43,6 @@ const config = { } }; +config.output = "export"; + module.exports = config; From d37d5f3aa0c6fd8347934b04b50a7282b18cb173 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sat, 3 Jan 2026 16:10:22 +0800 Subject: [PATCH 06/11] feat: add export process --- .github/workflows/nextjs.yml | 2 ++ next.config.js | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 3c30ddf6..d582802e 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -75,6 +75,8 @@ jobs: run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} - name: Build with Next.js run: ${{ steps.detect-package-manager.outputs.runner }} next build + - name: Export with Next.js + run: ${{ steps.detect-package-manager.outputs.runner }} next export - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/next.config.js b/next.config.js index 2c17a2d5..1fc453eb 100644 --- a/next.config.js +++ b/next.config.js @@ -44,5 +44,6 @@ const config = { }; config.output = "export"; +config.basePath = process.env.PAGES_BASE_PATH; module.exports = config; From 2f46e6b66c15226f61d55a84c330b87d8629a427 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sat, 3 Jan 2026 16:32:45 +0800 Subject: [PATCH 07/11] feat: add next config --- next.config.js | 5 ++++- package.json | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/next.config.js b/next.config.js index 1fc453eb..c6eee37a 100644 --- a/next.config.js +++ b/next.config.js @@ -44,6 +44,9 @@ const config = { }; config.output = "export"; -config.basePath = process.env.PAGES_BASE_PATH; +config.basePath = "/transform"; +config.assetPrefix = "/transform/"; +config.reactStrictMode = false; +config.trailingSlash = true; module.exports = config; diff --git a/package.json b/package.json index 11a62302..ad124447 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "build": "next build", "now-build": "next build", "postinstall": "patch-package", - "build:analyze": "ANALYZE=true yarn build" + "build:analyze": "ANALYZE=true yarn build", + "export": "next export" }, "engines": { "node": "16.x" From 49b1367e29433e137c6301adaca0849d51393a52 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sat, 3 Jan 2026 16:40:07 +0800 Subject: [PATCH 08/11] modify next config --- next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.config.js b/next.config.js index c6eee37a..19ac272a 100644 --- a/next.config.js +++ b/next.config.js @@ -23,7 +23,7 @@ const config = { loader: "worker-loader", options: { name: "static/[hash].worker.js", - publicPath: "/_next/" + publicPath: "/transform/_next/" } } }); From aea6deebf4b068a0a6d954b233a17a3a26bdbaa0 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sat, 3 Jan 2026 16:48:25 +0800 Subject: [PATCH 09/11] feat: modify icon --- components/Meta.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Meta.tsx b/components/Meta.tsx index 6fa02c03..b550dbca 100644 --- a/components/Meta.tsx +++ b/components/Meta.tsx @@ -5,7 +5,7 @@ export const Meta = ({ title, description, url }) => { return ( {title} - + @@ -20,7 +20,7 @@ export const Meta = ({ title, description, url }) => { /> - + ); }; From 3c655ac9f7ea94251d954b93b44427a6e0f40105 Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sat, 3 Jan 2026 21:48:55 +0800 Subject: [PATCH 10/11] rm prefix --- components/Meta.tsx | 4 ++-- next.config.js | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/Meta.tsx b/components/Meta.tsx index b550dbca..6fa02c03 100644 --- a/components/Meta.tsx +++ b/components/Meta.tsx @@ -5,7 +5,7 @@ export const Meta = ({ title, description, url }) => { return ( {title} - + @@ -20,7 +20,7 @@ export const Meta = ({ title, description, url }) => { /> - + ); }; diff --git a/next.config.js b/next.config.js index 19ac272a..2c17a2d5 100644 --- a/next.config.js +++ b/next.config.js @@ -23,7 +23,7 @@ const config = { loader: "worker-loader", options: { name: "static/[hash].worker.js", - publicPath: "/transform/_next/" + publicPath: "/_next/" } } }); @@ -44,9 +44,5 @@ const config = { }; config.output = "export"; -config.basePath = "/transform"; -config.assetPrefix = "/transform/"; -config.reactStrictMode = false; -config.trailingSlash = true; module.exports = config; From c379bf25cee81a0a3546e30b74b8378a6c2cd11f Mon Sep 17 00:00:00 2001 From: haotao chen Date: Sun, 4 Jan 2026 16:37:30 +0800 Subject: [PATCH 11/11] feat: rm unuse feature --- components/Navigator.tsx | 4 +- constants/data.ts | 6 + pages/_app.tsx | 6 +- pages/index.tsx | 59 +-- pages/json-to-format.tsx | 21 ++ pages/string-to-json.tsx | 22 ++ pages/svg-to-jsx.tsx | 56 +++ utils/routes.tsx | 770 +++++++++++++++++++++------------------ 8 files changed, 528 insertions(+), 416 deletions(-) create mode 100644 pages/json-to-format.tsx create mode 100644 pages/string-to-json.tsx create mode 100644 pages/svg-to-jsx.tsx diff --git a/components/Navigator.tsx b/components/Navigator.tsx index c50e4f47..22cce27c 100644 --- a/components/Navigator.tsx +++ b/components/Navigator.tsx @@ -75,7 +75,7 @@ export default function Navigator() { })} - + {/* - + */} ); } diff --git a/constants/data.ts b/constants/data.ts index c3c9c766..75fab3a2 100644 --- a/constants/data.ts +++ b/constants/data.ts @@ -535,3 +535,9 @@ export const square = `[ [2, 3, 1], [3, 1, 2], ]`; + +export const index = "Hello, World!"; + +export const stringjson = '"{\\"name\\":\\"Tom\\",\\"age\\":18}"'; + +export const jsonformat = `{ "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false }`; diff --git a/pages/_app.tsx b/pages/_app.tsx index 5f31f108..e4ab60fc 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -110,15 +110,15 @@ export default function App(props) { display: "inline-block", height: 20 }} - href="https://github.com/ritz078/transform" + href="https://github.com/NoFacePeace/transform" > - +