chore: add monorepo tools (#9196)
This commit is contained in:
@@ -62,7 +62,8 @@
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "cross-env DISTRIBUTION=admin yarn workspace @affine/cli bundle",
|
||||
"build": "affine bundle",
|
||||
"dev": "affine bundle --dev",
|
||||
"update-shadcn": "shadcn-ui add -p src/components/ui"
|
||||
},
|
||||
"exports": {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
darkMode: ['class'],
|
||||
content: ['./src/**/*.{ts,tsx}'],
|
||||
// TODO(@forehalo): we are not running webpack in admin dir
|
||||
content: ['./packages/frontend/admin/src/**/*.{ts,tsx}'],
|
||||
prefix: '',
|
||||
theme: {
|
||||
container: {
|
||||
|
||||
@@ -5,6 +5,6 @@ AFFiNE Android app.
|
||||
## Build
|
||||
|
||||
- yarn install
|
||||
- BUILD_TYPE=canary PUBLIC_PATH="/" yarn workspace @affine/android build
|
||||
- yarn workspace @affine/android cap sync
|
||||
- yarn workspace @affine/android cap open android
|
||||
- BUILD_TYPE=canary PUBLIC_PATH="/" yarn affine @affine/android build
|
||||
- yarn affine @affine/android cap sync
|
||||
- yarn affine @affine/android cap open android
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
"private": true,
|
||||
"browser": "src/index.tsx",
|
||||
"scripts": {
|
||||
"build": "cross-env DISTRIBUTION=android yarn workspace @affine/cli bundle",
|
||||
"dev": "yarn workspace @affine/cli dev",
|
||||
"static-server": "cross-env DISTRIBUTION=android yarn workspace @affine/cli dev --static"
|
||||
"build": "affine bundle",
|
||||
"dev": "affine bundle --dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
|
||||
@@ -7,7 +7,7 @@ To run AFFiNE Desktop Client Application locally, run the following commands:
|
||||
```sh
|
||||
# in repo root
|
||||
yarn install
|
||||
yarn workspace @affine/native build
|
||||
yarn affine @affine/native build
|
||||
yarn dev
|
||||
|
||||
# in packages/frontend/apps/electron
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "@affine/electron",
|
||||
"private": true,
|
||||
"version": "0.18.0",
|
||||
"main": "./dist/main.js",
|
||||
"author": "toeverything",
|
||||
"repository": {
|
||||
"url": "https://github.com/toeverything/AFFiNE",
|
||||
@@ -11,19 +12,20 @@
|
||||
"homepage": "https://github.com/toeverything/AFFiNE",
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"dev": "DEV_SERVER_URL=http://localhost:8080 node --loader ts-node/esm/transpile-only ./scripts/dev.ts",
|
||||
"dev:prod": "yarn node --loader ts-node/esm/transpile-only scripts/dev.ts",
|
||||
"build": "NODE_ENV=production node --loader ts-node/esm/transpile-only scripts/build-layers.ts",
|
||||
"build:dev": "NODE_ENV=development node --loader ts-node/esm/transpile-only scripts/build-layers.ts",
|
||||
"generate-assets": "node --loader ts-node/esm/transpile-only scripts/generate-assets.ts",
|
||||
"package": "cross-env NODE_OPTIONS=\"--loader ts-node/esm/transpile-only\" electron-forge package",
|
||||
"make": "cross-env NODE_OPTIONS=\"--loader ts-node/esm/transpile-only\" electron-forge make",
|
||||
"make-squirrel": "node --loader ts-node/esm/transpile-only scripts/make-squirrel.ts",
|
||||
"make-nsis": "node --loader ts-node/esm/transpile-only scripts/make-nsis.ts"
|
||||
"dev": "cross-env DEV_SERVER_URL=http://localhost:8080 node ./scripts/dev.ts",
|
||||
"dev:prod": "node ./scripts/dev.ts",
|
||||
"build": "cross-env NODE_ENV=production node ./scripts/build-layers.ts",
|
||||
"build:dev": "node ./scripts/build-layers.ts",
|
||||
"bundle": "affine bundle",
|
||||
"generate-assets": "node ./scripts/generate-assets.ts",
|
||||
"package": "electron-forge package",
|
||||
"make": "electron-forge make",
|
||||
"make-squirrel": "node ./scripts/make-squirrel.ts",
|
||||
"make-nsis": "node ./scripts/make-nsis.ts"
|
||||
},
|
||||
"main": "./dist/main.js",
|
||||
"devDependencies": {
|
||||
"@affine-test/kit": "workspace:*",
|
||||
"@affine-tools/utils": "workspace:*",
|
||||
"@affine/component": "workspace:*",
|
||||
"@affine/core": "workspace:*",
|
||||
"@affine/electron-api": "workspace:*",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||
import { getBuildConfig } from '@affine/cli/src/webpack/runtime-config';
|
||||
import { getBuildConfig } from '@affine-tools/utils/build-config';
|
||||
import { Package } from '@affine-tools/utils/workspace';
|
||||
import { sentryEsbuildPlugin } from '@sentry/esbuild-plugin';
|
||||
import type { BuildOptions, Plugin } from 'esbuild';
|
||||
|
||||
@@ -24,12 +24,10 @@ export const config = (): BuildOptions => {
|
||||
'process.env.NODE_ENV': process.env.NODE_ENV,
|
||||
REPLACE_ME_BUILD_ENV: process.env.BUILD_TYPE ?? 'stable',
|
||||
...Object.entries(
|
||||
getBuildConfig({
|
||||
channel: (process.env.BUILD_TYPE as any) ?? 'canary',
|
||||
distribution: 'desktop',
|
||||
getBuildConfig(new Package('@affine/electron'), {
|
||||
mode:
|
||||
process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
||||
static: false,
|
||||
channel: (process.env.BUILD_TYPE as any) ?? 'canary',
|
||||
})
|
||||
).reduce(
|
||||
(def, [key, val]) => {
|
||||
|
||||
@@ -34,6 +34,7 @@ function spawnOrReloadElectron() {
|
||||
const ext = process.platform === 'win32' ? '.cmd' : '';
|
||||
const exe = resolve(rootDir, 'node_modules', '.bin', `electron${ext}`);
|
||||
|
||||
delete process.env['NODE_OPTIONS'];
|
||||
spawnProcess = spawn(exe, ['.'], {
|
||||
cwd: electronDir,
|
||||
env: process.env,
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
},
|
||||
{
|
||||
"path": "../../../../tests/kit"
|
||||
},
|
||||
{
|
||||
"path": "../../../../tools/utils"
|
||||
}
|
||||
],
|
||||
"ts-node": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "Node",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noEmit": false,
|
||||
"outDir": "./lib/scripts",
|
||||
@@ -17,5 +17,10 @@
|
||||
"ts-node": {
|
||||
"esm": true,
|
||||
"experimentalSpecifierResolution": "node"
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../../tools/utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// TODO(@forehalo): reuse '@affine-tools/utils' once it's ready to switch to esm module
|
||||
import { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
|
||||
12
packages/frontend/apps/electron/webpack.config.js
Normal file
12
packages/frontend/apps/electron/webpack.config.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// TODO(@forehalo): all packages would become 'module'
|
||||
const path = require('node:path');
|
||||
|
||||
module.exports.config = {
|
||||
entry: {
|
||||
app: './renderer/index.tsx',
|
||||
shell: './renderer/shell/index.tsx',
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, './renderer/dist'),
|
||||
},
|
||||
};
|
||||
@@ -5,9 +5,9 @@ AFFiNE iOS app.
|
||||
## Build
|
||||
|
||||
- `yarn install`
|
||||
- `BUILD_TYPE=canary PUBLIC_PATH="/" yarn workspace @affine/ios build`
|
||||
- `yarn workspace @affine/ios cap sync`
|
||||
- `yarn workspace @affine/ios cap open ios`
|
||||
- `BUILD_TYPE=canary PUBLIC_PATH="/" yarn affine @affine/ios build`
|
||||
- `yarn affine @affine/ios cap sync`
|
||||
- `yarn affine @affine/ios cap open ios`
|
||||
|
||||
## Live Reload
|
||||
|
||||
@@ -16,5 +16,5 @@ AFFiNE iOS app.
|
||||
- `yarn install`
|
||||
- `yarn dev`
|
||||
- select `ios` for the "Distribution" option
|
||||
- `yarn workspace @affine/ios sync:dev`
|
||||
- `yarn workspace @affine/ios cap open ios`
|
||||
- `yarn affine @affine/ios sync:dev`
|
||||
- `yarn affine @affine/ios cap open ios`
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
"private": true,
|
||||
"browser": "src/index.tsx",
|
||||
"scripts": {
|
||||
"build": "cross-env DISTRIBUTION=ios yarn workspace @affine/cli bundle",
|
||||
"dev": "yarn workspace @affine/cli dev",
|
||||
"build": "affine bundle",
|
||||
"dev": "affine bundle --dev",
|
||||
"sync": "yarn cap sync",
|
||||
"sync:dev": "CAP_SERVER_URL=http://localhost:8080 yarn cap sync",
|
||||
"static-server": "cross-env DISTRIBUTION=ios yarn workspace @affine/cli dev --static"
|
||||
"sync:dev": "CAP_SERVER_URL=http://localhost:8080 yarn cap sync"
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
"private": true,
|
||||
"browser": "src/index.tsx",
|
||||
"scripts": {
|
||||
"build": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli bundle",
|
||||
"dev": "yarn workspace @affine/cli dev",
|
||||
"static-server": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli dev --static"
|
||||
"build": "affine bundle",
|
||||
"dev": "affine bundle --dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
"private": true,
|
||||
"browser": "src/index.tsx",
|
||||
"scripts": {
|
||||
"build": "cross-env DISTRIBUTION=web yarn workspace @affine/cli bundle",
|
||||
"dev": "yarn workspace @affine/cli dev",
|
||||
"static-server": "yarn workspace @affine/cli dev --static"
|
||||
"build": "affine bundle",
|
||||
"dev": "affine bundle --dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/component": "workspace:*",
|
||||
|
||||
@@ -3,7 +3,7 @@ import { StorybookConfig } from '@storybook/react-vite';
|
||||
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
||||
import swc from 'unplugin-swc';
|
||||
import { mergeConfig } from 'vite';
|
||||
import { getBuildConfig } from '@affine/cli/src/webpack/runtime-config';
|
||||
import { getBuildConfig } from '@affine-tools/utils/build-config';
|
||||
|
||||
export default {
|
||||
stories: ['../src/ui/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/cli": "workspace:*",
|
||||
"@affine/debug": "workspace:*",
|
||||
"@affine/electron-api": "workspace:*",
|
||||
"@affine/graphql": "workspace:*",
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"exclude": ["lib"],
|
||||
"include": ["./src/**/*", "./src/**/*.json", "./src/type.d.ts"],
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./src/**/*.json",
|
||||
"./src/type.d.ts",
|
||||
"./.storybook"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"noEmit": false,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
User-agent: *
|
||||
Allow: /
|
||||
Allow: /api/workspaces/*/blobs/*
|
||||
Disallow: /oauth/*
|
||||
Disallow: /workspace/*
|
||||
Disallow: /public-workspace/*
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
},
|
||||
{
|
||||
"path": "../../../blocksuite/affine/all"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.server.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"verbatimModuleSyntax": false,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"outDir": "./lib/.webpack",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": [".webpack/*.ts"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../tools/cli"
|
||||
},
|
||||
{
|
||||
"path": "../../common/env"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"outDir": "./lib/server"
|
||||
},
|
||||
"include": ["server.mts"]
|
||||
}
|
||||
@@ -30,7 +30,5 @@ generates:
|
||||
plugins:
|
||||
- typescript
|
||||
- typescript-operations
|
||||
- add:
|
||||
content: '/* eslint-disable */'
|
||||
- ./export-gql-plugin.cjs:
|
||||
output: ./src/graphql/index.ts
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"vitest": "2.1.8"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "gql-gen --errors-only"
|
||||
"build": "gql-gen --errors-only"
|
||||
},
|
||||
"dependencies": {
|
||||
"@affine/env": "workspace:*",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
/* oxlint-disable */
|
||||
export type Maybe<T> = T | null;
|
||||
export type InputMaybe<T> = T | null;
|
||||
export type Exact<T extends { [key: string]: unknown }> = {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"list": [
|
||||
{
|
||||
"input": "./src/resources/en.json",
|
||||
"output": "./src/i18n-generated",
|
||||
"output": "./src/i18n.gen",
|
||||
"parser": {
|
||||
"type": "i18next",
|
||||
"contextSeparator": "$",
|
||||
|
||||
@@ -39,7 +39,7 @@ function calcCompletenesses() {
|
||||
|
||||
writeFileSync(
|
||||
join(pkgRoot, 'src', 'i18n-completenesses.json'),
|
||||
JSON.stringify(completenesses, null, 2)
|
||||
JSON.stringify(completenesses, null, 2) + '\n'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
"ur": 2,
|
||||
"zh-Hans": 91,
|
||||
"zh-Hant": 90
|
||||
}
|
||||
}
|
||||
|
||||
6888
packages/frontend/i18n/src/i18n.gen.ts
Normal file
6888
packages/frontend/i18n/src/i18n.gen.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ import type { BackendModule, i18n } from 'i18next';
|
||||
import i18next from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
|
||||
import type { useAFFiNEI18N } from './i18n-generated';
|
||||
import type { useAFFiNEI18N } from './i18n.gen';
|
||||
import type { Language } from './resources';
|
||||
import { SUPPORTED_LANGUAGES } from './resources';
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"sideEffect": false,
|
||||
"version": "0.18.0",
|
||||
"scripts": {
|
||||
"postinstall": "node ./build-edgeless.mjs && node ./build-stickers.mjs"
|
||||
"build": "node ./build-edgeless.mjs && node ./build-stickers.mjs",
|
||||
"postinstall": "yarn build"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
|
||||
Reference in New Issue
Block a user