<commit_before>#!/usr/bin/env node
/**
 * Copyright 2020 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
"use strict";

const pkg = require("../package.json");
const semverMajor = require("semver/functions/major");
const semverLt = require("semver/functions/lt");
const fs = require("fs");

const PACKAGE_FOLDER_NAMES = [
  "google-closure-compiler",
  "google-closure-compiler-java",
  "google-closure-compiler-linux",
  "google-closure-compiler-osx",
];

// This script should catch and handle all rejected promises.
// If it ever fails to do so, report that and exit immediately.
process.on("unhandledRejection", (error) => {
  console.error(error);
  process.exit(1);
});

(async function () {
  // 1. Retrieve Closure Version from NPM version published.
  const closureVersion = `${semverMajor(
    pkg.devDependencies["google-closure-compiler"]
  )}.0.0`;

  // 2. Update Major version within each package.
  for await (const packageFolderName of PACKAGE_FOLDER_NAMES) {
    const packageLocation = `./packages/${packageFolderName}/package.json`;
    const packageContents = await fs.readFile(packageLocation, "utf8");
    const parsed = JSON.parse(packageContents);
    if (semverLt(parsed.version, closureVersion)) {
      // Only update the version if its older than the current released `closure-compiler`.
      parsed.version = closureVersion;

      // Ensure the linked dependencies are also using the current released `closure-compiler`.
      const hatClosureVersion = "^" + closureVersion;
      if (
        parsed.dependencies &&<commit_msg>use -java version for determining version<commit_after>#!/usr/bin/env node
/**
 * Copyright 2020 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
"use strict";

const pkg = require("../package.json");
const semverMajor = require("semver/functions/major");
const semverLt = require("semver/functions/lt");
const fs = require("fs");

const PACKAGE_FOLDER_NAMES = [
  "google-closure-compiler",
  "google-closure-compiler-java",
  "google-closure-compiler-linux",
  "google-closure-compiler-osx",
];

// This script should catch and handle all rejected promises.
// If it ever fails to do so, report that and exit immediately.
process.on("unhandledRejection", (error) => {
  console.error(error);
  process.exit(1);
});

(async function () {
  // 1. Retrieve Closure Version from NPM version published.
  const closureVersion = `${semverMajor(
    pkg.devDependencies["google-closure-compiler-java"]
  )}.0.0`;

  // 2. Update Major version within each package.
  for await (const packageFolderName of PACKAGE_FOLDER_NAMES) {
    const packageLocation = `./packages/${packageFolderName}/package.json`;
    const packageContents = await fs.readFile(packageLocation, "utf8");
    const parsed = JSON.parse(packageContents);
    if (semverLt(parsed.version, closureVersion)) {
      // Only update the version if its older than the current released `closure-compiler`.
      parsed.version = closureVersion;

      // Ensure the linked dependencies are also using the current released `closure-compiler`.
      const hatClosureVersion = "^" + closureVersion;
      if (
        parsed.dependencies &&
{'fraction_non_alphanumeric': 0.10962754743499649, 'fraction_numerical': 0.006558913094401499, 'mean_word_length': 3.88558352402746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3355836', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1162, 'n_words': 415}