-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,046 additions
and
1,158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ coverage | |
*.lcov | ||
.idea | ||
.nexp | ||
node-experience | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
import inquirer from 'inquirer'; | ||
import { Listr } from 'listr2'; | ||
import * as url from 'url'; | ||
|
||
import welcomeBox from './welcome.js'; | ||
import copyIndexFiles from '../lib/createProject/copyIndexFiles.js'; | ||
import createFolders from '../lib/createProject/createFolders.js'; | ||
import copyRootFiles from '../lib/createProject/copyRootFiles.js'; | ||
import cleanDomains from '../lib/createProject/cleanDomains/cleanDomains.js'; | ||
import copyDomainFiles from '../lib/createProject/copyDomainFiles.js'; | ||
import getChoices from '../lib/createProject/getChoices.js'; | ||
import createPackageJson from '../lib/createProject/package.js'; | ||
import setEvnVar from '../lib/createProject/setEnvVar.js'; | ||
import simpleGit from 'simple-git'; | ||
import fs from 'fs-extra'; | ||
|
||
const createProject = async() => | ||
{ | ||
console.log(welcomeBox); | ||
|
||
const rootPath = url.fileURLToPath(new URL('.', import.meta.url)).toString().replace('/bin', ''); | ||
|
||
const { orms, https } = await getChoices(rootPath); | ||
|
||
inquirer | ||
.prompt([ | ||
{ | ||
|
@@ -32,15 +28,8 @@ const createProject = async() => | |
type: 'list', | ||
name: 'orm', | ||
message: 'Choose an ORM.', | ||
choices: orms, | ||
choices: ['Mongoose', 'MikroORM'], | ||
default: 'Mongoose' | ||
}, | ||
{ | ||
type: 'list', | ||
name: 'http', | ||
message: 'Choose an HTTP Library.', | ||
choices: https, | ||
default: 'Koa' | ||
} | ||
]) | ||
.then((answers) => | ||
|
@@ -49,25 +38,45 @@ const createProject = async() => | |
|
||
console.log(answers); | ||
const tasks = new Listr([ | ||
{ | ||
{ | ||
title: 'Clone Node Experience', | ||
task: async() => | ||
{ | ||
const success = await fs.pathExists('node-experience'); | ||
|
||
if (!success) | ||
{ | ||
const options = { | ||
baseDir: process.cwd(), | ||
binary: 'git', | ||
maxConcurrentProcesses: 6, | ||
trimmed: false | ||
}; | ||
|
||
const git = simpleGit(options); | ||
await git.clone('[email protected]:DigiChanges/node-experience.git'); | ||
} | ||
} | ||
}, | ||
{ | ||
title: 'Initialization', | ||
task: async() => | ||
{ | ||
await createFolders(answers, rootPath); | ||
await createFolders(answers, './'); | ||
} | ||
}, | ||
{ | ||
title: 'Copy Index Files', | ||
task: async() => | ||
{ | ||
await copyIndexFiles(answers, rootPath); | ||
await copyIndexFiles(answers, './'); | ||
} | ||
}, | ||
{ | ||
title: 'Copy Root Files', | ||
task: async() => | ||
{ | ||
await copyRootFiles(answers, rootPath); | ||
await copyRootFiles(answers, './'); | ||
} | ||
}, | ||
{ | ||
|
@@ -81,21 +90,21 @@ const createProject = async() => | |
title: 'Copy Domain Files', | ||
task: async() => | ||
{ | ||
await copyDomainFiles(answers, rootPath); | ||
await copyDomainFiles(answers, './'); | ||
} | ||
}, | ||
{ | ||
title: 'Clean Domain Files', | ||
task: async() => | ||
{ | ||
await cleanDomains(answers, rootPath); | ||
await cleanDomains(answers, './'); | ||
} | ||
}, | ||
{ | ||
title: 'Create Package JSON', | ||
task: async() => | ||
{ | ||
await createPackageJson(answers, rootPath); | ||
await createPackageJson(answers, './'); | ||
} | ||
} | ||
]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import cleanOrm from './cleanOrm.js'; | ||
import cleanHttp from './cleanHttp.js'; | ||
import readInfoJsonNexp from '../readInfoJsonNexp.js'; | ||
|
||
const cleanDomains = async(vars, rootPath) => | ||
{ | ||
const { orm, http } = await readInfoJsonNexp(rootPath); | ||
const { orm } = await readInfoJsonNexp(rootPath); | ||
|
||
await cleanOrm(vars, orm); | ||
await cleanHttp(vars, http); | ||
}; | ||
|
||
export default cleanDomains; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.