<commit_before>#!/usr/bin/env node
/*
 * Copyright 2018 The Closure Compiler Authors.
 *
 * 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.
 */

/**
 * @fileoverview Create a nightly version of the package to publish to npm.
 * The compiler in this version will be a snapshot version.
 */

const {spawnSync} = require('child_process');

const today = new Date();
const month = (today.getMonth() < 9 ? '0' : '') + (today.getMonth() + 1).toString();
const day = (today.getDate() < 10 ? '0' : '') + today.getDate().toString();

// Version number is today's date with a -nightly prerelease suffix.
const nightlyVersion = `${today.getFullYear()}${month}${day}.0.0-nightly`;

// Lerna won't release packages on an already release tagged commit.
// Create a new empty commit for this nightly release.
spawnSync(
    'git',
    [
      'commit',
      '--allow-empty',
      '-m',
      `Create version for nightly release ${nightlyVersion}`
    ],
    {
      stdio: 'inherit',
    });

const glob = require('glob');

// Get the list of packages in this repo
const packages = glob.sync('packages/google-closure-compiler*')
    .map(packagePath => packagePath.replace('packages/', ''));

// Create a nightly version of all the packages
spawnSync(
    'node_modules/.bin/lerna',
    [<commit_msg>Create a branch for the nightly release.<commit_after>#!/usr/bin/env node
/*
 * Copyright 2018 The Closure Compiler Authors.
 *
 * 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.
 */

/**
 * @fileoverview Create a nightly version of the package to publish to npm.
 * The compiler in this version will be a snapshot version.
 */

const {spawnSync} = require('child_process');
const glob = require('glob');

const today = new Date();
const month = (today.getMonth() < 9 ? '0' : '') + (today.getMonth() + 1).toString();
const day = (today.getDate() < 10 ? '0' : '') + today.getDate().toString();

// Version number is today's date with a -nightly prerelease suffix.
const nightlyVersion = `${today.getFullYear()}${month}${day}.0.0-nightly`;

// Lerna won't release packages on an already release tagged commit or
// on a disconnected HEAD. Create a branch then an empty commit for this nightly release.
spawnSync(
    'git',
    [
      'checkout',
      '-b',
      `publish-${nightlyVersion}`
    ],
    {
      stdio: 'inherit',
    });
spawnSync(
    'git',
    [
      'commit',
      '--allow-empty',
      '-m',
      `Create version for nightly release ${nightlyVersion}`
    ],
    {
      stdio: 'inherit',
    });

// Get the list of packages in this repo
const packages = glob.sync('packages/google-closure-compiler*')
    .map(packagePath => packagePath.replace('packages/', ''));

// Create a nightly version of all the packages
spawnSync(
    'node_modules/.bin/lerna',
    [
{'fraction_non_alphanumeric': 0.1261237440507668, 'fraction_numerical': 0.008461131676361713, 'mean_word_length': 3.3633217993079585, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1353471', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1068, 'n_words': 418}