@edifice.io/cli 1.6.0-develop-b2school.9 → 1.6.0-develop-b2school.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/cli",
3
- "version": "1.6.0-develop-b2school.9",
3
+ "version": "1.6.0-develop-b2school.10",
4
4
  "description": "Edifice Frontend CLI",
5
5
  "keywords": [
6
6
  "frontend",
@@ -38,6 +38,7 @@ export const publish = async (options) => {
38
38
  /** @type {string[]} */
39
39
  const allTags = execSync("git tag").toString().split("\n");
40
40
 
41
+ // TODO: Keep this code for now, but it's not used
41
42
  const filteredTags = allTags
42
43
  // Ensure tag is valid
43
44
  .filter((t) => semver.valid(t))
@@ -56,8 +57,32 @@ export const publish = async (options) => {
56
57
  // @ts-ignore
57
58
  .sort(semver.compare);
58
59
 
60
+ /* const filteredTags = allTags
61
+ // Ensure tag is valid
62
+ .filter((t) => semver.valid(t))
63
+ // Filter tags based on whether the branch is a release or pre-release
64
+ .filter((t) => {
65
+ const isPrereleaseTag = semver.prerelease(t) !== null;
66
+ return branchConfig.prerelease ? isPrereleaseTag : !isPrereleaseTag;
67
+ })
68
+ // sort by latest
69
+ // @ts-ignore
70
+ .sort(semver.compare); */
71
+
59
72
  // Get the latest tag
60
73
  let latestTag = filteredTags.at(-1);
74
+
75
+ // TODO: Keep this code for now, but it's not used
76
+ /* if (branchConfig.prerelease) {
77
+ const mainTags = execSync("git tag --merged main").toString().split("\n");
78
+ const validMainTags = mainTags
79
+ .filter((t) => semver.valid(t))
80
+ .sort((a, b) => semver.compare(a, b));
81
+
82
+ latestTag = validMainTags.at(-1) || latestTag; // Use the latest tag from main if available
83
+ } */
84
+
85
+ // console.log({ filteredTags: filteredTags.reverse() });
61
86
  let rangeFrom = latestTag;
62
87
 
63
88
  // If RELEASE_ALL is set via a commit subject or body, all packages will be
@@ -112,10 +137,10 @@ export const publish = async (options) => {
112
137
  return !exclude;
113
138
  });
114
139
 
115
- // /**
116
- // * Get the commits since the latest tag
117
- // * @type {import('./index.js').Commit[]}
118
- // */
140
+ /**
141
+ * Get the commits since the latest tag
142
+ * @type {import('./index.js').Commit[]}
143
+ */
119
144
  const commitsSinceLatestTag = await Promise.all(
120
145
  rawCommitsLog.map(async (c) => {
121
146
  const parsed = await parseCommit(c.message);
@@ -167,13 +192,6 @@ export const publish = async (options) => {
167
192
  -1,
168
193
  );
169
194
 
170
- // If there is a breaking change and no manual tag is set, do not release
171
- /* if (recommendedReleaseLevel === 2 && !tag) {
172
- throw new Error(
173
- 'Major versions releases must be tagged and released manually.'
174
- );
175
- } */
176
-
177
195
  // If no release is semantically necessary and no manual tag is set, do not release
178
196
  if (recommendedReleaseLevel === -1 && !tag) {
179
197
  console.info(
@@ -232,6 +250,8 @@ export const publish = async (options) => {
232
250
  const changed = changedFiles.some(
233
251
  (file) =>
234
252
  file.startsWith(path.join(pkg.packageDir, "src")) ||
253
+ // check if any files in the assets directory were modified
254
+ file.startsWith(path.join(pkg.packageDir, "assets")) ||
235
255
  file.startsWith(path.join(pkg.packageDir, "package.json")),
236
256
  );
237
257
  return changed;
@@ -396,25 +416,33 @@ export const publish = async (options) => {
396
416
  }
397
417
 
398
418
  console.info();
399
- console.info("Committing changes...");
400
- execSync(
419
+ console.info("Resetting changes...");
420
+ /* execSync(
401
421
  `git add -A && git reset -- ${changedPackages
402
422
  .map((pkg) => path.resolve(rootDir, pkg.packageDir, "package.json"))
403
423
  .join(" ")}`,
424
+ ); */
425
+ execSync(
426
+ `git reset -- ${changedPackages
427
+ .map((pkg) => path.resolve(rootDir, pkg.packageDir, "package.json"))
428
+ .join(" ")}`,
404
429
  );
405
430
  execSync(
406
431
  `git checkout -- ${changedPackages
407
432
  .map((pkg) => path.resolve(rootDir, pkg.packageDir, "package.json"))
408
433
  .join(" ")}`,
409
434
  );
410
- execSync(`git commit -m "${releaseCommitMsg(version)}" --allow-empty -n`);
411
- console.info(" Committed Changes.");
435
+ // execSync(`git commit -m "${releaseCommitMsg(version)}" --allow-empty -n`);
436
+ console.info(" Reset changes.");
412
437
 
413
- console.info();
438
+ /* console.info();
414
439
  console.info("Pushing changes...");
415
440
  execSync(`git push origin ${currentGitBranch()}`);
416
- console.info(" Changes pushed.");
441
+ console.info(" Changes pushed."); */
417
442
 
443
+ /**
444
+ * We tag the latest commit as we want to keep the history clean without any release commits
445
+ */
418
446
  console.info();
419
447
  console.info(`Creating new git tag v${version}`);
420
448
  execSync(`git tag -a -m "v${version}" v${version}`);