Skip to content

Commit

Permalink
feat!: remove redux-bundler, full typescript (#448)
Browse files Browse the repository at this point in the history
* feat: convert to typescript and remove redux-bundler

* feat: fetching is working

* fix: build is working

* test: fix findLinkPath tests

* test: fixing unit tests

* fix: navigating through a dag works again

* chore: remove tests that will come from #449

* fix: builds and passes tests

* fix: storybook and types

* fix: deep-link to an explore view

* chore: pin storybook, remove viteFinal config

* chore: add package-lock.json to attempt to fix CI

* test: typed storybook default exports

* chore: update storybook

* chore: migrate storybook stories to tsx

* chore: update aegir

* fix: cid stories and rendering shortest cids

* fix: storybook dev auto-reload

* fix: graphcrumb stories

* fix: aegir build is consumable by explore.ipld.io

* feat: importable by explore.ipld.io

* chore: externalizing more deps

* chore: remove unnecessary build plugins

* chore: update and move react-helmet to deps

* chore: cleanup unused storybook deps

* chore: remove rollup direct dev dependency

* chore: remove babel

* chore: add react-hooks eslint plugin

* chore: update Helia deps

* chore: update eslint plugins

* chore: update aegir

* chore: update @types deps

* chore: update filesize

* chore: update ipld libs

* chore: update multiformats

* chore: update vite

* chore: update storybook deps

* chore: remove @rollup/plugin-node-resolve

* chore: update testing deps and react

* chore: update react peer deps

* chore: update the last of the deps

* feat: new links-table without react-virtualized

* fix: fixing up some issues with new links table

* fix: links-table uses grid instead of flex

* feat: new links table

* docs: update user guide instructions

* test: vitest runs again

* fix: breadcrumb link clicking

* chore: convert tests to typescript

* chore: fix import path

* chore: update package-lock.json
  • Loading branch information
SgtPooki authored Oct 17, 2024
1 parent 7748e75 commit eeb15ec
Show file tree
Hide file tree
Showing 100 changed files with 24,735 additions and 31,439 deletions.
94 changes: 79 additions & 15 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,82 @@
// import copy from 'esbuild-plugin-copy'
import fs from 'node:fs'
import path from 'node:path'

const copyPlugin = ({ext}) => {
return {
name: `copy-${ext}`,
setup(build) {
const srcDir = 'src'
const destDir = 'dist/src'
build.onEnd(() => {
const copyFile = (src, dest) => {
fs.mkdirSync(path.dirname(dest), { recursive: true })
fs.copyFileSync(src, dest)
}

const walkDir = (dir, callback) => {
fs.readdirSync(dir).forEach(f => {
const dirPath = path.join(dir, f)
const isDirectory = fs.statSync(dirPath).isDirectory()
isDirectory ? walkDir(dirPath, callback) : callback(path.join(dir, f))
})
}

walkDir(srcDir, (filePath) => {
if (filePath.endsWith(`.${ext}`)) {
const relativePath = path.relative(srcDir, filePath)
const destPath = path.join(destDir, relativePath)
copyFile(filePath, destPath)
}
})
})
}
}
}
/** @type {import('aegir').PartialOptions} */
module.exports = {
export default {
// TODO: fix build and test with aegir
// test: {
// build: false,
// files: [
// 'dist/test/**/*.spec.{js,ts, jsx, tsx}',
// ],
// },
build: {
config: {
inject: [
'./src/lib/browser-shims.js'
],
bundle: true,
loader: {
'.js': 'jsx',
'.ts': 'ts',
'.tsx': 'tsx',
'.jsx': 'jsx',
'.svg': 'text',
// '.css': 'css'
'.woff': 'file',
'.woff2': 'file',
'.eot': 'file',
'.otf': 'file',
},
platform: 'browser',
target: 'es2022',
format: 'esm',
metafile: true,
plugins: [
copyPlugin({ext: 'css'}),
copyPlugin({ext: 'svg'}),
],
}
},
lint: {
files: [
// '!node_modules/**',
'src/**/*.{js,jsx,ts,tsx}',
'test/**/*.{js,jsx,ts,tsx}',
// 'src/**/*.tsx',
// 'src/**/*.js',
// 'src/**/*.jsx',
'dev/**/*.{js,jsx,ts,tsx}',
// TODO: re-enable linting of stories.
'!src/**/*.stories.*',
]
},
dependencyCheck: {
Expand All @@ -19,28 +87,24 @@ module.exports = {
'filesize',
'react-inspector',
'react-joyride',
'react-helmet',

// storybook deps
'@chromatic-com/storybook',
'@storybook/addon-actions',
'@storybook/addon-coverage',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-links',
'@storybook/channels',
'@storybook/core-common',
'@storybook/core-events',
'@storybook/csf-plugin',
'@storybook/csf-tools',
'@storybook/docs-tools',
'@storybook/node-logger',
'@storybook/react-dom-shim',
'@storybook/types',

// problem with deps
'@typescript-eslint/eslint-plugin',

// scripts
'wait-on',

// vite stuff
'rollup-plugin-node-polyfills',
],
productionIgnorePatterns: [
'.aegir.js',
Expand All @@ -49,7 +113,7 @@ module.exports = {
'vitest.config.js',
'/test',
'.storybook',
'dist-vite'
'**/*.stories.*',
]
}
}
26 changes: 0 additions & 26 deletions .babelrc

This file was deleted.

16 changes: 0 additions & 16 deletions .editorconfig

This file was deleted.

27 changes: 18 additions & 9 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@ import { mergeConfig } from 'vite';
import viteConfig from '../vite.config';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],

addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-coverage'
'@storybook/addon-coverage',
'@chromatic-com/storybook'
],

framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
async viteFinal(config) {
// Merge custom configuration into the default config
return mergeConfig(config, viteConfig);

// async viteFinal(config) {
// // Merge custom configuration into the default config
// return mergeConfig(config, viteConfig);
// },
typescript: {
// reactDocgen: 'react-docgen-typescript'
reactDocgen: false
// reactDocgenTypescriptOptions: {

// }
},

// docs: {}
};
export default config;
15 changes: 3 additions & 12 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,12 @@ globalThis.Buffer = Buffer

// import CSS files
import 'ipfs-css'
import 'react-virtualized/styles.css'
import 'tachyons'
import '../src/components/loader/Loader.css'
import '../src/components/object-info/LinksTable.css'
import '../src/components/loader/loader.css'
import '../src/components/object-info/links-table.css'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
// tags: ['autodocs']
};

export default preview;
Loading

0 comments on commit eeb15ec

Please sign in to comment.