Skip to content

Instantly share code, notes, and snippets.

View 0xC0A1's full-sized avatar
🔥
Burning stronger

0xC0A1 0xC0A1

🔥
Burning stronger
View GitHub Profile
@0xC0A1
0xC0A1 / package.jsonc
Created August 25, 2020 01:34
Resolutions file added
{
...
"resolutions": {
"react": "~16.11.0",
"react-dom": "~16.11.0"
}
}
@0xC0A1
0xC0A1 / index.ts
Created August 25, 2020 01:31
Export XPButton Component
export * from "./components/XPButton";
@0xC0A1
0xC0A1 / init-xpbutton.sh
Created August 25, 2020 01:29
Create first button
$ mkdir src/components # Create components folder
$ touch src/components/XPButton.tsx # Create our first component file: XPButton
@0xC0A1
0xC0A1 / init-ui-folders.sh
Created August 25, 2020 01:27
UI Library folders initialization
$ mkdir docs # Create folder for storybook stories
$ mkdir src # Create folder for component library
$ touch src/index.ts # Create entry point for component library
@0xC0A1
0xC0A1 / init-storybook.sh
Created August 25, 2020 01:26
Initialize storybook
$ mkdir .storybook # Create storybook folder
$ touch .storybook/main.js # Create main entry point for storybook
@0xC0A1
0xC0A1 / dependencies.sh
Created August 25, 2020 01:24
Dependencies to use
# Inside of the ui folder, otherwise you'll need to prefix it by yarn workspace @xproduct/ui add ...
$ yarn add react-native-web@~0.11.7
$ yarn add --peer react@~16.11.0\
react-dom@~16.11.0\
react-native@~0.62.2
$ yarn add --dev @storybook/react\
react@~16.11.0\
react-dom@~16.11.0\
react-native@~0.62.2\
@types/react-native@~0.62.2\
@0xC0A1
0xC0A1 / package.jsonc
Created August 25, 2020 01:21
Scripts to use on the ui package
{
# ...
"scripts": {
"dev": "tsc -p tsconfig.build.json --watch",
"dev:docs": "start-storybook -p 4000",
"clean": "rm -rf ./dist && rm -rf ./build",
"build": "tsc -p tsconfig.build.json && build-storybook -c .storybook -o build"
}
}
@0xC0A1
0xC0A1 / init-ui-2.sh
Created August 25, 2020 01:19
Initialization instructions for ui folder
$ yarn init
# Name it @xproduct/ui
# Set the entrypoint (main) to dist/index.js
# Set the version to 0.1.0
# Make it private: true
@0xC0A1
0xC0A1 / init-ui.sh
Created August 25, 2020 01:18
Initialize ui folder
$ mkdir libraries/ui && cd libraries/ui
@0xC0A1
0xC0A1 / setup-expo-yarn-workspaces.sh
Created August 25, 2020 01:13
Set up expo yarn workspaces as dev dependency
$ yarn workspace @xproduct/mobile add expo-yarn-wokspaces -D