gaffer-generator 1.2.4 → 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/dependabot.yml +8 -0
- package/.github/workflows/codeql-analysis.yml +67 -0
- package/README.md +3 -3
- package/SECURITY.md +15 -0
- package/package.json +7 -7
- package/renovate.json +6 -0
- package/src/generate/directory.js +1 -1
- package/src/generate/root.js +5 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ master ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ master ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '22 16 * * 6'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
|
|
28
|
+
strategy:
|
|
29
|
+
fail-fast: false
|
|
30
|
+
matrix:
|
|
31
|
+
language: [ 'javascript' ]
|
|
32
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
33
|
+
# Learn more:
|
|
34
|
+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- name: Checkout repository
|
|
38
|
+
uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
# Initializes the CodeQL tools for scanning.
|
|
41
|
+
- name: Initialize CodeQL
|
|
42
|
+
uses: github/codeql-action/init@v3
|
|
43
|
+
with:
|
|
44
|
+
languages: ${{ matrix.language }}
|
|
45
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
46
|
+
# By default, queries listed here will override any specified in a config file.
|
|
47
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
48
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
49
|
+
|
|
50
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
51
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
52
|
+
- name: Autobuild
|
|
53
|
+
uses: github/codeql-action/autobuild@v3
|
|
54
|
+
|
|
55
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
56
|
+
# 📚 https://git.io/JvXDl
|
|
57
|
+
|
|
58
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
59
|
+
# and modify them (or add more) to build your code if your project
|
|
60
|
+
# uses a compiled language
|
|
61
|
+
|
|
62
|
+
#- run: |
|
|
63
|
+
# make bootstrap
|
|
64
|
+
# make release
|
|
65
|
+
|
|
66
|
+
- name: Perform CodeQL Analysis
|
|
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/SECURITY.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Use this section to tell people about which versions of your project are
|
|
6
|
+
currently being supported with security updates.
|
|
7
|
+
|
|
8
|
+
| Version | Supported |
|
|
9
|
+
| ------- | ------------------ |
|
|
10
|
+
| 1.x | :white_check_mark: |
|
|
11
|
+
|
|
12
|
+
## Reporting a Vulnerability
|
|
13
|
+
|
|
14
|
+
If you discover a vulnerability, please create an Issue, or better yet,
|
|
15
|
+
a Pull Request, and we'll tackle it together!
|
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
|
+
"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'];
|
|
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
|
}
|