fix: imports

This commit is contained in:
Botond
2022-08-26 19:38:15 +02:00
parent ed8b053d7b
commit 91cdd434b6
6 changed files with 30 additions and 18 deletions
+3 -2
View File
@@ -107,8 +107,9 @@ const run = async ({
if (unstagedFiles.length) {
launchGitWorkflow({
apiVersion,
apiCommitHash,
branchName: TYPE_UPDATE_BRANCH,
frontendRepoOwner,
frontendRepoName,
commitMessage: `update types for v${apiVersion} on HEAD:${apiCommitHash}`,
});
+6 -3
View File
@@ -1,10 +1,10 @@
const fs = require('node:fs');
const path = require('node:path');
const { execSync } = require('node:child_process');
const execWrap = require('./utils/exec-wrap');
const githubRequest = require('./utils/github-request');
const wrapCli = require('./utils/wrap-cli');
const launchGitWorkflow = require('./utils/git-workflow');
const launchGithubWorkflow = require('./utils/github-workflow');
const NETWORK_UPDATE_BRANCH = 'fix/networks';
@@ -119,10 +119,13 @@ const run = async ({
.split('\n')
.filter((file) => file !== '');
console.log(frontendRepoOwner, frontendRepoName)
if (unstagedFiles.length) {
launchGitWorkflow({
apiVersion,
apiCommitHash,
branchName: NETWORK_UPDATE_BRANCH,
frontendRepoOwner,
frontendRepoName,
commitMessage: `update networks based on ${networkRepoOwner}/${networkRepoName} HEAD:${networkCommitHash}`,
});
+14 -11
View File
@@ -1,11 +1,14 @@
const execWrap = require('./exec-wrap');
module.exports = ({
branchName,
commitMessage,
frontendRepoOwner,
frontendRepoName,
}) => {
const remoteBranches = execWrap({
cmd: `git ls-remote --heads ssh://github.com/${frontendRepoOwner}/${frontendRepoName}.git ${TYPE_UPDATE_BRANCH}`,
errMessage: `Error checking if the branch "${TYPE_UPDATE_BRANCH}" exists on the origin.`,
cmd: `git ls-remote --heads ssh://github.com/${frontendRepoOwner}/${frontendRepoName}.git ${branchName}`,
errMessage: `Error checking if the branch "${branchName}" exists on the origin.`,
});
const localBranches = execWrap({
cmd: 'git branch',
@@ -13,24 +16,24 @@ module.exports = ({
});
if (
remoteBranches.includes(TYPE_UPDATE_BRANCH) ||
localBranches.includes(TYPE_UPDATE_BRANCH)
remoteBranches.includes(branchName) ||
localBranches.includes(branchName)
) {
const currentBranchName = execWrap({
cmd: `git branch --show-current`,
errMessage: `Error getting current branch name.`,
});
if (currentBranchName !== TYPE_UPDATE_BRANCH) {
if (currentBranchName !== branchName) {
execWrap({
cmd: `git checkout ${TYPE_UPDATE_BRANCH}`,
errMessage: `There was an error trying to check out the branch "${TYPE_UPDATE_BRANCH}".`,
cmd: `git checkout ${branchName}`,
errMessage: `There was an error trying to check out the branch "${branchName}".`,
});
}
} else {
execWrap({
cmd: `git checkout -b ${TYPE_UPDATE_BRANCH}`,
errMessage: `There was an error trying to check out the branch "${TYPE_UPDATE_BRANCH}".`,
cmd: `git checkout -b ${branchName}`,
errMessage: `There was an error trying to check out the branch "${branchName}".`,
});
}
@@ -41,11 +44,11 @@ module.exports = ({
execWrap({
cmd: `git commit -m 'chore: ${commitMessage}' --no-verify`,
errMessage: `Error checking if the branch "${TYPE_UPDATE_BRANCH}" exists on the origin.`,
errMessage: `Error checking if the branch "${branchName}" exists on the origin.`,
});
execWrap({
cmd: `git push -u ssh://github.com/${frontendRepoOwner}/${frontendRepoName}.git ${TYPE_UPDATE_BRANCH} --no-verify`,
cmd: `git push -u ssh://github.com/${frontendRepoOwner}/${frontendRepoName}.git ${branchName} --no-verify`,
errMessage: 'Error pushing changes.',
});
};
+2 -1
View File
@@ -1,6 +1,7 @@
const https = require('node:https');
const request = require('./request');
module.exports = async (url, { body }) => {
module.exports = async (url, { githubAuthToken, body }) => {
const options = {
method: 'POST',
headers: {
+4
View File
@@ -1,3 +1,5 @@
const githubRequest = require('./github-request');
module.exports = async ({
issueBody,
prBody,
@@ -8,6 +10,7 @@ module.exports = async ({
const { number, html_url: issueHtmlUrl } = await githubRequest(
`https://api.github.com/repos/${frontendRepoOwner}/${frontendRepoName}/issues`,
{
githubAuthToken,
body: JSON.stringify(issueBody),
}
);
@@ -17,6 +20,7 @@ module.exports = async ({
const { html_url: prHtmlUrl } = await githubRequest(
`https://api.github.com/repos/${frontendRepoOwner}/${frontendRepoName}/pulls`,
{
githubAuthToken,
body: JSON.stringify({
base: prBody.base || 'master',
title: `fix/${number}: ${prBody.title}`,
+1 -1
View File
@@ -16,7 +16,7 @@ module.exports = ({ specs, args = [] }) => {
}
return {
...acc,
[spec.name]: value,
[spec.name]: value || spec.default,
};
}, {});
};