0.0.9 • Published 3 years ago
mytestpgk v0.0.9
Connector TypeScript Library
Based of https://github.com/alexjoverm/typescript-library-starter
Importing library
You can import the generated bundle to use the whole library generated by this starter:
import myLib from 'mylib'
Or, you can import the transpiled modules from dist/lib
in case you have a modular library:
import something from 'mylib/dist/connector.min.js'
You can also use the CDN version directly from https://unpkg.com/packagename@version/dist/connector.min.js
// configuration (needs updates)
var widgetInstance = Womply.connect({
env: 'prod',
url: 'https://unpkg.com/'
})
// Show widget
widgetInstance.open({...args})
// close widget
widgetInstance.close()
// remove all resources
widgetInstance.destroy()
NPM scripts
npm t
: Run test suitenpm start
: Runnpm run build
in watch modenpm run test:watch
: Run test suite in interactive watch modenpm run test:prod
: Run linting and generate coveragenpm run build
: Generate bundles and typings, create docsnpm run lint
: Lints code
Excluding peerDependencies
On library development, one might want to set some peer dependencies, and thus remove those from the final bundle. You can see in Rollup docs how to do that.
Good news: the setup is here for you, you must only include the dependency name in external
property within rollup.config.js
. For example, if you want to exclude lodash
, just write there external: ['lodash']
.