Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

Sets up the CoreEditor project as a Yarn workspace to support modularization as the project scales. The workspace infrastructure is now in place and ready for migrating existing modules to packages in future PRs.

Changes

  • Workspace configuration: Added workspaces: ["packages/*"] to package.json and configured .yarnrc.yml
  • Package structure: Created packages/ directory for modularized packages (currently empty, ready for real packages)
  • Build system: Updated eslint to ignore packages/*/dist/* and .gitignore to exclude .yarn/cache/

Configuration Pattern Established

The workspace is configured to support shared configurations between packages and the root, avoiding duplication:

ESLint pattern (minimal config in packages):

import rootConfig from '../../eslint.config.mjs';
export default rootConfig;

TypeScript pattern (extends root with minimal overrides):

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "./dist",
    "rootDir": "./src",
    "noEmit": true
  }
}

Benefits:

  • No configuration duplication across packages
  • Single source of truth for linting and TypeScript rules
  • Changes to root config automatically apply to all packages
  • Smaller package.json files (packages only include package-specific dependencies)

Future Usage

When packages are added to the packages/ directory, they will:

  • Be automatically recognized by the workspace
  • Can be referenced using workspace:* protocol in dependencies
  • Share configurations and dependencies from the root
  • Follow the established pattern for consistency

List workspaces:

yarn workspaces list

The root package.json remains the main entry point. The workspace infrastructure is ready for migrating existing modules to packages in subsequent PRs.

Original prompt

This section details on the original issue you should resolve

<issue_title>Modularizing CoreEditor</issue_title>
<issue_description>The CoreEditor project began as a small initiative and is now expanding. We should consider modularizing it to separate the business logic and enhance reusability.

To begin:

  • Create a mono repo (or "workspace") for CoreEditor.
  • Keep CoreEditor/package.json as the main entry point.
  • Add a CoreEditor/packages folder and relocate modularized packages there.
  • Add a CoreEditor/packages/markedit-hello local package for testing purposes.
  • Include CoreEditor/packages/markedit-hello in CoreEditor/package.json to test the workspace.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

],
"author": "",
"license": "MIT",
"devDependencies": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can you make modularized packages vite project, make sure eslint is enabled.

Just like the main package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! The markedit-hello package is now a Vite project with ESLint enabled, matching the main package structure.

Changes in commits a289871 and f17647c:

  • Added Vite build system with vite.config.mts
  • Added ESLint configuration with eslint.config.mjs (same rules as main package)
  • Package builds to both ESM and CommonJS formats
  • All lint, build, and test commands work correctly

The package now has the same dev scripts as the main package:

  • yarn dev - run Vite dev server
  • yarn lint - run ESLint
  • yarn build - build with Vite
  • yarn clean - clean dist folder

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Can it reuse configurations used in the main package instead of always needing separate config files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! The package now reuses configurations from the root:

ESLint (3 lines, down from 107):

import rootConfig from '../../eslint.config.mjs';
export default rootConfig;

TypeScript (extends root with minimal overrides):

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "./dist",
    "rootDir": "./src",
    "noEmit": true
  }
}

Dependencies (2 Vite-specific deps, down from 13):

  • All ESLint, TypeScript, and shared tooling now come from root workspace
  • Package only includes vite and vite-plugin-dts

Benefits:

  • No configuration duplication
  • Single source of truth
  • Changes to root config automatically apply to all packages
  • Much smaller package.json files

Commit: 3ddc580

Copilot AI changed the title [WIP] Modularize CoreEditor for better reusability Modularize CoreEditor with Yarn workspaces Nov 24, 2025
Copilot AI requested a review from cyanzhong November 24, 2025 03:35
@cyanzhong
Copy link
Contributor

@copilot Please rebase from main.

Copy link
Contributor Author

Copilot AI commented Dec 2, 2025

@copilot Please rebase from main.

I'm unable to perform git rebase operations as I cannot pull branches from GitHub. Could you please rebase this branch from main? After you've done that, I can continue with any additional changes if needed.

@cyanzhong cyanzhong force-pushed the copilot/modularize-coreeditor-structure branch from 3ddc580 to 50adb86 Compare December 7, 2025 14:18
@cyanzhong
Copy link
Contributor

@copilot I've tested markedit-hello and it works fine. Now please delete markedit-hello entirely, we will be migrating existing modules to packages in following PRs.

Copy link
Contributor Author

Copilot AI commented Dec 9, 2025

@copilot I've tested markedit-hello and it works fine. Now please delete markedit-hello entirely, we will be migrating existing modules to packages in following PRs.

Done! The markedit-hello test package has been completely removed.

Removed:

  • packages/markedit-hello/ directory (all files)
  • test/workspace.test.ts
  • markedit-hello dependency from package.json
  • Updated yarn.lock

Workspace is ready:

  • packages/ directory exists for future packages
  • ✅ Workspace configuration (workspaces: ["packages/*"]) remains in place
  • ✅ All 49 tests pass
  • ✅ Build succeeds

The infrastructure is now ready for migrating existing modules to packages in future PRs.

Commit: 565befb

Copilot AI changed the title Modularize CoreEditor with Yarn workspaces Set up CoreEditor as Yarn workspace (monorepo) Dec 9, 2025
@cyanzhong cyanzhong marked this pull request as ready for review December 9, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modularizing CoreEditor

2 participants