Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a browser package #905

Merged
merged 10 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/alpha-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
env:
# Packages not listed here will be excluded from publishing
# These are currently in a specific order due to dependency requirements
PACKAGES: "crypto crypto-aws-kms common dids credentials agent identity-agent proxy-agent user-agent api"
PACKAGES: "common crypto crypto-aws-kms dids credentials agent identity-agent proxy-agent user-agent api browser"

steps:
- name: Checkout source
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
[
"agent",
"api",
"browser",
"common",
"credentials",
"crypto",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: pnpm --recursive --stream --sequential build:tests:node

- name: Run tests for all packages
run: pnpm --recursive --stream exec c8 mocha -- --color
run: pnpm --recursive --filter '!browser' --stream exec c8 mocha -- --color
shamilovtim marked this conversation as resolved.
Show resolved Hide resolved
env:
TEST_DWN_URL: http://localhost:3000

Expand All @@ -89,7 +89,7 @@ jobs:
- group: "B"
packages: "--filter dids --filter identity-agent"
- group: "C"
packages: "--filter api"
packages: "--filter api --filter browser"
- group: "D"
packages: "--filter crypto"
- group: "E"
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
/packages/user-agent @lirancohen @csuwildcat @shamilovtim
/packages/identity-agent @lirancohen @csuwildcat @shamilovtim
/packages/api @lirancohen @csuwildcat @shamilovtim @nitro-neal
/packages/browser @lirancohen @csuwildcat

19 changes: 19 additions & 0 deletions packages/browser/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"all": true,
"cache": false,
"extension": [
".js"
],
"include": [
"tests/compiled/**/src/**"
],
"exclude": [
"tests/compiled/**/src/index.js",
"tests/compiled/**/src/types.js",
"tests/compiled/**/src/types/**"
],
"reporter": [
"cobertura",
"text"
]
}
Empty file added packages/browser/CHANGELOG.md
Empty file.
13 changes: 13 additions & 0 deletions packages/browser/build/esbuild-browser-config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import('esbuild').BuildOptions} */
module.exports = {
entryPoints : ['./src/index.ts'],
bundle : true,
format : 'esm',
sourcemap : true,
minify : true,
platform : 'browser',
target : ['chrome101', 'firefox108', 'safari16'],
define : {
'global': 'globalThis',
},
};
16 changes: 16 additions & 0 deletions packages/browser/build/esbuild-tests.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const esbuild = require('esbuild');
const browserConfig = require('./esbuild-browser-config.cjs');

esbuild.build({
...browserConfig,
format : 'esm',
entryPoints : ['./tests/**/*.spec.*'],
bundle : true,
minify : false,
outdir : 'tests/compiled',
define : {
...browserConfig.define,
'process.env.TEST_DWN_URL': JSON.stringify(process.env.TEST_DWN_URL ?? null),
},
});
84 changes: 84 additions & 0 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"name": "@web5/browser",
"version": "0.0.1",
"description": "Web5 tools and features to use in the brwoser",
"type": "module",
"main": "./dist/esm/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"scripts": {
"clean": "rimraf dist coverage tests/compiled",
"build:tests": "rimraf tests/compiled && node build/esbuild-tests.cjs",
"build:esm": "rimraf dist/esm dist/types && pnpm tsc -p tsconfig.json",
"build:browser": "pnpm build:esm",
"build": "pnpm clean && pnpm build:esm",
"lint": "eslint . --max-warnings 0",
"lint:fix": "eslint . --fix",
"test:browser": "pnpm build:tests && web-test-runner"
},
"homepage": "https://github.com/TBD54566975/web5-js/tree/main/packages/browser#readme",
"bugs": "https://github.com/TBD54566975/web5-js/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/TBD54566975/web5-js.git",
"directory": "packages/browser"
},
"license": "Apache-2.0",
"contributors": [
{
"name": "Daniel Buchner",
"url": "https://github.com/csuwildcat"
},
{
"name": "Liran Cohen",
"url": "https://github.com/lirancohen"
}
],
"files": [
"dist",
"src"
],
"keywords": [
"decentralized",
"decentralized-applications",
"decentralized-identity",
"decentralized-web",
"DID",
"sdk",
"verifiable-credentials",
"web5",
"web5-sdk",
"browser",
"tools"
],
"publishConfig": {
"access": "public",
"provenance": true
},
"dependencies": {
"@web5/dids": "workspace:*"
},
"devDependencies": {
"@playwright/test": "1.45.3",
"@types/chai": "4.3.6",
"@types/eslint": "8.56.10",
"@types/mocha": "10.0.1",
"@types/sinon": "17.0.3",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.14.1",
"@web/test-runner": "0.18.2",
"@web/test-runner-playwright": "0.11.0",
"c8": "9.1.0",
"chai": "4.3.10",
"esbuild": "0.19.8",
"eslint": "9.3.0",
"eslint-plugin-mocha": "10.4.3",
"mocha": "10.2.0",
"mocha-junit-reporter": "2.2.1",
"playwright": "1.45.3",
"rimraf": "4.4.0",
"sinon": "18.0.0",
"source-map-loader": "4.0.2",
"typescript": "5.1.6"
}
}
1 change: 1 addition & 0 deletions packages/browser/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './web-features.js';
Loading
Loading