/ (defaults to the extensions directory).} {--force : Overwrite the target directory if it already exists.}')] class MakeCommand extends Command implements PromptsForMissingInput { public function handle(ExtensionScaffolder $scaffolder): int { try { $target = $scaffolder->scaffold( id: $this->argument('id'), name: $this->option('name'), description: $this->option('description'), author: $this->option('author'), ui: ! $this->option('no-ui'), outDir: $this->option('out'), force: (bool) $this->option('force'), prefix: $this->option('prefix'), theme: (bool) $this->option('theme'), cssOnly: (bool) $this->option('css-only'), extends: $this->option('extends'), ); } catch (InvalidExtensionException $invalidExtensionException) { $this->components->error($invalidExtensionException->getMessage()); return self::FAILURE; } $this->components->info("Extension scaffolded at {$target}."); foreach ($scaffolder->files() as $file) { $this->components->twoColumnDetail($file, 'created'); } $this->line(''); $this->components->info('Next steps:'); // p:extension:dev builds, installs and enables the package where it is; p:extension:install takes archives. $this->components->bulletList(array_filter([ $this->option('no-ui') && ! $this->option('theme') ? null : "cd {$target} && npm install", "php artisan p:extension:dev {$target} --enable", $this->option('theme') ? "php artisan p:theme:activate {$this->argument('id')}" : null, ])); return self::SUCCESS; } /** @return array> */ protected function promptForMissingArgumentsUsing(): array { return [ 'id' => ['What should the extension be identified as?', 'E.g. my-extension'], ]; } }