acebase/create-package-files
Ewout Stortenbeker d6e6f1e802 use browser files
2022-11-07 11:52:55 +01:00

47 lines
1.5 KiB
Bash

#!/bin/bash
# Create CommonJS package.json
cat >dist/cjs/package.json <<JSON
{
"type": "commonjs",
"types": "../types/index.d.ts",
"browser": {
"./index.js": "./browser.js",
"./ipc/index.js": "./ipc/browser.js",
"./promise-fs/index.js": "./promise-fs/browser.js",
"./storage/binary/index.js": "./storage/binary/browser.js",
"./storage/mssql/index.js": "./storage/mssql/browser.js",
"./storage/sqlite/index.js": "./storage/sqlite/browser.js",
"./data-index/index.js": "./data-index/browser.js",
"./btree/index.js": "./btree/browser.js"
}
}
JSON
# Write typings to support Node16 module resolution
cat >dist/cjs/index.d.ts <<TYPESCRIPT
export * from '../types';
TYPESCRIPT
# Create ESM package.json
cat >dist/esm/package.json <<JSON
{
"type": "module",
"types": "../types/index.d.ts",
"browser": {
"./index.js": "./browser.js",
"./ipc/index.js": "./ipc/browser.js",
"./promise-fs/index.js": "./promise-fs/browser.js",
"./storage/binary/index.js": "./storage/binary/browser.js",
"./storage/mssql/index.js": "./storage/mssql/browser.js",
"./storage/sqlite/index.js": "./storage/sqlite/browser.js",
"./data-index/index.js": "./data-index/browser.js",
"./btree/index.js": "./btree/browser.js"
}
}
JSON
# Write typings to support Node16 module resolution
cat >dist/esm/index.d.ts <<TYPESCRIPT
export * from '../types';
TYPESCRIPT