@openfairygui/cli 0.2.0-alpha.31 → 0.2.0-alpha.33

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +15 -12
  2. package/package.json +4 -4
package/dist/cli.mjs CHANGED
@@ -12490,6 +12490,10 @@ var ProjectReader = class {
12490
12490
  if (!desc) return;
12491
12491
  let pkg = ctx.document.getRoot().getPackage(dirName);
12492
12492
  if (!pkg) pkg = ctx.document.createPackage(dirName);
12493
+ pkg.setExtras({
12494
+ ...pkg.getExtras(),
12495
+ _preservePackageResourceOrder: true
12496
+ });
12493
12497
  if (!branchName) {
12494
12498
  const packageId = readXmlAttr(desc, PROJECT_XML_PROTOCOL.packageDescription.attrs.id) || "";
12495
12499
  pkg.setId(packageId);
@@ -14221,8 +14225,9 @@ var ProjectWriter = class {
14221
14225
  return attrs;
14222
14226
  });
14223
14227
  if (publishAtlases.length > 0) publishAttrs.atlas = publishAtlases;
14228
+ const preserveResourceOrder = pkg.getExtras()._preservePackageResourceOrder === true;
14224
14229
  const packageDescriptorPath = fs.join(pkgDir, "package.xml");
14225
- await fs.writeFile(packageDescriptorPath, this._renderPackageDescriptionXml(packageDescriptionAttrs, mainFolders, mainResources, publishAttrs));
14230
+ await fs.writeFile(packageDescriptorPath, this._renderPackageDescriptionXml(packageDescriptionAttrs, mainFolders, mainResources, publishAttrs, preserveResourceOrder));
14226
14231
  currentSourceFilePaths.add(packageDescriptorPath);
14227
14232
  await this._writeResourceFolders(mainFolders, pkgDir, currentResourceFolderPaths);
14228
14233
  for (const comp of mainResources.filter((resource) => resource.propertyType === "Component")) {
@@ -14239,7 +14244,7 @@ var ProjectWriter = class {
14239
14244
  const branchPkgDir = fs.join(basePath, `assets_${branchName}`, pkg.getName());
14240
14245
  await fs.mkdir(branchPkgDir);
14241
14246
  const branchDescriptorPath = fs.join(branchPkgDir, "package_branch.xml");
14242
- await fs.writeFile(branchDescriptorPath, this._renderBranchDescriptionXml(branchFolders, branchResources));
14247
+ await fs.writeFile(branchDescriptorPath, this._renderBranchDescriptionXml(branchFolders, branchResources, preserveResourceOrder));
14243
14248
  currentSourceFilePaths.add(branchDescriptorPath);
14244
14249
  await this._writeResourceFolders(branchFolders, branchPkgDir, currentResourceFolderPaths);
14245
14250
  for (const comp of branchResources.filter((resource) => resource.propertyType === "Component")) {
@@ -14364,14 +14369,14 @@ var ProjectWriter = class {
14364
14369
  if (segments.some((segment) => segment === "." || segment === ".." || segment.includes(":"))) throw new Error(`Invalid project source path "${value}".`);
14365
14370
  return segments.join("/");
14366
14371
  }
14367
- _renderPackageDescriptionXml(packageDescriptionAttrs, folders, resources, publishAttrs) {
14372
+ _renderPackageDescriptionXml(packageDescriptionAttrs, folders, resources, publishAttrs, preserveResourceOrder) {
14368
14373
  const publishNodeAttrs = Object.fromEntries(Object.entries(publishAttrs).filter(([key]) => key !== "atlas"));
14369
14374
  const lines = [
14370
14375
  "<?xml version=\"1.0\" encoding=\"utf-8\"?>",
14371
14376
  `<packageDescription${renderXmlAttrs(packageDescriptionAttrs)}>`,
14372
14377
  " <resources>",
14373
14378
  ...this._renderPackageResourceFolderLines(folders, " "),
14374
- ...this._renderPackageResourceLines(resources, " "),
14379
+ ...this._renderPackageResourceLines(resources, " ", preserveResourceOrder),
14375
14380
  " </resources>",
14376
14381
  ` <publish${renderXmlAttrs(publishNodeAttrs)}>`
14377
14382
  ];
@@ -14381,13 +14386,13 @@ var ProjectWriter = class {
14381
14386
  lines.push("</packageDescription>");
14382
14387
  return `${lines.join("\n")}\n`;
14383
14388
  }
14384
- _renderBranchDescriptionXml(folders, resources) {
14389
+ _renderBranchDescriptionXml(folders, resources, preserveResourceOrder) {
14385
14390
  return `${[
14386
14391
  "<?xml version=\"1.0\" encoding=\"utf-8\"?>",
14387
14392
  "<branchDescription>",
14388
14393
  " <resources>",
14389
14394
  ...this._renderPackageResourceFolderLines(folders, " "),
14390
- ...this._renderPackageResourceLines(resources, " "),
14395
+ ...this._renderPackageResourceLines(resources, " ", preserveResourceOrder),
14391
14396
  " </resources>",
14392
14397
  "</branchDescription>"
14393
14398
  ].join("\n")}\n`;
@@ -14404,17 +14409,15 @@ var ProjectWriter = class {
14404
14409
  return `${indent}<folder${renderXmlAttrs(attrs)}/>`;
14405
14410
  });
14406
14411
  }
14407
- _renderPackageResourceLines(resources, indent) {
14408
- return this._orderedPackageResources(resources).map((resource) => {
14412
+ _renderPackageResourceLines(resources, indent, preserveResourceOrder) {
14413
+ return this._orderedPackageResources(resources, preserveResourceOrder).map((resource) => {
14409
14414
  const serialized = this._serializePackageResourceEntry(resource);
14410
14415
  if (!serialized) return null;
14411
14416
  return `${indent}<${serialized.tagName}${renderXmlAttrs(serialized.attrs)}/>`;
14412
14417
  }).filter((line) => !!line);
14413
14418
  }
14414
- _orderedPackageResources(resources) {
14415
- const original = [...resources].sort((a, b) => {
14416
- return compareResourceIdSequence(a.getId?.() ?? "", b.getId?.() ?? "");
14417
- });
14419
+ _orderedPackageResources(resources, preserveResourceOrder) {
14420
+ const original = preserveResourceOrder ? [...resources] : [...resources].sort((a, b) => compareResourceIdSequence(a.getId?.() ?? "", b.getId?.() ?? ""));
14418
14421
  const syntheticAfter = /* @__PURE__ */ new Map();
14419
14422
  const trailing = [];
14420
14423
  for (const resource of original) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/cli",
3
- "version": "0.2.0-alpha.31",
3
+ "version": "0.2.0-alpha.33",
4
4
  "description": "FairyGUI Headless Authoring SDK — command-line interface.",
5
5
  "author": "OpenFairyGUI Contributors",
6
6
  "license": "MIT",
@@ -33,13 +33,13 @@
33
33
  "restore"
34
34
  ],
35
35
  "devDependencies": {
36
- "@openfairygui/core": "0.2.0-alpha.31",
37
- "@openfairygui/functions": "0.2.0-alpha.31"
36
+ "@openfairygui/functions": "0.2.0-alpha.33",
37
+ "@openfairygui/core": "0.2.0-alpha.33"
38
38
  },
39
39
  "dependencies": {
40
40
  "commander": "^14.0.2",
41
41
  "jiti": "^2.7.0",
42
- "@openfairygui/backend": "0.2.0-alpha.31"
42
+ "@openfairygui/backend": "0.2.0-alpha.33"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "sharp": ">=0.33.0"