-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,173 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const fs = require("fs") | ||
const path = require("path") | ||
const camelcase = require("lodash.camelcase") | ||
const ucfirst = require("./ucfirst") | ||
|
||
/** | ||
* | ||
* @param {string} dir | ||
* @param {{filter?: null | ((s: string) => boolean)}} param1 | ||
* @returns Record<string, any> | ||
*/ | ||
module.exports = (dir, { filter = null } = {}) => { | ||
let files = fs.readdirSync(dir) | ||
if (filter) { | ||
files = files.filter(filter) | ||
} | ||
return files.reduce( | ||
/** @param {Record<string, any>} acc */ | ||
(acc, file) => { | ||
const { name } = path.parse(file) | ||
let key = camelcase(name) | ||
if (key.endsWith("Class")) { | ||
key = ucfirst(key.slice(0, -5)) | ||
} | ||
acc[key] = require(`${dir}/${file}`) | ||
return acc | ||
}, | ||
{} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// import JSDoc definitions | ||
type Slug = typeof import("./slug"); | ||
type KindIsRunnable = typeof import("./kind-is-runnable"); | ||
type AsyncShell = typeof import("./async-shell"); | ||
type IsVersionTag = typeof import("./is-version-tag"); | ||
type SanitizeLabel = typeof import("./sanitize-label"); | ||
type IgnoreYarnState = typeof import("./ignore-yarn-state"); | ||
type PatternMatch = typeof import("./pattern-match"); | ||
type KubectlRetry = typeof import("./kubectl-retry"); | ||
|
||
// TODO : fetch from ./*.js | ||
// for some reason the description from source JSDoc isnt displayed | ||
interface Utils { | ||
/** execute some async shell command */ | ||
asyncShell: AsyncShell; | ||
/** Return slugified, hostname-friendly string */ | ||
slug: Slug; | ||
/** Check if some branch is valid semantic-release tag: vx.y.z */ | ||
isVersionTag: IsVersionTag; | ||
/** exclude non-alphanums chars */ | ||
sanitizeLabel: SanitizeLabel; | ||
//@ts-ignore | ||
yaml; | ||
//@ts-ignore | ||
logger; | ||
//@ts-ignore | ||
KontinuousPluginError; | ||
//@ts-ignore | ||
patternMatch: PatternMatch; | ||
// check if the manifest is "runnable" in kubernetes | ||
// act as a typeguard | ||
kindIsRunnable: KindIsRunnable; | ||
/** Run kubectl with exponential backoff */ | ||
kubectlRetry: KubectlRetry; | ||
//@ts-ignore | ||
needKubectl; | ||
/** check if some path should be ignored */ | ||
ignoreYarnState: IgnoreYarnState; | ||
} | ||
|
||
export { Utils }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const kindsRunnable = require("./kinds-runnable") | ||
Check failure on line 1 in packages/common/utils/kind-is-runnable.js GitHub Actions / Lint
Check failure on line 1 in packages/common/utils/kind-is-runnable.js GitHub Actions / Lint
|
||
|
||
/** | ||
* | ||
* @param {Kontinuous.Manifest} manifest | ||
* @returns {manifest is Kontinuous.RunnableManifest} | ||
*/ | ||
module.exports = (manifest) => kindsRunnable.includes(manifest.kind) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.