-
-
Notifications
You must be signed in to change notification settings - Fork 0
Switch nutils to vite build #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1769143
67fc000
957ccd8
23a22d9
3b20cf1
754a75e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,6 +1,24 @@ | ||||
import { Option, Command } from 'clipanion' | ||||
import { NotionExporter } from './index' | ||||
import { generateTreemaps, PageNode } from '../treemap' | ||||
import { computeStats, writeStats } from '../stats' | ||||
treemap = Option.Boolean('--treemap', { | ||||
description: 'Generate HTML treemap after export' | ||||
}) | ||||
stats = Option.Boolean('--stats', { | ||||
description: 'Generate statistics JSON after export' | ||||
}) | ||||
|
||||
if (this.treemap || this.stats) if (!exporter.pageTree) await exporter.loadRaw() | ||||
|
||||
const tree = exporter.pageTree as unknown as PageNode | ||||
if (this.treemap && tree) await generateTreemaps(this.folder, tree) | ||||
|
||||
if (this.stats && tree) { | ||||
const stats = computeStats(tree) | ||||
await writeStats(`${this.folder}/stats.json`, stats) | ||||
} | ||||
import { generateTreemaps, PageNode } from '../treemap' | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A duplicate import of 'generateTreemaps' and 'PageNode' was introduced, which can lead to confusion and potential maintenance issues. Removing the redundant import should resolve this.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||
import { computeStats, writeStats } from '../stats' | ||||
|
||||
export class NotionExportCommand extends Command { | ||||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineConfig } from 'vite' | ||
import dts from 'vite-plugin-dts' | ||
import pkg from './package.json' assert { type: 'json' } | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: 'src/main.ts', | ||
formats: ['es'], | ||
fileName: () => 'main.js' | ||
}, | ||
outDir: 'build/src', | ||
target: 'node16', | ||
sourcemap: true, | ||
minify: true, | ||
rollupOptions: { | ||
external: [ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
'fs', | ||
'fs/promises', | ||
'path', | ||
'stream', | ||
'util' | ||
] | ||
} | ||
}, | ||
plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build/src' })] | ||
}) | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'vite' | ||
import dts from 'vite-plugin-dts' | ||
import pkg from './package.json' assert { type: 'json' } | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
formats: ['es'], | ||
fileName: () => 'index.js' | ||
}, | ||
outDir: 'build', | ||
target: 'es2015', | ||
sourcemap: true, | ||
minify: true, | ||
rollupOptions: { | ||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})] | ||
} | ||
}, | ||
plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
}) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'vite' | ||
import dts from 'vite-plugin-dts' | ||
import pkg from './package.json' assert { type: 'json' } | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
formats: ['es'], | ||
fileName: () => 'index.js' | ||
}, | ||
outDir: 'build', | ||
target: 'es2015', | ||
sourcemap: true, | ||
minify: true, | ||
rollupOptions: { | ||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})] | ||
} | ||
}, | ||
plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import React from 'react' | ||
import { getBlockParentPage, getBlockTitle } from '@texonom/nutils' | ||
|
||
import { NotionContextConsumer, NotionContextProvider } from '../context' | ||
import { ClearIcon } from '../icons/clear-icon' | ||
import { LoadingIcon } from '../icons/loading-icon' | ||
|
@@ -19,6 +17,16 @@ const debounce = (func: (...args: any[]) => void, wait: number) => { | |
} | ||
} | ||
|
||
// debounce search calls so the expensive query only runs after typing stops | ||
this._search = debounce(this._searchImpl.bind(this), 500) | ||
onInput={this._onChangeQuery} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 'onInput={this._onChangeQuery}' attribute appears to be misplaced within the debounce function block. Consider moving it to the appropriate component JSX element to avoid unintended behavior. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
let timeout: ReturnType<typeof setTimeout> | undefined | ||
return (...args: any[]) => { | ||
if (timeout) clearTimeout(timeout) | ||
timeout = setTimeout(() => func(...args), wait) | ||
} | ||
} | ||
|
||
export class SearchDialog extends React.Component<{ | ||
isOpen: boolean | ||
rootBlockId: string | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'vite' | ||
import dts from 'vite-plugin-dts' | ||
import pkg from './package.json' assert { type: 'json' } | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: 'src/index.tsx', | ||
formats: ['es'], | ||
fileName: () => 'index.js' | ||
}, | ||
outDir: 'build', | ||
target: 'es2015', | ||
sourcemap: true, | ||
minify: true, | ||
rollupOptions: { | ||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})] | ||
} | ||
}, | ||
plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
}) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'vite' | ||
import dts from 'vite-plugin-dts' | ||
import pkg from './package.json' assert { type: 'json' } | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
formats: ['es'], | ||
fileName: () => 'index.js' | ||
}, | ||
outDir: 'build', | ||
target: 'es2015', | ||
sourcemap: true, | ||
minify: true, | ||
rollupOptions: { | ||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})] | ||
} | ||
}, | ||
plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
}) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineConfig } from 'vite' | ||
import dts from 'vite-plugin-dts' | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: 'src/index.ts', | ||
formats: ['es'], | ||
fileName: () => 'index.js' | ||
}, | ||
outDir: 'build', | ||
target: 'es2015', | ||
sourcemap: true, | ||
minify: true, | ||
rollupOptions: { | ||
external: ['is-url-superb', 'mem', 'normalize-url', '@texonom/ntypes', 'p-queue'] | ||
} | ||
}, | ||
plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
}) |
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duplicate export statement for './treemap' (and similarly for './stats') can cause redundancy and potential conflicts. Remove the extra export lines to keep the module exports clear.
Copilot uses AI. Check for mistakes.