1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1751],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=a,h=p["".concat(s,".").concat(m)]||p[m]||u[m]||l;return n?r.createElement(h,o(o({ref:t},d),{},{components:n})):r.createElement(h,o({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[p]="string"==typeof e?e:a,o[1]=i;for(var c=2;c<l;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},6879:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=n(7462),a=n(3366),l=(n(7294),n(3905)),o=["components"],i={title:"Build & Install"},s=void 0,c={unversionedId:"sdk/hive/js/install",id:"sdk/hive/js/install",title:"Build & Install",description:"Developers use Hive Javascript SDK in the following two ways:",source:"@site/../docs/7.sdk/hive/js/install.md",sourceDirName:"7.sdk/hive/js",slug:"/sdk/hive/js/install",permalink:"/sdk/hive/js/install",draft:!1,editUrl:"https://github.com/elastos/Elastos.Wiki/edit/master/website/../docs/7.sdk/hive/js/install.md",tags:[],version:"current",lastUpdatedBy:"racollette",lastUpdatedAt:1678815391,formattedLastUpdatedAt:"Mar 14, 2023",frontMatter:{title:"Build & Install"},sidebar:"sdkSidebar",previous:{title:"Introduction",permalink:"/sdk/hive/js/introduction"},next:{title:"Introduction",permalink:"/sdk/hive/java/introduction"}},d={},p=[{value:"How to Use the SDK package",id:"how-to-use-the-sdk-package",level:2},{value:"Build from Source",id:"build-from-source",level:2},{value:"Install dependency",id:"install-dependency",level:3},{value:"Build SDK",id:"build-sdk",level:3},{value:"Generate API Documentation",id:"generate-api-documentation",level:3},{value:"Run Test Cases",id:"run-test-cases",level:3}],u={toc:p},m="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,o);return(0,l.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"Developers use Hive Javascript SDK in the following two ways:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Use npm dependency to download the distribution package compiled by developers directly from the package repository, which is suitable for junior developers to facilitate integration"),(0,l.kt)("li",{parentName:"ul"},"Download the source code to build environment compilation integration")),(0,l.kt)("h2",{id:"how-to-use-the-sdk-package"},"How to Use the SDK package"),(0,l.kt)("p",null,"Here are examples to integrate this SDK into the projects with package.json file. Add the following snippet of dependency declaration in their package.json file:"),(0,l.kt)("pre",null,(0,l.kt)("c
1ode",{parentName:"pre"},'"@elastosfoundation/did-js-sdk": "^2.5.1",\n')),(0,l.kt)("h2",{id:"build-from-source"},"Build from Source"),(0,l.kt)("p",null,"Prepare with the developer toolkit, then run the following commands to clone the source from GitHub:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"$ git clone https://github.com/elastos/Elastos.Hive.JS.SDK.git\n$ cd Elastos.NET.Hive.JS.SDK\n")),(0,l.kt)("p",null,"Then open the Eclipse to build the project and run the test cases. As an alternative to Webstorm, you can also use the following commands."),(0,l.kt)("h3",{id:"install-dependency"},"Install dependency"),(0,l.kt)("p",null,"Simple command to prepare the dependency with generating ./node_modules folder."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"$ npm install\n")),(0,l.kt)("h3",{id:"build-sdk"},"Build SDK"),(0,l.kt)("p",null,"The following command will build the hive js project and generate ./dist and ./typings folder."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"$ npm run build\n")),(0,l.kt)("h3",{id:"generate-api-documentation"},"Generate API Documentation"),(0,l.kt)("p",null,"The following command will generate ./docs folder which contains the API documentation."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"$ npm run docs\n")),(0,l.kt)("h3",{id:"run-test-cases"},"Run Test Cases"),(0,l.kt)("p",null,"The following commands will go to ./tests folder and run all test cases from terminal."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"$ cd tests\n$ npm install\n$ npm run test:node\n")))}h.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.