TypeScript-based various types of solutions for TokenE projects.
For the change log, see CHANGELOG.md.
The TokenE Webkit is a library that consists of many smaller NPM packages within the @tokene namespace, a so-called monorepo.
Here are the packages in the namespace:
Package | Description | Latest |
---|---|---|
@tokene/toolkit | Collection of common utilities, functions, enums, errors and helpers | |
@tokene/vue-web3-provider | The Vue reactive wrapper of @distributedlab/w3p | |
@tokene/styles | The global styles for every TokenE project and common function, mixins and variables | |
@tokene/ui-kit | The global ui-kit for every TokenE project | |
@tokene/toasts | Vue based toasts | |
@tokene/sdk | Collection of common interactions with TokenE graph, core contracts, and extensions |
To use any of the packages in React project, created with create-react-app you need to add craco package and config to resolve the ESM version:
yarn add -D @craco/craco
Next, in the root of your project (where package.json
is located) create a file named craco.config.js
with the following content:
module.exports = {
webpack: {
configure: {
module: {
rules: [
{
test: /\.m?js$/,
resolve: {
fullySpecified: false,
},
},
],
},
},
},
}
This config disables the breaking change that causes this error.
Then change the start
/build
/test
commands in package.json
replacing react-scripts
to craco
:
{
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test"
}
}
To get ESLint and Prettier working in VSCode, install ESLint extension and add the following to your settings.json:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"typescript"
],
"eslint.alwaysShowStatus": true,
"eslint.packageManager": "yarn",
"eslint.workingDirectories": [{ "mode": "auto" }]
}
To get ESLint and Prettier working in WebStorm, go to Preferences > Languages & Frameworks > JavaScript > Code Quality Tools > ESLint
and check the following:
Run eslint --fix on save
enabledAutomatic ESLint configuration
enabled{**/*,*}.{js,ts}
in Run for files
fieldTo install all dependencies, run:
yarn install
If you are implementing a new package which needs to depend on the local package, you can use the following command to install it:
yarn workspace @tokene/target-package add @tokene/package-to-add
To install a dependency to all packages, use the following command:
yarn workspaces foreach -pt run add @tokene/package-to-add
To test the packages, you need:
Build the packages:
yarn build
Switch yarn to version berry in the project where you want to test package, to yarn be able to resolve workspace dependencies:
yarn set version berry
Add this to the .yarnrc.yml
file:
nodeLinker: node-modules
Link the packages to the project:
yarn link -p -A /path/to/web-kit/root/directory
Add dependencies to the package.json file:
{
"dependencies": {
"@tokene/toolkit": "*"
}
}
Install the dependencies:
yarn install
yarn build
yarn test
yarn lint
yarn rsc 0.1.0
yarn apply-version 0.1.0
First off, thanks for taking the time to contribute! Now, take a moment to be sure your contributions make sense to everyone else.
Found a problem? Want a new feature? First of all see if your issue or idea has already been reported. If don't, just open a new clear and descriptive issue.
Pull requests are the greatest contributions, so be sure they are focused in scope, and do avoid unrelated commits.
git clone https://github.com/<your-username>/web-kit
cd web-kit
git checkout -b feature/my-new-feature
yarn install
git commit -am 'Add some feature'
git push origin feature/my-new-feature
Generated using TypeDoc