feat: add ci-log package

This commit is contained in:
Amin Yahyaabadi 2022-08-08 01:22:28 -07:00
parent 547d9b47ce
commit 79eae5db23
34 changed files with 147 additions and 30 deletions

File diff suppressed because one or more lines are too long

1
dist/actions_python.c201471c.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
dist/actions_python.f71abc63.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/setup_cpp.mjs vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -56,6 +56,7 @@
"@actions/io": "^1.1.2", "@actions/io": "^1.1.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d", "@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d",
"ci-log": "workspace:*",
"escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3", "escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3",
"exec-powershell": "workspace:*", "exec-powershell": "workspace:*",
"execa": "^5.1.1", "execa": "^5.1.1",

70
packages/ci-log/README.md Normal file
View File

@ -0,0 +1,70 @@
<h1 align="center">ci-log</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
<a href="#" target="_blank">
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
</a>
</p>
> Colorful logging and print for any environment including GitHub Actions
## Install
```sh
npm install --save ci-log
```
## Usage
<!-- INSERT GENERATED DOCS START -->
### `error` (function)
**Parameters:**
- err (`string | Error`)
**returns:** void
### `success` (function)
**Parameters:**
- msg (`string`)
**returns:** void
### `warning` (function)
**Parameters:**
- msg (`string`)
**returns:** void
### `notice` (function)
**Parameters:**
- msg (`string`)
**returns:** void
### `info` (function)
**Parameters:**
- msg (`string`)
**returns:** void
<!-- INSERT GENERATED DOCS END -->
## 🤝 Contributing
You can sponsor my work here:
https://github.com/sponsors/aminya
Pull requests, issues and feature requests are welcome.
See the [Contributing guide](https://github.com/aminya/setup-cpp/blob/master/CONTRIBUTING.md).

View File

@ -0,0 +1,29 @@
{
"name": "ci-log",
"version": "1.0.0",
"description": "Colorful logging and print for any environment including GitHub Actions",
"homepage": "https://github.com/aminya/setup-cpp",
"license": "Apache-2.0",
"author": "Amin Yahyaabadi",
"main": "./dist/index.js",
"source": "./src/index.ts",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@actions/core": "^1.9.0",
"@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d"
},
"keywords": [
"log",
"print",
"GitHub",
"actions",
"Gitlab",
"CI",
"color",
"console",
"info",
"notifications"
]
}

View File

@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["./src"]
}

View File

@ -24,6 +24,7 @@ importers:
'@types/semver': ^7.3.10 '@types/semver': ^7.3.10
'@types/which': ^2.0.1 '@types/which': ^2.0.1
caxa: ^2.1.0 caxa: ^2.1.0
ci-log: workspace:*
cross-env: 7.0.3 cross-env: 7.0.3
cross-spawn: ^7.0.3 cross-spawn: ^7.0.3
cspell: ^6.5.0 cspell: ^6.5.0
@ -65,11 +66,12 @@ importers:
'@actions/io': 1.1.2 '@actions/io': 1.1.2
'@actions/tool-cache': 2.0.1 '@actions/tool-cache': 2.0.1
'@npmcli/ci-detect': github.com/aminya/ci-detect/37fe40075bebec96794ba0a7c4a6d5c70cbea00d '@npmcli/ci-detect': github.com/aminya/ci-detect/37fe40075bebec96794ba0a7c4a6d5c70cbea00d
ci-log: link:packages/ci-log
escape-path-with-spaces: github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3 escape-path-with-spaces: github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3
exec-powershell: link:packages/exec-powershell exec-powershell: link:packages/exec-powershell
execa: 5.1.1 execa: 5.1.1
extension-tools: link:packages/extension-tools extension-tools: link:packages/extension-tools
get-works: link:packages/ok-status get-works: link:packages/get-works
mri: 1.2.0 mri: 1.2.0
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1 msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
numerous: 1.0.3 numerous: 1.0.3
@ -109,6 +111,14 @@ importers:
ts-readme: 1.1.3_typescript@4.7.4 ts-readme: 1.1.3_typescript@4.7.4
typescript: 4.7.4 typescript: 4.7.4
packages/ci-log:
specifiers:
'@actions/core': ^1.9.0
'@npmcli/ci-detect': github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d
dependencies:
'@actions/core': 1.9.0
'@npmcli/ci-detect': github.com/aminya/ci-detect/37fe40075bebec96794ba0a7c4a6d5c70cbea00d
packages/exec-powershell: packages/exec-powershell:
specifiers: specifiers:
'@types/which': ^2.0.1 '@types/which': ^2.0.1
@ -123,7 +133,7 @@ importers:
packages/extension-tools: packages/extension-tools:
specifiers: {} specifiers: {}
packages/ok-status: packages/get-works:
specifiers: specifiers:
root-tools: workspace:* root-tools: workspace:*
dependencies: dependencies:

View File

@ -6,7 +6,7 @@ import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { addBinExtension } from "extension-tools" import { addBinExtension } from "extension-tools"
import { extractTar, extractZip } from "../utils/setup/extract" import { extractTar, extractZip } from "../utils/setup/extract"
import { notice } from "../utils/io/io" import { notice } from "ci-log"
import { setupGraphviz } from "../graphviz/graphviz" import { setupGraphviz } from "../graphviz/graphviz"
import { getVersion } from "../default_versions" import { getVersion } from "../default_versions"
import { existsSync } from "fs" import { existsSync } from "fs"

View File

@ -8,7 +8,7 @@ import semverMajor from "semver/functions/major"
import semverCoerce from "semver/functions/coerce" import semverCoerce from "semver/functions/coerce"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk" import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import path from "path" import path from "path"
import { warning, info } from "../utils/io/io" import { warning, info } from "ci-log"
import ciDetect from "@npmcli/ci-detect" import ciDetect from "@npmcli/ci-detect"
import { addBinExtension } from "extension-tools" import { addBinExtension } from "extension-tools"
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin" import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"

View File

@ -13,7 +13,7 @@ import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu" import { isUbuntu } from "../utils/env/isUbuntu"
import { addVPrefix, removeVPrefix } from "../utils/setup/version" import { addVPrefix, removeVPrefix } from "../utils/setup/version"
import { info } from "../utils/io/io" import { info } from "ci-log"
import { untildifyUser } from "untildify-user" import { untildifyUser } from "untildify-user"
import { setupNinja } from "../ninja/ninja" import { setupNinja } from "../ninja/ninja"

View File

@ -15,7 +15,7 @@ import { addBinExtension } from "extension-tools"
import { addEnv } from "../utils/env/addEnv" import { addEnv } from "../utils/env/addEnv"
import { setOutput } from "@actions/core" import { setOutput } from "@actions/core"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack" import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
import { info, warning } from "../utils/io/io" import { info, warning } from "ci-log"
import { existsSync } from "fs" import { existsSync } from "fs"
import ciDetect from "@npmcli/ci-detect" import ciDetect from "@npmcli/ci-detect"
import { setupGcc } from "../gcc/gcc" import { setupGcc } from "../gcc/gcc"

View File

@ -1,6 +1,6 @@
import { getExecOutput } from "@actions/exec" import { getExecOutput } from "@actions/exec"
import { addEnv } from "../utils/env/addEnv" import { addEnv } from "../utils/env/addEnv"
import { error } from "../utils/io/io" import { error } from "ci-log"
export async function setupMacOSSDK() { export async function setupMacOSSDK() {
if (process.platform === "darwin") { if (process.platform === "darwin") {

View File

@ -34,7 +34,7 @@ import semverValid from "semver/functions/valid"
import { getVersion, syncVersions } from "./default_versions" import { getVersion, syncVersions } from "./default_versions"
import { setupGcc } from "./gcc/gcc" import { setupGcc } from "./gcc/gcc"
import { InstallationInfo } from "./utils/setup/setupBin" import { InstallationInfo } from "./utils/setup/setupBin"
import { error, info, success, warning } from "./utils/io/io" import { error, info, success, warning } from "ci-log"
import { setupVcpkg } from "./vcpkg/vcpkg" import { setupVcpkg } from "./vcpkg/vcpkg"
import { join } from "path" import { join } from "path"
import { setupVCVarsall } from "./vcvarsall/vcvarsall" import { setupVCVarsall } from "./vcvarsall/vcvarsall"

View File

@ -6,7 +6,7 @@ import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
import ciDetect from "@npmcli/ci-detect" import ciDetect from "@npmcli/ci-detect"
import path from "path" import path from "path"
import { existsSync } from "fs" import { existsSync } from "fs"
import { error, info, warning } from "../utils/io/io" import { error, info, warning } from "ci-log"
type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string

View File

@ -3,7 +3,7 @@ import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-help
import { getVersion } from "../../default_versions" import { getVersion } from "../../default_versions"
import { ubuntuVersion } from "../../utils/env/ubuntu_version" import { ubuntuVersion } from "../../utils/env/ubuntu_version"
import ciDetect from "@npmcli/ci-detect" import ciDetect from "@npmcli/ci-detect"
import { info } from "../../utils/io/io" import { info } from "ci-log"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-python", () => { describe("setup-python", () => {

View File

@ -1,7 +1,7 @@
import { useCpythonVersion } from "setup-python/src/find-python" import { useCpythonVersion } from "setup-python/src/find-python"
import { findPyPyVersion } from "setup-python/src/find-pypy" import { findPyPyVersion } from "setup-python/src/find-pypy"
import { existsSync } from "fs" import { existsSync } from "fs"
import { info, warning } from "../utils/io/io" import { info, warning } from "ci-log"
import { debug } from "@actions/core" import { debug } from "@actions/core"
import path from "path" import path from "path"
import ciDetect from "@npmcli/ci-detect" import ciDetect from "@npmcli/ci-detect"

View File

@ -4,7 +4,7 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import ciDetect from "@npmcli/ci-detect" import ciDetect from "@npmcli/ci-detect"
import { warning, info } from "../utils/io/io" import { warning, info } from "ci-log"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import which from "which" import which from "which"
import { InstallationInfo } from "../utils/setup/setupBin" import { InstallationInfo } from "../utils/setup/setupBin"

View File

@ -2,7 +2,7 @@ import { exportVariable, addPath as ghAddPath, info, setFailed } from "@actions/
import ciDetect from "@npmcli/ci-detect" import ciDetect from "@npmcli/ci-detect"
import { untildifyUser } from "untildify-user" import { untildifyUser } from "untildify-user"
import { appendFileSync, existsSync, readFileSync } from "fs" import { appendFileSync, existsSync, readFileSync } from "fs"
import { error, warning } from "../io/io" import { error, warning } from "ci-log"
import { execPowershell } from "exec-powershell" import { execPowershell } from "exec-powershell"
import { delimiter } from "path" import { delimiter } from "path"
import escapeSpace from "escape-path-with-spaces" import escapeSpace from "escape-path-with-spaces"

View File

@ -2,7 +2,7 @@ import execa from "execa"
import { mkdirP } from "@actions/io" import { mkdirP } from "@actions/io"
import which from "which" import which from "which"
import { setupSevenZip } from "../../sevenzip/sevenzip" import { setupSevenZip } from "../../sevenzip/sevenzip"
import { warning } from "../io/io" import { warning } from "ci-log"
import { giveUserAccess } from "user-access" import { giveUserAccess } from "user-access"
export { extractTar, extractXar } from "@actions/tool-cache" export { extractTar, extractXar } from "@actions/tool-cache"

View File

@ -5,7 +5,7 @@ import { setupChocolatey } from "../../chocolatey/chocolatey"
import { InstallationInfo } from "./setupBin" import { InstallationInfo } from "./setupBin"
import execa from "execa" import execa from "execa"
import { info } from "@actions/core" import { info } from "@actions/core"
import { notice } from "../io/io" import { notice } from "ci-log"
let hasChoco = false let hasChoco = false

View File

@ -1,7 +1,7 @@
/* eslint-disable require-atomic-updates */ /* eslint-disable require-atomic-updates */
import { InstallationInfo } from "./setupBin" import { InstallationInfo } from "./setupBin"
import { execRootSync } from "root-tools" import { execRootSync } from "root-tools"
import { info, warning } from "../io/io" import { info, warning } from "ci-log"
// let didUpdate: boolean = false // let didUpdate: boolean = false

View File

@ -1,7 +1,7 @@
/* eslint-disable require-atomic-updates */ /* eslint-disable require-atomic-updates */
import { InstallationInfo } from "./setupBin" import { InstallationInfo } from "./setupBin"
import { execRootSync } from "root-tools" import { execRootSync } from "root-tools"
import { info } from "../io/io" import { info } from "ci-log"
let didUpdate: boolean = false let didUpdate: boolean = false
let didInit: boolean = false let didInit: boolean = false

View File

@ -3,7 +3,7 @@ import semverCompare from "semver/functions/compare"
import semverCoerce from "semver/functions/coerce" import semverCoerce from "semver/functions/coerce"
import semverValid from "semver/functions/valid" import semverValid from "semver/functions/valid"
import { getExecOutput } from "@actions/exec" import { getExecOutput } from "@actions/exec"
import { info } from "../io/io" import { info } from "ci-log"
/** /**
* Gets the specific versions supported by this action compatible with the supplied (specific or minimum) version in * Gets the specific versions supported by this action compatible with the supplied (specific or minimum) version in

View File

@ -4,7 +4,7 @@ import { dirname, join } from "path"
import which from "which" import which from "which"
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { addShellExtension, addShellHere } from "extension-tools" import { addShellExtension, addShellHere } from "extension-tools"
import { notice } from "../utils/io/io" import { notice } from "ci-log"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack" import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo } from "../utils/setup/setupBin" import { InstallationInfo } from "../utils/setup/setupBin"

View File

@ -3,7 +3,7 @@ import { existsSync } from "fs"
// @ts-ignore // @ts-ignore
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js" import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
import { addEnv } from "../utils/env/addEnv" import { addEnv } from "../utils/env/addEnv"
import { info } from "../utils/io/io" import { info } from "ci-log"
function getArch(arch: string): string { function getArch(arch: string): string {
switch (arch) { switch (arch) {