Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More →
Socket
Sign inDemoInstall
Socket

07-cli

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

07-cli - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

110

commands/yml.js

@@ -0,6 +1,16 @@

/*
Code to create .github/workflows/main.yml file
Used for building Create React Apps from Git and syncing to FTP server
All server info is specified in Github secrets
*/
// Dependency to execute code in terminal
const execSync = require("child_process").execSync;
const commander = require("commander");
const { program } = require("commander");
// File system, dependency to check paths
const fs = require("fs");
const { resolve } = require("path");
// Question dependencies
const readline = require("readline");

@@ -11,3 +21,4 @@ const rl = readline.createInterface({

});
const emoji = require("node-emoji");
// Colors to style console logs
const colors = require("colors");

@@ -22,4 +33,10 @@ colors.setTheme({

});
// Emoji function
const emoji = require("node-emoji");
const e = (n) => emoji.get(n);
function init(options) {
/* ********************************** */
/* LOG ARGUMENTS */
/* ********************************** */
Object.values(options).length > 0 && console.log("#".meta);

@@ -36,3 +53,48 @@ options.output && console.log(`Prosjektnavn: ${options.output.info}`);

/* ********************************** */
/* CREATE OUTPUT FOLDER */
/* ********************************** */
const createDir = (dir) => {
if (dir) {
let exists = fs.existsSync(dir.replace(/'/g, ""));
if (exists) {
console.log(
`${e("nerd_face")} ${"Mappen eksisterer!".green} ${
`${resolve(dir)}`.meta
}`
);
console.log(
`${e("nerd_face")} ${
"Github workflow - Lager mappestruktur".green
} ${"(.github/workflows/)".meta}`
);
execSync(`mkdir -p ${dir}/.github/workflows`);
initYml(dir);
} else if (!exists) {
console.log(
`${e("worried")} ${
"Mappen eksisterer ikke".red
} Oppretter mappe.${`${resolve(dir)}`.meta}`
);
execSync(`mkdir -p ${dir}/.github/workflows`);
console.log(
`${e("nerd_face")} ${
"Github workflow - Lager mappestruktur".green
} ${"(.github/workflows/)".meta}`
);
initYml(dir);
}
} else {
rl.close();
}
};
/* ********************************** */
/* CREATE YML FILE */
/* ********************************** */
const initYml = (dir) => {
/* ********************************** */
/* CREATE GITHUB WORKFLOW YML */
/* ********************************** */
// Installs node_modules, caches them, builds react app & syncs to ftp folder
const createYml = (server, serverFolder) => {

@@ -59,2 +121,5 @@ let host = "${{ secrets.FTP_HOST_" + server + " }}";

} else {
/* ********************************** */
/* SERVER */
/* ********************************** */
rl.question(

@@ -76,2 +141,5 @@ `${e(

} else {
/* ********************************** */
/* SERVER FOLDER */
/* ********************************** */
rl.question(

@@ -96,36 +164,3 @@ `${e(

const createDir = (dir) => {
if (dir) {
let exists = fs.existsSync(dir.replace(/'/g, ""));
if (exists) {
console.log(
`${e("nerd_face")} ${"Mappen eksisterer!".green} ${
`${resolve(dir)}`.meta
}`
);
console.log(
`${e("nerd_face")} ${
"Github workflow - Lager mappestruktur".green
} ${"(.github/workflows/)".meta}`
);
execSync(`mkdir -p ${dir}/.github/workflows`);
initYml(dir);
} else if (!exists) {
console.log(
`${e("worried")} ${
"Mappen eksisterer ikke".red
} Oppretter mappe.${`${resolve(dir)}`.meta}`
);
execSync(`mkdir -p ${dir}/.github/workflows`);
console.log(
`${e("nerd_face")} ${
"Github workflow - Lager mappestruktur".green
} ${"(.github/workflows/)".meta}`
);
initYml(dir);
}
} else {
rl.close();
}
};
// Check for arguments or ask for info
if (options.output) {

@@ -142,2 +177,3 @@ createDir(options.output);

// Conclusion
rl.on("close", function (status) {

@@ -144,0 +180,0 @@ if (status === "success") {

{
"name": "07-cli",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc