init
This commit is contained in:
commit
9f71f97833
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@ -0,0 +1,16 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
30
.github/issue_template/bug.md
vendored
Normal file
30
.github/issue_template/bug.md
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
|
||||
name: "Bug report"
|
||||
about: "Encountered an issue"
|
||||
ref: "develop"
|
||||
labels:
|
||||
- Type/Bug
|
||||
|
||||
---
|
||||
|
||||
# Bug Report
|
||||
<!-- Description of problem -->
|
||||
I tried to ...
|
||||
|
||||
But instead ...
|
||||
|
||||
## Steps to Reproduce
|
||||
<!-- How can developers replicate & test the problem? -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
## Logs
|
||||
<!-- Any logs that accompenied the error -->
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
## Screenshots
|
||||
<!-- Screenshots (annoted if possible) of the problem -->
|
22
.github/issue_template/enhancment.md
vendored
Normal file
22
.github/issue_template/enhancment.md
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
|
||||
name: "Enhancement"
|
||||
about: "Request a feature"
|
||||
ref: "develop"
|
||||
labels:
|
||||
- Type/Enhancement
|
||||
|
||||
---
|
||||
|
||||
# Feature Request
|
||||
<!-- Detailed description -->
|
||||
...
|
||||
|
||||
## Requirements
|
||||
<!-- Bullet list of requirments -->
|
||||
1. ...
|
||||
2. ...
|
||||
|
||||
## Notes
|
||||
<!-- Any additional considerations, solutions or design choices -->
|
||||
...
|
26
.github/issue_template/refactor.md
vendored
Normal file
26
.github/issue_template/refactor.md
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
|
||||
name: "Refactor"
|
||||
about: "Refactor existing system"
|
||||
ref: "develop"
|
||||
labels:
|
||||
- Kind/Refactor
|
||||
|
||||
---
|
||||
|
||||
# Refactor
|
||||
<!-- Detailed description -->
|
||||
The current...
|
||||
|
||||
Should be changed/updated to...
|
||||
|
||||
## Reasoning
|
||||
- ...
|
||||
|
||||
## Scope
|
||||
<!-- What systems will this impact -->
|
||||
- ...
|
||||
|
||||
## Notes
|
||||
<!-- Any additional design considerations -->
|
||||
...
|
15
.github/pull_request_template.md
vendored
Normal file
15
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
## Description
|
||||
<!-- Addition information & context -->
|
||||
...
|
||||
|
||||
## Issues
|
||||
<!-- Issues this PR will address -->
|
||||
- closes #___
|
||||
- owner/repo#___
|
||||
|
||||
## Checklist
|
||||
<!-- Complete after creating PR -->
|
||||
- [ ] Linked issues
|
||||
- [ ] Reviewed changes
|
||||
- [ ] Updated comments/documentation
|
||||
|
53
.github/workflows/build.yaml
vendored
Normal file
53
.github/workflows/build.yaml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Publish Library
|
||||
run-name: Publish Library
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build NPM Project
|
||||
runs-on: ubuntu-latest
|
||||
container: node:alpine
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: ztimson/actions/clone@develop
|
||||
|
||||
- name: Install & Build
|
||||
run: npm i && npm run build
|
||||
|
||||
- name: Upload to Registry
|
||||
uses: ztimson/actions/npm/publish@develop
|
||||
|
||||
- name: Upload to NPM
|
||||
uses: ztimson/actions/npm/publish@develop
|
||||
with:
|
||||
owner: ztimson
|
||||
registry: https://registry.npmjs.org/
|
||||
token: ${{secrets.NPM_TOKEN}}
|
||||
tag:
|
||||
name: Tag Version
|
||||
needs: build
|
||||
if: ${{github.ref_name}} == 'release'
|
||||
runs-on: ubuntu-latest
|
||||
container: node:alpine
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: ztimson/actions/clone@develop
|
||||
|
||||
- name: Get Version Number
|
||||
run: echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
|
||||
|
||||
- name: Tag Version
|
||||
uses: ztimson/actions/tag@develop
|
||||
with:
|
||||
tag: ${{env.VERSION}}
|
||||
|
||||
docs:
|
||||
name: Publish CDN & Docs
|
||||
needs: build
|
||||
uses: ztimson/actions/.github/workflows/docker.yaml@develop
|
||||
with:
|
||||
name: ztimson/css-utils
|
||||
repository: ${{github.server_url}}/${{github.repository}}.git
|
||||
pass: ${{secrets.DEPLOY_TOKEN}}
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.idea
|
||||
.vscode
|
||||
*.log
|
||||
dist
|
||||
node_modules
|
6
.npmignore
Normal file
6
.npmignore
Normal file
@ -0,0 +1,6 @@
|
||||
.github
|
||||
.idea
|
||||
node_modules
|
||||
.editorconfig
|
||||
.gitignore
|
||||
CODEOWNERS
|
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@ -0,0 +1 @@
|
||||
* @ztimson
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
# Build application
|
||||
FROM node:alpine as build
|
||||
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN if [ ! -d "node_modules" ]; then npm i; fi && \
|
||||
if [ ! -d "dist" ]; then npm run docs; fi
|
||||
|
||||
# Use Nginx to serve
|
||||
FROM nginx:1.23-alpine
|
||||
|
||||
COPY --from=build /app/docs /usr/share/nginx/html
|
7
LICENSE
Normal file
7
LICENSE
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (c) 2023 Zakary Timson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
91
README.md
Normal file
91
README.md
Normal file
@ -0,0 +1,91 @@
|
||||
<!-- Header -->
|
||||
<div id="top" align="center">
|
||||
<br />
|
||||
|
||||
<!-- Logo -->
|
||||
<img src="https://git.zakscode.com/repo-avatars/77dbab78e5fb3302dc9e751c4d6315a64df8d3a714d5cd5719b0dc39e6619119" alt="Logo" width="200" height="200">
|
||||
|
||||
<!-- Title -->
|
||||
### @ztimson/node-utils
|
||||
|
||||
<!-- Description -->
|
||||
Node Utilities
|
||||
|
||||
<!-- Repo badges -->
|
||||
[![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/node-utils/tags&query=$[0].name)](https://git.zakscode.com/ztimson/node-utils/tags)
|
||||
[![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/node-utils&query=open_pr_counter)](https://git.zakscode.com/ztimson/node-utils/pulls)
|
||||
[![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/node-utils&query=open_issues_count)](https://git.zakscode.com/ztimson/node-utils/issues)
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
---
|
||||
<div>
|
||||
<a href="https://node-utils.docs.zakscode.com" target="_blank">Documentation</a>
|
||||
• <a href="https://git.zakscode.com/ztimson/node-utils/releases" target="_blank">Release Notes</a>
|
||||
• <a href="https://git.zakscode.com/ztimson/node-utils/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
|
||||
• <a href="https://git.zakscode.com/ztimson/node-utils/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
|
||||
</div>
|
||||
|
||||
---
|
||||
</div>
|
||||
|
||||
## Table of Contents
|
||||
- [@ztimson/utils](#top)
|
||||
- [About](#about)
|
||||
- [Built With](#built-with)
|
||||
- [Setup](#setup)
|
||||
- [Production](#production)
|
||||
- [Development](#development)
|
||||
- [Documentation](https://node-utils.docs.zakscode.com/)
|
||||
- [License](#license)
|
||||
|
||||
## About
|
||||
|
||||
A collection of node utilities to make life a little easier
|
||||
|
||||
### Built With
|
||||
[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://typescriptlang.org/)
|
||||
|
||||
## Setup
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<h3 id="production" style="display: inline">
|
||||
Production
|
||||
</h3>
|
||||
</summary>
|
||||
|
||||
#### Prerequisites
|
||||
- [Node.js](https://nodejs.org/en/download)
|
||||
|
||||
#### Instructions
|
||||
1. Install persist: `npm i @ztimosn/node-utils`
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<h3 id="development" style="display: inline">
|
||||
Development
|
||||
</h3>
|
||||
</summary>
|
||||
|
||||
#### Prerequisites
|
||||
- [Node.js](https://nodejs.org/en/download)
|
||||
|
||||
#### Instructions
|
||||
1. Install the dependencies: `npm i`
|
||||
2. Build library: `npm build`
|
||||
3. Run unit tests: `npm test`
|
||||
|
||||
</details>
|
||||
|
||||
## Documentation
|
||||
|
||||
[Available Here](https://node-utils.docs.zakscode.com/)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2023 Zakary Timson | Available under MIT Licensing
|
||||
|
||||
See the [license](_media/LICENSE) for more information.
|
1
docs/.nojekyll
Normal file
1
docs/.nojekyll
Normal file
@ -0,0 +1 @@
|
||||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
22
docs/assets/highlight.css
Normal file
22
docs/assets/highlight.css
Normal file
@ -0,0 +1,22 @@
|
||||
:root {
|
||||
--light-code-background: #FFFFFF;
|
||||
--dark-code-background: #1E1E1E;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) { :root {
|
||||
--code-background: var(--light-code-background);
|
||||
} }
|
||||
|
||||
@media (prefers-color-scheme: dark) { :root {
|
||||
--code-background: var(--dark-code-background);
|
||||
} }
|
||||
|
||||
:root[data-theme='light'] {
|
||||
--code-background: var(--light-code-background);
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] {
|
||||
--code-background: var(--dark-code-background);
|
||||
}
|
||||
|
||||
pre, code { background: var(--code-background); }
|
18
docs/assets/icons.js
Normal file
18
docs/assets/icons.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/icons.svg
Normal file
1
docs/assets/icons.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 9.5 KiB |
60
docs/assets/main.js
Normal file
60
docs/assets/main.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/navigation.js
Normal file
1
docs/assets/navigation.js
Normal file
@ -0,0 +1 @@
|
||||
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAACpXQ3wrCIBQG8Hc5dSn9lSBfo8sxxlBDmXNjHmERvXvUYiZzo249/j6+c7I7oOwRGHCjgUBbogIGdSO8kW7Ljd4orA0QqLQVwA4EuNJGdNICy0a8DvTqLUfd2AEXMT/RBwnocrN8Fr6GE5x/cW2F7KeV38//lp7iVTFyuj/T426heUp/fswllK5a9MM81vHyrcdUQuvxp+WjAuH0Q0DpqsTp8yfEMnYaLQIAAA=="
|
1
docs/assets/search.js
Normal file
1
docs/assets/search.js
Normal file
@ -0,0 +1 @@
|
||||
window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACp2US46cMBBA71LJssRgzK99g6wjzcZCLQQeBTUYxGcmEeLuETbdHmQ3IbPCKvu9chUlz9C3HwMwPsOtkiWwAEHmjQAGRV0BwtTXwKBpy6kWw0tRV96vsakBoajzYRADMIAF73QcPvDvD/htksVYtVLjV4cAoct7Icctq9v3848snjnXvf/xmiorWYrfVp0qeljpZ0M3jQ5DN41ne5UPN0dlWpEPt+PKdH7jDcklpL7rR9jVfbseaNfGHGh3/8Ol3g58Tf+5JQ653j5UZ7it2Azvoh+qVgKDwKPeBRDeKlGX6+DrhAhF2zQrj1C2xaSW2XbsVRRj26+H9ekXH5D7SFLvkpAsQ36H1YYK3B0mokACyAkS6qUx3YHEAskODAB54AIDCwx2IAXk1HVVaoF0B4aAPHSBoQWGOzAC5JHrqpEFRjswftac2ALjHZg8a05igckOTJ9dNbVAHVEz9S76UZQ/9GxxDoAzXLdRI/cBnoEAmxeEeP0sZr5U8DFi696aR82z0URGE2kiPaVRb7bR+Ebjn+K319AYqDHQkwb1GhpDaAzhKcOgng0jCIwg0Ejyb0+G0FWdqCspgPFsWf4Cq9S0pOkGAAA=";
|
1493
docs/assets/style.css
Normal file
1493
docs/assets/style.css
Normal file
File diff suppressed because it is too large
Load Diff
1
docs/functions/cli._.html
Normal file
1
docs/functions/cli._.html
Normal file
File diff suppressed because one or more lines are too long
1
docs/functions/cli._Sync.html
Normal file
1
docs/functions/cli._Sync.html
Normal file
File diff suppressed because one or more lines are too long
5
docs/functions/input.ask.html
Normal file
5
docs/functions/input.ask.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ask | @ztimson/css-utils</title><meta name="description" content="Documentation for @ztimson/css-utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="../"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ztimson/css-utils</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ztimson/css-utils</a></li><li><a href="../modules/input.html">input</a></li><li><a href="input.ask.html">ask</a></li></ul><h1>Function ask</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="ask" class="tsd-anchor"></a><span class="tsd-kind-call-signature">ask</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">prompt</span>, <span class="tsd-kind-parameter">hide</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><a href="#ask" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Retrieve input form the CLI</p>
|
||||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">prompt</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Prepend a prompt before the cursor carrot</p>
|
||||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">hide</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></span><div class="tsd-comment tsd-typography"><p>Hide user input (replacing with stars)</p>
|
||||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><p>User input</p>
|
||||
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in input.ts:10</li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ztimson/css-utils</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="../"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
4
docs/index.html
Normal file
4
docs/index.html
Normal file
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@ztimson/css-utils</title><meta name="description" content="Documentation for @ztimson/css-utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="../node-utils/"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@ztimson/css-utils</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h1>@ztimson/css-utils</h1></div><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><h3 class="tsd-index-heading uppercase">Index</h3><section class="tsd-index-section"><h3 class="tsd-index-heading">Modules</h3><div class="tsd-index-list"><a href="modules/cli.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-2"></use></svg><span>cli</span></a>
|
||||
<a href="modules/index.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-2"></use></svg><span>index</span></a>
|
||||
<a href="modules/input.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-2"></use></svg><span>input</span></a>
|
||||
</div></section></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="index.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>@ztimson/css-utils</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="../node-utils/"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
3
docs/modules/cli.html
Normal file
3
docs/modules/cli.html
Normal file
@ -0,0 +1,3 @@
|
||||
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>cli | @ztimson/css-utils</title><meta name="description" content="Documentation for @ztimson/css-utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="../"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ztimson/css-utils</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ztimson/css-utils</a></li><li><a href="cli.html">cli</a></li></ul><h1>Module cli</h1></div><aside class="tsd-sources"><ul><li>Defined in cli.ts:1</li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><h3 class="tsd-index-heading uppercase">Index</h3><section class="tsd-index-section"><h3 class="tsd-index-heading">Functions</h3><div class="tsd-index-list"><a href="../functions/cli._.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-64"></use></svg><span>$</span></a>
|
||||
<a href="../functions/cli._Sync.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-64"></use></svg><span>$<wbr/>Sync</span></a>
|
||||
</div></section></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ztimson/css-utils</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="../"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
4
docs/modules/index.html
Normal file
4
docs/modules/index.html
Normal file
File diff suppressed because one or more lines are too long
2
docs/modules/input.html
Normal file
2
docs/modules/input.html
Normal file
@ -0,0 +1,2 @@
|
||||
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>input | @ztimson/css-utils</title><meta name="description" content="Documentation for @ztimson/css-utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="../"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ztimson/css-utils</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ztimson/css-utils</a></li><li><a href="input.html">input</a></li></ul><h1>Module input</h1></div><aside class="tsd-sources"><ul><li>Defined in input.ts:1</li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><h3 class="tsd-index-heading uppercase">Index</h3><section class="tsd-index-section"><h3 class="tsd-index-heading">Functions</h3><div class="tsd-index-list"><a href="../functions/input.ask.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-64"></use></svg><span>ask</span></a>
|
||||
</div></section></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ztimson/css-utils</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="../"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
1975
package-lock.json
generated
Normal file
1975
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
38
package.json
Normal file
38
package.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@ztimson/node-utils",
|
||||
"version": "1.0.0",
|
||||
"description": "CSS Utility Classes",
|
||||
"author": "ztimson",
|
||||
"license": "MIT",
|
||||
"private": false,
|
||||
"readme": "README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git.zakscode.com:ztimson/node-utils"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npx tsc && npx vite build",
|
||||
"docs": "typedoc --cleanOutputDir false --out ./docs --entryPoints src/**/*.ts --readme none",
|
||||
"watch": "npx vite build --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.10.1",
|
||||
"typedoc": "^0.26.7",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.12",
|
||||
"vite-plugin-dts": "^3.7.2"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
}
|
14
src/cli.ts
Normal file
14
src/cli.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import {exec, execSync} from 'child_process';
|
||||
|
||||
export function $(str: TemplateStringsArray, ...args: string[]): Promise<string> {
|
||||
let cmd = str.reduce((acc, part, i) => acc + part + (args[i] || ''), '');
|
||||
return new Promise((res, rej) => exec(cmd, (err, stdout, stderr) => {
|
||||
if(err || stderr) return rej(err || stderr);
|
||||
return res(stdout);
|
||||
}))
|
||||
}
|
||||
|
||||
export function $Sync(str: TemplateStringsArray, ...args: string[]): string {
|
||||
let cmd = str.reduce((acc, part, i) => acc + part + (args[i] || ''), '');
|
||||
return execSync(cmd, { encoding: 'utf-8' });
|
||||
}
|
2
src/index.ts
Normal file
2
src/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './cli';
|
||||
export * from './input';
|
49
src/input.ts
Normal file
49
src/input.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import readline from 'node:readline';
|
||||
|
||||
/**
|
||||
* Retrieve input form the CLI
|
||||
*
|
||||
* @param {string} prompt Prepend a prompt before the cursor carrot
|
||||
* @param {boolean} hide Hide user input (replacing with stars)
|
||||
* @return {Promise<string>} User input
|
||||
*/
|
||||
export function ask(prompt: string, hide = false): Promise<string> {
|
||||
const rl: any = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
terminal: true
|
||||
});
|
||||
|
||||
return new Promise((resolve) => {
|
||||
if (!hide) {
|
||||
rl.question(prompt, (answer: string) => {
|
||||
rl.close();
|
||||
resolve(answer);
|
||||
});
|
||||
} else {
|
||||
rl.output.write(prompt);
|
||||
let input = '';
|
||||
|
||||
// Listen for 'keypress' to handle masking
|
||||
rl.input.on('keypress', (char: string, key: any) => {
|
||||
if (key && key.name === 'return') {
|
||||
rl.output.write('\n'); // Submit on new line
|
||||
rl.close();
|
||||
resolve(input);
|
||||
} else if (key && key.name === 'backspace') {
|
||||
if (input.length > 0) {
|
||||
input = input.slice(0, -1);
|
||||
rl.output.write(`\r${prompt}${input.replaceAll(/./g, '*')} \b`);
|
||||
}
|
||||
} else {
|
||||
input += char;
|
||||
rl.output.write('\b*'); // Mask the input with '*'
|
||||
}
|
||||
});
|
||||
|
||||
// Restore settings
|
||||
rl.input.setRawMode(true);
|
||||
rl.input.resume();
|
||||
}
|
||||
});
|
||||
}
|
20
tsconfig.json
Normal file
20
tsconfig.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"include": ["src"],
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "NodeNext",
|
||||
"lib": ["ESNext"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "NodeNext",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"declaration": true,
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true
|
||||
}
|
||||
}
|
23
vite.config.ts
Normal file
23
vite.config.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {resolve} from 'path';
|
||||
import {defineConfig} from 'vite';
|
||||
import dts from 'vite-plugin-dts';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(process.cwd(), 'src/index.ts'),
|
||||
name: 'node-utils',
|
||||
fileName: (format: string) => format === 'es' ? 'index.mjs' : 'index.cjs'
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [
|
||||
'child_process',
|
||||
'readline'
|
||||
],
|
||||
},
|
||||
emptyOutDir: true,
|
||||
minify: false,
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [dts()],
|
||||
});
|
Loading…
Reference in New Issue
Block a user