-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from aminya/monorepo [skip ci]
- Loading branch information
Showing
80 changed files
with
2,096 additions
and
335 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<h1 align="center"><%= projectName %></h1> | ||
<p> | ||
<% if (isProjectOnNpm) { -%> | ||
<a href="https://www.npmjs.com/package/<%= projectName %>" target="_blank"> | ||
<img alt="Version" src="https://img.shields.io/npm/v/<%= projectName %>.svg"> | ||
</a> | ||
<% } -%> | ||
<% if (projectVersion && !isProjectOnNpm) { -%> | ||
<img alt="Version" src="https://img.shields.io/badge/version-<%= projectVersion %>-blue.svg?cacheSeconds=2592000" /> | ||
<% } -%> | ||
<% if (projectPrerequisites) { -%> | ||
<% projectPrerequisites.map(({ name, value }) => { -%> | ||
<img src="https://img.shields.io/badge/<%= name %>-<%= encodeURIComponent(value) %>-blue.svg" /> | ||
<% }) -%> | ||
<% } -%> | ||
<% if (projectDocumentationUrl) { -%> | ||
<a href="<%= projectDocumentationUrl %>" target="_blank"> | ||
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> | ||
</a> | ||
<% } -%> | ||
<% if (isGithubRepos) { -%> | ||
<a href="<%= repositoryUrl %>/graphs/commit-activity" target="_blank"> | ||
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" /> | ||
</a> | ||
<% } -%> | ||
<% if (licenseName) { -%> | ||
<a href="<%= licenseUrl ? licenseUrl : '#' %>" target="_blank"> | ||
<img alt="License: <%= licenseName %>" src="https://img.shields.io/<%= isGithubRepos ? `github/license/${authorGithubUsername}/${projectName}` : `badge/License-${licenseName}-yellow.svg` %>" /> | ||
</a> | ||
<% } -%> | ||
<% if (authorTwitterUsername) { -%> | ||
<a href="https://twitter.com/<%= authorTwitterUsername %>" target="_blank"> | ||
<img alt="Twitter: <%= authorTwitterUsername %>" src="https://img.shields.io/twitter/follow/<%= authorTwitterUsername %>.svg?style=social" /> | ||
</a> | ||
<% } -%> | ||
</p> | ||
<% if (projectDescription) { -%> | ||
|
||
> <%= projectDescription %> | ||
> <% } -%> | ||
## Install | ||
|
||
```sh | ||
npm install --save <%= projectName %> | ||
``` | ||
|
||
## Usage | ||
|
||
<!-- INSERT GENERATED DOCS START --> | ||
|
||
<!-- 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). |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,60 @@ | ||
<h1 align="center">exec-powershell</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> | ||
|
||
> Run a powershell command. | ||
## Install | ||
|
||
```sh | ||
npm install --save exec-powershell | ||
``` | ||
|
||
## Usage | ||
|
||
<!-- INSERT GENERATED DOCS START --> | ||
|
||
### `execPowershell` (function) | ||
|
||
Asynchronously execute a powershell command. | ||
|
||
**Parameters:** | ||
|
||
- command (`string`) - The powershell command to execute | ||
- startupFlags (`string[]`) - The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", "-NonInteractive"]`. This means that the Powershell profile is not sourced first. | ||
- execOptions (`execa.Options`) - The options passed to `execa`. Defaults to `{ stdio: "inherit" }` | ||
|
||
**returns:** execa.ExecaChildProcess<string> | ||
|
||
### `execPowershellSync` (function) | ||
|
||
Execute a powershell command. | ||
|
||
**Parameters:** | ||
|
||
- command (`string`) - The powershell command to execute | ||
- startupFlags (`string[]`) - The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", "-NonInteractive"]`. This means that the Powershell profile is not sourced first. | ||
- execOptions (`execa.SyncOptions`) - The options passed to `execa`. Defaults to `{ stdio: "inherit" }` | ||
|
||
**returns:** execa.ExecaSyncReturnValue<string> | ||
|
||
### `getPowerShell` (function) | ||
|
||
Get the path to the powershell executable. | ||
|
||
**returns:** string | ||
|
||
<!-- 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). |
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,33 @@ | ||
{ | ||
"name": "exec-powershell", | ||
"version": "1.0.0", | ||
"description": "Run a powershell command.", | ||
"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": { | ||
"execa": "^5.1.1", | ||
"which": "^2.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/which": "^2.0.1" | ||
}, | ||
"keywords": [ | ||
"powershell", | ||
"pwsh", | ||
"exec", | ||
"execa", | ||
"spawn", | ||
"system", | ||
"github-actions", | ||
"github", | ||
"actions", | ||
"gitlab", | ||
"ci" | ||
] | ||
} |
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,64 @@ | ||
import execa from "execa" | ||
import which from "which" | ||
|
||
/** The cached powershell path */ | ||
let powershell: string | undefined | ||
|
||
/** | ||
* Asynchronously execute a powershell command. | ||
* | ||
* @param command The powershell command to execute | ||
* @param startupFlags The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", | ||
* "-NonInteractive"]`. This means that the Powershell profile is not sourced first. | ||
* @param execOptions The options passed to `execa`. Defaults to `{ stdio: "inherit" }` | ||
* @returns A promise to the execution result | ||
* @note It prefers `pwsh` over `powershell` | ||
*/ | ||
export function execPowershell( | ||
command: string, | ||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"], | ||
execOptions: execa.Options = { stdio: "inherit" } | ||
): execa.ExecaChildProcess<string> { | ||
return execa(getPowerShell(), [...startupFlags, "-c", command], execOptions) | ||
} | ||
|
||
/** | ||
* Execute a powershell command. | ||
* | ||
* @param command The powershell command to execute | ||
* @param startupFlags The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", | ||
* "-NonInteractive"]`. This means that the Powershell profile is not sourced first. | ||
* @param execOptions The options passed to `execa`. Defaults to `{ stdio: "inherit" }` | ||
* @returns The execution result | ||
* @note It prefers `pwsh` over `powershell` | ||
*/ | ||
export function execPowershellSync( | ||
command: string, | ||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"], | ||
execOptions: execa.SyncOptions = { stdio: "inherit" } | ||
): execa.ExecaSyncReturnValue<string> { | ||
return execa.sync(getPowerShell(), [...startupFlags, "-c", command], execOptions) | ||
} | ||
|
||
/** | ||
* Get the path to the powershell executable. | ||
* | ||
* @note It prefers `pwsh` over `powershell` | ||
* @note It caches the path for the subsequent calls to this function | ||
*/ | ||
export function getPowerShell() { | ||
if (powershell === undefined) { | ||
const maybePwsh = which.sync("pwsh", { nothrow: true }) | ||
if (maybePwsh !== null) { | ||
powershell = maybePwsh | ||
} | ||
const maybePowerShell = which.sync("powershell", { nothrow: true }) | ||
if (maybePowerShell !== null) { | ||
powershell = maybePowerShell | ||
} | ||
} | ||
if (powershell === undefined) { | ||
throw new Error("Could not find powershell") | ||
} | ||
return powershell | ||
} |
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,7 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist" | ||
}, | ||
"include": ["./src"] | ||
} |
Oops, something went wrong.