build: use tsconfig bundler (#3581)

This commit is contained in:
Alex Yang
2023-08-04 17:00:36 -07:00
committed by GitHub
parent bbf5f0efe0
commit 97de0ef5b4
21 changed files with 116 additions and 221 deletions

View File

@@ -1,5 +1,7 @@
import type { PrimitiveAtom } from 'jotai';
import { atom } from 'jotai';
import { atomFamily, atomWithStorage } from 'jotai/utils';
import type { AtomFamily } from 'jotai/vanilla/utils/atomFamily';
import type { CreateWorkspaceMode } from '../components/affine/create-workspace-modal';
import type { SettingProps } from '../components/affine/setting-modal';
@@ -59,19 +61,16 @@ const defaultPageSetting = {
mode: 'page',
} satisfies PageLocalSetting;
export const pageSettingFamily = atomFamily((pageId: string) =>
export const pageSettingFamily: AtomFamily<
string,
PrimitiveAtom<PageLocalSetting>
> = atomFamily((pageId: string) =>
atom(
get =>
get(pageSettingsBaseAtom)[pageId] ?? {
...defaultPageSetting,
},
(
get,
set,
patch:
| Partial<PageLocalSetting>
| ((prevSetting: PageLocalSetting | undefined) => void)
) => {
(get, set, patch) => {
set(recentPageSettingsBaseAtom, ids => {
// pick 3 recent page ids
return [...new Set([pageId, ...ids]).values()].slice(0, 3);

View File

@@ -1,23 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "ESNext",
"resolveJsonModule": true,
"isolatedModules": true,
"moduleResolution": "bundler",
"jsx": "preserve",
"jsxImportSource": "@emotion/react",
"incremental": true,
"experimentalDecorators": true,
"outDir": "lib",
"typeRoots": ["../../node_modules", "../../node_modules/@types"],
"types": ["webpack-env", "ses"]
"types": ["webpack-env", "ses", "affine__env"]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"],

View File

@@ -21,7 +21,7 @@
"react": "18.3.0-canary-1fdacbefd-20230630",
"react-dom": "18.3.0-canary-1fdacbefd-20230630",
"react-server-dom-webpack": "18.3.0-canary-1fdacbefd-20230630",
"waku": "0.12.1"
"waku": "0.14.0"
},
"devDependencies": {
"@types/react": "^18.2.17",

View File

@@ -4,7 +4,7 @@ export default defineRouter(
async id => {
switch (id) {
case 'index': {
const { default: AppCreator } = await import('./src/app.js');
const { default: AppCreator } = await import('./app.js');
return AppCreator(id);
}
default:

View File

@@ -29,7 +29,7 @@
<div class="spinner"></div>
</div>
<!--/placeholder1-->
<script src="./src/index.tsx" defer type="module"></script>
<script src="./index.tsx" defer type="module"></script>
<!--placeholder2-->
<!--/placeholder2-->
</body>

Binary file not shown.

View File

@@ -10,7 +10,8 @@
"skipLibCheck": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"jsxImportSource": "react"
},
"include": ["src", "entries.ts"],
"references": [

View File

@@ -29,7 +29,6 @@ test.skip('move workspace db file', async ({ page, appInfo, workspace }) => {
// move db file to tmp folder
await page.evaluate(tmpPath => {
// @ts-expect-error
window.apis?.dialog.setFakeDialogResult({
filePath: tmpPath,
});
@@ -72,7 +71,6 @@ test('export then add', async ({ page, appInfo, workspace }) => {
// export db file to tmp folder
await page.evaluate(tmpPath => {
// @ts-expect-error
window.apis?.dialog.setFakeDialogResult({
filePath: tmpPath,
});
@@ -92,7 +90,6 @@ test('export then add', async ({ page, appInfo, workspace }) => {
await page.getByTestId('add-or-new-workspace').click();
await page.evaluate(tmpPath => {
// @ts-expect-error
window.apis?.dialog.setFakeDialogResult({
filePath: tmpPath,
});