@bam.tech/kettle
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "@bam.tech/kettle", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "./dist/kettle.js", | ||
@@ -5,0 +5,0 @@ "types": "./dist/kettle.d.ts", |
127
README.md
@@ -31,2 +31,20 @@ # Kettle | ||
## Using Kettle templates in paths | ||
Kettle will also replace values in paths: | ||
- Input: `path/to/__replace__appName__/file.env` will output `path/to/myApp/file.env` | ||
To add a folder/file conditionnaly: | ||
- With `path/to/__replace__appName____if__isTrue__/subFolder__if__isTrue__/file.env`, the resulting file will appear in the written file at the path `path/to/myApp/subFolder/file.env` | ||
- With `path/to/__replace__appName__/subFolder__if__isFalse__/file.env`, Kettle will not write any file | ||
## Reverse assertions | ||
It is possible to reverse assertions using `!` | ||
For example, `path/to/__replace__appName__/subFolder__if__!isFalse__/file.env` will render `path/to/myApp/subFolder/file.env` | ||
## Using Kettle templates in files | ||
@@ -37,2 +55,6 @@ | ||
```javascript | ||
const import1 = require('path/to/imports1__if__isFalse__/import1.js'); | ||
const import2 = require('path/to/imports2__if__isTrue__/import2.js'); | ||
const import2 = require('path/to/imports2__if__!isTrue__/import2.js'); | ||
// __if__isTrue__ | ||
@@ -45,2 +67,5 @@ __replace__functionName__(); | ||
// __endif__ | ||
// __if__!isTrue__ | ||
shouldNotAppear(); | ||
// __endif__ | ||
``` | ||
@@ -51,2 +76,4 @@ | ||
```javascript | ||
const import2 = require('path/to/imports1/import1.js'); | ||
myFunction(); | ||
@@ -56,3 +83,3 @@ console.log('myApp'); | ||
Supported comment syntax: | ||
## Supported comment syntax: | ||
@@ -62,12 +89,94 @@ - `//` | ||
## Using Kettle templates in paths | ||
## Syntax highlighting | ||
Kettle will also replace values in paths: | ||
### VSCode | ||
- Input: `path/to/__replace__appName__/file.env` will output `path/to/myApp/file.env` | ||
To highlight Kettle syntax it is advised to install the [VSCode Highlight](https://github.com/fabiospampinato/vscode-highlight.git) plugin and use the following rules in `.vscode/settings.json`: | ||
To add a folder/file conditionnaly: | ||
- With `path/to/__replace__appName____if__isTrue__/subFolder__if__isTrue__/file.env`, the resulting file will appear in the written file at the path `path/to/myApp/subFolder/file.env` | ||
- With `path/to/__replace__appName__/subFolder__if__isFalse__/file.env`, Kettle will not write any file | ||
```json | ||
{ | ||
"highlight.regexes": { | ||
"(.*?__if__)(!.+?)(__.*?)\\n": [ | ||
{ | ||
"backgroundColor": "#a06f5f", | ||
"color": "#FFF" | ||
}, | ||
{ | ||
"backgroundColor": "#a06f5f", | ||
"color": "#ffbfb4", | ||
"fontWeight": "bold" | ||
}, | ||
{ | ||
"backgroundColor": "#a06f5f", | ||
"color": "#FFF" | ||
} | ||
], | ||
"(.*?__if__)([^!]+?)(__.*?)\\n": [ | ||
{ | ||
"backgroundColor": "#a06f5f", | ||
"color": "#FFF" | ||
}, | ||
{ | ||
"backgroundColor": "#a06f5f", | ||
"color": "#c7ffa4", | ||
"fontWeight": "bold" | ||
}, | ||
{ | ||
"backgroundColor": "#a06f5f", | ||
"color": "#FFF" | ||
} | ||
], | ||
"((?:\\/\\/|#) __if__)([^!]+?)(__)": [ | ||
{ | ||
"backgroundColor": "#808080", | ||
"color": "#FFF" | ||
}, | ||
{ | ||
"backgroundColor": "#808080", | ||
"color": "#c7ffa4", | ||
"fontWeight": "bold" | ||
}, | ||
{ | ||
"backgroundColor": "#808080", | ||
"color": "#FFF" | ||
} | ||
], | ||
"((?:\\/\\/|#) __if__)(!.+?)(__)": [ | ||
{ | ||
"backgroundColor": "#808080", | ||
"color": "#FFF" | ||
}, | ||
{ | ||
"backgroundColor": "#808080", | ||
"color": "#ffbfb4", | ||
"fontWeight": "bold" | ||
}, | ||
{ | ||
"backgroundColor": "#808080", | ||
"color": "#FFF" | ||
} | ||
], | ||
"((?:\\/\\/|#) __endif__)": [ | ||
{ | ||
"backgroundColor": "#808080", | ||
"color": "#FFF" | ||
} | ||
], | ||
"(__replace__)(.+?)(__)": [ | ||
{ | ||
"backgroundColor": "#5F9EA0", | ||
"color": "#FFF" | ||
}, | ||
{ | ||
"backgroundColor": "#5F9EA0", | ||
"color": "#FFF", | ||
"fontWeight": "bold" | ||
}, | ||
{ | ||
"backgroundColor": "#5F9EA0", | ||
"color": "#FFF" | ||
} | ||
] | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220785
177