This is an example repo of building plugins.
Here we've called the Stencil component library being wrapped component-library and the name of this React wrapper library component-library-react.
- Update all occurrences of
component-library-reactwith your chosen project name, saymy-library-react. - Update all occurrences of
component-librarywith the name of the Stencil library you are wrapping, saymy-library. - Change the repository url in
package.jsonto your own.
- Update
src/component/proxies.tswith your Stencil component definitions, using the corresponding Ionic source as reference:https://github.com/ionic-team/ionic/blob/master/packages/react/src/components/proxies.ts
TODO: This should really be automatically generated.
- Update the
package.jsonversion andnpm i,npm run build,npm publish - Update the dependecy version in the test app:
test/test-appand run in the usual way
The steps below depend on the following PR to be merged: stenciljs/component-starter#83
- Install verdaccio to create a quick local npm registry
- Install:
npm install --global verdaccio - Run in the terminal:
verdaccio - Set npm registry:
npm set registry http://localhost:4873/ - Add a user:
npm adduser --registry http://localhost:4873
- Create and publich a new Stencil component library
- Create:
npm init stencil(choosecomponentand name itcomponent-library) - Change directory:
cd component-library, installnpm iand buildnpm run build - Publish:
npm publish --registry http://localhost:4873
- Create and publish a React wrapper libary for the one above
- Clone:
git clone https://github.com/ionic-team/stencil-ds-react-template.git - Leave the defaults in place and cd
cd stencil-ds-react-template, installnpm iand buildnpm run build - Publish:
npm publish --registry http://localhost:4873
- Run the React test app
cd test/test-app,npm i,npm start
Presto!