Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Jan 13, 2023
1 parent 8a6ae28 commit fdd3da6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/common/utils/async-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const promiseFromChildProcess = (child, callback, logger, extraOptions) => {
}
/**
*
* @param {[cmd: string, args: string[]]} arg
* @param {string} arg
* @param {Record<string, any>} options
* @param {null | ((child: import("child_process").ChildProcessWithoutNullStreams) => void)} callback
* @param {Kontinuous.PatchContext["logger"]} logger
Expand Down
11 changes: 11 additions & 0 deletions packages/common/utils/degit-tag-has-changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const asyncShell = require("./async-shell")

const normalizeRepositoryUrl = require("./normalize-repository-url")

/** @type {Record<string, string>} */
const supported = {
github: ".com",
gitlab: ".com",
Expand All @@ -14,6 +15,11 @@ const supported = {
"git.sr.ht": ".ht",
}

/**
*
* @param {string} src
* @returns {{site:string, user:string, name:string, ref:string, url:string, ssh:string, subdir:string, mode:string}}
*/
function parse(src) {
const match =
/^(?:(?:https:\/\/)?([^:/]+\.[^:/]+)\/|git@([^:/]+)[:/]|([^/]+):)?([^/\s]+)\/([^/\s#]+)(?:((?:\/[^/\s#]+)+))?(?:\/)?(?:#(.+))?/.exec(
Expand Down Expand Up @@ -45,6 +51,11 @@ function parse(src) {
return { site: siteName, user, name, ref, url, ssh, subdir, mode }
}

/**
*
* @param {string} target
* @returns boolean
*/
module.exports = async (target) => {
const base = path.join(os.homedir(), ".degit")
const repo = parse(target)
Expand Down
5 changes: 5 additions & 0 deletions packages/common/utils/parse-command.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
*
* @param {string|string[]} arg
* @returns {[cmd: string, args:string[]]}
*/
module.exports = (arg) => {
if (typeof arg === "string") {
arg = arg
Expand Down

0 comments on commit fdd3da6

Please sign in to comment.