Skip to content

Commit

Permalink
update readme + fix package script (#1110)
Browse files Browse the repository at this point in the history
* update readme + fix package script

* Update README.md

---------

Co-authored-by: Shane Osbourne <sosbourne@duckduckgo.com>
Co-authored-by: Jonathan Kingston <jkingston@duckduckgo.com>
  • Loading branch information
3 people authored Oct 16, 2024
1 parent 0e81ff0 commit c38571f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 85 deletions.
143 changes: 66 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
# 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)

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.

---

Expand All @@ -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
```
12 changes: 6 additions & 6 deletions special-pages/readme.md → special-pages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions special-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c38571f

Please sign in to comment.