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

clarity-cli

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clarity-cli - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

sample-projects/babel/lib/index.js

21

lib/commands/init-project.js

@@ -21,7 +21,2 @@ "use strict";

var templates = {
babel: "project-template",
system: "system-project-template"
};
exports.default = function (program) {

@@ -34,9 +29,10 @@

var projectName = args[1] || "";
var type = program.type || "babel";
var templateName = templates[type] || templates.babel;
var templateName = "init-project-template";
var templateDirectory = _path2.default.join(__dirname, "../../templates/", templateName);
var projectDirectory = process.cwd();
var readmeFile = _path2.default.join(projectDirectory, "README.md");
var packageJsonFile = _path2.default.join(projectDirectory, "package.json");
var existingPackageJson = null;
var existingReadme = null;

@@ -49,3 +45,8 @@ if (projectName == null) {

_fsExtra2.default.readJson(packageJsonFile).catch(function () {
_fsExtra2.default.readFile(readmeFile).catch(function () {
return null;
}).then(function (readme) {
existingReadme = readme;
return _fsExtra2.default.readJson(packageJsonFile);
}).catch(function () {
return {};

@@ -64,2 +65,6 @@ }).then(function (json) {

}).then(function () {
if (existingReadme != null) {
return _fsExtra2.default.writeFile(readmeFile, existingReadme);
}
}).then(function () {
console.log("Running npm for you, this may take a while...");

@@ -66,0 +71,0 @@ return _childProcessEs6Promise2.default.exec("npm install", { cwd: projectDirectory });

{
"name": "clarity-cli",
"version": "1.0.7",
"version": "1.0.8",
"description": "Clarity setup for vscode.",

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

@@ -16,6 +16,8 @@ /*************************************************************

const removeWorkspaceRoot = (value) => {
return value.replace("${workspaceRoot}", workspaceRoot );
return value.replace("${workspaceRoot}", workspaceRoot);
}
fs.readJson(path.join(workspaceRoot, ".vscode/tasks.json")).then((tasksConfig) => {
fs.readJson(path.join(workspaceRoot, ".vscode/tasks.json")).catch(() => {
console.log("Couldn't find tasks.json in .vscode folder.");
}).then((tasksConfig) => {
if (tasksConfig && tasksConfig.tasks) {

@@ -31,3 +33,6 @@ return tasksConfig.tasks.filter((task) => {

return promise.then(() => {
return exec(command, { cwd: workspaceRoot });
return exec(command, { cwd: workspaceRoot }).catch((error) => {
console.log(`Failed to build project because of task: ${task.taskName}`);
throw error;
});
});

@@ -39,4 +44,4 @@

console.log("Build complete.");
}).catch(() => {
console.log("Couldn't find tasks.json in .vscode folder.");
}).catch(()=>{
console.log("Build failed.");
});

@@ -1,42 +0,42 @@

var fs = require("fs");
var fs = require("fs-extra");
var path = require("path");
const testDirectory = path.join(__dirname, "test");
const testDirectory = path.join(__dirname, "../lib/tests");
fs.readdir(testDirectory, function (err, files) {
if (err == null) {
fs.readdir(testDirectory).then((files) => {
files.forEach((file) => {
if (path.extname(file) === ".js") {
var tests = require(path.join(testDirectory, file));
var defaultModules = tests.default || tests;
files.forEach((file) => {
if (path.extname(file) === ".js") {
var tests = require(path.resolve(testDirectory, file));
var defaultModules = tests.default || tests;
Object.keys(defaultModules).reduce((promise, testName) => {
if (typeof defaultModules[testName] !== "function") {
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function.");
}
return promise.then(() => {
try {
let result = defaultModules[testName]();
result = result instanceof Promise ? result : Promise.resolve(result);
Object.keys(defaultModules).reduce(function (promise, testName) {
if (typeof defaultModules[testName] !== "function") {
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function.");
}
return promise.then(() => {
try {
let result = defaultModules[testName]();
result = result instanceof Promise ? result : Promise.resolve(result);
return result.then(() => {
console.log("PASSED: " + testName);
}).catch((error) => {
console.log("FAILED: " + testName);
console.log(error);
});
} catch (error) {
return result.then(() => {
console.log("PASSED: " + testName);
}).catch((error) => {
console.log("FAILED: " + testName);
console.log(error);
});
} catch (error) {
console.log("FAILED: " + testName);
console.log(error);
return Promise.reject(error);
}
});
}, Promise.resolve()).catch((error) => {
console.log("UNEXPECTED FAILURE: Most likely an async error.");
return Promise.reject(error);
}
});
}
});
}
}, Promise.resolve()).catch((error) => {
console.log("UNEXPECTED FAILURE: Most likely an async error.");
});
}
});
}).catch(() => {
console.log(`Couldn't find test folder here: ${testDirectory}`);
});

@@ -1,20 +0,1 @@

{
"name": "babel",
"version": "0.0.1",
"description": "",
"main": "./lib/index.js",
"scripts": {
"test": "node ./.clarity/test.js",
"build": "node ./.clarity/build.js"
},
"keywords": [],
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-preset-env": "^1.5.1",
"child-process-es6-promise": "^1.1.0",
"fs-extra": "^3.0.1",
"istanbul": "^0.4.5",
"jsdoc": "^3.4.3"
},
"dependencies": {}
}
{"name":"babel","version":"0.0.1","description":"","main":"./lib/index.js","scripts":{"test":"node ./.clarity/test.js","build":"node ./.clarity/build.js"},"keywords":[],"devDependencies":{"babel-cli":"^6.24.1","babel-preset-env":"^1.5.1","child-process-es6-promise":"^1.1.0","fs-extra":"^3.0.1","istanbul":"^0.4.5","jsdoc":"^3.4.3"},"dependencies":{}}

@@ -5,7 +5,2 @@ import fs from "fs-extra";

var templates = {
babel: "project-template",
system: "system-project-template"
};
export default (program) => {

@@ -20,9 +15,10 @@

var projectName = args[1] || "";
var type = program.type || "babel"
var templateName = templates[type] || templates.babel;
var templateName = "init-project-template";
var templateDirectory = path.join(__dirname, "../../templates/", templateName);
var projectDirectory = process.cwd();
var readmeFile = path.join(projectDirectory, "README.md");
var packageJsonFile = path.join(projectDirectory, "package.json");
var existingPackageJson = null;
var existingReadme = null;

@@ -35,3 +31,8 @@ if (projectName == null) {

fs.readJson(packageJsonFile).catch(()=>{
fs.readFile(readmeFile).catch(()=>{
return null;
}).then((readme) => {
existingReadme = readme;
return fs.readJson(packageJsonFile)
}).catch(() => {
return {};

@@ -49,2 +50,6 @@ }).then((json) => {

return fs.writeJson(packageJsonFile, newPackageJson);
}).then(()=>{
if (existingReadme != null){
return fs.writeFile(readmeFile, existingReadme);
}
}).then(() => {

@@ -51,0 +56,0 @@ console.log("Running npm for you, this may take a while...");

@@ -1,42 +0,42 @@

var fs = require("fs");
var fs = require("fs-extra");
var path = require("path");
const testDirectory = path.join(__dirname, "test");
const testDirectory = path.join(__dirname, "../lib/tests");
fs.readdir(testDirectory, function (err, files) {
if (err == null) {
fs.readdir(testDirectory).then((files) => {
files.forEach((file) => {
if (path.extname(file) === ".js") {
var tests = require(path.join(testDirectory, file));
var defaultModules = tests.default || tests;
files.forEach((file) => {
if (path.extname(file) === ".js") {
var tests = require(path.resolve(testDirectory, file));
var defaultModules = tests.default || tests;
Object.keys(defaultModules).reduce((promise, testName) => {
if (typeof defaultModules[testName] !== "function") {
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function.");
}
return promise.then(() => {
try {
let result = defaultModules[testName]();
result = result instanceof Promise ? result : Promise.resolve(result);
Object.keys(defaultModules).reduce(function (promise, testName) {
if (typeof defaultModules[testName] !== "function") {
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function.");
}
return promise.then(() => {
try {
let result = defaultModules[testName]();
result = result instanceof Promise ? result : Promise.resolve(result);
return result.then(() => {
console.log("PASSED: " + testName);
}).catch((error) => {
console.log("FAILED: " + testName);
console.log(error);
});
} catch (error) {
return result.then(() => {
console.log("PASSED: " + testName);
}).catch((error) => {
console.log("FAILED: " + testName);
console.log(error);
});
} catch (error) {
console.log("FAILED: " + testName);
console.log(error);
return Promise.reject(error);
}
});
}, Promise.resolve()).catch((error) => {
console.log("UNEXPECTED FAILURE: Most likely an async error.");
return Promise.reject(error);
}
});
}
});
}
}, Promise.resolve()).catch((error) => {
console.log("UNEXPECTED FAILURE: Most likely an async error.");
});
}
});
}).catch(() => {
console.log(`Couldn't find test folder here: ${testDirectory}`);
});

@@ -1,42 +0,42 @@

var fs = require("fs");
var fs = require("fs-extra");
var path = require("path");
const testDirectory = path.resolve(__dirname, "./../lib/tests");
const testDirectory = path.join(__dirname, "../lib/tests");
fs.readdir(testDirectory, function (err, files) {
if (err == null) {
fs.readdir(testDirectory).then((files) => {
files.forEach((file) => {
if (path.extname(file) === ".js") {
var tests = require(path.join(testDirectory, file));
var defaultModules = tests.default || tests;
files.forEach((file) => {
if (path.extname(file) === ".js") {
var tests = require(path.resolve(testDirectory, file));
var defaultModules = tests.default || tests;
Object.keys(defaultModules).reduce((promise, testName) => {
if (typeof defaultModules[testName] !== "function") {
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function.");
}
return promise.then(() => {
try {
let result = defaultModules[testName]();
result = result instanceof Promise ? result : Promise.resolve(result);
Object.keys(defaultModules).reduce(function (promise, testName) {
if (typeof defaultModules[testName] !== "function") {
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function.");
}
return promise.then(() => {
try {
let result = defaultModules[testName]();
result = result instanceof Promise ? result : Promise.resolve(result);
return result.then(() => {
console.log("PASSED: " + testName);
}).catch((error) => {
console.log("FAILED: " + testName);
console.log(error);
});
} catch (error) {
return result.then(() => {
console.log("PASSED: " + testName);
}).catch((error) => {
console.log("FAILED: " + testName);
console.log(error);
});
} catch (error) {
console.log("FAILED: " + testName);
console.log(error);
return Promise.reject(error);
}
});
}, Promise.resolve()).catch((error) => {
console.log("UNEXPECTED FAILURE: Most likely an async error.");
return Promise.reject(error);
}
});
}
});
}
}, Promise.resolve()).catch((error) => {
console.log("UNEXPECTED FAILURE: Most likely an async error.");
});
}
});
}).catch(() => {
console.log(`Couldn't find test folder here: ${testDirectory}`);
});

Sorry, the diff of this file is not supported yet

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