mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
chore: remove blocksuite local debug option (#8386)
This PR removes the blocksuite local debug option when running `yarn dev`. After this, to enable local debugging, simply run ```sh yarn link <path-to-blocksuite> -A yarn dev ``` You can disable local debugging by running ```sh yarn unlink <path-to-blocksuite> -A ```
This commit is contained in:
@@ -18,7 +18,6 @@ const flags: BuildFlags = {
|
|||||||
static: false,
|
static: false,
|
||||||
channel: 'canary',
|
channel: 'canary',
|
||||||
coverage: process.env.COVERAGE === 'true',
|
coverage: process.env.COVERAGE === 'true',
|
||||||
localBlockSuite: undefined,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const files = ['.env', '.env.local'];
|
const files = ['.env', '.env.local'];
|
||||||
@@ -34,7 +33,7 @@ for (const file of files) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const buildFlags = process.argv.includes('--static')
|
const buildFlags = process.argv.includes('--static')
|
||||||
? { ...flags, debugBlockSuite: false, static: true }
|
? { ...flags, static: true }
|
||||||
: ((await p.group(
|
: ((await p.group(
|
||||||
{
|
{
|
||||||
distribution: () =>
|
distribution: () =>
|
||||||
@@ -90,11 +89,6 @@ const buildFlags = process.argv.includes('--static')
|
|||||||
message: 'Enable coverage',
|
message: 'Enable coverage',
|
||||||
initialValue: process.env.COVERAGE === 'true',
|
initialValue: process.env.COVERAGE === 'true',
|
||||||
}),
|
}),
|
||||||
debugBlockSuite: () =>
|
|
||||||
p.confirm({
|
|
||||||
message: 'Debug blocksuite locally?',
|
|
||||||
initialValue: false,
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
@@ -102,7 +96,7 @@ const buildFlags = process.argv.includes('--static')
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)) as BuildFlags & { debugBlockSuite: boolean });
|
)) as BuildFlags);
|
||||||
|
|
||||||
flags.distribution = buildFlags.distribution;
|
flags.distribution = buildFlags.distribution;
|
||||||
flags.mode = buildFlags.mode;
|
flags.mode = buildFlags.mode;
|
||||||
@@ -122,27 +116,6 @@ if (flags.distribution === 'desktop') {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buildFlags.debugBlockSuite) {
|
|
||||||
const { config } = await import('dotenv');
|
|
||||||
const envLocal = config({
|
|
||||||
path: join(cwd, '.env.local'),
|
|
||||||
});
|
|
||||||
|
|
||||||
const localBlockSuite = await p.text({
|
|
||||||
message: 'local blocksuite PATH',
|
|
||||||
initialValue: envLocal.error
|
|
||||||
? undefined
|
|
||||||
: envLocal.parsed?.LOCAL_BLOCK_SUITE,
|
|
||||||
});
|
|
||||||
if (typeof localBlockSuite !== 'string') {
|
|
||||||
throw new Error('local blocksuite PATH is required');
|
|
||||||
}
|
|
||||||
if (!existsSync(localBlockSuite)) {
|
|
||||||
throw new Error(`local blocksuite not found: ${localBlockSuite}`);
|
|
||||||
}
|
|
||||||
flags.localBlockSuite = localBlockSuite;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.info(flags);
|
console.info(flags);
|
||||||
|
|
||||||
if (!flags.static) {
|
if (!flags.static) {
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ export const createConfiguration: (
|
|||||||
buildFlags: BuildFlags,
|
buildFlags: BuildFlags,
|
||||||
buildConfig: BUILD_CONFIG_TYPE
|
buildConfig: BUILD_CONFIG_TYPE
|
||||||
) => webpack.Configuration = (cwd, buildFlags, buildConfig) => {
|
) => webpack.Configuration = (cwd, buildFlags, buildConfig) => {
|
||||||
const blocksuiteBaseDir = buildFlags.localBlockSuite;
|
|
||||||
const config = {
|
const config = {
|
||||||
name: 'affine',
|
name: 'affine',
|
||||||
// to set a correct base path for the source map
|
// to set a correct base path for the source map
|
||||||
@@ -146,81 +145,9 @@ export const createConfiguration: (
|
|||||||
'.mjs': ['.mjs', '.mts'],
|
'.mjs': ['.mjs', '.mts'],
|
||||||
},
|
},
|
||||||
extensions: ['.js', '.ts', '.tsx'],
|
extensions: ['.js', '.ts', '.tsx'],
|
||||||
fallback:
|
|
||||||
blocksuiteBaseDir === undefined
|
|
||||||
? undefined
|
|
||||||
: {
|
|
||||||
events: false,
|
|
||||||
},
|
|
||||||
alias: {
|
alias: {
|
||||||
yjs: join(workspaceRoot, 'node_modules', 'yjs'),
|
yjs: join(workspaceRoot, 'node_modules', 'yjs'),
|
||||||
lit: join(workspaceRoot, 'node_modules', 'lit'),
|
lit: join(workspaceRoot, 'node_modules', 'lit'),
|
||||||
'@blocksuite/affine/block-std': blocksuiteBaseDir
|
|
||||||
? join(blocksuiteBaseDir, 'packages', 'framework', 'block-std', 'src')
|
|
||||||
: join(
|
|
||||||
workspaceRoot,
|
|
||||||
'node_modules',
|
|
||||||
'@blocksuite',
|
|
||||||
'block-std',
|
|
||||||
'dist'
|
|
||||||
),
|
|
||||||
'@blocksuite/affine/blocks': blocksuiteBaseDir
|
|
||||||
? join(blocksuiteBaseDir, 'packages', 'blocks', 'src')
|
|
||||||
: join(
|
|
||||||
workspaceRoot,
|
|
||||||
'node_modules',
|
|
||||||
'@blocksuite',
|
|
||||||
'blocks',
|
|
||||||
'dist'
|
|
||||||
),
|
|
||||||
'@blocksuite/affine/presets': blocksuiteBaseDir
|
|
||||||
? join(blocksuiteBaseDir, 'packages', 'presets', 'src')
|
|
||||||
: join(
|
|
||||||
workspaceRoot,
|
|
||||||
'node_modules',
|
|
||||||
'@blocksuite',
|
|
||||||
'presets',
|
|
||||||
'dist'
|
|
||||||
),
|
|
||||||
'@blocksuite/affine/global': blocksuiteBaseDir
|
|
||||||
? join(blocksuiteBaseDir, 'packages', 'framework', 'global', 'src')
|
|
||||||
: join(
|
|
||||||
workspaceRoot,
|
|
||||||
'node_modules',
|
|
||||||
'@blocksuite',
|
|
||||||
'global',
|
|
||||||
'dist'
|
|
||||||
),
|
|
||||||
'@blocksuite/affine/store/providers/broadcast-channel':
|
|
||||||
blocksuiteBaseDir
|
|
||||||
? join(
|
|
||||||
blocksuiteBaseDir,
|
|
||||||
'packages',
|
|
||||||
'framework',
|
|
||||||
'store',
|
|
||||||
'src/providers/broadcast-channel'
|
|
||||||
)
|
|
||||||
: join(
|
|
||||||
workspaceRoot,
|
|
||||||
'node_modules',
|
|
||||||
'@blocksuite',
|
|
||||||
'store',
|
|
||||||
'dist',
|
|
||||||
'providers',
|
|
||||||
'broadcast-channel.js'
|
|
||||||
),
|
|
||||||
'@blocksuite/affine/store': blocksuiteBaseDir
|
|
||||||
? join(blocksuiteBaseDir, 'packages', 'framework', 'store', 'src')
|
|
||||||
: join(workspaceRoot, 'node_modules', '@blocksuite', 'store', 'dist'),
|
|
||||||
'@blocksuite/inline': blocksuiteBaseDir
|
|
||||||
? join(blocksuiteBaseDir, 'packages', 'framework', 'inline', 'src')
|
|
||||||
: join(
|
|
||||||
workspaceRoot,
|
|
||||||
'node_modules',
|
|
||||||
'@blocksuite',
|
|
||||||
'inline',
|
|
||||||
'dist'
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user