interacter 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +33 -0
- package/README.md +52 -1
- package/exp.js +2 -1
- package/ios.js +2 -1
- package/package.json +4 -1
- package/test.js +12 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-npm:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: 20
|
|
29
|
+
registry-url: https://registry.npmjs.org/
|
|
30
|
+
- run: npm ci
|
|
31
|
+
- run: npm publish
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
package/README.md
CHANGED
|
@@ -1 +1,52 @@
|
|
|
1
|
-
# IOS
|
|
1
|
+
# Interacter | IOS
|
|
2
|
+
Interacter is a module that helps dev in performing input and output operation, which values can be stored and later used for manipulation
|
|
3
|
+
|
|
4
|
+
## Example
|
|
5
|
+
```js
|
|
6
|
+
import Input from "./ios.js";
|
|
7
|
+
import { main, writeLine } from "./ios.js";
|
|
8
|
+
|
|
9
|
+
main (async () => {
|
|
10
|
+
|
|
11
|
+
const username = new Input();
|
|
12
|
+
const password = new Input();
|
|
13
|
+
|
|
14
|
+
await username.readl("Enter your username: ");
|
|
15
|
+
await password.readl("Enter your password: ");
|
|
16
|
+
|
|
17
|
+
writeLine(username.value, password.value);
|
|
18
|
+
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
## Features
|
|
22
|
+
- Live input read
|
|
23
|
+
- Character restrict
|
|
24
|
+
### Example
|
|
25
|
+
```js
|
|
26
|
+
main(async() => {
|
|
27
|
+
|
|
28
|
+
const a = new Input();
|
|
29
|
+
|
|
30
|
+
a.readl("Enter anything except a: ", keypress((key) => {
|
|
31
|
+
if (key === "a") {
|
|
32
|
+
a.alt("a"); //restict the character a
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
- Store value
|
|
38
|
+
|
|
39
|
+
Installation `npm install interacter`;
|
|
40
|
+
Importation `import Input from "./ios"`
|
|
41
|
+
|
|
42
|
+
## Modules
|
|
43
|
+
- Input
|
|
44
|
+
- writeLine: Just as console.log() but plain
|
|
45
|
+
- int: convert to integer numbers
|
|
46
|
+
- keypress: listen to keyboard event
|
|
47
|
+
- main
|
|
48
|
+
|
|
49
|
+
### Note
|
|
50
|
+
All module should be used within the main module for proper behavour.
|
|
51
|
+
|
|
52
|
+
|
package/exp.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {highlight, main, int,
|
|
1
|
+
import Input, {highlight, main, int, writeLine, keyPress} from "./IOS.js";
|
|
2
2
|
import {colors} from "./colors.js";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
//usage
|
|
6
6
|
main(async () => {
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
const y = new Input();
|
|
9
10
|
|
|
10
11
|
//accepting input from user
|
package/ios.js
CHANGED
|
@@ -2,7 +2,7 @@ import { colors } from "./colors.js"
|
|
|
2
2
|
let c = new colors();
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
export class Input {
|
|
5
|
+
export default class Input {
|
|
6
6
|
|
|
7
7
|
constructor() {
|
|
8
8
|
this.input = "";
|
|
@@ -158,6 +158,7 @@ export async function writeLine(...arg) {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
|
|
161
|
+
/**Under construction */
|
|
161
162
|
export const highlight = (arg, prmpt) => {
|
|
162
163
|
|
|
163
164
|
process.stdout.write('\r\x1b[2K');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "interacter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": " A simple package that allows dev to interact with the CLI by accepting user input and displaying output with customizable behavour like restricting the some characters. It can live listen to user input to prevent so",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"input",
|
|
@@ -28,5 +28,8 @@
|
|
|
28
28
|
"main": "ios.js",
|
|
29
29
|
"scripts": {
|
|
30
30
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"interacter": "^1.0.0"
|
|
31
34
|
}
|
|
32
35
|
}
|
package/test.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import { writeLine } from "./IOS.js";
|
|
2
|
+
import {Input} from "./node_modules/interacter/ios.js"
|
|
3
|
+
import { main } from "./node_modules/interacter/ios.js"
|
|
1
4
|
|
|
2
|
-
let value = "hey how are you"
|
|
3
|
-
let g = value.split(" ", 2)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
main(async () => {
|
|
7
|
+
const username = new Input();
|
|
8
|
+
const password = new Input();
|
|
9
|
+
|
|
10
|
+
await username.readl("Enter username: ");
|
|
11
|
+
await password.readl("Enter password: ");
|
|
12
|
+
|
|
13
|
+
writeLine(username.value, password.value)
|
|
14
|
+
})
|