easy-templates
Advanced tools
Comparing version 0.0.5 to 0.0.6
#!/usr/bin/env node | ||
import inquirer from 'inquirer'; | ||
import path from 'path'; | ||
import criarEstruturaDePastasReactTsWebpack from './src/react-ts-webpack/index.js'; | ||
import { questions } from './src/types/index.js'; | ||
inquirer.prompt(questions).then((answers) => { | ||
const currentFolder = path.basename(process.cwd()).replace(/\s+/g, '-'); | ||
const userInput = { | ||
packageManager: answers.packageManager, | ||
appName: answers.appName || currentFolder, | ||
appDescription: answers.appDescription || 'App Description', | ||
appAuthor: answers.appAuthor || '', | ||
appLicense: answers.appLicense || 'ISC', | ||
selectedTemplate: answers.template, | ||
import { firstQuestion, questions, separetedFiles } from './src/promptArrays/index.js'; | ||
import criarEstruturaDePastasReactTsWebpack from './src/templates/react-ts-webpack/index.js'; | ||
import createAndInstallTsEslintPrettier from './src/presets/ts-eslint-prettier/index.js'; | ||
import simpleHtmlJsCssStructure from './src/templates/simpleHtmlJsCssStructure/index.js'; | ||
import createAndInstallJsEslint from './src/presets/js-eslint/index.js'; | ||
inquirer.prompt(firstQuestion).then(function (answer) { | ||
var userFisrtInput = { | ||
firstQuestionChoice: answer.firstQuestionChoice, | ||
packageManager: answer.packageManager, | ||
}; | ||
if (userInput.selectedTemplate === 'reactjs_ts_webpack_react-router-dom_styled-components_babel') { | ||
criarEstruturaDePastasReactTsWebpack(userInput); | ||
if (userFisrtInput.firstQuestionChoice === 'Complete template') { | ||
inquirer.prompt(questions).then(function (answers) { | ||
var currentFolder = path.basename(process.cwd()).replace(/\s+/g, '-'); | ||
var userInput = { | ||
packageManager: userFisrtInput.packageManager, | ||
appName: answers.appName || currentFolder, | ||
appDescription: answers.appDescription || 'App Description', | ||
appAuthor: answers.appAuthor || '', | ||
appLicense: answers.appLicense || 'ISC', | ||
selectedTemplate: answers.template, | ||
}; | ||
switch (userInput.selectedTemplate) { | ||
case 'reactjs_ts_webpack_react-router-dom_styled-components_babel': | ||
criarEstruturaDePastasReactTsWebpack(userInput); | ||
break; | ||
case 'simple-Html-Js-Css-Structure': | ||
simpleHtmlJsCssStructure(userInput); | ||
break; | ||
default: | ||
console.error("This template doesn't exist"); | ||
break; | ||
} | ||
}); | ||
} | ||
else if (userFisrtInput.firstQuestionChoice === 'Separete files') { | ||
inquirer.prompt(separetedFiles).then(function (answers) { | ||
var separetedFiles = { | ||
packageManager: userFisrtInput.packageManager, | ||
filesToInstall: answers.filesToInstall, | ||
}; | ||
switch (separetedFiles.filesToInstall) { | ||
case 'ts-eslint-prettier': | ||
createAndInstallTsEslintPrettier(separetedFiles); | ||
break; | ||
case 'js-eslint-generic': | ||
createAndInstallJsEslint(separetedFiles); | ||
break; | ||
default: | ||
console.error("This files doesn't exist"); | ||
break; | ||
} | ||
}); | ||
} | ||
else { | ||
console.error("This template doesn't exist"); | ||
console.error('Exit, Process finished'); | ||
} | ||
}); |
@@ -1,36 +0,1 @@ | ||
const templateChoices = ['reactjs_ts_webpack_react-router-dom_styled-components_babel']; | ||
const packageManager = ['yarn', 'npm']; | ||
export const questions = [ | ||
{ | ||
type: 'list', | ||
name: 'packageManager', | ||
message: 'Choose package manager:', | ||
choices: packageManager, | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'appName', | ||
message: 'Enter the name of your app in package.json:', | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'appDescription', | ||
message: 'Enter the description:', | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'appAuthor', | ||
message: 'Enter the author:', | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'appLicense', | ||
message: 'Enter the license:', | ||
}, | ||
{ | ||
type: 'list', | ||
name: 'template', | ||
message: 'Choose a template:', | ||
choices: templateChoices, | ||
}, | ||
]; | ||
export {}; |
{ | ||
"name": "easy-templates", | ||
"author": "Gabriel Logan", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "easy-templates - A library for creating various templates easily and efficiently using NPX.", | ||
"bin": "bin/index.js", | ||
"types": "types", | ||
"scripts": { | ||
@@ -36,2 +37,6 @@ "test": "echo \"Error: no test specified\" && exit 1", | ||
"license": "MIT", | ||
"dependencies": { | ||
"cross-spawn": "^7.0.3", | ||
"inquirer": "^9.2.11" | ||
}, | ||
"devDependencies": { | ||
@@ -41,4 +46,4 @@ "@types/cross-spawn": "^6.0.4", | ||
"@types/node": "^20.8.7", | ||
"@typescript-eslint/eslint-plugin": "^6.8.0", | ||
"@typescript-eslint/parser": "^6.8.0", | ||
"@typescript-eslint/eslint-plugin": "^6.9.0", | ||
"@typescript-eslint/parser": "^6.9.0", | ||
"eslint": "^8.52.0", | ||
@@ -50,7 +55,3 @@ "eslint-config-prettier": "^9.0.0", | ||
"typescript": "^5.2.2" | ||
}, | ||
"dependencies": { | ||
"cross-spawn": "^7.0.3", | ||
"inquirer": "^9.2.11" | ||
} | ||
} |
@@ -23,4 +23,12 @@ # easy-templates | ||
Templates | ||
- **reactjs_ts_webpack_react-router-dom_styled-components_babel**: Reactjs with typescript, webpack, react-router-dom and styled-components pre configured | ||
- **simple-Html-Js-Css-Structure**: Create a simple structure using html css and javascript | ||
Pre configs only | ||
- **js-eslint-generic**: Run a sub runner asking for several custom options | ||
- **ts-eslint-prettier**: Create a file structure and install dependencies using ts eslint and prettier | ||
### Help the dev | ||
@@ -27,0 +35,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
36061
10
40
475
6
2