diff --git a/README.md b/README.md index b52959211..65c869442 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,14 @@ # Project Overview -This repository uses npm workspaces to manage multiple projects within a single codebase. Some scripts, such as those -for ESLint, TypeScript, and documentation generation, are global in nature (see below). - -Please check the README.md & package.json in each +A collection of shared JavaScript and HTML projects that are used within our Browsers. ## Child Projects ### [Injected](./injected) -This is a framework designed to create specialized JavaScript bundles tailored to specific sets of -protections and features for different platforms. For instance, Apple platforms might utilize -a particular combination of features, while Android may require a different configuration entirely. +A library of features/protections that are executed within our browsers. -Features here have a deep integration with [privacy-configuration](https://github.com/duckduckgo/privacy-configuration), +Features have a deep integration with [privacy-configuration](https://github.com/duckduckgo/privacy-configuration), to allow dynamic enabling or disabling of features at runtime. ### [Special Pages](./special-pages) @@ -21,24 +16,17 @@ to allow dynamic enabling or disabling of features at runtime. This project contains a set of isolated JavaScript applications that end up being embedded directly into our browsers. A 'special page' can be as simple as a single-screen, or as complex as a New Tab Page. -Special Pages are often developed for a specific platform initially, but can then be easily adopted -by others when it makes sense. - ### [Messaging](./messaging) This project serves as an abstraction layer for seamless web-to-native and native-to-web communications, inspired by the [JSON-RPC](https://www.jsonrpc.org/specification) format. -Its primary goal is to simplify the development process by allowing engineers to focus on building -features without worrying about the underlying communication mechanisms. The module provides three core methods: `notify` for fire-and-forget messages, `request` for asynchronous request-response interactions, and `subscribe` for handling push-based data updates. ### [Types-generator](./types-generator) -This project provides a set of scripts to automatically generate TypeScript types from JSON Schema files. -It supports generating types for two main purposes: `settings` and `messages`. These types are -designed to integrate smoothly with features such as `@duckduckgo/messaging`. +Utilities to automatically generate TypeScript types from JSON Schema files. --- @@ -51,70 +39,71 @@ From the top-level root folder of this npm workspace, you can run the following Use this to produce the same output as a release. The `build` directory will be populated with various artifacts. - ```sh - npm run build - ``` +```sh +npm run build +``` > [!TIP] > You can run the `build` command from within any sub-project too, the artifacts will always be > lifted out to the root-level `build` folder. **Run unit tests for all workspaces**: - ```sh - npm run test-unit - ``` - -- **Run integration tests for all workspaces**: - ```sh - npm run test-int - ``` - -- **Run extended integration tests for all workspaces**: - ```sh - npm run test-int-x - ``` - -- **Clean tree and check for changes**: - ```sh - npm run test-clean-tree - ``` - -- **Generate documentation using TypeDoc**: - ```sh - npm run docs - ``` - -- **Generate and watch documentation using TypeDoc**: - ```sh - npm run docs-watch - ``` - -- **Compile TypeScript files**: - ```sh - npm run tsc - ``` - -- **Watch and compile TypeScript files**: - ```sh - npm run tsc-watch - ``` - -- **Lint the codebase using ESLint**: - ```sh - npm run lint - ``` - -- **Lint and automatically fix issues**: - ```sh - npm run lint-fix - ``` - -- **Serve integration test pages on port 3220**: - ```sh - npm run serve - ``` - -- **Serve special pages on port 3221**: - ```sh - npm run serve-special-pages - ``` + +```sh +npm run test-unit +``` + +**Run integration tests for all workspaces**: +```sh +npm run test-int +``` + +**Run extended integration tests for all workspaces**: +```sh +npm run test-int-x +``` + +**Clean tree and check for changes**: +```sh +npm run test-clean-tree +``` + +**Generate documentation using TypeDoc**: +```sh +npm run docs +``` + +**Generate and watch documentation using TypeDoc**: +```sh +npm run docs-watch +``` + +**Compile TypeScript files**: +```sh +npm run tsc +``` + +**Watch and compile TypeScript files**: +```sh +npm run tsc-watch +``` + +**Lint the codebase using ESLint**: +```sh +npm run lint +``` + +**Lint and automatically fix issues**: +```sh +npm run lint-fix +``` + +**Serve integration test pages on port 3220**: +```sh +npm run serve +``` + +**Serve special pages on port 3221**: +```sh +npm run serve-special-pages +``` diff --git a/special-pages/readme.md b/special-pages/README.md similarity index 88% rename from special-pages/readme.md rename to special-pages/README.md index 24e7c8b13..90d0f5159 100644 --- a/special-pages/readme.md +++ b/special-pages/README.md @@ -2,9 +2,9 @@ Special Pages gives us a single place to implement isolated HTML/CSS/Javascript projects that can be loaded into a web context that has privileged access to API. -- `packages/special-pages/pages/example` -- `packages/special-pages/pages/duckplayer` -- `packages/special-pages/pages/errorpage` +- `special-pages/pages/example` +- `special-pages/pages/duckplayer` +- `special-pages/pages/errorpage` Would translate into the following build output @@ -26,13 +26,13 @@ This allows each respective platform to configure their integrations to use the ### Integration Tests -Ensure these commands are run from the `packages/special-pages` folder. +Ensure these commands are run from the `special-pages` folder. ```shell # to have all platforms tested (minus screenshots) -npm run test +npm run test-int # to only run the iOS tests, likewise for the other platforms -npm run test -- --project ios +npm run test-int -- --project ios # to *only* run screenshot tests npm run test.screenshots # to also update screenshots (if you've made changes to anything visual) diff --git a/special-pages/package.json b/special-pages/package.json index 06325bd9a..53f479116 100644 --- a/special-pages/package.json +++ b/special-pages/package.json @@ -12,14 +12,14 @@ "test-unit": "node --test unit-test/translations.mjs pages/duckplayer/unit-tests/embed-settings.mjs", "test-int": "npm run test-unit && npm run build.dev && playwright test --grep-invert '@screenshots'", "test-int-x": "npm run test-int", - "test.screenshots": "npm run test-unit && playwright test --grep '@screenshots'", + "test.screenshots": "npm run test-unit && npm run build.dev && playwright test --grep '@screenshots'", "test.windows": "npm run test-int -- --project windows", "test.macos": "npm run test-int -- --project macos", "test.ios": "npm run test-int -- --project ios", "test.android": "npm run test-int -- --project android", "test.headed": "npm run test-int -- --headed", "test.ui": "npm run test-int -- --ui", - "serve": "http-server -c-1 --port 3210 ../../", + "serve": "http-server -c-1 --port 3210 ../build/integration/pages", "watch": "chokidar pages shared --initial -c 'npm run build.dev'" }, "license": "ISC",