src/Defaulter.php
static function packageJson($project_directory, $app_engine_project, $app_engine_service, $package_json_defaults = []) {
        $package_json_location = $project_directory . DIRECTORY_SEPARATOR . "package.json";
        $package_json_content = Files::getJson($package_json_location, []);
        $package_json_content = array_merge([
            "name" => null,
            "project" => null,
            "private" => null,
        ], $package_json_content);
        $project_name = $app_engine_project . '-' . $app_engine_service;
        $package_json_defaults["private"] = true;
        $package_json_content["name"] = $project_name;
        $package_json_content["project"] = $app_engine_project;
        foreach ($package_json_defaults as $key => $val) {
            $package_json_content[$key] = $val;
        }
        if ($app_engine_service == "default") {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml queue.yaml --project $npm_package_project --promote --quiet';
        } else {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml --project $npm_package_project --promote --quiet';
        }
        $gaeutil_json = Files::getJson(Conf::getGaeUtilJsonPath($project_directory), []);

        $project_key_name = $gaeutil_json[Secrets::CONF_PROJECT_KEY_NAME];
        $project_key = Secrets::reverseKmsKey($project_key_name);
        $crypt_params = [
            "ciphertext-file" => "config/secrets.cipher",
            "plaintext-file" => "secrets.json",
            "project" => $project_key["project"],
            "location" => $project_key["location"],
            "keyring" => $project_key["keyRing"],
            "key" => $project_key["cryptoKey"]
        ];
        $package_json_content["scripts"]["encrypt"] = self::commandMaker("gcloud kms encrypt", $crypt_params);
        $package_json_content["scripts"]["decrypt"] = self::commandMaker("gcloud kms decrypt", $crypt_params);
        $package_json_content["scripts"]["devserve"] = 'dev_appserver.py --port=5000 . -A $npm_package_project';
        if (Files::putJson($package_json_location, $package_json_content)) {
            Util::cmdline("Updated package.json in $project_name");
        }

    }
static function packageJson($project_directory, $app_engine_project, $app_engine_service, $package_json_defaults = []) {
        $package_json_location = $project_directory . DIRECTORY_SEPARATOR . "package.json";
        $package_json_content = Files::getJson($package_json_location, []);
        $package_json_content = array_merge([
            "name" => null,
            "project" => null,
            "private" => null,
        ], $package_json_content);
        $project_name = $app_engine_project . '-' . $app_engine_service;
        $package_json_defaults["private"] = true;
        $package_json_content["name"] = $project_name;
        $package_json_content["project"] = $app_engine_project;
        foreach ($package_json_defaults as $key => $val) {
            $package_json_content[$key] = $val;
        }
        if ($app_engine_service == "default") {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml queue.yaml --project $npm_package_project --promote --quiet';
        } else {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml --project $npm_package_project --promote --quiet';
        }
        $gaeutil_json = Files::getJson(Conf::getGaeUtilJsonPath($project_directory), []);

        $project_key_name = $gaeutil_json[Secrets::CONF_PROJECT_KEY_NAME];
        $project_key = Secrets::reverseKmsKey($project_key_name);
        $crypt_params = [
            "ciphertext-file" => "config/secrets.cipher",
            "plaintext-file" => "secrets.json",
            "project" => $project_key["project"],
            "location" => $project_key["location"],
            "keyring" => $project_key["keyRing"],
            "key" => $project_key["cryptoKey"]
        ];
        $package_json_content["scripts"]["encrypt"] = self::commandMaker("gcloud kms encrypt", $crypt_params);
        $package_json_content["scripts"]["decrypt"] = self::commandMaker("gcloud kms decrypt", $crypt_params);
        $package_json_content["scripts"]["devserve"] = 'dev_appserver.py --port=5000 . -A $npm_package_project';
        if (Files::putJson($package_json_location, $package_json_content)) {
            Util::cmdline("Updated package.json in $project_name");
        }

    }
static function packageJson ( $ project_directory , $ app_engine_project , $ app_engine_service , $ package_json_defaults = [ ] ) { $ package_json_location = $ project_directory . DIRECTORY_SEPARATOR . "package.json" ; $ package_json_content = Files :: getJson ( $ package_json_location , [ ] ) ; $ package_json_content = array_merge ( [ "name" => null , "project" => null , "private" => null , ] , $ package_json_content ) ; $ project_name = $ app_engine_project . '-' . $ app_engine_service ; $ package_json_defaults [ "private" ] = true ; $ package_json_content [ "name" ] = $ project_name ; $ package_json_content [ "project" ] = $ app_engine_project ; foreach ( $ package_json_defaults as $ key => $ val ) { $ package_json_content [ $ key ] = $ val ; } if ( $ app_engine_service == "default" ) { $ package_json_content [ "scripts" ] [ "deploy" ] = 'gcloud app deploy app.yaml queue.yaml --project $npm_package_project --promote --quiet' ; } else { $ package_json_content [ "scripts" ] [ "deploy" ] = 'gcloud app deploy app.yaml --project $npm_package_project --promote --quiet' ; } $ gaeutil_json = Files :: getJson ( Conf :: getGaeUtilJsonPath ( $ project_directory ) , [ ] ) ; $ project_key_name = $ gaeutil_json [ Secrets :: CONF_PROJECT_KEY_NAME ] ; $ project_key = Secrets :: reverseKmsKey ( $ project_key_name ) ; $ crypt_params = [ "ciphertext-file" => "config/secrets.cipher" , "plaintext-file" => "secrets.json" , "project" => $ project_key [ "project" ] , "location" => $ project_key [ "location" ] , "keyring" => $ project_key [ "keyRing" ] , "key" => $ project_key [ "cryptoKey" ] ] ; $ package_json_content [ "scripts" ] [ "encrypt" ] = self :: commandMaker ( "gcloud kms encrypt" , $ crypt_params ) ; $ package_json_content [ "scripts" ] [ "decrypt" ] = self :: commandMaker ( "gcloud kms decrypt" , $ crypt_params ) ; $ package_json_content [ "scripts" ] [ "devserve" ] = 'dev_appserver.py --port=5000 . -A $npm_package_project' ; if ( Files :: putJson ( $ package_json_location , $ package_json_content ) ) { Util :: cmdline ( "Updated package.json in $project_name" ) ; } }
Fixing package.json
Fixing package . json