https://github.com/teambit/example-templates
Automatic templates for bit.dev's examples
https://github.com/teambit/example-templates
Last synced: 10 months ago
JSON representation
Automatic templates for bit.dev's examples
- Host: GitHub
- URL: https://github.com/teambit/example-templates
- Owner: teambit
- License: other
- Created: 2020-02-18T10:08:49.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-24T11:35:06.000Z (almost 6 years ago)
- Last Synced: 2025-01-14T09:38:14.732Z (11 months ago)
- Language: TypeScript
- Homepage: https://bit.dev
- Size: 759 KB
- Stars: 1
- Watchers: 7
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This repository contains the boilerplates used by [bit.dev's playground](https://docs.bit.dev/docs/bit-dev#component-playground) for creating new examples.

## Templates
The templates are located under the components/template folder in thie repo, and also published as public Bit components [here](https://bit.dev/bit/javascript?namespaces=template).
Here is the list of existing templates:
* [react](./components/template/react/react-template.ts) (most of the code is [here](./components/default-generator/react/react/react-default-code.ts))
* [react-native](./components/template/react-native/index.ts)
* [angular](./components/template/angular/ng-template-generator.ts)
* [vue](./components/template/vue/vue-template.ts) (most of code is [here](./components/default-generator/vue/vue-default-code.ts))
### Template APIs
A template component should export the following interface
(Currently components use different names for exports, but they will be unified in the future)
```tsx
mainFile: string;
makeTemplate: ({ npmId: string }) => {
files: { [filepath: string]: string };
mainFile: string;
};
```
Example:
```tsx
export const mainFile = "index.js";
export const makeTemplate = ({npmId}) => (`
import Component from ${npmId}
export default () => Component();
`)
```
## Contributing
Contributions are welcome on this repository, and will be published to the collection and to bit.dev.
1. Clone the repository
1. [Install bit](https://docs.bit.dev/docs/installation)
1. Run `bit import` to sync components.
1. Update code in a new branch.
1. Run `bit build` (or `yarn build`)
1. Test the components: `bit test` (or `yarn test`)
1. Create a *pull request* with your changes
After approving the PR, changes will be exported to the collection, and deployed to bit.dev.
Note:
We are in a process of unifying all components to use the same tester.