I'm building an admin dashboard using Laravel Nova. There, custom tools are being generated in nova-components directory. I have created a tool called "Team Dashboard" and in that team dashboard folder, there is a separate composer.json file & package.json file. To build assests, I have to run "npm run production".
What I want to is, run "npm run production" from Team Dashboard folder when I run "composer install" command from root folder. For that, I add the following lines to composer.json file in root. See "post-install-cmd".
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force",
"npm install",
"npm run production"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"post-install-cmd": [
"cd nova-components/TeamDashboard npm run production",
"npm install",
"npm run production"
]
},
When executing "cd nova-components/TeamDashboard npm run production"
part, composer says The system cannot find the path specified.
.
How I can implement such a case in composer.json.
CodePudding user response:
cd nova-components/TeamDashboard npm run production
tries to use cd
with all these arguments. It does not execute the parts after the path.
cd nova-components/TeamDashboard && npm run production
could work, as it runs cd
first, and npm
afterwards