Skip to content

Commit

Permalink
Merge pull request #65 from JC-Coder/fix/gitignore-patch
Browse files Browse the repository at this point in the history
Fix/gitignore patch
  • Loading branch information
JC-Coder authored Mar 10, 2024
2 parents 8adf86f + 0d21d09 commit b745140
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 94 deletions.
29 changes: 29 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
profile:
name: qodana.starter

#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-js:latest
28 changes: 15 additions & 13 deletions src/utils/create-backend-project.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
addGitignore,
copyFile,
createAndUpdateFile,
createFolder,
Expand Down Expand Up @@ -36,10 +37,9 @@ import {
import ora from "ora";
import shell from "shelljs";
import crypto from "crypto";
import { processDependenciesInstall } from "./helper.js";
import { processDependenciesInstall } from "./helper.js";
import { sendStat } from "./stat.js";


/**
* function to create backend projects
*/
Expand All @@ -49,9 +49,9 @@ export async function createBackendProject(
framework,
database,
orm,
installDependencies
installDependencies,
) {
const spinner = ora('Creating Project ...').start();
const spinner = ora("Creating Project ...").start();
try {
const destinationPath = path.join(
process.cwd(),
Expand Down Expand Up @@ -79,7 +79,7 @@ export async function createBackendProject(

if (database) {
spinner.succeed();
spinner.start('Adding Database Module ...');
spinner.start("Adding Database Module ...");

switch (database) {
case "mongodb":
Expand Down Expand Up @@ -170,7 +170,7 @@ export async function createBackendProject(

if (database) {
spinner.succeed();
spinner.start('Adding Database Module ...');
spinner.start("Adding Database Module ...");

// create schema folder
createFolder(`${destinationPath}/src/modules/schemas`);
Expand Down Expand Up @@ -337,21 +337,23 @@ export async function createBackendProject(
}
}

addGitignore(framework, destinationPath);

// process dependencies install
if (installDependencies) {
spinner.succeed()
spinner.start("Installing dependencies ...")
spinner.succeed();
spinner.start("Installing dependencies ...");
await processDependenciesInstall(framework, destinationPath);
}

// success message
spinner.succeed()
spinner.succeed(`Backend project created successfully! : ${destinationPath}`)
spinner.succeed();
spinner.succeed(
`Backend project created successfully! : ${destinationPath}`,
);

// send stat
sendStat("startease", framework).then(() => {
})

sendStat("startease", framework).then(() => {});
} catch (e) {
console.log(`Error Creating Backend Project: ${e}`);
}
Expand Down
10 changes: 6 additions & 4 deletions src/utils/create-frontend-project.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { copyFile, getTemplateDir } from "./file-manager.js";
import { addGitignore, copyFile, getTemplateDir } from "./file-manager.js";
import path from "path";
import ora from "ora";
import { sendStat } from "./stat.js";
Expand Down Expand Up @@ -50,6 +50,7 @@ export async function createFrontendProject(projectName, framework, language) {
default:
break;
}
addGitignore(framework, destinationPath);

// success message
stages.push({
Expand Down Expand Up @@ -77,12 +78,14 @@ export async function createFrontendProject(projectName, framework, language) {
default:
break;
}
addGitignore(framework, destinationPath);

// success message
stages.push({
message: `Frontend - VueJs project with ${
language.charAt(0).toUpperCase() + language.slice(1)
} created successfully! : ${destinationPath}`, });
} created successfully! : ${destinationPath}`,
});
} else if (framework === "html-x-css-x-javascript") {
copyFile(getTemplateDir(`frontend/html-css-javascript`), destinationPath);

Expand All @@ -96,8 +99,7 @@ export async function createFrontendProject(projectName, framework, language) {
}

// update stat
sendStat("startease", framework).then(() => {
})
sendStat("startease", framework).then(() => {});
} catch (e) {
console.log(`Error Creating Frontend Project: ${e}`);
}
Expand Down
19 changes: 19 additions & 0 deletions src/utils/file-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,22 @@ export function createFolder(path) {
export const getTemplateDir = (filePath) => {
return path.join(__dirname, "..", "../templates", filePath);
};

/**
* Add .gitignore file to project scaffold
* @param {string} type
* @param {string} destination
*/
export function addGitignore(type, destination) {
const templateDir = getTemplateDir("gitignores");
const gitignoreDestination = `${destination}/.gitignore`;

if (["reactjs", "vuejs"].includes(type)) {
type = "nextjs";
}

const gitignoreSource = `${templateDir}/${type}`;

fs.createFileSync(gitignoreDestination);
fs.copyFileSync(gitignoreSource, gitignoreDestination);
}
24 changes: 0 additions & 24 deletions templates/frontend/reactjs/react-javascript-temp/.gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions templates/frontend/reactjs/react-typescript-temp/.gitignore

This file was deleted.

28 changes: 0 additions & 28 deletions templates/frontend/vuejs/vuejs-javascript-temp/.gitignore

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ Thumbs.db

# Typescript
*.tsbuildinfo

Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ coverage
*.njsproj
*.sln
*.sw?

# Environment configuration files
.env
39 changes: 39 additions & 0 deletions templates/gitignores/nestjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

dump.rdb
.env
access.log
File renamed without changes.

0 comments on commit b745140

Please sign in to comment.