kintone-migrator 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1756,22 +1756,23 @@ function resolveSingleApp(config, appName) {
1756
1756
 
1757
1757
  //#endregion
1758
1758
  //#region src/core/domain/projectConfig/appFilePaths.ts
1759
- function buildAppFilePaths(appName) {
1759
+ function buildAppFilePaths(appName, baseDir) {
1760
+ const prefix = (path) => baseDir ? join(baseDir, path) : path;
1760
1761
  return {
1761
- schema: `schemas/${appName}.yaml`,
1762
- seed: `seeds/${appName}.yaml`,
1763
- customize: `customize/${appName}.yaml`,
1764
- view: `view/${appName}.yaml`,
1765
- settings: `settings/${appName}.yaml`,
1766
- notification: `notification/${appName}.yaml`,
1767
- report: `report/${appName}.yaml`,
1768
- action: `action/${appName}.yaml`,
1769
- process: `process/${appName}.yaml`,
1770
- fieldAcl: `field-acl/${appName}.yaml`,
1771
- appAcl: `app-acl/${appName}.yaml`,
1772
- recordAcl: `record-acl/${appName}.yaml`,
1773
- adminNotes: `admin-notes/${appName}.yaml`,
1774
- plugin: `plugin/${appName}.yaml`
1762
+ schema: prefix(`schemas/${appName}.yaml`),
1763
+ seed: prefix(`seeds/${appName}.yaml`),
1764
+ customize: prefix(`customize/${appName}.yaml`),
1765
+ view: prefix(`view/${appName}.yaml`),
1766
+ settings: prefix(`settings/${appName}.yaml`),
1767
+ notification: prefix(`notification/${appName}.yaml`),
1768
+ report: prefix(`report/${appName}.yaml`),
1769
+ action: prefix(`action/${appName}.yaml`),
1770
+ process: prefix(`process/${appName}.yaml`),
1771
+ fieldAcl: prefix(`field-acl/${appName}.yaml`),
1772
+ appAcl: prefix(`app-acl/${appName}.yaml`),
1773
+ recordAcl: prefix(`record-acl/${appName}.yaml`),
1774
+ adminNotes: prefix(`admin-notes/${appName}.yaml`),
1775
+ plugin: prefix(`plugin/${appName}.yaml`)
1775
1776
  };
1776
1777
  }
1777
1778
 
@@ -3388,7 +3389,7 @@ function planResources(resources, platformDir, resourceType, relativeBaseDir) {
3388
3389
  };
3389
3390
  }
3390
3391
  function planPlatform(remotePlatform, platformName, args) {
3391
- const platformDir = join(args.input.basePath, platformName);
3392
+ const platformDir = join(args.input.basePath, args.input.filePrefix, platformName);
3392
3393
  const platformPrefix = join(args.input.filePrefix, platformName);
3393
3394
  const jsPlan = planResources(remotePlatform.js, platformDir, "js", platformPrefix);
3394
3395
  const cssPlan = planResources(remotePlatform.css, platformDir, "css", platformPrefix);
@@ -3445,10 +3446,8 @@ async function saveCustomization({ container, input }) {
3445
3446
  //#region src/cli/commands/customize/capture.ts
3446
3447
  function deriveFilePrefix(customizeFilePath) {
3447
3448
  const resolved = resolve(customizeFilePath);
3448
- const parentDir = basename(dirname(resolved));
3449
3449
  const fileName = basename(resolved, extname(resolved));
3450
- if (parentDir === "") return fileName;
3451
- if (fileName === "customize") return parentDir;
3450
+ if (fileName === "customize") return "";
3452
3451
  return fileName;
3453
3452
  }
3454
3453
  async function runCaptureCustomization(config) {
@@ -5173,7 +5172,7 @@ function createCliCaptureContainers(input) {
5173
5172
  appId: input.appId,
5174
5173
  guestSpaceId: input.guestSpaceId
5175
5174
  };
5176
- const paths = buildAppFilePaths(input.appName);
5175
+ const paths = buildAppFilePaths(input.appName, input.baseDir);
5177
5176
  return {
5178
5177
  paths,
5179
5178
  containers: {
@@ -6234,7 +6233,7 @@ function generateProjectConfig(input) {
6234
6233
  const name = deduplicateAppName(resolveAppName(app), usedNames);
6235
6234
  apps[name] = {
6236
6235
  appId: app.appId,
6237
- files: buildAppFilePaths(name)
6236
+ files: buildAppFilePaths(name, input.baseDir)
6238
6237
  };
6239
6238
  }
6240
6239
  const config = {
@@ -6262,7 +6261,7 @@ const initArgs = {
6262
6261
  output: {
6263
6262
  type: "string",
6264
6263
  short: "o",
6265
- description: "Output config file path (default: kintone-migrator.yaml)"
6264
+ description: "Output directory"
6266
6265
  },
6267
6266
  yes: {
6268
6267
  type: "boolean",
@@ -6299,7 +6298,8 @@ var init_default = define({
6299
6298
  const baseUrl = validateKintoneDomain(kintoneDomain);
6300
6299
  const auth = resolveAuth(apiToken, username, password);
6301
6300
  const guestSpaceId = values["guest-space-id"] ?? process.env.KINTONE_GUEST_SPACE_ID;
6302
- const configPath = values.output ?? DEFAULT_CONFIG_PATH;
6301
+ const output = values.output;
6302
+ const configPath = output ? join(output, DEFAULT_CONFIG_PATH) : DEFAULT_CONFIG_PATH;
6303
6303
  const skipConfirm = values.yes ?? false;
6304
6304
  const dryRun = values["dry-run"] ?? false;
6305
6305
  const { spaceReader, projectConfigStorage } = createInitCliContainer({
@@ -6323,7 +6323,8 @@ var init_default = define({
6323
6323
  const configText = generateProjectConfig({
6324
6324
  apps,
6325
6325
  domain: kintoneDomain,
6326
- guestSpaceId
6326
+ guestSpaceId,
6327
+ baseDir: output
6327
6328
  });
6328
6329
  if (dryRun) {
6329
6330
  p.log.info(pc.dim("(dry-run mode - no files will be written)"));
@@ -6331,7 +6332,7 @@ var init_default = define({
6331
6332
  p.log.message(configText);
6332
6333
  for (const app of apps) {
6333
6334
  const appName = resolveAppName(app);
6334
- const paths = buildAppFilePaths(appName);
6335
+ const paths = buildAppFilePaths(appName, output);
6335
6336
  p.log.step(`\n=== [${pc.bold(appName)}] (appId: ${app.appId}) ===`);
6336
6337
  p.log.message(" Files that would be created:");
6337
6338
  for (const [domain, filePath] of Object.entries(paths)) p.log.message(` ${domain}: ${pc.dim(filePath)}`);
@@ -6356,7 +6357,8 @@ var init_default = define({
6356
6357
  auth,
6357
6358
  appId: app.appId,
6358
6359
  guestSpaceId,
6359
- appName
6360
+ appName,
6361
+ baseDir: output
6360
6362
  });
6361
6363
  const cs = p.spinner();
6362
6364
  cs.start(`Capturing all domains for ${appName}...`);