Last active
February 28, 2023 23:04
-
-
Save H4ad/bc6e6f2af449942b8cd1b8220aa4adb9 to your computer and use it in GitHub Desktop.
Revisions
-
H4ad renamed this gist
Feb 28, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ # the description that will be shown during "tp list" description: "My simple template" # Where we can get this template # installUrl: # commands that will be read by tp generate: # name of your resource # this will be exposed like: tp generate setup <name> setup: description: "Initialize the API with some files" structure: -
H4ad created this gist
Feb 26, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ # the description that will be shown during "dobby list" description: "My simple template" # Where we can get this template # installUrl: # commands that will be read by dobby generate: # name of your resource # this will be exposed like: dobby generate setup <name> setup: description: "Initialize the API with some files" structure: # inside your resource, you can specificy which files will be created # it will be relative to the CLI, and you can specificy sub-folders by just putting folder/file src/$PARAM_SINGULAR_NAME$.api.js: content: |- const express = require('express'); const router = express.Router(); router.get('/$NAME$', (req, res) => res.json(JSON.parse({ hello: 'World' }))); module.exports = router; src/index.js: content: |- const $CAMEL_SINGULAR_NAME$ = require('$PARAM_SINGULAR_NAME$.api'); const express = require('express'); const app = express(); app.use('/$NAME$', $CAMEL_SINGULAR_NAME$); app.listen(3000); README.md: content: |- # Simple API This is an example of how this could work. ## Docs To customize the file content during generation, you can use the above variables: - `NAME`: $NAME$ - `PASCAL_SINGULAR_NAME`: $PASCAL_SINGULAR_NAME$ - `PARAM_SINGULAR_NAME`: $PARAM_SINGULAR_NAME$ - `CAMEL_SINGULAR_NAME`: $CAMEL_SINGULAR_NAME$ - `PASCAL_PLURAL_NAME`: $PASCAL_PLURAL_NAME$ - `CAMEL_PLURAL_NAME`: $CAMEL_PLURAL_NAME$ - `PARAM_PLURAL_NAME`: $PARAM_PLURAL_NAME$ - `PASCAL_NAME`: $PASCAL_NAME$ - `PARAM_NAME`: $PARAM_NAME$ - `CAMEL_NAME`: $CAMEL_NAME$ To work, you should put the name wrapped by `$`, like: `$TEST$`