easy-templates
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -0,1 +1,10 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import * as fs from 'fs'; | ||
@@ -11,3 +20,3 @@ import { exec } from 'child_process'; | ||
var indexContent = "import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport App from './App';\n\nconst root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);\nroot.render(\n\t<React.StrictMode>\n\t\t<App />\n\t</React.StrictMode>,\n);"; | ||
var packageJsonContent = "{\n\t\"name\": \"".concat(appName, "\",\n\t\"version\": \"1.0.0\",\n\t\"description\": \"").concat(appDescription, "\",\n\t\"author\": \"").concat(appAuthor, "\",\n\t\"keywords\": [],\n\t\"license\": \"").concat(appLicense, "\",\n\t\"private\": true,\n\t\"scripts\": {\n\t\t\"lint\": \"npx eslint src --fix\",\n\t\t\"start\": \"webpack serve --mode development\",\n\t\t\"build\": \"webpack --mode production\"\n\t},\n\t\"dependencies\": {\n\t\t\"react\": \"^18.2.0\",\n\t\t\"react-dom\": \"^18.2.0\",\n\t\t\"react-router-dom\": \"^6.17.0\",\n\t\t\"styled-components\": \"^6.1.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@babel/core\": \"^7.23.2\",\n\t\t\"@babel/preset-env\": \"^7.23.2\",\n\t\t\"@babel/preset-react\": \"^7.22.15\",\n\t\t\"@types/node\": \"^20.8.7\",\n\t\t\"@types/react\": \"^18.2.29\",\n\t\t\"@types/react-dom\": \"^18.2.13\",\n\t\t\"@types/react-router-dom\": \"^5.3.3\",\n\t\t\"@typescript-eslint/eslint-plugin\": \"^6.8.0\",\n\t\t\"@typescript-eslint/parser\": \"^6.8.0\",\n\t\t\"babel-loader\": \"^9.1.3\",\n\t\t\"copy-webpack-plugin\": \"^11.0.0\",\n\t\t\"css-loader\": \"^6.8.1\",\n\t\t\"eslint\": \"^8.51.0\",\n\t\t\"eslint-config-prettier\": \"^9.0.0\",\n\t\t\"eslint-plugin-prettier\": \"^5.0.1\",\n\t\t\"eslint-plugin-react-hooks\": \"^4.6.0\",\n\t\t\"html-webpack-plugin\": \"^5.5.3\",\n\t\t\"prettier\": \"^3.0.3\",\n\t\t\"style-loader\": \"^3.3.3\",\n\t\t\"ts-loader\": \"^9.5.0\",\n\t\t\"ts-node\": \"^10.9.1\",\n\t\t\"typescript\": \"^5.2.2\",\n\t\t\"webpack\": \"^5.89.0\",\n\t\t\"webpack-cli\": \"^5.1.4\",\n\t\t\"webpack-dev-server\": \"^4.15.1\"\n\t}\n}"); | ||
var packageJsonContent = "{\n\t\"name\": \"".concat(appName, "\",\n\t\"version\": \"1.0.0\",\n\t\"description\": \"").concat(appDescription, "\",\n\t\"author\": \"").concat(appAuthor, "\",\n\t\"keywords\": [],\n\t\"license\": \"").concat(appLicense, "\",\n\t\"private\": true,\n\t\"scripts\": {\n\t\t\"lint\": \"npx eslint src --fix\",\n\t\t\"start\": \"webpack serve --mode development\",\n\t\t\"build\": \"webpack --mode production\"\n\t},\n\t\"dependencies\": {},\n\t\"devDependencies\": {}\n}"); | ||
var prettierContent = "module.exports = {\n\tsemi: true,\n\ttrailingComma: 'all',\n\tsingleQuote: true,\n\tprintWidth: 100,\n}"; | ||
@@ -57,17 +66,68 @@ var eslintContent = "/* eslint-env node */\nmodule.exports = {\n\textends: [\n\t\t'eslint:recommended',\n\t\t'plugin:@typescript-eslint/recommended',\n\t\t'plugin:prettier/recommended',\n\t],\n\tparser: '@typescript-eslint/parser',\n\tplugins: ['@typescript-eslint', 'react-hooks'],\n\troot: true,\n\trules: {\n\t\t'react-hooks/rules-of-hooks': 'error', // Check rules of Hooks\n\t\t'react-hooks/exhaustive-deps': 'warn', // Add this rule\n\t},\n};"; | ||
fs.writeFileSync(folderName + '/README.md', readmeContent); | ||
var child = spawn(packageManager, ['install'], { cwd: folderName, stdio: 'inherit' }); | ||
var installDependencies = ['install']; | ||
var installDevDependencies = ['install']; | ||
var dependencies = ['react', 'react-dom', 'react-router-dom', 'styled-components']; | ||
var devDependencies = [ | ||
'@babel/core', | ||
'@babel/preset-env', | ||
'@babel/preset-react', | ||
'@types/node', | ||
'@types/react', | ||
'@types/react-dom', | ||
'@types/react-router-dom', | ||
'@typescript-eslint/eslint-plugin', | ||
'@typescript-eslint/parser', | ||
'babel-loader', | ||
'copy-webpack-plugin', | ||
'css-loader', | ||
'eslint', | ||
'eslint-config-prettier', | ||
'eslint-plugin-prettier', | ||
'eslint-plugin-react-hooks', | ||
'html-webpack-plugin', | ||
'prettier', | ||
'style-loader', | ||
'ts-loader', | ||
'ts-node', | ||
'typescript', | ||
'webpack', | ||
'webpack-cli', | ||
'webpack-dev-server', | ||
]; | ||
switch (packageManager) { | ||
case 'yarn': | ||
installDependencies = __spreadArray(['add'], dependencies, true); | ||
installDevDependencies = __spreadArray(['add', '--dev'], devDependencies, true); | ||
break; | ||
default: | ||
installDependencies = __spreadArray(['install'], dependencies, true); | ||
installDevDependencies = __spreadArray(['install', 'save-dev'], devDependencies, true); | ||
break; | ||
} | ||
var child = spawn(packageManager, installDependencies, { cwd: folderName, stdio: 'inherit' }); | ||
child.on('exit', function (code) { | ||
if (code === 0) { | ||
console.log('\nFolder structure created and dependencies installed successfully\n'); | ||
console.log("# My App\n\nThis is my app.\n\n## Getting Started\n\nTo get started, run the following commands:\n\n### npm start\n\n### 'npm run build'\n\n### yarn start\n\n### yarn build\n\nThen, open [http://localhost:3000] to view it in the browser.\n\n## License Gabriel Logan Copyright 2023\n\n## Happy hacking (:\n"); | ||
exec(packageManager === 'npm' | ||
? "cd ".concat(folderName, " && npm run lint") | ||
: "cd ".concat(folderName, " && yarn lint")); | ||
var child2 = spawn('cd', [folderName]); | ||
child2.on('exit', function (code) { | ||
var child2devDep = spawn(packageManager, installDevDependencies, { | ||
cwd: folderName, | ||
stdio: 'inherit', | ||
}); | ||
child2devDep.on('exit', function (code) { | ||
if (code === 0) { | ||
console.log("Run npm start or yarn start - ".concat(folderName, " directory")); | ||
console.log('\nFolder structure created and dependencies installed successfully\n'); | ||
console.log("# My App\n\nThis is my app.\n\n## Getting Started\n\nTo get started, run the following commands:\n\n### npm start\n\n### 'npm run build'\n\n### yarn start\n\n### yarn build\n\nThen, open [http://localhost:3000] to view it in the browser.\n\n## License Gabriel Logan Copyright 2023\n\n## Happy hacking (: \n"); | ||
exec(packageManager === 'npm' | ||
? "cd ".concat(folderName, " && npm run lint") | ||
: "cd ".concat(folderName, " && yarn lint")); | ||
var child2 = spawn('cd', [folderName]); | ||
child2.on('exit', function (code) { | ||
if (code === 0) { | ||
console.log("Run npm start or yarn start - ".concat(folderName, " directory")); | ||
} | ||
else { | ||
console.error("Error navigating to the ".concat(folderName, " directory")); | ||
} | ||
}); | ||
} | ||
else { | ||
console.error("Error navigating to the ".concat(folderName, " directory")); | ||
console.error("Error running '".concat(packageManager, " install' with exit code ").concat(code)); | ||
} | ||
@@ -74,0 +134,0 @@ }); |
{ | ||
"name": "easy-templates", | ||
"author": "Gabriel Logan", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "easy-templates - A library for creating various templates easily and efficiently using NPX.", | ||
@@ -6,0 +6,0 @@ "bin": "bin/index.js", |
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
37247
530
5
1