ic-mops 0.29.0-0 → 0.29.0-1

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.
@@ -27,7 +27,7 @@ export async function update(pkg?: string) {
27
27
  let dev = !!config['dev-dependencies']?.[dep.name];
28
28
  let commit = await getGithubCommit(`${org}/${gitName}`, branch);
29
29
  if (commit.sha !== commitHash) {
30
- await add(`https://github.com/${org}/${gitName}#${branch}@${commitHash}`, {dev});
30
+ await add(`https://github.com/${org}/${gitName}#${branch}@${commit.sha}`, {dev});
31
31
  }
32
32
  }
33
33
 
@@ -23,7 +23,7 @@ export async function update(pkg) {
23
23
  let dev = !!config['dev-dependencies']?.[dep.name];
24
24
  let commit = await getGithubCommit(`${org}/${gitName}`, branch);
25
25
  if (commit.sha !== commitHash) {
26
- await add(`https://github.com/${org}/${gitName}#${branch}@${commitHash}`, { dev });
26
+ await add(`https://github.com/${org}/${gitName}#${branch}@${commit.sha}`, { dev });
27
27
  }
28
28
  }
29
29
  // update mops packages
package/dist/mops.js CHANGED
@@ -193,6 +193,11 @@ export function parseGithubURL(href) {
193
193
  export async function getGithubCommit(repo, ref) {
194
194
  let res = await fetch(`https://api.github.com/repos/${repo}/commits/${ref}`);
195
195
  let json = await res.json();
196
+ // try on main branch
197
+ if (json.message && ref === 'master') {
198
+ res = await fetch(`https://api.github.com/repos/${repo}/commits/main`);
199
+ json = await res.json();
200
+ }
196
201
  return json;
197
202
  }
198
203
  export function getDependencyType(version) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.29.0-0",
3
+ "version": "0.29.0-1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
package/mops.ts CHANGED
@@ -225,7 +225,13 @@ export function parseGithubURL(href: string) {
225
225
 
226
226
  export async function getGithubCommit(repo: string, ref: string): Promise<any> {
227
227
  let res = await fetch(`https://api.github.com/repos/${repo}/commits/${ref}`);
228
- let json = await res.json();
228
+ let json: any = await res.json();
229
+
230
+ // try on main branch
231
+ if (json.message && ref === 'master') {
232
+ res = await fetch(`https://api.github.com/repos/${repo}/commits/main`);
233
+ json = await res.json();
234
+ }
229
235
  return json;
230
236
  }
231
237
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.29.0-0",
3
+ "version": "0.29.0-1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"