diff --git a/README.md b/README.md
index 9bb5ae9e3..d8ad18ad5 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,17 @@ If you are interested in contributing to this project, please read the [contribu
### Publishing
+### For @dfinity/core
+
+@dfinity/core is published independently of the rest of the packages in this repo. To publish a new version of @dfinity/core, follow these steps;
+
+- Update the version in `packages/core/package.json`
+- `npm install`
+- `npm run build --workspace @dfinity/core`
+- `npm publish --workspace @dfinity/core`
+
+### For the rest of the packages
+
To publish to NPM, create a branch and run the following commands;
- `git clean -dfx`. Removes all non-tracked files and directories.
@@ -57,7 +68,7 @@ Then, when you have merged the new versions and published to npm, open https://g
### Publishing Docs
-Until we have an internal process and centrally owned canister, docs can be released manually for `@dfinity/agent` and `@dfinity/authentication`.
+Until we have an internal process and centrally owned canister, docs can be released manually for all packages in this monorepo.
- Start from a fresh clone (or `git clean -dfx .`)
- `npm install`
diff --git a/bin/version.ts b/bin/version.ts
index 01e430aa9..c580e8442 100644
--- a/bin/version.ts
+++ b/bin/version.ts
@@ -49,7 +49,10 @@ const newVersion = (() => {
console.log('New version will be: ' + newVersion);
// Read workspaces from root package.json
-const workspaces: string[] = rootPackage.workspaces?.packages;
+const workspaces: string[] = rootPackage.workspaces?.packages.filter(
+ // omit @dfinity/core, whose version is not pinned
+ workspace => !workspace.includes('core'),
+);
// Identify packages in `/packages directory
const packages = workspaces
diff --git a/docs/generated/changelog.html b/docs/generated/changelog.html
index 6d22722ae..74a27313c 100644
--- a/docs/generated/changelog.html
+++ b/docs/generated/changelog.html
@@ -12,6 +12,19 @@
Agent-JS Changelog
Version x.x.x
+ -
+ Introduces @dfinity/core, a meta-package that will be released seperately from the
+ versions of the rest of the agent-js monorepo. It bundles the following packages as
+ dependencies:
+
+
+ - @dfnity/agent
+ - @dfnity/principal
+ - @dfnity/candid
+ - @dfnity/identity
+ - @dfnity/utils
+
+
-
Corrects some dev dependencies incorrectly listed as dependencies in auth-client
package.json
diff --git a/package-lock.json b/package-lock.json
index ad8f31141..426f3e31b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -52,6 +52,7 @@
"packages/auth-client",
"packages/assets",
"packages/identity-secp256k1",
+ "packages/core",
"e2e/node",
"e2e/browser",
"demos/sample-javascript"
@@ -1940,6 +1941,10 @@
"resolved": "packages/candid",
"link": true
},
+ "node_modules/@dfinity/core": {
+ "resolved": "packages/core",
+ "link": true
+ },
"node_modules/@dfinity/identity": {
"resolved": "packages/identity",
"link": true
@@ -1952,6 +1957,11 @@
"resolved": "packages/principal",
"link": true
},
+ "node_modules/@dfinity/utils": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-0.0.10.tgz",
+ "integrity": "sha512-aLXpDvbbtIPM5bYyVkXGeCCF8NnF4OxvlKMgb6uopHqP545JVejTgEOnAiSV0g5vqhPD6cyaAR2lnBV8Ze4Y8Q=="
+ },
"node_modules/@discoveryjs/json-ext": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz",
@@ -11319,8 +11329,7 @@
"node_modules/idb": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/idb/-/idb-7.0.2.tgz",
- "integrity": "sha512-jjKrT1EnyZewQ/gCBb/eyiYrhGzws2FeY92Yx8qT9S9GeQAmo4JFVIiWRIfKW/6Ob9A+UDAOW9j9jn58fy2HIg==",
- "dev": true
+ "integrity": "sha512-jjKrT1EnyZewQ/gCBb/eyiYrhGzws2FeY92Yx8qT9S9GeQAmo4JFVIiWRIfKW/6Ob9A+UDAOW9j9jn58fy2HIg=="
},
"node_modules/idb-keyval": {
"version": "6.2.0",
@@ -19643,6 +19652,9 @@
"name": "@dfinity/auth-client",
"version": "0.15.1",
"license": "Apache-2.0",
+ "dependencies": {
+ "idb": "^7.0.2"
+ },
"devDependencies": {
"@peculiar/webcrypto": "^1.4.0",
"@types/jest": "^28.1.4",
@@ -19652,7 +19664,6 @@
"eslint": "^8.19.0",
"eslint-plugin-jsdoc": "^39.3.3",
"fake-indexeddb": "^4.0.0",
- "idb": "^7.0.2",
"jest": "^28.1.2",
"jest-environment-jsdom": "^28.1.2",
"size-limit": "^8.1.0",
@@ -19893,6 +19904,18 @@
"integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==",
"dev": true
},
+ "packages/core": {
+ "name": "@dfinity/core",
+ "version": "1.0.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@dfinity/agent": "0.15.x",
+ "@dfinity/candid": "^0.15.x",
+ "@dfinity/identity": "^0.15.x",
+ "@dfinity/principal": "^0.15.x",
+ "@dfinity/utils": "^0.0.x"
+ }
+ },
"packages/identity": {
"name": "@dfinity/identity",
"version": "0.15.1",
@@ -21825,6 +21848,16 @@
}
}
},
+ "@dfinity/core": {
+ "version": "file:packages/core",
+ "requires": {
+ "@dfinity/agent": "0.15.x",
+ "@dfinity/candid": "^0.15.x",
+ "@dfinity/identity": "^0.15.x",
+ "@dfinity/principal": "^0.15.x",
+ "@dfinity/utils": "^0.0.x"
+ }
+ },
"@dfinity/identity": {
"version": "file:packages/identity",
"requires": {
@@ -22007,6 +22040,11 @@
}
}
},
+ "@dfinity/utils": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-0.0.10.tgz",
+ "integrity": "sha512-aLXpDvbbtIPM5bYyVkXGeCCF8NnF4OxvlKMgb6uopHqP545JVejTgEOnAiSV0g5vqhPD6cyaAR2lnBV8Ze4Y8Q=="
+ },
"@discoveryjs/json-ext": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz",
@@ -28906,8 +28944,7 @@
"idb": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/idb/-/idb-7.0.2.tgz",
- "integrity": "sha512-jjKrT1EnyZewQ/gCBb/eyiYrhGzws2FeY92Yx8qT9S9GeQAmo4JFVIiWRIfKW/6Ob9A+UDAOW9j9jn58fy2HIg==",
- "dev": true
+ "integrity": "sha512-jjKrT1EnyZewQ/gCBb/eyiYrhGzws2FeY92Yx8qT9S9GeQAmo4JFVIiWRIfKW/6Ob9A+UDAOW9j9jn58fy2HIg=="
},
"idb-keyval": {
"version": "6.2.0",
diff --git a/package.json b/package.json
index c300b0879..36d1e68a4 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"packages/auth-client",
"packages/assets",
"packages/identity-secp256k1",
+ "packages/core",
"e2e/node",
"e2e/browser",
"demos/sample-javascript"
diff --git a/packages/core/.gitignore b/packages/core/.gitignore
new file mode 100644
index 000000000..40ba0014d
--- /dev/null
+++ b/packages/core/.gitignore
@@ -0,0 +1,17 @@
+build_info.json
+node_modules/
+dist/
+**/*.js
+**/*.js.map
+**/*.d.ts
+
+# generated docs
+/docs/reference
+
+# Cannot ignore .d.ts files in types/
+!types/**/*.d.ts
+
+# Cannot ignore setup files for webpack and jest, which are still JavaScript.
+!webpack.config.js
+!jest.config.js
+!test-setup.js
diff --git a/packages/core/.npmignore b/packages/core/.npmignore
new file mode 100644
index 000000000..eb725972f
--- /dev/null
+++ b/packages/core/.npmignore
@@ -0,0 +1,11 @@
+# We work with a safelist here, so block everything that's not permitted, and add packages
+# that are.
+**
+
+!lib/**
+!types/**/*.d.ts
+!package.json
+!README.md
+
+# The following line further removes all test files (which matches .js and .d.ts).
+lib/**/*.test.*
diff --git a/packages/core/README.md b/packages/core/README.md
new file mode 100644
index 000000000..59aeb35f5
--- /dev/null
+++ b/packages/core/README.md
@@ -0,0 +1,32 @@
+# @dfinity/core
+
+This package provides the core functionality for interacting with the Internet Computer using JavaScript.
+
+It contains and re-exports the following packages:
+
+- [@dfinity/agent](../agent/README.md)
+- [@dfinity/candid](../candid/README.md)
+- [@dfinity/principal](../principal/README.md)
+- [@dfinity/identity](../identity/README.md)
+- [@dfinity/utils](https://github.com/dfinity/ic-js/blob/main/packages/utils/README.md)
+
+## Installation
+
+```bash
+npm install @dfinity/core
+```
+
+## Usage
+
+```js
+import {
+ Actor,
+ HttpAgent,
+ ECDSAKeyIdentity,
+ uint8ArrayToBigInt,
+ createAgent,
+ toNullable,
+} from '@dfinity/core';
+```
+
+All the good stuff is in here. More documentation coming soon.
diff --git a/packages/core/package.json b/packages/core/package.json
new file mode 100644
index 000000000..a7fb1dec4
--- /dev/null
+++ b/packages/core/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@dfinity/core",
+ "version": "1.0.0",
+ "author": "DFINITY Stiftung ",
+ "license": "Apache-2.0",
+ "description": "JavaScript and TypeScript library to interact with the Internet Computer",
+ "homepage": "https://internetcomputer.org",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dfinity/agent-js.git",
+ "directory": "packages/agent"
+ },
+ "bugs": {
+ "url": "https://github.com/dfinity/agent-js/issues"
+ },
+ "keywords": [
+ "internet computer",
+ "internet-computer",
+ "ic",
+ "dfinity",
+ "agent",
+ "actor",
+ "dfx",
+ "canister",
+ "candid",
+ "motoko",
+ "javascript",
+ "typescript",
+ "blockchain",
+ "crypto",
+ "distributed",
+ "api",
+ "sdk"
+ ],
+ "main": "./lib/cjs/index",
+ "module": "./lib/esm/index",
+ "unpkg": "./lib/esm/index",
+ "scripts": {
+ "build": "tsc -b && tsc -p tsconfig-cjs.json",
+ "build:watch": "tsc -b --watch",
+ "bundle": "esbuild --bundle src/index.ts --outfile=dist/index.js",
+ "eslint:fix": "npm run lint -- --fix",
+ "eslint": "eslint --ext '.js,.jsx,.ts,.tsx' src/index.ts",
+ "lint": "npm run eslint",
+ "make:docs/reference": "typedoc src/index.ts --out ../../docs/generated/core --excludeInternal",
+ "release": "npm publish",
+ "test": "jest --verbose",
+ "test:coverage": "jest --verbose --collectCoverage",
+ "tslint:fix": "npm run lint -- --fix",
+ "tslint": "tslint --project tsconfig.json --config tslint.json"
+ },
+ "dependencies": {
+ "@dfinity/agent": "0.15.x",
+ "@dfinity/candid": "^0.15.x",
+ "@dfinity/identity": "^0.15.x",
+ "@dfinity/principal": "^0.15.x",
+ "@dfinity/utils": "^0.0.x"
+ },
+ "size-limit": [
+ {
+ "path": "./dist/index.js",
+ "limit": "100 kB",
+ "webpack": false
+ }
+ ]
+}
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
new file mode 100644
index 000000000..1e725d7c6
--- /dev/null
+++ b/packages/core/src/index.ts
@@ -0,0 +1,24 @@
+export * from '@dfinity/agent';
+export * from '@dfinity/identity';
+export * from '@dfinity/principal';
+export type { JsonArray, JsonObject, JsonValue } from '@dfinity/candid';
+export {
+ IDL,
+ idlLabelToId,
+ safeRead,
+ safeReadUint8,
+ slebDecode,
+ slebEncode,
+ lebDecode,
+ lebEncode,
+ writeIntLE,
+ writeUIntLE,
+ readIntLE,
+ readUIntLE,
+ concat,
+ toHexString,
+ fromHexString,
+ PipeArrayBuffer,
+} from '@dfinity/candid';
+
+export * from '@dfinity/utils';
diff --git a/packages/core/tsconfig-cjs.json b/packages/core/tsconfig-cjs.json
new file mode 100644
index 000000000..524a27af4
--- /dev/null
+++ b/packages/core/tsconfig-cjs.json
@@ -0,0 +1,7 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "module": "CommonJS",
+ "outDir": "lib/cjs"
+ }
+}
diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json
new file mode 100644
index 000000000..ea45e450a
--- /dev/null
+++ b/packages/core/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "baseUrl": "./",
+ "composite": true,
+ "declaration": true,
+ "esModuleInterop": true,
+ "forceConsistentCasingInFileNames": true,
+ "incremental": true,
+ "lib": ["dom", "es2017"],
+ "module": "ES2020",
+ "moduleResolution": "node",
+ "outDir": "lib/esm",
+ "resolveJsonModule": true,
+ "rootDir": "./src",
+ "sourceMap": true,
+ "inlineSources": true,
+ "strict": true,
+ "target": "es2017",
+ "tsBuildInfoFile": "./build_info.json"
+ },
+ "include": ["src/**/*.ts"]
+}