- First initialize the Lerna project
lerna init
- Rename
packages
directory toapps
and in thelerna.json
file add thenpmClient: true
anduseWorkspaces: true
properties and make sure thepackages
orperties now uses the newapps
directory{ "packages": [ "apps/*" ], "version": "0.0.0", "npmClient": "yarn", "useWorkspaces": true }
- To the root
package.json
add scripts to bootstrap, watch and build usinglerna run <command> --parallel
. This will read the package.json files underapps/
and execute the ones that also have that same command. - Add the
workspaces
properties usingapps/*
as value - Create new components library using tsdx
Make sure to select react + storybook option on tsdx
cd apps tsdx create coolcomponents
- Change the library name in
coolcomponents/package.json
fromcoolcomponents
to@omedym/coolcomponents
. Also make sure to rename thestart
script towatch
- Create a Laravel application using
composer create-project --prefer-dist laravel/laravel backend
and make sure thepackage.json
has a version (preferably the same as apps/coolcomponents) and theprivate: true
property. - In the
package.json
for backend project make sure that thewatch
script uses yarn instead of npm"watch": "yarn run development --watch"
- Because all dependencies will be installed in the
apps
directory it is important for the case of laravel to use two upper directories for development mode:../../node_modules
- Install the react and react-dom and change the webpack.mix.js settings to use the
react
function instead. - Add
"@omedym/coolcomponents": "^0.1.0"
as a dependency in backendpackage.json
using text and not with yarn in case the library was not previously pubished in some registry. - In the
welcome.blade.php
add a div where the react application can be loaded - Go to the root folder and run:
yarn # To update depedencies between projects yarn bootstrap yarn watch
- Now with this changes it will be possible to reflect in the Laravel application all the changes made in the components library
-
Notifications
You must be signed in to change notification settings - Fork 0
sergio-dreamcode/example-lerna-laravel-mix
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published