mirror of
https://github.com/filiprojek/nork.git
synced 2024-11-23 01:01:04 +01:00
code formatted
This commit is contained in:
parent
564cd09d8b
commit
03fbb74171
@ -3,27 +3,16 @@
|
|||||||
"es2021": true,
|
"es2021": true,
|
||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 6,
|
"ecmaVersion": 6,
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": ["@typescript-eslint"],
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent": [
|
"indent": ["error", "tab"],
|
||||||
"error",
|
"linebreak-style": ["error", "unix"],
|
||||||
"tab"
|
|
||||||
],
|
|
||||||
"linebreak-style": [
|
|
||||||
"error",
|
|
||||||
"unix"
|
|
||||||
],
|
|
||||||
"quotes": [
|
"quotes": [
|
||||||
"error",
|
"error",
|
||||||
"single",
|
"single",
|
||||||
@ -31,9 +20,6 @@
|
|||||||
"allowTemplateLiterals": true
|
"allowTemplateLiterals": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"semi": [
|
"semi": ["error", "never"]
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
.prettierrc
Normal file
15
.prettierrc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 4,
|
||||||
|
"useTabs": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"semi": false,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"jsxBracketSameLine": true,
|
||||||
|
"printWidth": 200,
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"vueIndentScriptAndStyle": true,
|
||||||
|
"arrowParens": "always",
|
||||||
|
"bracketSameLine": false,
|
||||||
|
"endOfLine": "lf"
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
# Nork
|
# Nork
|
||||||
|
|
||||||
Simple node.js tool that extends express projects.
|
Simple node.js tool that extends express projects.
|
||||||
|
|
||||||
- [About](#about)
|
- [About](#about)
|
||||||
@ -6,17 +7,23 @@ Simple node.js tool that extends express projects.
|
|||||||
- [How to use](#how-to-use)
|
- [How to use](#how-to-use)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
The point of this tool is to add to express some feeling of php framework Laravel. Primarily get simply express app into MVC architecture.
|
The point of this tool is to add to express some feeling of php framework Laravel. Primarily get simply express app into MVC architecture.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install -g nork
|
npm install -g nork
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install nork globally. If you would like to install nork for only one project, you can also install it locally. For local installation:
|
This will install nork globally. If you would like to install nork for only one project, you can also install it locally. For local installation:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install nork
|
npm install nork
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
```
|
```
|
||||||
Usage: nork <command> [options]
|
Usage: nork <command> [options]
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
"copy-assets": "ts-node src/utils/copyAssets",
|
"copy-assets": "ts-node src/utils/copyAssets",
|
||||||
"build": "npm-run-all clean tsc copy-assets",
|
"build": "npm-run-all clean tsc copy-assets",
|
||||||
"test": "mocha --config .mocharc.json --watch src/**/*.test.ts",
|
"test": "mocha --config .mocharc.json --watch src/**/*.test.ts",
|
||||||
"prepublish": "npm-run-all build"
|
"prepublish": "npm-run-all build",
|
||||||
|
"format": "npx prettier --write ."
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"node",
|
"node",
|
||||||
@ -42,6 +43,7 @@
|
|||||||
"eslint": "^8.3.0",
|
"eslint": "^8.3.0",
|
||||||
"mocha": "^9.1.3",
|
"mocha": "^9.1.3",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
|
"prettier": "^2.7.1",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"ts-node": "^10.4.0",
|
"ts-node": "^10.4.0",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* spell-checker: disable */
|
/_ spell-checker: disable _/
|
||||||
|
|
||||||
# Todo:
|
# Todo:
|
||||||
|
|
||||||
- [ ] auth jwt refresh token based system
|
- [ ] auth jwt refresh token based system
|
||||||
- https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/
|
- https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/
|
||||||
- [ ] version of nork control
|
- [ ] version of nork control
|
||||||
@ -9,8 +10,8 @@
|
|||||||
- [ ] vyzadovat aktualni verzi 3.#.# pro make commandy (pouzivaly se jiny predtim soubory)
|
- [ ] vyzadovat aktualni verzi 3.#.# pro make commandy (pouzivaly se jiny predtim soubory)
|
||||||
- [ ] moznost vytvorit projekt bez db
|
- [ ] moznost vytvorit projekt bez db
|
||||||
|
|
||||||
|
|
||||||
### 11-24-2021
|
### 11-24-2021
|
||||||
|
|
||||||
- zacal jsem predelavat nork do OOP
|
- zacal jsem predelavat nork do OOP
|
||||||
- co jsem udelal:
|
- co jsem udelal:
|
||||||
- [x] --help
|
- [x] --help
|
||||||
@ -23,10 +24,12 @@
|
|||||||
- zatim netestovana funkcnost
|
- zatim netestovana funkcnost
|
||||||
|
|
||||||
### 1-10-2022
|
### 1-10-2022
|
||||||
|
|
||||||
- dodelal jsem create a otestoval ho
|
- dodelal jsem create a otestoval ho
|
||||||
- [x] create
|
- [x] create
|
||||||
|
|
||||||
### 7-30-2022
|
### 7-30-2022
|
||||||
|
|
||||||
- norkconfig se generuje lepe a actually ho pouzivam
|
- norkconfig se generuje lepe a actually ho pouzivam
|
||||||
- pri vytvareni projektu je mozne vybrat si orm (mongoose & sequlize)
|
- pri vytvareni projektu je mozne vybrat si orm (mongoose & sequlize)
|
||||||
- default modely pro db se kopiruji na zaklade parametru db z norkconfigu
|
- default modely pro db se kopiruji na zaklade parametru db z norkconfigu
|
||||||
|
@ -14,7 +14,7 @@ export default class Create {
|
|||||||
{
|
{
|
||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'project_name',
|
name: 'project_name',
|
||||||
message: 'Enter project name:',
|
message: 'Enter project name:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'list',
|
type: 'list',
|
||||||
@ -22,8 +22,8 @@ export default class Create {
|
|||||||
name: 'lang',
|
name: 'lang',
|
||||||
choices: [
|
choices: [
|
||||||
{ name: 'Typescript', value: 'ts' },
|
{ name: 'Typescript', value: 'ts' },
|
||||||
{ name: 'Javascript - DEPRECATED', value: 'js' },
|
{ name: 'Javascript - DEPRECATED', value: 'js' }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'list',
|
type: 'list',
|
||||||
@ -32,24 +32,24 @@ export default class Create {
|
|||||||
choices: [
|
choices: [
|
||||||
{ name: 'MongoDB - Mongoose', value: { db: 'mongodb', orm: 'mongoose' } },
|
{ name: 'MongoDB - Mongoose', value: { db: 'mongodb', orm: 'mongoose' } },
|
||||||
{ name: 'MySQL - Sequelize', value: { db: 'mysql', orm: 'sequelize' } },
|
{ name: 'MySQL - Sequelize', value: { db: 'mysql', orm: 'sequelize' } },
|
||||||
{ name: 'PostgreSQL - Sequelize', value: { db: 'postgresql', orm: 'sequelize' } },
|
{ name: 'PostgreSQL - Sequelize', value: { db: 'postgresql', orm: 'sequelize' } }
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'author',
|
name: 'author',
|
||||||
message: 'Enter your name:',
|
message: 'Enter your name:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'email',
|
name: 'email',
|
||||||
message: 'Enter your email:',
|
message: 'Enter your email:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'website',
|
name: 'website',
|
||||||
message: 'Enter your website:',
|
message: 'Enter your website:'
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
// remove first question if project name is already known
|
// remove first question if project name is already known
|
||||||
if (projectName) questions.shift()
|
if (projectName) questions.shift()
|
||||||
@ -61,7 +61,7 @@ export default class Create {
|
|||||||
author: answers.author,
|
author: answers.author,
|
||||||
database: answers.db,
|
database: answers.db,
|
||||||
website: answers.website,
|
website: answers.website,
|
||||||
email: answers.email,
|
email: answers.email
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy skeleton to new project
|
// copy skeleton to new project
|
||||||
@ -76,7 +76,7 @@ export default class Create {
|
|||||||
const pkgJson = fs.readJsonSync(path.join(projectPath, 'package.json'))
|
const pkgJson = fs.readJsonSync(path.join(projectPath, 'package.json'))
|
||||||
pkgJson.name = data.project_name
|
pkgJson.name = data.project_name
|
||||||
pkgJson.author = `${data.author} <${data.email}> (${data.website})`
|
pkgJson.author = `${data.author} <${data.email}> (${data.website})`
|
||||||
fs.writeFile(path.join(projectPath, 'package.json'), JSON.stringify(pkgJson, null, 2), err => {
|
fs.writeFile(path.join(projectPath, 'package.json'), JSON.stringify(pkgJson, null, 2), (err) => {
|
||||||
if (err) return global.logError(err.message)
|
if (err) return global.logError(err.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@ export interface Questions {
|
|||||||
{
|
{
|
||||||
name: string
|
name: string
|
||||||
value: string
|
value: string
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ const root_get = (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root_get,
|
root_get
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,12 @@ const modelSchema = new Schema(
|
|||||||
{
|
{
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
timestamps: true,
|
timestamps: true
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const ModelName = mongoose.model('ModelName', modelSchema)
|
const ModelName = mongoose.model('ModelName', modelSchema)
|
||||||
|
@ -4,12 +4,12 @@ const modelSchema = new Schema<any>(
|
|||||||
{
|
{
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
timestamps: true,
|
timestamps: true
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
export default model('ModelName', modelSchema)
|
export default model('ModelName', modelSchema)
|
||||||
|
@ -13,8 +13,8 @@ export default class Setup {
|
|||||||
name: 'lang',
|
name: 'lang',
|
||||||
choices: [
|
choices: [
|
||||||
{ name: 'Typescript', value: 'ts' },
|
{ name: 'Typescript', value: 'ts' },
|
||||||
{ name: 'Javascript', value: 'js' },
|
{ name: 'Javascript', value: 'js' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
const answers = await inquirer.prompt(Object(questions))
|
const answers = await inquirer.prompt(Object(questions))
|
||||||
fs.writeJsonSync(path.join(process.cwd(), './norkconfig.json'), answers)
|
fs.writeJsonSync(path.join(process.cwd(), './norkconfig.json'), answers)
|
||||||
|
@ -15,13 +15,13 @@ const app = express()
|
|||||||
const dbURI = process.env.DB_URI
|
const dbURI = process.env.DB_URI
|
||||||
mongoose
|
mongoose
|
||||||
.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true })
|
.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true })
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
console.log('connected to db')
|
console.log('connected to db')
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`server is running on http://localhost:${port}`)
|
console.log(`server is running on http://localhost:${port}`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -4,5 +4,5 @@ const root_get = (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root_get,
|
root_get
|
||||||
}
|
}
|
||||||
|
@ -10,26 +10,26 @@ Instance.init(
|
|||||||
type: DataTypes.UUID,
|
type: DataTypes.UUID,
|
||||||
primaryKey: true,
|
primaryKey: true,
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
unique: true,
|
unique: true
|
||||||
},
|
},
|
||||||
username: {
|
username: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
allowNull: false,
|
allowNull: false
|
||||||
},
|
},
|
||||||
password: {
|
password: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
allowNull: false,
|
allowNull: false
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
unique: true,
|
unique: true
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sequelize: db,
|
sequelize: db,
|
||||||
tableName: path.basename(__filename).split('.')[0].toLowerCase(),
|
tableName: path.basename(__filename).split('.')[0].toLowerCase()
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
export default Instance
|
export default Instance
|
||||||
|
@ -1,23 +1,15 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
"target": "es6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||||
"module": "commonjs", /* Specify what module code is generated. */
|
"module": "commonjs" /* Specify what module code is generated. */,
|
||||||
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
||||||
"rootDir": "./src", /* Specify the root folder within your source files. */
|
"rootDir": "./src" /* Specify the root folder within your source files. */,
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true /* Enable all strict type-checking options. */,
|
||||||
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
|
||||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
|
||||||
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
||||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||||
"declaration": true,
|
"declaration": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": ["_old", "node_modules", "src/make-files", "src/skeletons", "src/tests", "src/interfaces", "src/utils"]
|
||||||
"_old",
|
|
||||||
"node_modules",
|
|
||||||
"src/make-files",
|
|
||||||
"src/skeletons",
|
|
||||||
"src/tests",
|
|
||||||
"src/interfaces",
|
|
||||||
"src/utils"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user