public function bundleCommand(string $packageKey, string $serverScript = null, string $clientScript = null)
    {
        $start = microtime(true);
        $filePathResolver = new FilePathResolver();
        /** @var Package $package */
        $package = $this->packageManager->getPackage($packageKey);
        if ($serverScript !== null) {
            $serverScript = $filePathResolver->resolveFilePath($serverScript);
        } else {
            $serverScript = str_replace('@packageResourcesPath', rtrim($package->getResourcesPath(), '/'), $this->reactServerFilePattern);
        }

        if ($clientScript !== null) {
            $clientScript = $filePathResolver->resolveFilePath($clientScript);
        } else {
            $clientScript = str_replace('@packageResourcesPath', rtrim($package->getResourcesPath(), '/'), $this->reactClientFilePattern);
        }

        $identifier = md5($serverScript);

        $request = new ActionRequest(Request::createFromEnvironment());
        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($request);

        $controllerContext = new ControllerContext($request, new Response(), new Arguments(), $uriBuilder);

        $unit = new Unit($controllerContext);

        $unit->work(function (App $app) use ($clientScript, $serverScript, $identifier) {
            $this->outputLine();
            $this->output('Transpiling... ');

            $transpiler = new Transpiler($app);
            $transpiler->transpile($identifier, $serverScript, $clientScript)->done(function () use ($app) {
                $this->outputLine('<success>done</success>');
                $app->end();
            });
        });

        $bundler = new Bundler($controllerContext);
        $this->output('Bundling module... ');
        $bundler->bundle($identifier);
        $this->outputLine('<success>done</success>');

        $this->outputLine();
        $elapsed = round(microtime(true) - $start, 2);
        $this->outputLine('Bundled <success>%s</success> in <success>%s seconds</success>.', [$package->getPackageKey(), $elapsed]);
        $this->outputLine();
    }