CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

adobe/aem-cloud-service

All AEM as a Cloud Service skills: component development, Workflow model design, development, triggering, launchers, debugging, and triaging, Dispatcher config authoring, advisory, incident response, performance tuning, and security hardening, Rapid Development Environment (RDE) deployment, log inspection, snapshots, and troubleshooting via `aio aem rde`, Jackrabbit Oak query/index tuning (property, Lucene index definitions), and extracting/inventorying JCR queries (XPath, SQL2, QueryBuilder) across a codebase.

Quality

85%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

build.jsskills/migration/scripts/validate-migration/

'use strict';

/**
 * build.js — wraps `mvn clean package -DskipTests` for a validate-migration project.
 *
 * Input : { projectDir }
 * Output: { ok, artifactPath, log, elapsedMs }
 *
 * Uses whatever `java` / JAVA_HOME the customer has. Set AEM_JAVA_HOME to pin
 * a specific JDK for validate-migration builds without touching JAVA_HOME globally.
 */
const { execFileSync } = require('child_process');
const fs = require('fs');
const path = require('path');

// Pick the build output a pattern needs from target/: bundle-runtime patterns
// deploy an OSGi `.jar`; source-only patterns (legacy-ui, cdw) inspect a
// content-package `.zip`, falling back to a content-embedding jar. Returns the
// filename or undefined.
function selectArtifact(files, artifact) {
  const jar = files.find((f) => f.endsWith('.jar') && !/-(sources|javadoc|tests)\.jar$/.test(f));
  const zip = files.find((f) => f.endsWith('.zip'));
  return artifact === 'content-package' ? (zip || jar) : (jar || zip);
}

function build({ projectDir, artifact = 'bundle' }) {
  const t0 = Date.now();
  if (!fs.existsSync(path.join(projectDir, 'pom.xml'))) {
    return { ok: false, log: `no pom.xml at ${projectDir}` };
  }
  const env = { ...process.env };
  if (process.env.AEM_JAVA_HOME) env.JAVA_HOME = process.env.AEM_JAVA_HOME;

  let log;
  try {
    // validate-migration verifies runtime contract on the SDK, not customer test correctness.
    log = execFileSync('mvn', ['-q', '-B', '-DskipTests', 'clean', 'package'],
      { cwd: projectDir, env, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 });
  } catch (e) {
    return { ok: false, log: (e.stdout || '') + (e.stderr || e.message), elapsedMs: Date.now() - t0 };
  }

  const targetDir = path.join(projectDir, 'target');
  const chosen = selectArtifact(fs.readdirSync(targetDir), artifact);
  if (!chosen) {
    const want = artifact === 'content-package' ? '.zip content package (or content-embedding .jar)' : '.jar bundle';
    return { ok: false, log: `no ${want} under target/`, elapsedMs: Date.now() - t0 };
  }
  return { ok: true, artifactPath: path.join(targetDir, chosen), log, elapsedMs: Date.now() - t0 };
}

module.exports = { build, selectArtifact };

skills

migration

README.md

SKILL.md

README.md

tile.json