Skip to content

Commit

Permalink
fixes exports
Browse files Browse the repository at this point in the history
  • Loading branch information
kezike committed Mar 7, 2024
1 parent 0bb92ad commit 5a59fec
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @digitalbazaar/vc ChangeLog
# @digitalcredentials/vc ChangeLog

## 7.0.0 -

Expand Down
17 changes: 17 additions & 0 deletions build-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
mkdir ./dist/esm

cat >dist/esm/index.js <<!EOF
import cjsModule from '../index.js';
export const issue = cjsModule.issue;
export const verify = cjsModule.verify;
export const verifyCredential = cjsModule.verifyCredential;
export const createPresentation = cjsModule.createPresentation;
export const signPresentation = cjsModule.signPresentation;
export const derive = cjsModule.derive;
!EOF

cat >dist/esm/package.json <<!EOF
{
"type": "module"
}
!EOF
47 changes: 29 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
{
"name": "@digitalbazaar/vc",
"name": "@digitalcredentials/vc",
"version": "6.2.1-0",
"description": "Verifiable Credentials JavaScript library.",
"homepage": "https://github.com/digitalbazaar/vc",
"author": {
"name": "Digital Bazaar, Inc.",
"email": "[email protected]",
"url": "https://digitalbazaar.com/"
},
"contributors": [
"Dave Longley <[email protected]>",
"David I. Lehn <[email protected]>",
"Dmitri Zagidulin <[email protected]>"
],
"homepage": "https://github.com/digitalcredentials/vc",
"repository": {
"type": "git",
"url": "https://github.com/digitalbazaar/vc"
"url": "https://github.com/digitalcredentials/vc"
},
"bugs": {
"url": "https://github.com/digitalbazaar/vc/issues",
"email": "[email protected]"
"url": "https://github.com/digitalcredentials/vc/issues"
},
"license": "BSD-3-Clause",
"type": "module",
"exports": "./lib/index.js",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/esm/index.js"
},
"./package.json": "./package.json"
},
"files": [
"lib/**/*.js"
"dist",
"lib",
"rollup.config.js",
"build-dist.sh",
"README.md",
"LICENSE"
],
"dependencies": {
"@digitalbazaar/credentials-v2-context": "github:digitalbazaar/credentials-v2-context",
Expand All @@ -44,6 +45,7 @@
"@digitalbazaar/ed25519-verification-key-2018": "^4.0.0",
"@digitalbazaar/multikey-context": "^1.0.0",
"@digitalbazaar/odrl-context": "^1.0.0",
"@npmcli/package-json": "^5.0.0",
"c8": "^8.0.1",
"chai": "^4.3.7",
"cross-env": "^7.0.3",
Expand All @@ -63,6 +65,8 @@
"klona": "^2.0.6",
"mocha": "^10.2.0",
"mocha-lcov-reporter": "^1.3.0",
"rimraf": "^5.0.5",
"rollup": "^2.77.2",
"uuid": "^9.0.0",
"veres-one-context": "^12.0.0",
"webpack": "^5.75.0"
Expand All @@ -87,6 +91,13 @@
"Credential"
],
"scripts": {
"rollup": "rollup -c rollup.config.js",
"build": "npm run clear && npm run rollup && ./build-dist.sh",
"clear": "rimraf dist/ && mkdir dist",
"posttest": "node post-test.js",
"prepare": "npm run build",
"pretest": "node pre-test.js",
"rebuild": "npm run clear && npm run build",
"test": "npm run test-node",
"test-node": "cross-env NODE_ENV=test mocha --preserve-symlinks -t 10000 test/*.spec.js",
"test-karma": "karma start karma.conf.cjs",
Expand Down
11 changes: 11 additions & 0 deletions post-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PackageJson from '@npmcli/package-json';

// post-test script
const main = async () => {
const pkgJson = await PackageJson.load('./');
pkgJson.update({ type: undefined });
await pkgJson.save();
};

// run post-test script
main();
11 changes: 11 additions & 0 deletions pre-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const PackageJson = require('@npmcli/package-json');

// pre-test script
const main = async () => {
const pkgJson = await PackageJson.load('./');
pkgJson.update({ type: 'module' });
await pkgJson.save();
};

// run pre-test script
main();
14 changes: 14 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pkg from './package.json';
export default [
{
input: './lib/index.js',
output: [
{
dir: 'dist',
format: 'cjs',
preserveModules: true
}
],
external: Object.keys(pkg.dependencies)
}
];

0 comments on commit 5a59fec

Please sign in to comment.