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

create-yoshi-app

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-yoshi-app - npm Package Compare versions

Comparing version 3.4.4 to 3.6.0

scripts/cache.js

10

__tests__/generateProject.spec.js

@@ -1,12 +0,12 @@

const fs = require('fs');
const path = require('path');
const tempy = require('tempy');
const getProjectTypes = require('../src/getProjectTypes');
const { generateProject } = require('../src');
const getFilesInDir = require('../src/getFilesInDir');
const Answers = require('../src/Answers');
const projectTypes = fs.readdirSync(path.join(__dirname, '../templates'));
const projectTypes = getProjectTypes();
const mockedAnswers = projectTypes.map(projectType => [
projectType,
{
new Answers({
projectName: `test-${projectType}`,

@@ -18,3 +18,3 @@ authorName: 'rany',

transpiler: projectType.endsWith('typescript') ? 'typescript' : 'babel',
},
}),
]);

@@ -21,0 +21,0 @@

@@ -11,10 +11,11 @@ #! /usr/bin/env node

const chalk = require('chalk');
const execa = require('execa');
const { runPrompts, generateProject } = require('../src/index');
const { clearConsole, install, lintFix } = require('../src/utils');
const {
runPrompt,
generateProject,
verifyRegistry,
verifyWorkingDirectory,
} = require('../src/index');
const pkg = require('../package.json');
const privateRegistry = 'http://npm.dev.wixpress.com';
const clearConsole = () => process.stdout.write('\x1Bc');
program

@@ -35,53 +36,6 @@ .version(pkg.version)

function install(dir) {
console.log(
`Running ${chalk.magenta(
'npm install',
)}, that might take a few minutes... ⌛ \n`,
);
execa.shellSync('npm install', {
cwd: dir,
stdio: 'inherit',
});
}
function getRegistry(dir) {
// TODO: change to npm ping to the private registry when it will be fixed with the CI team
const { stdout } = execa.shellSync('npm config get registry', {
cwd: dir,
stdio: 'pipe',
});
return stdout;
}
function lintFix(dir) {
console.log(`\nRunning ${chalk.magenta('yoshi lint --fix')}\n`);
execa.shellSync('npx yoshi lint --fix', {
cwd: dir,
stdio: 'inherit',
});
}
async function createApp(workingDir) {
const emptyDirectory = fs.readdirSync(workingDir).length === 0;
verifyWorkingDirectory();
verifyRegistry();
if (!emptyDirectory) {
console.log(`The directory "${workingDir}" is not an empty directory\n`);
console.log('Aborting...');
process.exit(1);
}
const registry = getRegistry(workingDir);
if (!registry.includes(privateRegistry)) {
console.log(`You should be authenticated to Wix's private registry`);
console.log('Run the following command and try again:\n');
console.log(chalk.cyan(` npm config set registry ${privateRegistry}`));
return;
}
clearConsole();

@@ -94,16 +48,5 @@

let promptAborted = false;
// use customProjectDir to ask less questions
const results = await runPrompts(workingDir, {
onCancel: () => {
promptAborted = true;
},
});
const results = await runPrompt(workingDir);
if (promptAborted) {
console.log();
console.log('Aborting ...');
return;
}
console.log(

@@ -110,0 +53,0 @@ `\nCreating a new ${chalk.cyan(

{
"name": "create-yoshi-app",
"version": "3.4.4",
"version": "3.6.0",
"description": "create yoshi powered apps",

@@ -17,3 +17,4 @@ "keywords": [

"scripts": {
"test": "jest"
"test": "jest",
"dev": "node scripts/dev.js"
},

@@ -41,2 +42,5 @@ "jest": {

"devDependencies": {
"chokidar": "^2.0.4",
"clipboardy": "^1.2.3",
"find-cache-dir": "^2.0.0",
"jest": "^23.3.0",

@@ -43,0 +47,0 @@ "tempy": "^0.2.1"

@@ -37,1 +37,7 @@ # create-yoshi-app

You can also use these on file names.
# development
```bash
npm run dev
```

@@ -5,38 +5,9 @@ const fs = require('fs-extra');

const replaceTemplates = require('./replaceTemplates');
const constantCase = require('constant-case');
const getValuesMap = require('./getValuesMap');
module.exports = (
{
authorName,
authorEmail,
organization,
projectType,
transpiler,
projectName,
},
workingDir,
) => {
const typescriptSuffix = transpiler === 'typescript' ? '-typescript' : '';
const templatePath = path.join(
__dirname,
'../templates',
projectType + typescriptSuffix,
);
module.exports = (answers, workingDir) => {
const valuesMap = getValuesMap(answers);
const valuesMap = {
projectName,
authorName,
authorEmail,
organization,
gitignore: '.gitignore',
packagejson: 'package.json',
};
const files = getFilesInDir(answers.templatePath);
for (const key in valuesMap) {
// create CONSTANT_CASE entries for values map
valuesMap[constantCase(key)] = constantCase(valuesMap[key]);
}
const files = getFilesInDir(templatePath);
for (const fileName in files) {

@@ -43,0 +14,0 @@ const fullPath = path.join(workingDir, fileName);

@@ -1,9 +0,9 @@

const fs = require('fs');
const path = require('path');
const getGitConfig = require('parse-git-config');
const getProjectTypes = require('./getProjectTypes');
module.exports = async () => {
const projectTypes = fs
.readdirSync(path.join(__dirname, '../templates'))
.filter(type => !type.endsWith('-typescript'));
const projectTypes = getProjectTypes().filter(
type => !type.endsWith('-typescript'),
);
const gitConfig = getGitConfig.sync({ include: true, type: 'global' });

@@ -10,0 +10,0 @@

@@ -1,7 +0,17 @@

const runPrompts = require('./runPrompt');
const runPrompt = require('./runPrompt');
const generateProject = require('./generateProject');
const replaceTemplates = require('./replaceTemplates');
const getValuesMap = require('./getValuesMap');
const verifyWorkingDirectory = require('./verifyWorkingDirectory');
const verifyRegistry = require('./verifyRegistry');
const getProjectTypes = require('./getProjectTypes');
module.exports = {
runPrompts,
runPrompt,
generateProject,
replaceTemplates,
getProjectTypes,
getValuesMap,
verifyRegistry,
verifyWorkingDirectory,
};
const templateRegex = /{%\w+%}/g;
module.exports = (content, map) => {
module.exports = (content, map, { graceful } = {}) => {
function replacer(match) {

@@ -8,2 +8,6 @@ const key = match.slice(2, -2);

if (!map.hasOwnProperty(key)) {
if (graceful) {
return match;
}
throw new Error(

@@ -10,0 +14,0 @@ `the key ${key} suppose to be one of the following: ${Object.keys(

const path = require('path');
const prompts = require('prompts');
const Answers = require('./Answers');
const getQuestions = require('./getQuestions');
module.exports = async (workingDir, options) => {
module.exports = async (workingDir = process.cwd()) => {
const questions = await getQuestions(workingDir);
const results = await prompts(questions, options);
let promptAborted = false;
// use customProjectDir to ask less questions
const answers = await prompts(questions, {
onCancel: () => {
promptAborted = true;
},
});
if (promptAborted) {
console.log();
console.log('Aborting ...');
process.exit(1);
}
// use the basename of the current working directory if projectName wasn't supplied
results.projectName = results.projectName || path.basename(workingDir);
answers.projectName = answers.projectName || path.basename(workingDir);
return results;
return new Answers(answers);
};
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