Contains all of my personal customized components and utilities for rapid frontend development.
*This is a work in progress. This is a personal project and is not intended for production use.*
// For local development
"@core": "core@http://localhost:8080/remoteEntry.js"
// For deployed/ production
"@core": "core@https://bernz322-core.vercel.app/remoteEntry.js"
import "@core/styles"; // Place this import in your main/ entry point
import { CoreButton } from "@core/components";
import { CoreAsset } from "@core/assets";
import { useCoreHook } from "@core/hooks";
import { CoreThemeProvider } from "@core/theme";
import { CoreUtils } from "@core/utils";
npm install @bernz322/core
@import '@bernz322/core/dist/styles.css';
import { Button, Header } from "@bernz322/core";
function App() {
return (
<Header />
<Button
primary
onClick={() => alert("Alert!")}
label="Alert me!"
/>
)
}
Refer to all stuffs the package offers at its Storybook.
Run the following command on your local environment:
git clone https://github.com/Bernz322/core my-project-name
cd my-project-name
npm install
Note: I always update all dependencies whenever I have the time. Then run the storybook in development mode to see components by running:
npm run storybook
Open http://localhost:6006 with your favorite browser to see the storybook.
Create a new component file inside "src/components" directory and export it in "src/index.ts". Note: This is not limited to components only, you can add React Hooks, Utility Functions, and more to it.
To check your created component, create a story of it and run storybook.
You can execute testing by running:
npm run test
For linting and checking code quality and problems, execute:
npm run lint
To fix errors, execute:
npm run lint:fix
For formatting codes, execute:
npm run format
For building your library, execute:
npm run build
This will create a build folder containing index.esm.js, index.cjs.js and typings folder for declarations.
Deployment of Storybook is automated via Github Actions. You can check storybook.yml on how it's done.
Same with Storybook deployment, publishing to NPM is also automated. Just make sure to add NPM_TOKEN in your repositories "Secrets and variables" > "Actions".