mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 13:38:49 +08:00
refactor(infra): no bundle infra (#5414)
This commit is contained in:
@@ -21,10 +21,6 @@ inputs:
|
|||||||
description: 'set nmMode to hardlinks-local in .yarnrc.yml'
|
description: 'set nmMode to hardlinks-local in .yarnrc.yml'
|
||||||
required: false
|
required: false
|
||||||
default: 'true'
|
default: 'true'
|
||||||
build-infra:
|
|
||||||
description: 'Build infra'
|
|
||||||
required: false
|
|
||||||
default: 'true'
|
|
||||||
nmHoistingLimits:
|
nmHoistingLimits:
|
||||||
description: 'Set nmHoistingLimits in .yarnrc.yml'
|
description: 'Set nmHoistingLimits in .yarnrc.yml'
|
||||||
required: false
|
required: false
|
||||||
@@ -186,8 +182,3 @@ runs:
|
|||||||
run: node ./node_modules/electron/install.js
|
run: node ./node_modules/electron/install.js
|
||||||
env:
|
env:
|
||||||
electron_config_cache: ./node_modules/.cache/electron
|
electron_config_cache: ./node_modules/.cache/electron
|
||||||
|
|
||||||
- name: Build Infra
|
|
||||||
shell: bash
|
|
||||||
if: inputs.build-infra == 'true'
|
|
||||||
run: yarn run build:infra
|
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
extra-flags: workspaces focus @affine/native
|
extra-flags: workspaces focus @affine/native
|
||||||
electron-install: false
|
electron-install: false
|
||||||
build-infra: false
|
|
||||||
- name: Setup filename
|
- name: Setup filename
|
||||||
id: filename
|
id: filename
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -248,7 +247,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
extra-flags: workspaces focus @affine/storage
|
extra-flags: workspaces focus @affine/storage
|
||||||
electron-install: false
|
electron-install: false
|
||||||
build-infra: false
|
|
||||||
- name: Build Rust
|
- name: Build Rust
|
||||||
uses: ./.github/actions/build-rust
|
uses: ./.github/actions/build-rust
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -67,12 +67,6 @@ Note: use `strip` from system instead of `binutils` if you are running MacOS. [s
|
|||||||
yarn workspace @affine/native build
|
yarn workspace @affine/native build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build Infra
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn run build:infra
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build Server Dependencies
|
### Build Server Dependencies
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
"build": "yarn nx build @affine/core",
|
"build": "yarn nx build @affine/core",
|
||||||
"build:electron": "yarn nx build @affine/electron",
|
"build:electron": "yarn nx build @affine/electron",
|
||||||
"build:storage": "yarn nx run-many -t build -p @affine/storage",
|
"build:storage": "yarn nx run-many -t build -p @affine/storage",
|
||||||
"build:infra": "yarn nx run-many -t build --projects=tag:infra",
|
|
||||||
"build:storybook": "yarn nx build @affine/storybook",
|
"build:storybook": "yarn nx build @affine/storybook",
|
||||||
"start:web-static": "yarn workspace @affine/core static-server",
|
"start:web-static": "yarn workspace @affine/core static-server",
|
||||||
"start:storybook": "yarn exec serve tests/storybook/storybook-static -l 6006",
|
"start:storybook": "yarn exec serve tests/storybook/storybook-static -l 6006",
|
||||||
|
|||||||
@@ -1,39 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@toeverything/infra",
|
"name": "@toeverything/infra",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"private": true,
|
||||||
"exports": {
|
"exports": {
|
||||||
"./blocksuite": {
|
"./blocksuite": "./src/blocksuite/index.ts",
|
||||||
"types": "./dist/src/blocksuite/index.d.ts",
|
"./command": "./src/command/index.ts",
|
||||||
"import": "./dist/blocksuite.js",
|
"./atom": "./src/atom/index.ts",
|
||||||
"require": "./dist/blocksuite.cjs"
|
"./app-config-storage": "./src/app-config-storage.ts",
|
||||||
},
|
"./__internal__/*": "./src/__internal__/*.ts"
|
||||||
"./command": {
|
|
||||||
"types": "./dist/src/command/index.d.ts",
|
|
||||||
"import": "./dist/command.js",
|
|
||||||
"require": "./dist/command.cjs"
|
|
||||||
},
|
|
||||||
"./atom": {
|
|
||||||
"type": "./dist/src/atom.d.ts",
|
|
||||||
"import": "./dist/atom.js",
|
|
||||||
"require": "./dist/atom.cjs"
|
|
||||||
},
|
|
||||||
"./app-config-storage": {
|
|
||||||
"type": "./dist/src/app-config-storage.d.ts",
|
|
||||||
"import": "./dist/app-config-storage.js",
|
|
||||||
"require": "./dist/app-config-storage.cjs"
|
|
||||||
},
|
|
||||||
"./__internal__/*": {
|
|
||||||
"type": "./dist/src/__internal__/*.d.ts",
|
|
||||||
"import": "./dist/__internal__/*.js",
|
|
||||||
"require": "./dist/__internal__/*.cjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"build": "vite build",
|
|
||||||
"dev": "vite build --watch"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/debug": "workspace:*",
|
"@affine/debug": "workspace:*",
|
||||||
@@ -51,9 +25,7 @@
|
|||||||
"@affine/templates": "workspace:*",
|
"@affine/templates": "workspace:*",
|
||||||
"@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb",
|
"@blocksuite/lit": "0.11.0-nightly-202312220916-e3abcbb",
|
||||||
"@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb",
|
"@blocksuite/presets": "0.11.0-nightly-202312220916-e3abcbb",
|
||||||
"@testing-library/react": "^14.0.0",
|
|
||||||
"async-call-rpc": "^6.3.1",
|
"async-call-rpc": "^6.3.1",
|
||||||
"electron": "link:../../frontend/electron/node_modules/electron",
|
|
||||||
"nanoid": "^5.0.3",
|
"nanoid": "^5.0.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "infra",
|
|
||||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
||||||
"projectType": "library",
|
|
||||||
"sourceRoot": "packages/common/src",
|
|
||||||
"targets": {
|
|
||||||
"build": {
|
|
||||||
"executor": "nx:run-script",
|
|
||||||
"dependsOn": ["^build"],
|
|
||||||
"inputs": ["{projectRoot}/**/*"],
|
|
||||||
"options": {
|
|
||||||
"script": "build"
|
|
||||||
},
|
|
||||||
"outputs": ["{projectRoot}/dist"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": ["infra"]
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"noEmit": false,
|
"noEmit": false,
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"outDir": "lib"
|
"outDir": "lib"
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
import { resolve } from 'node:path';
|
|
||||||
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import { defineConfig } from 'vite';
|
|
||||||
import dts from 'vite-plugin-dts';
|
|
||||||
|
|
||||||
const root = fileURLToPath(new URL('.', import.meta.url));
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
build: {
|
|
||||||
minify: false,
|
|
||||||
lib: {
|
|
||||||
entry: {
|
|
||||||
blocksuite: resolve(root, 'src/blocksuite/index.ts'),
|
|
||||||
atom: resolve(root, 'src/atom/index.ts'),
|
|
||||||
command: resolve(root, 'src/command/index.ts'),
|
|
||||||
'app-config-storage': resolve(root, 'src/app-config-storage.ts'),
|
|
||||||
},
|
|
||||||
formats: ['es', 'cjs'],
|
|
||||||
name: 'AffineInfra',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: [
|
|
||||||
'electron',
|
|
||||||
'async-call-rpc',
|
|
||||||
'rxjs',
|
|
||||||
'zod',
|
|
||||||
'react',
|
|
||||||
'yjs',
|
|
||||||
'nanoid',
|
|
||||||
/^jotai/,
|
|
||||||
/^@blocksuite/,
|
|
||||||
/^@affine\/templates/,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [dts()],
|
|
||||||
});
|
|
||||||
@@ -46,9 +46,6 @@ export default {
|
|||||||
assetsInclude: ['**/*.md'],
|
assetsInclude: ['**/*.md'],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@toeverything/infra': fileURLToPath(
|
|
||||||
new URL('../../../packages/common/infra/src', import.meta.url)
|
|
||||||
),
|
|
||||||
// workaround for https://github.com/vitejs/vite/issues/9731
|
// workaround for https://github.com/vitejs/vite/issues/9731
|
||||||
// it seems vite does not resolve self reference correctly?
|
// it seems vite does not resolve self reference correctly?
|
||||||
'@affine/core': fileURLToPath(
|
'@affine/core': fileURLToPath(
|
||||||
|
|||||||
@@ -171,16 +171,6 @@ function awaitChildProcess(child: ChildProcess): Promise<number> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Build:infra
|
|
||||||
await awaitChildProcess(
|
|
||||||
spawn('yarn', ['build:infra'], {
|
|
||||||
cwd,
|
|
||||||
stdio: 'inherit',
|
|
||||||
shell: true,
|
|
||||||
env: process.env,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Start webpack
|
// Start webpack
|
||||||
await awaitChildProcess(
|
await awaitChildProcess(
|
||||||
spawn(
|
spawn(
|
||||||
|
|||||||
@@ -13515,9 +13515,7 @@ __metadata:
|
|||||||
"@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb"
|
"@blocksuite/lit": "npm:0.11.0-nightly-202312220916-e3abcbb"
|
||||||
"@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb"
|
"@blocksuite/presets": "npm:0.11.0-nightly-202312220916-e3abcbb"
|
||||||
"@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb"
|
"@blocksuite/store": "npm:0.11.0-nightly-202312220916-e3abcbb"
|
||||||
"@testing-library/react": "npm:^14.0.0"
|
|
||||||
async-call-rpc: "npm:^6.3.1"
|
async-call-rpc: "npm:^6.3.1"
|
||||||
electron: "link:../../frontend/electron/node_modules/electron"
|
|
||||||
jotai: "npm:^2.5.1"
|
jotai: "npm:^2.5.1"
|
||||||
jotai-effect: "npm:^0.2.3"
|
jotai-effect: "npm:^0.2.3"
|
||||||
nanoid: "npm:^5.0.3"
|
nanoid: "npm:^5.0.3"
|
||||||
@@ -19745,12 +19743,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"electron@link:../../frontend/electron/node_modules/electron::locator=%40toeverything%2Finfra%40workspace%3Apackages%2Fcommon%2Finfra":
|
|
||||||
version: 0.0.0-use.local
|
|
||||||
resolution: "electron@link:../../frontend/electron/node_modules/electron::locator=%40toeverything%2Finfra%40workspace%3Apackages%2Fcommon%2Finfra"
|
|
||||||
languageName: node
|
|
||||||
linkType: soft
|
|
||||||
|
|
||||||
"electron@npm:^27.1.0":
|
"electron@npm:^27.1.0":
|
||||||
version: 27.1.2
|
version: 27.1.2
|
||||||
resolution: "electron@npm:27.1.2"
|
resolution: "electron@npm:27.1.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user