create-fivem-resource
Advanced tools
| { | ||
| "name": "create-fivem-resource", | ||
| "version": "1.0.6", | ||
| "version": "1.0.9", | ||
| "license": "MIT", | ||
@@ -8,2 +8,5 @@ "bin": { | ||
| }, | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
@@ -10,0 +13,0 @@ "start": "ts-node src/index.ts", |
@@ -57,3 +57,3 @@ "use strict"; | ||
| type: "list", | ||
| name: "nuiFramewok", | ||
| name: "nuiFramework", | ||
| message: "Nui framework :", | ||
@@ -60,0 +60,0 @@ choices: ["Vue", "React"], |
@@ -41,3 +41,3 @@ "use strict"; | ||
| (0, fs_1.mkdirSync)(tmpPath); | ||
| yield git.clone(repoUrl, tmpPath); | ||
| yield git.clone(repoUrl, tmpPath, { "--depth": 1 }); | ||
| console.log("Template fetched successfully!"); | ||
@@ -44,0 +44,0 @@ ///// COPY TEMPLATE FILES ///// |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.installDependencies = exports.hasPackageJson = void 0; | ||
| const path_1 = require("path"); | ||
| const fs_1 = require("fs"); | ||
| const path_1 = require("path"); | ||
| const child_process_1 = require("child_process"); | ||
| // Function to recursively find all package.json files | ||
| const findPackageJsonFiles = (dir, fileList = []) => { | ||
| const files = (0, fs_1.readdirSync)(dir); | ||
| files.forEach((file) => { | ||
| const filePath = (0, path_1.join)(dir, file); | ||
| const stat = (0, fs_1.statSync)(filePath); | ||
| if (stat.isDirectory()) { | ||
| findPackageJsonFiles(filePath, fileList); | ||
| } | ||
| else if (file === "package.json") { | ||
| fileList.push(filePath); | ||
| } | ||
| }); | ||
| return fileList; | ||
| }; | ||
| const hasPackageJson = (projectPath) => { | ||
| return findPackageJsonFiles(projectPath).length > 0; | ||
| return (0, fs_1.existsSync)((0, path_1.join)(projectPath, "package.json")); | ||
| }; | ||
| exports.hasPackageJson = hasPackageJson; | ||
| const installDependencies = (projectPath) => { | ||
| const packageJsonFiles = findPackageJsonFiles(projectPath); | ||
| for (const packageJsonFile of packageJsonFiles) { | ||
| //get directory of package.json file | ||
| const packageJsonDir = (0, path_1.dirname)(packageJsonFile); | ||
| //install dependencies | ||
| (0, child_process_1.execSync)("npm install", { cwd: packageJsonDir, stdio: "inherit" }); | ||
| } | ||
| (0, child_process_1.execSync)("pnpm install", { cwd: projectPath, stdio: "inherit" }); | ||
| }; | ||
| exports.installDependencies = installDependencies; |
@@ -6,7 +6,7 @@ "use strict"; | ||
| const runtime = config.runtime.toLowerCase(); | ||
| if (!config.Nui) { | ||
| if (!config.nuiFramework) { | ||
| return `${runtime}/vanilla`; | ||
| } | ||
| return `${runtime}/nui/${config.nuiFramewok.toLowerCase()}`; | ||
| return `${runtime}/nui/${config.nuiFramework.toLowerCase()}`; | ||
| }; | ||
| exports.getInternalTemplatePath = getInternalTemplatePath; |
@@ -6,2 +6,15 @@ "use strict"; | ||
| const fs_1 = require("fs"); | ||
| const removeScripts = (scripts, workspace) => { | ||
| // Create a copy of the scripts object to avoid mutating the original | ||
| const updatedScripts = Object.assign({}, scripts); | ||
| // Iterate over the keys of the object | ||
| for (const key in updatedScripts) { | ||
| // Check if the key contains ":web" | ||
| if (key.includes(`:${workspace}`)) { | ||
| // Delete the key from the updatedScripts object | ||
| delete updatedScripts[key]; | ||
| } | ||
| } | ||
| return updatedScripts; | ||
| }; | ||
| const updatePackageJson = (projectPath, resourceName, config) => { | ||
@@ -24,2 +37,14 @@ // Update package.json with user inputs | ||
| } | ||
| let scripts = packageJson.scripts; | ||
| // Remove scripts if not needed | ||
| if (!config.type.includes("server")) { | ||
| scripts = removeScripts(scripts, "server"); | ||
| } | ||
| if (!config.type.includes("client")) { | ||
| scripts = removeScripts(scripts, "client"); | ||
| } | ||
| if (!config.nuiFramework) { | ||
| scripts = removeScripts(scripts, "web"); | ||
| } | ||
| packageJson.scripts = scripts; | ||
| (0, fs_1.writeFileSync)(packageJsonPath, JSON.stringify(packageJson, null, 2)); | ||
@@ -26,0 +51,0 @@ }; |
+1
-1
| { | ||
| "name": "create-fivem-resource", | ||
| "version": "1.0.8", | ||
| "version": "1.0.9", | ||
| "license": "MIT", | ||
@@ -5,0 +5,0 @@ "bin": { |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
16933
1.18%308
1.32%