evophp 1.0.21 → 1.0.23
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/helpers.js +5 -4
- package/new-plugin.js +15 -2
- package/package.json +1 -1
package/helpers.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const readline = require('readline');
|
|
4
|
-
const rl = readline.createInterface({
|
|
5
|
-
input: process.stdin,
|
|
6
|
-
output: process.stdout
|
|
7
|
-
});
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* Prompt user for input with a message
|
|
@@ -12,6 +8,11 @@ const rl = readline.createInterface({
|
|
|
12
8
|
* @returns {Promise<string>} - Resolves with user input
|
|
13
9
|
*/
|
|
14
10
|
const readLineAsync = (msg) => {
|
|
11
|
+
const rl = readline.createInterface({
|
|
12
|
+
input: process.stdin,
|
|
13
|
+
output: process.stdout
|
|
14
|
+
});
|
|
15
|
+
|
|
15
16
|
return new Promise((resolve) => {
|
|
16
17
|
rl.question(msg, (userRes) => {
|
|
17
18
|
resolve(userRes);
|
package/new-plugin.js
CHANGED
|
@@ -5,7 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const axios = require('axios');
|
|
7
7
|
const helpersPath = path.resolve(__dirname, 'helpers.js');
|
|
8
|
-
const { readLineAsync,
|
|
8
|
+
const { readLineAsync, splitPluginName } = require(helpersPath);
|
|
9
9
|
|
|
10
10
|
(async () => {
|
|
11
11
|
try {
|
|
@@ -29,7 +29,7 @@ const { readLineAsync, splitpluginName } = require(helpersPath);
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// Validate name and split it into author and item name
|
|
32
|
-
const [author, pluginName] = await
|
|
32
|
+
const [author, pluginName] = await splitPluginName(name);
|
|
33
33
|
|
|
34
34
|
// Validate PAT by checking the authenticated user's username
|
|
35
35
|
const userData = await getUserData(gitHubToken);
|
|
@@ -246,4 +246,17 @@ const editFile = async (file, data) => {
|
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
248
|
})
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const test = (str, maxLength) => {
|
|
252
|
+
str = str.trim().replaceAll(" ", "")
|
|
253
|
+
if(str.length > maxLength) {
|
|
254
|
+
console.error(`Your input cannot be longer than ${maxLength} characters`);
|
|
255
|
+
return false
|
|
256
|
+
}
|
|
257
|
+
if(str.length < 1) {
|
|
258
|
+
console.error(`You have not made any entry`);
|
|
259
|
+
return false
|
|
260
|
+
}
|
|
261
|
+
return str;
|
|
249
262
|
}
|