<commit_before>#!/usr/bin/env node

const fs = require("fs");
const yaml = require("js-yaml");
const path = require("path");

const basePipeline = {
  build: { dependsOn: ["^build"], outputs: [] },
  "build-decls": { dependsOn: ["^build-decls"], outputs: [] },
  typecheck: { dependsOn: ["build-decls"], outputs: [] },
};
const turboJSON = {
  $schema: "https://turborepo.org/schema.json",
  pipeline: { ...basePipeline },
};
const packagesDir = "packages";
for (const package of fs.readdirSync(packagesDir)) {
  const { name, turbo } = JSON.parse(
    fs.readFileSync(path.join(packagesDir, package, "package.json")).toString()
  );
  if (turbo) {
    for (const [script, unparsed] of Object.entries(turbo)) {
      const config = yaml.load(`{${unparsed}}`);
      const entry = {
        dependsOn: [
          ...(basePipeline[script]?.dependsOn ?? []),
          ...(config.deps ?? []),
        ],
        outputs: config.out ?? [],
      };
      if ("cache" in config) entry.cache = config.cache;
      turboJSON.pipeline[`${name}#${script}`] = entry;
    }
  }
}
fs.writeFileSync("turbo.json", JSON.stringify(turboJSON, null, 2));<commit_msg>build: Skip missing package.json in turboConfig.js (#1101)<commit_after>#!/usr/bin/env node

const fs = require("fs");
const yaml = require("js-yaml");
const path = require("path");

const basePipeline = {
  build: { dependsOn: ["^build"], outputs: [] },
  "build-decls": { dependsOn: ["^build-decls"], outputs: [] },
  typecheck: { dependsOn: ["build-decls"], outputs: [] },
};
const turboJSON = {
  $schema: "https://turborepo.org/schema.json",
  pipeline: { ...basePipeline },
};
const packagesDir = "packages";
for (const package of fs.readdirSync(packagesDir)) {
  const p = path.join(packagesDir, package, "package.json");
  if (!fs.existsSync(p)) continue;
  const { name, turbo } = JSON.parse(fs.readFileSync(p).toString());
  if (!turbo) continue;
  for (const [script, unparsed] of Object.entries(turbo)) {
    const config = yaml.load(`{${unparsed}}`);
    const entry = {
      dependsOn: [
        ...(basePipeline[script]?.dependsOn ?? []),
        ...(config.deps ?? []),
      ],
      outputs: config.out ?? [],
    };
    if ("cache" in config) entry.cache = config.cache;
    turboJSON.pipeline[`${name}#${script}`] = entry;
  }
}
fs.writeFileSync("turbo.json", JSON.stringify(turboJSON, null, 2));
{'fraction_non_alphanumeric': 0.2032967032967033, 'fraction_numerical': 0.00253592561284869, 'mean_word_length': 3.605058365758755, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '5674370', 'n_tokens_mistral': 806, 'n_tokens_neox': 793, 'n_words': 163}