1.0.6 • Published 2 years ago
@websaam/sdk-ts-starter v1.0.6
A boilerplate to start create a Typescript SDK
Getting started
npx @websaam/sdk-ts-starter my-ts-sdk
Installation
Run
yarn
Change your configs in
esbuild-config.js
Change your package name in
package.json
, rename@websaam/sdk-ts-starter
to anything you want
HTML
devHtml
: Listens to Typescript file changes fromsrc
, and output tosrc_build_from_ts
, which is also being listend and built to./build/web/index.js
. Finally, run a live server onlocalhost:3000
Open tests/html/html-test.html
to edit
<script src="/build/web/index.js"></script>
<script>
console.log("ExampleSDK:", ExampleSDK);
ExampleSDK.foo();
</script>
React
devReact
: Listens to Typescript file changes fromsrc
, and output tosrc_build_from_ts
, which is also being listend and built to./build/node/index.js
. Finally, run React app onlocalhost:3000
// 1. Download React
yarn getReact
// 2. Build the SDK for both client/node, and publish locally using yalc
yarn build
// 3. Go to the React app and link the local published sdk (change the name of the package name `@websaam/sdk-ts-starter` to something you desired)
yarn linkReact
// 4. In the App.js
import * as ExampleSDK from '@websaam/sdk-ts-starter';
ExampleSDK.hello();