{"id":14981923,"url":"https://github.com/zxol/react-component-publish","last_synced_at":"2025-10-29T09:31:27.337Z","repository":{"id":34052175,"uuid":"167763676","full_name":"zxol/react-component-publish","owner":"zxol","description":"A starter for publishing your own react components.","archived":false,"fork":false,"pushed_at":"2023-01-03T16:11:26.000Z","size":1081,"stargazers_count":9,"open_issues_count":22,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-29T06:22:42.205Z","etag":null,"topics":["babel","boilerplate","component","npm","publish","react","template","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zxol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-27T03:03:31.000Z","updated_at":"2022-05-21T07:35:05.000Z","dependencies_parsed_at":"2023-01-15T04:15:16.965Z","dependency_job_id":null,"html_url":"https://github.com/zxol/react-component-publish","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxol%2Freact-component-publish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxol%2Freact-component-publish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxol%2Freact-component-publish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxol%2Freact-component-publish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zxol","download_url":"https://codeload.github.com/zxol/react-component-publish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219857951,"owners_count":16556049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","boilerplate","component","npm","publish","react","template","webpack"],"created_at":"2024-09-24T14:04:29.181Z","updated_at":"2025-10-29T09:31:26.943Z","avatar_url":"https://github.com/zxol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-component-publish\n\nA barebones boilerplate to quickly publish react components.\n\nFeatures Webpack 4 and Babel 7.\n\nIt will compile down to commonjs, and will require a peer dependancy of react, meaning it will use whatever version of react the host project is using. Hopefully this will minimize compatibility issues.\n\n[Based on this tutorial](https://medium.com/quick-code/publish-your-own-react-component-as-npm-package-under-5-minutes-8a47f0cb92b9) by [codewithbernard](https://github.com/codewithbernard)\n\n## To start\n\n```\nnpm i\nnpm start\n```\n\nEdit `src/index.js` (your component)\n\n## To view your component in isolation with a basic webpack dev server:\ntype:\n\n```\nnpm run dev\n```\n\nEdit `/srctest/app.js` to change the parent environment, pass in props, etc.\n\n## To test your component in another project (locally), before publishing to npm:\n\nBuild this project:\n\n```\nnpm run build\n```\n\nIn this project's root directory, type:\n\n```\nnpm link\n```\n\nAnd then, in the project (root dir) you would like to use your component:\n\n```\nnpm link my-awesome-component\n```\n\nFor this example I've used the package name `my-awesome-component`.\nThis creates a symlink of your package in your project's node_modules/ dir.\nNow, you may import the component in your test project, as if it was a normally installed dependancy:\n\n```\nimport MyAwesomeComponent from 'my-awesome-component'\n```\n\nIf you're using a hot-reload system, you should be able to observe any changes you make to your component (as long as you build them)\n\n## To publish your component to npm\nUpdate the package.json with correct information.\nImportant things to set:\n\n```json\n{\n  \"name\": \"cool-beans\",\n  \"version\": \"4.2.0\",\n  \"description\": \"My wizzbang gizmo\",\n  \"author\": \"stevejobs\",\n  \"license\": \"ISC\"\n}\n```\n\nIf you have a git repo for the project, include the details:\n\n```json\n\"repository\": {\n    \"type\" : \"git\",\n    \"url\" : \"https://github.com/zxol/react-component-publish\"\n  },\n```\n\nThen, in the root directory, type:\n\n```\nnpm publish\n```\n\n[npm docs on publishing packages](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)\n\n## A note on webpack configs and the dev server:\nThere are two webpack configs.\n\n- One for building the published component `webpack.publish.js`\n- One for viewing the component in the dev server. `webpack.testServer.js`\n\nNote that they are separate, so any additions you make will have to be mirrored in both files, if you want to use the dev server. If anyone knows a better way to do this, please let me know.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxol%2Freact-component-publish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzxol%2Freact-component-publish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxol%2Freact-component-publish/lists"}