Skip to content

leung018/zero-in

Repository files navigation

zero-in

Introduction

A browser extension that helps users stay focused with website restriction features and a timer that supports time-based focus and break intervals.

Please visit the Zero In website for more details and installation.

Development

Prerequisites

  • Node.js: I use v20 and if you use nvm, you can run nvm use to switch to that version.
  • Yarn: Follow the instructions here for how to enabling Yarn if you haven't.

Install the Dependencies

yarn

Formatting & git hooks

  • Run yarn format to apply Prettier (see .prettierrc.json for options) and yarn format-check before pushing.
  • A pre-commit hook runs lint-staged to format staged files; it is installed via simple-git-hooks on yarn install. If you need to reinstall the hooks, run yarn simple-git-hooks.

Compile and Hot-Reload for Development

yarn dev

Type-Check, Compile and Minify for Production

yarn build

Run Unit Tests with Vitest

yarn test:unit

Run End-to-End Tests with Playwright

# Install browsers for the first run
npx playwright install

# When testing on CI, must build the project first
yarn build:ci

# Runs the end-to-end tests
yarn test:e2e

Lint with ESLint

yarn lint

How to Copy Data from One Extension to Another

If you want to copy data from one extension to another, you can use the following steps:

  1. In the Target Extension Console
chrome.runtime.onMessageExternal.addListener(function (request, sender, sendResponse) {
  if (request.action === 'import_storage' && request.data) {
    chrome.storage.local.set(request.data, function () {
      sendResponse({ success: true })
    })
    return true
  }
})
  1. In the Source Extension Console
chrome.storage.local.get(null, function (data) {
  chrome.runtime.sendMessage(
    TARGET_EXTENSION_ID,
    {
      action: 'import_storage',
      data: data
    },
    function (response) {
      console.log('Data transfer response:', response)
    }
  )
})

For the TARGET_EXTENSION_ID, you can find it in the URL of page in that extension, which looks like chrome-extension://<extension-id>/. OR you can find it in the chrome://extensions/.

How to update Third-Party Licenses

license-checker --production --markdown --out THIRD_PARTY_LICENSES_LIBRARIES.md

And remove the last line of zero in itself.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •