@travetto/repo 4.0.2 → 4.0.4

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": "@travetto/repo",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "Monorepo utilities",
5
5
  "keywords": [
6
6
  "travetto",
@@ -22,8 +22,8 @@
22
22
  "directory": "module/repo"
23
23
  },
24
24
  "dependencies": {
25
- "@travetto/cli": "^4.0.2",
26
- "@travetto/worker": "^4.0.1"
25
+ "@travetto/cli": "^4.0.4",
26
+ "@travetto/worker": "^4.0.2"
27
27
  },
28
28
  "peerDependenciesMeta": {
29
29
  "@travetto/cli": {
@@ -8,6 +8,8 @@ import { CliModuleUtil } from '@travetto/cli';
8
8
 
9
9
  export type SemverLevel = 'minor' | 'patch' | 'major' | 'prerelease' | 'premajor' | 'preminor' | 'prepatch';
10
10
 
11
+ type Ctx = Omit<ManifestContext, 'build'>;
12
+
11
13
  /**
12
14
  * Utilities for working with package managers
13
15
  */
@@ -16,7 +18,7 @@ export class PackageManager {
16
18
  /**
17
19
  * Is a module already published
18
20
  */
19
- static isPublished(ctx: ManifestContext, mod: IndexedModule): ChildProcess {
21
+ static isPublished(ctx: Ctx, mod: IndexedModule): ChildProcess {
20
22
  let args: string[];
21
23
  switch (ctx.workspace.manager) {
22
24
  case 'npm':
@@ -32,7 +34,7 @@ export class PackageManager {
32
34
  /**
33
35
  * Validate published result
34
36
  */
35
- static validatePublishedResult(ctx: ManifestContext, mod: IndexedModule, result: ExecutionResult): boolean {
37
+ static validatePublishedResult(ctx: Ctx, mod: IndexedModule, result: ExecutionResult): boolean {
36
38
  switch (ctx.workspace.manager) {
37
39
  case 'npm': {
38
40
  if (!result.valid && !result.stderr.includes('E404')) {
@@ -52,7 +54,7 @@ export class PackageManager {
52
54
  /**
53
55
  * Setting the version
54
56
  */
55
- static async version(ctx: ManifestContext, modules: IndexedModule[], level: SemverLevel, preid?: string): Promise<void> {
57
+ static async version(ctx: Ctx, modules: IndexedModule[], level: SemverLevel, preid?: string): Promise<void> {
56
58
  const mods = modules.flatMap(m => ['-w', m.sourceFolder]);
57
59
  let args: string[];
58
60
  switch (ctx.workspace.manager) {
@@ -67,7 +69,7 @@ export class PackageManager {
67
69
  /**
68
70
  * Dry-run packaging
69
71
  */
70
- static dryRunPackaging(ctx: ManifestContext, mod: IndexedModule): ChildProcess {
72
+ static dryRunPackaging(ctx: Ctx, mod: IndexedModule): ChildProcess {
71
73
  let args: string[];
72
74
  switch (ctx.workspace.manager) {
73
75
  case 'npm':
@@ -81,7 +83,7 @@ export class PackageManager {
81
83
  /**
82
84
  * Publish a module
83
85
  */
84
- static publish(ctx: ManifestContext, mod: IndexedModule, dryRun: boolean | undefined): ChildProcess {
86
+ static publish(ctx: Ctx, mod: IndexedModule, dryRun: boolean | undefined): ChildProcess {
85
87
  if (dryRun) {
86
88
  return this.dryRunPackaging(ctx, mod);
87
89
  }
@@ -23,6 +23,8 @@ export class RepoVersionCommand implements CliCommandShape {
23
23
  * @alias m
24
24
  */
25
25
  modules?: string[];
26
+ /** Should we create a tag for the version */
27
+ tag?: boolean;
26
28
 
27
29
  async validate(): Promise<CliValidationError | undefined> {
28
30
  if (!this.force && await CliScmUtil.isWorkspaceDirty()) {
@@ -33,6 +35,8 @@ export class RepoVersionCommand implements CliCommandShape {
33
35
  async main(level: SemverLevel, prefix?: string): Promise<void> {
34
36
  const mode = this.mode ?? CHANGE_LEVELS.has(level) ? 'changed' : 'all';
35
37
 
38
+ this.tag ??= (level === 'minor' || level === 'major');
39
+
36
40
  const allModules = await CliModuleUtil.findModules(mode === 'changed' ? 'changed' : 'all');
37
41
 
38
42
  const modules = allModules.filter(x => !x.internal && (this.mode !== 'direct' || this.modules?.includes(x.name)));
@@ -48,6 +52,10 @@ export class RepoVersionCommand implements CliCommandShape {
48
52
  if (this.commit) {
49
53
  const commitMessage = `Publish ${modules.map(x => `${x.name}#${versions[x.name]?.replace('^', '') ?? x.version}`).join(',')}`;
50
54
  console.log!(await CliScmUtil.createCommit(commitMessage));
55
+ if (this.tag) {
56
+ await CliScmUtil.createTag(versions['@travetto/manifest']);
57
+ }
58
+
51
59
  // Touch package when done to trigger restart of compiler
52
60
  await fs.utimes(RuntimeContext.workspaceRelative('package.json'), Date.now(), Date.now());
53
61
  }