@@ -24,12 +24,27 @@ import path from 'path';
2424import { readFileSync } from 'fs' ;
2525import { globSync } from 'glob' ;
2626
27+ /**
28+ * @typedef {Object } PkgInfo
29+ * @property {string } version
30+ * @property {string } name
31+ * @property {string } location
32+ * @property {string } [tag]
33+ */
34+
2735// -- Utility functions --
2836// TODO: move this into a common file
37+ /**
38+ * @param {string } filePath
39+ * @returns {Object }
40+ */
2941const readJson = ( filePath ) => {
3042 return JSON . parse ( readFileSync ( filePath ) ) ;
3143} ;
3244
45+ /**
46+ * @returns {PkgInfo[] }
47+ */
3348const getPackages = ( ) => {
3449 const TOP = process . cwd ( ) ;
3550 const pj = readJson ( path . join ( TOP , 'package.json' ) ) ;
@@ -43,6 +58,11 @@ const getPackages = () => {
4358 } ) ;
4459}
4560
61+ /**
62+ * @param {PkgInfo } pkgInfo
63+ * @param {string } commitOrTag
64+ * @returns
65+ */
4666const getPkgCommitsFrom = ( pkgInfo , commitOrTag ) => {
4767 const command = `git log ${ commitOrTag } ..HEAD --oneline ${ pkgInfo . location } ` ;
4868 const commits = execSync ( command , { encoding : 'utf-8' } ) . split ( '\n' ) ;
@@ -51,8 +71,7 @@ const getPkgCommitsFrom = (pkgInfo, commitOrTag) => {
5171}
5272
5373/**
54- *
55- * @param {Record<string, any> } pkgInfo
74+ * @param {PkgInfo } pkgInfo
5675 * @param {string[] } commits
5776 * @returns {'major' | 'minor' | 'patch' }
5877 */
@@ -107,15 +126,6 @@ repoTags.forEach((tag) => {
107126// Check for commits on each package
108127// Assumption: current version is latest on npm (so no checking it)
109128publicPkgList . forEach ( ( pkgInfo ) => {
110- const pkgScope = pkgInfo . name . replace ( '@opentelemetry/' , '' ) ;
111-
112- // if (pkgInfo.tag) {
113- // console.log(`**** commits for ${pkgScope} from ${pkgInfo.tag} ****`)
114- // const scopedCommits = getPkgCommitsFrom(pkgInfo, pkgInfo.tag);
115- // console.log('bump type', getBumpType(pkgInfo, scopedCommits))
116- // }
117- // return
118-
119129 if ( pkgInfo . tag ) {
120130 const scopedCommits = getPkgCommitsFrom ( pkgInfo , pkgInfo . tag ) ;
121131
0 commit comments