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

@frontend-project-generator/utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontend-project-generator/utils - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

75

lib/utils.js
'use strict';
const fs = require('fs');
function isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
return Object.prototype.toString.call(o) === '[object Object]';
}
function spinnerStart(msg, spinnerString = '|/-\\') {
const Spinner = require('cli-spinner').Spinner;
const spinner = new Spinner(msg + ' %s');
spinner.setSpinnerString(spinnerString);
spinner.start();
return spinner;
}
function sleep(timeout = 1000) {
return new Promise(resolve => setTimeout(resolve, timeout));
}
function exec(command, args, options) {
const win32 = process.platform === 'win32';
const cmd = win32 ? 'cmd' : command;
const cmdArgs = win32 ? ['/c'].concat(command, args) : args;
return require('child_process').spawn(cmd, cmdArgs, options || {});
}
function execAsync(command, args, options) {
return new Promise((resolve, reject) => {
const p = exec(command, args, options);
p.on('error', e => {
reject(e);
});
p.on('exit', c => {
resolve(c);
});
});
}
function readFile(path, options = {}) {
if (fs.existsSync(path)) {
const buffer = fs.readFileSync(path);
if (buffer) {
if (options.toJson) {
return buffer.toJSON();
} else {
return buffer.toString();
}
}
}
return null;
}
function writeFile(path, data, { rewrite = true } = {}) {
if (fs.existsSync(path)) {
if (rewrite) {
fs.writeFileSync(path, data);
return true;
}
return false;
} else {
fs.writeFileSync(path, data);
return true;
}
}
module.exports = {
isObject
}
isObject,
spinnerStart,
sleep,
exec,
execAsync,
readFile,
writeFile,
};

7

package.json
{
"name": "@frontend-project-generator/utils",
"version": "0.0.9",
"version": "0.0.10",
"description": "> TODO: description",

@@ -9,2 +9,5 @@ "author": "381119117@qq.com <381119117@qq.com>",

"main": "lib/utils.js",
"dependencies": {
"cli-spinner": "^0.2.10"
},
"directories": {

@@ -20,3 +23,3 @@ "lib": "lib",

},
"gitHead": "c209f77ad15bd4c236409d4cc1d06882465ba8bd"
"gitHead": "dc6b7f6c8a18ac22513206ec02ac5eb81f1ddc3f"
}
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