FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.88k stars 137 forks source link

foal CLI [request] #607

Closed anonimusprogramus closed 4 years ago

anonimusprogramus commented 4 years ago

Based on my experiences (ymmv):

  1. From time to time, I added controller/entities/services to its folder, usually by using CLI, but sometimes manually.

Would it be possible to have a command to re-index the index.ts with newest file list, like foal do reindex?

  1. Sometimes I had to clean compiled files in /build folder before re-starting server.

A command for cleaning then starting server might be a good idea.

FoalTS rocks, thanks!

LoicPoullain commented 4 years ago

FoalTS rocks, thanks!

Thanks!

Sometimes I had to clean compiled files in /build folder before re-starting server.

Thank for the suggestion. It's true that it is sometimes annoying (especially with migrations and spec files). I added a new command foal rmdir build to remove recursively a directory. It will be released with v1.6. Once done, here is a way to update your package.json to obtain the desired behavior:

  "scripts": {
    "build:app": "foal rmdir build/app && copy-cli \"src/**/*.html\" build && tsc -p tsconfig.app.json",
    "build:app:w": "tsc -p tsconfig.app.json -w",
    "start": "node ./build/index.js",
    "start:w": "supervisor -w ./build --no-restart-on error ./build/index.js",
    "develop": "npm run build:app && concurrently \"npm run build:app:w\" \"npm run start:w\"",
    "build:test": "foal rmdir build && copy-cli \"src/**/*.html\" build && tsc -p tsconfig.test.json",
    "build:test:w": "tsc -p tsconfig.test.json -w",
    "start:test": "mocha --file \"./build/test.js\" \"./build/**/*.spec.js\"",
    "start:test:w": "mocha --file \"./build/test.js\" -w \"./build/**/*.spec.js\"",
    "test": "npm run build:test && concurrently \"npm run build:test:w\" \"npm run start:test:w\"",
    "build:e2e": "foal rmdir build/e2e && copy-cli \"src/**/*.html\" build && tsc -p tsconfig.e2e.json",
    "build:e2e:w": "tsc -p tsconfig.e2e.json -w",
    "start:e2e": "mocha --file \"./build/e2e.js\" \"./build/e2e/**/*.js\"",
    "start:e2e:w": "mocha --file \"./build/e2e.js\" -w \"./build/e2e/**/*.js\"",
    "e2e": "npm run build:e2e && concurrently \"npm run build:e2e:w\" \"npm run start:e2e:w\"",
    "build:scripts": "foal rmdir build/scripts && tsc -p tsconfig.scripts.json",
    "build:scripts:w": "tsc -p tsconfig.scripts.json -w",
    "lint": "eslint --ext ts src",
    "lint:fix": "eslint --ext ts --fix src",
    "build:migrations": "foal rmdir build/migrations && tsc -p tsconfig.migrations.json",
    "migration:generate": "./node_modules/.bin/typeorm migration:generate",
    "migration:run": "./node_modules/.bin/typeorm migration:run",
    "migration:revert": "./node_modules/.bin/typeorm migration:revert"
  },

Would it be possible to have a command to re-index the index.ts with newest file list, like foal do reindex?

I'm not sure this problem is shared by many users and implementing this feature would require a bit of work. I'd rather focus on other features for now ;)

LoicPoullain commented 4 years ago

PR merged