Skip to content

Commit

Permalink
fixes exports
Browse files Browse the repository at this point in the history
  • Loading branch information
kezike committed Mar 8, 2024
1 parent 08091bd commit 97fb15d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
18 changes: 18 additions & 0 deletions build-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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;
export const defaultDocumentLoader = cjsModule.defaultDocumentLoader;
!EOF

cat >dist/esm/package.json <<!EOF
{
"type": "module"
}
!EOF
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,22 @@
"url": "https://github.com/digitalcredentials/vc"
},
"license": "BSD-3-Clause",
"main": "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 Down Expand Up @@ -49,6 +62,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 @@ -73,8 +88,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
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 97fb15d

Please sign in to comment.