Skip to content

Latest commit

 

History

History
99 lines (72 loc) · 3.06 KB

File metadata and controls

99 lines (72 loc) · 3.06 KB

Contributing Guide

Submitting Code

  1. Fork the repository.

  2. Clone your forked repository to your local machine.

    git clone https://github.com/${yourname}/NiceTab
  3. Create your feature branch dev-your-awesome-code from the dev branch.

    git checkout -b dev-your-awesome-code origin/dev
  4. Commit your changes (follow commit message conventions). Note: Before committing, it is recommended to run the pnpm compile command to verify TypeScript types.

    pnpm compile
    git commit -m 'feat: add a new feature'
  5. Push your branch to your remote repository.

    git push -u origin dev-your-awesome-code
  6. Create a Pull Request from your dev-your-awesome-code branch to the dev branch of web-dahuyou/NiceTab.

    https://github.com/web-dahuyou/NiceTab/compare/dev...${yourname}:NiceTab:dev-your-awesome-code

Development Guidelines

Project Setup

  • Install dependencies:
    pnpm install
  • Start the dev server:
    pnpm run dev

File Export Requirement

Important: Each .js .ts .tsx file must have an export default statement. Otherwise, you'll encounter errors when running the local service.

Import Path Alias

The project uses the ~ alias for imports from the entrypoints directory (the @ alias also works but ~ is preferred for consistency).

import { something } from '~/entrypoints/common/utils';

Set Browser Binaries

By default, WXT will try to automatically discover where Chrome/Firefox are installed. If you encounter an error:

ERROR  No Chrome installations found.  

Or you want to specify a browser executable binary.

You can refer to the docs - Set Browser Binaries to manually configure the browser binary paths.

// <rootDir>/web-ext.config.ts

export default defineRunnerConfig({
  binaries: {
    chrome: '/path/to/chrome-beta', // Use Chrome Beta instead of regular Chrome
    firefox: 'firefoxdeveloperedition', // Use Firefox Developer Edition instead of regular Firefox
    edge: '/path/to/edge', // Open MS Edge when running "wxt -b edge"
  },
});

Persist User Data

If you want to preserve user data between development sessions, you can persist data by following the official documentation - persist-data.

// <rootDir>/web-ext.config.ts

import { defineRunnerConfig } from 'wxt';

// Mac/Linux
export default defineRunnerConfig({
   chromiumArgs: ['--user-data-dir=./.wxt/chrome-data'],
});

// Windows
import path from 'path';
export default defineRunnerConfig({
   // On Windows, the path must be absolute
   chromiumProfile: path.resolve('.wxt\\chrome-data'),
   keepProfileChanges: true
})