gaffer-generator 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/codeql-analysis.yml +4 -4
- package/README.md +3 -3
- package/package.json +7 -7
- package/renovate.json +6 -0
- package/src/generate/directory.js +1 -1
- package/src/generate/root.js +5 -1
|
@@ -35,11 +35,11 @@ jobs:
|
|
|
35
35
|
|
|
36
36
|
steps:
|
|
37
37
|
- name: Checkout repository
|
|
38
|
-
uses: actions/checkout@
|
|
38
|
+
uses: actions/checkout@v4
|
|
39
39
|
|
|
40
40
|
# Initializes the CodeQL tools for scanning.
|
|
41
41
|
- name: Initialize CodeQL
|
|
42
|
-
uses: github/codeql-action/init@
|
|
42
|
+
uses: github/codeql-action/init@v3
|
|
43
43
|
with:
|
|
44
44
|
languages: ${{ matrix.language }}
|
|
45
45
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
@@ -50,7 +50,7 @@ jobs:
|
|
|
50
50
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
51
51
|
# If this step fails, then you should remove it and run the build manually (see below)
|
|
52
52
|
- name: Autobuild
|
|
53
|
-
uses: github/codeql-action/autobuild@
|
|
53
|
+
uses: github/codeql-action/autobuild@v3
|
|
54
54
|
|
|
55
55
|
# ℹ️ Command-line programs to run using the OS shell.
|
|
56
56
|
# 📚 https://git.io/JvXDl
|
|
@@ -64,4 +64,4 @@ jobs:
|
|
|
64
64
|
# make release
|
|
65
65
|
|
|
66
66
|
- name: Perform CodeQL Analysis
|
|
67
|
-
uses: github/codeql-action/analyze@
|
|
67
|
+
uses: github/codeql-action/analyze@v3
|
package/README.md
CHANGED
|
@@ -62,11 +62,11 @@ You should see output similar to the following:
|
|
|
62
62
|
Let's break down the discrete steps that happened above:
|
|
63
63
|
|
|
64
64
|
1. We search the current directory recursively for `.templateroot` directories.
|
|
65
|
-
2. When one is found, we read in the `template.js` file (it should be a CommonJS module).
|
|
65
|
+
2. When one is found, we read in the `template.cjs` (or `template.js`) file (it should be a CommonJS module).
|
|
66
66
|
3. Call the `download` method of this file, which should return a promise that eventually resolves to any JSON describing what you want to generate.
|
|
67
|
-
4. Using the exported `into` property from the `template.js
|
|
67
|
+
4. Using the exported `into` property from the `template.cjs` (or `template.js`), we'll recursively look at all of the other files within the `.templateroot`.
|
|
68
68
|
5. When we find a directory, recurse in to it!
|
|
69
|
-
6. When we find a file, parse it as a [lodash template](https://lodash.com/docs/4.17.11#template). The context will be whatever was returned from the `download` promise above, plus any exported methods of our `template.js` will be exposed on the `utils` object.
|
|
69
|
+
6. When we find a file, parse it as a [lodash template](https://lodash.com/docs/4.17.11#template). The context will be whatever was returned from the `download` promise above, plus any exported methods of our `template.cjs` (or `template.js`) will be exposed on the `utils` object.
|
|
70
70
|
7. When we find a variable in the path, like `_fileName_.ts`, evaluate it based on our context from `download`.
|
|
71
71
|
8. When we find a `_each` in the path, like `_eachEnum.fileName_.ts`, expand it out. This lets us generate many files from a single template.
|
|
72
72
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaffer-generator",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"colors": "^1.4.0",
|
|
17
|
-
"globule": "^1.3.
|
|
18
|
-
"node-fetch": "^2.6.
|
|
19
|
-
"recursive-copy": "^2.0.
|
|
20
|
-
"yargs": "^17.
|
|
17
|
+
"globule": "^1.3.4",
|
|
18
|
+
"node-fetch": "^2.6.7",
|
|
19
|
+
"recursive-copy": "^2.0.14",
|
|
20
|
+
"yargs": "^17.6.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"jest": "^
|
|
24
|
-
"ts-node": "^9.1
|
|
23
|
+
"jest": "^29.3.1",
|
|
24
|
+
"ts-node": "^10.9.1"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/renovate.json
ADDED
|
@@ -10,7 +10,7 @@ const utils = require('../utils');
|
|
|
10
10
|
const dryRun = argv.dryRun || false;
|
|
11
11
|
const node = require('./node');
|
|
12
12
|
|
|
13
|
-
const reservedItems = ['template.js', 'template.ts', 'template', '.DS_Store'];
|
|
13
|
+
const reservedItems = ['template.cjs', 'template.js', 'template.ts', 'template', '.DS_Store'];
|
|
14
14
|
|
|
15
15
|
/*
|
|
16
16
|
Public API.
|
package/src/generate/root.js
CHANGED
|
@@ -31,7 +31,7 @@ function visit(rootPath) {
|
|
|
31
31
|
const templateSettingsPath = determineTemplateFile(rootPath);
|
|
32
32
|
if (!templateSettingsPath) {
|
|
33
33
|
utils.logError(
|
|
34
|
-
'Found .templateroot without a template.js or template.ts file:\n'.red
|
|
34
|
+
'Found .templateroot without a template.cjs, template.js or template.ts file:\n'.red
|
|
35
35
|
+ rootPath.cyan);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -64,8 +64,12 @@ function visit(rootPath) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function determineTemplateFile(rootPath) {
|
|
67
|
+
const cjsTemplate = path.join(rootPath, 'template.cjs');
|
|
67
68
|
const jsTemplate = path.join(rootPath, 'template.js');
|
|
68
69
|
const tsTemplate = path.join(rootPath, 'template.ts');
|
|
70
|
+
if (fs.existsSync(cjsTemplate)) {
|
|
71
|
+
return cjsTemplate;
|
|
72
|
+
}
|
|
69
73
|
if (fs.existsSync(jsTemplate)) {
|
|
70
74
|
return jsTemplate;
|
|
71
75
|
}
|