Skip to content

Commit d168b35

Browse files
committed
modify packaging for dcc use
1 parent 7ed2896 commit d168b35

10 files changed

+123
-46
lines changed

Diff for: .github/workflows/issues-to-project.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: move new, edited, reopened issues to DCC Engineering project
2+
3+
on:
4+
issues:
5+
types: [ opened, edited, reopened ]
6+
jobs:
7+
add-to-project:
8+
name: Add issue to project
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/add-to-project@main
12+
with:
13+
project-url: https://github.com/orgs/digitalcredentials/projects/14
14+
github-token: ${{ secrets.PROJECTS_ACCESS_TOKEN }}

Diff for: CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @digitalbazaar/did-method-web ChangeLog
1+
# @digitalcredentials/did-method-web ChangeLog
22

33
## 1.0.1 - 2024-04-14
44

Diff for: README.md

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# did:web method driver _(@digitalbazaar/did-method-web)_
1+
# did:web method driver _(@digitalcredentials/did-method-web)_
22

33
[![Build status](https://github.com/digitalbazaar/did-method-web/actions/workflows/main.yml/badge.svg)](https://github.com/digitalbazaar/did-method-web/actions/workflows/main.yml)
44
[![Coverage status](https://img.shields.io/codecov/c/github/digitalbazaar/did-method-web)](https://codecov.io/gh/digitalbazaar/did-method-web)
@@ -25,7 +25,7 @@ See also (related specs):
2525
* [Linked Data Cryptographic Suite Registry](https://w3c-ccg.github.io/ld-cryptosuite-registry/)
2626
* [Linked Data Proofs](https://w3c-dvcg.github.io/ld-proofs/)
2727

28-
A `did:web` method driver for the [`did-io`](https://github.com/digitalbazaar/did-io)
28+
A `did:web` method driver for the [`did-io`](https://github.com/digitalcredentials/did-io)
2929
client library and for standalone use.
3030

3131
`did:web` allows DIDs to bootstrap trust using a web domain's existing reputation.
@@ -99,13 +99,13 @@ Requires Node.js 18+
9999
To install from `npm`:
100100

101101
```
102-
npm install --save @digitalbazaar/did-method-web
102+
npm install --save @digitalcredentials/did-method-web
103103
```
104104

105105
To install locally (for development):
106106

107107
```
108-
git clone https://github.com/digitalbazaar/did-method-web.git
108+
git clone https://github.com/digitalcredentials/did-method-web.git
109109
cd did-method-web
110110
npm install
111111
```
@@ -117,11 +117,11 @@ npm install
117117
A new `did:web` DID Document can be generated from an existing key pair:
118118

119119
```js
120-
import {driver} from '@digitalbazaar/did-method-web';
120+
import {driver} from '@digitalcredentials/did-method-web';
121121
import {Ed25519VerificationKey2020} from
122-
'@digitalbazaar/ed25519-verification-key-2020';
122+
'@digitalcredentials/ed25519-verification-key-2020';
123123
import {X25519KeyAgreementKey2020} from
124-
'@digitalbazaar/x25519-key-agreement-key-2020';
124+
'@digitalcredentials/x25519-key-agreement-key-2020';
125125

126126
// create a driver with the desired key support
127127
const didWebDriver = driver();
@@ -299,7 +299,7 @@ This library resolves HTTP requests using implementations of [`fetch`](https://f
299299
The following apis will accept a `fetchOptions` parameter: `DidWebDriver`, `driver`, and `driver.get`.
300300

301301
```js
302-
import {DidWebDriver, driver} from '@digitalbazaar/did-method-web';
302+
import {DidWebDriver, driver} from '@digitalcredentials/did-method-web';
303303
// accept really large DID documents
304304
const fetchOptions = {size: 81920000};
305305
const driver = new driver({fetchOptions});
@@ -317,33 +317,27 @@ functions for working with `did:web` DIDs.
317317
To convert a `did:web` URL to its corresponding HTTPS URL:
318318

319319
```js
320-
import {didUrlToHttpsUrl} from '@digitalbazaar/did-method-web';
320+
import {didUrlToHttpsUrl} from '@digitalcredentials/did-method-web';
321321
const didUrl = 'did:web:w3c-ccg.github.io:user:alice';
322322
const httpsUrl = didUrlToHttpsUrl(did);
323323
// https://w3c-ccg.github.io/user/alice/did.json
324324
```
325325
To convert an HTTPS URL to its corresponding `did:web` DID URL
326326
```js
327-
import {httpsUrlToDidUrl} from '@digitalbazaar/did-method-web';
327+
import {httpsUrlToDidUrl} from '@digitalcredentials/did-method-web';
328328
const httpsUrl = 'https://w3c-ccg.github.io/user/alice/did.json'
329329
const didUrl = httpsUrlToDidUrl(url);
330330
// did:web:w3c-ccg.github.io:user:alice
331331
```
332332

333333
## Contribute
334334

335-
See [the contribute file](https://github.com/digitalbazaar/bedrock/blob/master/CONTRIBUTING.md)!
336-
337335
PRs accepted.
338336

339337
If editing the Readme, please conform to the
340338
[standard-readme](https://github.com/RichardLitt/standard-readme) specification.
341339

342-
## Commercial Support
343-
344-
Commercial support for this library is available upon request from
345-
Digital Bazaar: [email protected]
346-
347340
## License
348341

349-
[New BSD License (3-clause)](LICENSE) © Digital Bazaar
342+
[MIT License](LICENSE.md) © 2025 Digital Credentials Consortium.
343+

Diff for: build-dist.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
mkdir ./dist/esm
2+
3+
cat >dist/esm/index.js <<!EOF
4+
import cjsModule from '../index.js';
5+
export const createFromMultibase = cjsModule.createFromMultibase;
6+
export const driver = cjsModule.driver;
7+
export const DidWebDriver = cjsModule.DidWebDriver;
8+
export const didUrlToHttpsUrl = cjsModule.didUrlToHttpsUrl;
9+
export const httpsUrlToDidUrl = cjsModule.httpsUrlToDidUrl;
10+
!EOF
11+
12+
cat >dist/esm/package.json <<!EOF
13+
{
14+
"type": "module"
15+
}
16+
!EOF

Diff for: lib/DidWebDriver.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*!
22
* Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
33
*/
4-
import * as didIo from '@digitalbazaar/did-io';
4+
import * as didIo from '@digitalcredentials/did-io';
55
import {
66
didUrlToHttpsUrl,
77
getNode,
88
httpsUrlToDidUrl
99
} from './helpers.js';
1010
import {assertDomain} from './assertions.js';
1111
import {defaultFetchOptions} from './constants.js';
12-
import {driver as DidKeyDriver} from '@digitalbazaar/did-method-key';
13-
import {httpClient} from '@digitalbazaar/http-client';
12+
import {driver as DidKeyDriver} from '@digitalcredentials/did-method-key';
13+
import {httpClient} from '@digitalcredentials/http-client';
1414

1515
export class DidWebDriver {
1616
/**

Diff for: lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {didUrlToHttpsUrl, httpsUrlToDidUrl} from './helpers.js';
55
import {DidWebDriver} from './DidWebDriver.js';
66

77
// re-export `createFromMultibase` for `use` API
8-
export {createFromMultibase} from '@digitalbazaar/did-method-key';
8+
export {createFromMultibase} from '@digitalcredentials/did-method-key';
99

1010
/**
1111
* Helper method to match the `.driver()` API of other `did-io` plugins.

Diff for: package.json

+40-23
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
{
2-
"name": "@digitalbazaar/did-method-web",
3-
"version": "1.0.2-0",
2+
"name": "@digitalcredentials/did-method-web",
3+
"version": "1.0.3-beta.1",
44
"description": "A did:web method resolver.",
5-
"homepage": "https://github.com/digitalbazaar/did-method-web",
6-
"author": {
7-
"name": "Digital Bazaar, Inc.",
8-
"email": "[email protected]",
9-
"url": "https://digitalbazaar.com/"
10-
},
5+
"homepage": "https://github.com/digitalcredentials/did-method-web",
116
"repository": {
127
"type": "git",
13-
"url": "https://github.com/digitalbazaar/did-method-web"
8+
"url": "https://github.com/digitalcredentials/did-method-web"
149
},
1510
"bugs": {
16-
"url": "https://github.com/digitalbazaar/did-method-web/issues",
17-
"email": "[email protected]"
11+
"url": "https://github.com/digitalcredentials/did-method-web/issues"
12+
},
13+
"license": "MIT",
14+
"main": "dist/index.js",
15+
"module": "dist/esm/index.js",
16+
"exports": {
17+
".": {
18+
"require": "./dist/index.js",
19+
"import": "./dist/esm/index.js"
20+
},
21+
"./package.json": "./package.json"
1822
},
19-
"license": "BSD-3-Clause",
20-
"type": "module",
21-
"exports": "./lib/index.js",
2223
"files": [
23-
"lib/**/*.js"
24+
"dist",
25+
"lib",
26+
"rollup.config.js",
27+
"build-dist.sh",
28+
"README.md",
29+
"LICENSE"
2430
],
2531
"dependencies": {
26-
"@digitalbazaar/did-io": "^2.0.0",
27-
"@digitalbazaar/did-method-key": "^5.2.0",
28-
"@digitalbazaar/http-client": "^4.0.0",
32+
"@digitalcredentials/did-io": "^2.0.0",
33+
"@digitalcredentials/did-method-key": "^5.2.0",
34+
"@digitalcredentials/http-client": "^4.0.0",
2935
"klona": "^2.0.6"
3036
},
3137
"devDependencies": {
@@ -74,12 +80,23 @@
7480
"DID"
7581
],
7682
"scripts": {
83+
"rollup": "rollup -c rollup.config.js",
84+
"build": "npm run clear && npm run rollup && ./build-dist.sh",
85+
"clear": "rimraf dist/ && mkdir dist",
86+
"posttest": "node post-test.js",
87+
"prepare": "npm run build",
88+
"pretest": "node pre-test.js",
89+
"rebuild": "npm run clear && npm run build",
7790
"test": "npm run test-node",
78-
"test-node": "cross-env NODE_ENV=test mocha --preserve-symlinks -t 10000 test/mocha/*.spec.js",
91+
"test-node": "cross-env NODE_ENV=test mocha --preserve-symlinks -t 10000 test/*.spec.js",
7992
"test-karma": "karma start karma.conf.cjs",
80-
"coverage": "cross-env NODE_ENV=test c8 npm run test-node",
81-
"coverage-ci": "cross-env NODE_ENV=test c8 --reporter=lcovonly --reporter=text-summary --reporter=text npm run test-node",
82-
"coverage-report": "c8 report",
83-
"lint": "eslint ."
93+
"lint": "eslint 'lib/**/*.js' 'test/**/*.js'",
94+
"coverage": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text-summary npm run test-node",
95+
"coverage-ci": "cross-env NODE_ENV=test nyc --reporter=lcovonly npm run test-node",
96+
"coverage-report": "nyc report"
8497
}
98+
99+
100+
101+
85102
}

Diff for: post-test.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import PackageJson from '@npmcli/package-json';
2+
3+
// post-test script
4+
const main = async () => {
5+
const pkgJson = await PackageJson.load('./');
6+
pkgJson.update({ type: undefined });
7+
await pkgJson.save();
8+
};
9+
10+
// run post-test script
11+
main();

Diff for: pre-test.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const PackageJson = require('@npmcli/package-json');
2+
3+
// pre-test script
4+
const main = async () => {
5+
const pkgJson = await PackageJson.load('./');
6+
pkgJson.update({ type: 'module' });
7+
await pkgJson.save();
8+
};
9+
10+
// run pre-test script
11+
main();

Diff for: rollup.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import pkg from './package.json';
2+
export default [
3+
{
4+
input: './lib/index.js',
5+
output: [
6+
{
7+
dir: 'dist',
8+
format: 'cjs',
9+
preserveModules: true
10+
}
11+
],
12+
external: Object.keys(pkg.dependencies)
13+
}
14+
];

0 commit comments

Comments
 (0)