From ba6a09a754aa180502f9b4ec00e98d5793bf9035 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Mon, 24 Jul 2023 09:24:20 -0700 Subject: [PATCH 1/2] fix: url-encoded dag-PB names can be explored fixes https://github.com/ipld/explore.ipld.io/issues/122 --- src/bundles/explore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundles/explore.js b/src/bundles/explore.js index 34bd4b40..b8a41f3d 100644 --- a/src/bundles/explore.js +++ b/src/bundles/explore.js @@ -103,7 +103,7 @@ const makeBundle = () => { } // add the root cid to the start pathParts.unshift(cid) - const path = pathParts.join('/') + const path = pathParts.map((part) => encodeURIComponent(part)).join('/') const hash = `#/explore/${path}` store.doUpdateHash(hash) } From 6c594b860e958fca2649a5298889fadc9bd0b950 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Mon, 24 Jul 2023 10:10:35 -0700 Subject: [PATCH 2/2] fix: get fleek preview for explorer-components --- .gitignore | 1 + index.html | 2 +- src/lib/get-raw-block.ts | 1 - vite.config.ts | 42 +++++++++++++++++++++------------------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 68c3352f..e68bfaab 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* storybook-static +dist-vite diff --git a/index.html b/index.html index ff872cac..4b117773 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@ typescript & jsx than babel+typescript, which we're required to use to get our bundled assets working properly for explore.ipld.io --> - + diff --git a/src/lib/get-raw-block.ts b/src/lib/get-raw-block.ts index a6a6c053..649b6fdd 100644 --- a/src/lib/get-raw-block.ts +++ b/src/lib/get-raw-block.ts @@ -65,7 +65,6 @@ export async function verifyBytes (providedCid: CID, bytes: Uint8Array): Promise * @returns {boolean} */ function ensureGatewayFetchEnabled (): boolean { - console.info('import.meta.env.NODE_ENV: ', import.meta.env.NODE_ENV) console.info( "🎛️ Customise whether ipld-explorer-components fetches content from gateways by setting an `explore.ipld.gatewayEnabled` value to true/false in localStorage. e.g. localStorage.setItem('explore.ipld.gatewayEnabled', false) -- NOTE: defaults to true" ) diff --git a/vite.config.ts b/vite.config.ts index ea225752..d462cf8b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -69,33 +69,34 @@ export default defineConfig(({ mode, command }) => { include: /\.(tsx?|jsx?)$/ } const viteBuild: UserConfig['build'] = { - lib: { - entry: [ - pathResolve(__dirname, 'src/index.js') - ], - fileName: (format, entryName) => `${format}/${entryName}.js`, - formats: ['es'] - }, + // lib: { + // entry: [ + // pathResolve(__dirname, 'src/index.js') + // ], + // fileName: (format, entryName) => `${format}/${entryName}.js`, + // formats: ['es'] + // }, outDir: 'dist-vite', target: 'esnext', - minify: false, - cssCodeSplit: false, + // minify: false, + // cssCodeSplit: false, rollupOptions: { external: [ /node_modules/, /\.stories\..+$/ - ], - preserveEntrySignatures: 'strict', - input: { - index: pathResolve(__dirname, 'src/index.js') - }, - output: { - preserveModules: true, - preserveModulesRoot: 'src', - entryFileNames: '[name].js' - }, - plugins: [ ] + // preserveEntrySignatures: 'strict', + // input: { + // // index: pathResolve(__dirname, 'dev/devPage.jsx') + // index: pathResolve(__dirname, 'index.html') + // }, + // output: { + // preserveModules: true, + // preserveModulesRoot: 'src', + // entryFileNames: '[name].js' + // }, + // plugins: [ + // ] } } @@ -116,6 +117,7 @@ export default defineConfig(({ mode, command }) => { } const finalConfig: UserConfigExport = { + base: './', plugins: vitePlugins, resolve: viteResolve, define: viteDefine,