create-lt-adventure 0.0.16 → 0.1.3
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/README.md +85 -85
- package/addons/github-workflow/addon.json +5 -5
- package/addons/github-workflow/main.yml +96 -48
- package/addons/github-workflow/{setup.ts → setup.mjs} +115 -112
- package/addons/sf2e-pf2e-redirects/addon.json +5 -0
- package/addons/sf2e-pf2e-redirects/setup.mjs +119 -0
- package/dist/bin.js +223 -84
- package/dist/bin.js.map +1 -1
- package/dist/migrate.d.ts +2 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +169 -0
- package/dist/migrate.js.map +1 -0
- package/dist/options.d.ts +5 -2
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +14 -5
- package/dist/options.js.map +1 -1
- package/package.json +68 -66
- package/templates/vite/.env.example +1 -1
- package/templates/vite/CHANGELOG +1 -0
- package/templates/vite/gitignore +37 -37
- package/templates/vite/module.json +37 -36
- package/templates/vite/package.json +3 -2
- package/templates/vite/scripts/extractPacks.mjs +54 -49
- package/templates/vite/scripts/jsonReplacer.mjs +11 -0
- package/templates/vite/scripts/onCreate.mjs +41 -13
- package/templates/vite/scripts/symlink.mjs +78 -78
- package/templates/vite/src/adventureSheet/index.js +497 -497
- package/templates/vite/src/hooks.ts +22 -0
- package/templates/vite/src/index.js +4 -4
- package/templates/vite/src/lib/utils.ts +1 -0
- package/templates/vite/src/misc/prosemirror.js +46 -46
- package/templates/vite/src/module.css +306 -306
- package/templates/vite/src/types.d.ts +7 -7
- package/templates/vite/tsconfig.json +33 -29
- package/templates/vite/vite.config.ts +129 -128
- package/templates/vite/bun.lock +0 -802
package/README.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# create-lt-adventure
|
|
2
|
-
|
|
3
|
-
A CLI scaffolding tool for creating Foundry VTT modules.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
### Global Installation (for end users)
|
|
8
|
-
|
|
9
|
-
Once published to npm, you can run the script via Bun:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
bunx create-lt-adventure
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
create-lt-adventure
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Update the package using
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
bun update create-lt-adventure -g --latest
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Development Installation
|
|
28
|
-
|
|
29
|
-
For development purposes:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
git clone https://github.com/Loot-Foundry/create-lt-adventure
|
|
33
|
-
cd create-lt-adventure
|
|
34
|
-
bun install
|
|
35
|
-
bun run dev
|
|
36
|
-
```
|
|
37
|
-
### Development
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
# Install dependencies
|
|
41
|
-
bun install
|
|
42
|
-
|
|
43
|
-
# Run in development mode (requires Bun)
|
|
44
|
-
bun run dev
|
|
45
|
-
|
|
46
|
-
# Watch for TypeScript changes
|
|
47
|
-
bun run build:watch
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Scripts
|
|
51
|
-
|
|
52
|
-
- `bun run build` - Compile TypeScript to JavaScript
|
|
53
|
-
- `bun run build:watch` - Watch TypeScript files and rebuild on changes
|
|
54
|
-
- `bun run dev` - Run the CLI in development mode (requires Bun)
|
|
55
|
-
- `bun run prepublishOnly` - Automatically run before publishing
|
|
56
|
-
|
|
57
|
-
## System Support
|
|
58
|
-
|
|
59
|
-
Currently supports:
|
|
60
|
-
- **dnd5e** - Dungeons & Dragons 5th Edition
|
|
61
|
-
- **pf2e** - Pathfinder 2nd Edition
|
|
62
|
-
|
|
63
|
-
Additional systems can be added in `src/options.ts`.
|
|
64
|
-
|
|
65
|
-
## Resources
|
|
66
|
-
|
|
67
|
-
### Foundry VTT Documentation
|
|
68
|
-
- [dnd5e System Wiki](https://github.com/foundryvtt/dnd5e/wiki)
|
|
69
|
-
- [dnd5e Module Registration](https://github.com/foundryvtt/dnd5e/wiki/Module-Registration)
|
|
70
|
-
- [PF2e Wiki](https://github.com/foundryvtt/pf2e/wiki)
|
|
71
|
-
|
|
72
|
-
### Module Development
|
|
73
|
-
- [Foundry VTT Module Development](https://foundryvtt.com/article/modules/)
|
|
74
|
-
|
|
75
|
-
## License
|
|
76
|
-
|
|
77
|
-
MIT
|
|
78
|
-
|
|
79
|
-
## Contributing
|
|
80
|
-
|
|
81
|
-
Contributions are welcome! Please feel free to submit pull requests.
|
|
82
|
-
|
|
83
|
-
## Issues
|
|
84
|
-
|
|
85
|
-
Found a bug? Please open an issue on [GitHub](https://github.com/Loot-Foundry/create-lt-adventure/issues).
|
|
1
|
+
# create-lt-adventure
|
|
2
|
+
|
|
3
|
+
A CLI scaffolding tool for creating Foundry VTT modules.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Global Installation (for end users)
|
|
8
|
+
|
|
9
|
+
Once published to npm, you can run the script via Bun:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bunx create-lt-adventure
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Updating the package:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
create-lt-adventure
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Update the package using
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bun update create-lt-adventure -g --latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Development Installation
|
|
28
|
+
|
|
29
|
+
For development purposes:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/Loot-Foundry/create-lt-adventure
|
|
33
|
+
cd create-lt-adventure
|
|
34
|
+
bun install
|
|
35
|
+
bun run dev
|
|
36
|
+
```
|
|
37
|
+
### Development
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Install dependencies
|
|
41
|
+
bun install
|
|
42
|
+
|
|
43
|
+
# Run in development mode (requires Bun)
|
|
44
|
+
bun run dev
|
|
45
|
+
|
|
46
|
+
# Watch for TypeScript changes
|
|
47
|
+
bun run build:watch
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Scripts
|
|
51
|
+
|
|
52
|
+
- `bun run build` - Compile TypeScript to JavaScript
|
|
53
|
+
- `bun run build:watch` - Watch TypeScript files and rebuild on changes
|
|
54
|
+
- `bun run dev` - Run the CLI in development mode (requires Bun)
|
|
55
|
+
- `bun run prepublishOnly` - Automatically run before publishing
|
|
56
|
+
|
|
57
|
+
## System Support
|
|
58
|
+
|
|
59
|
+
Currently supports:
|
|
60
|
+
- **dnd5e** - Dungeons & Dragons 5th Edition
|
|
61
|
+
- **pf2e** - Pathfinder 2nd Edition
|
|
62
|
+
|
|
63
|
+
Additional systems can be added in `src/options.ts`.
|
|
64
|
+
|
|
65
|
+
## Resources
|
|
66
|
+
|
|
67
|
+
### Foundry VTT Documentation
|
|
68
|
+
- [dnd5e System Wiki](https://github.com/foundryvtt/dnd5e/wiki)
|
|
69
|
+
- [dnd5e Module Registration](https://github.com/foundryvtt/dnd5e/wiki/Module-Registration)
|
|
70
|
+
- [PF2e Wiki](https://github.com/foundryvtt/pf2e/wiki)
|
|
71
|
+
|
|
72
|
+
### Module Development
|
|
73
|
+
- [Foundry VTT Module Development](https://foundryvtt.com/article/modules/)
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
Contributions are welcome! Please feel free to submit pull requests.
|
|
82
|
+
|
|
83
|
+
## Issues
|
|
84
|
+
|
|
85
|
+
Found a bug? Please open an issue on [GitHub](https://github.com/Loot-Foundry/create-lt-adventure/issues).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Github Workflow",
|
|
3
|
-
"description": "Adds support for automated releases via Github workflows",
|
|
4
|
-
"default": true
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "Github Workflow",
|
|
3
|
+
"description": "Adds support for automated releases via Github workflows",
|
|
4
|
+
"default": true
|
|
5
|
+
}
|
|
@@ -1,48 +1,96 @@
|
|
|
1
|
-
name: Release Creation
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
name: Release Creation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: oven-sh/setup-bun@v2
|
|
13
|
+
|
|
14
|
+
- name: Extract version from tag without the v
|
|
15
|
+
id: get-version
|
|
16
|
+
run: echo "v=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
|
17
|
+
|
|
18
|
+
- name: Substitute Manifest and Download Links For Versioned Ones
|
|
19
|
+
id: sub_manifest_link_version
|
|
20
|
+
uses: microsoft/variable-substitution@v1
|
|
21
|
+
with:
|
|
22
|
+
files: module.json
|
|
23
|
+
env:
|
|
24
|
+
flags.canUpload: false
|
|
25
|
+
version: ${{ steps.get-version.outputs.v }}
|
|
26
|
+
|
|
27
|
+
- name: Install packages
|
|
28
|
+
run: bun i --frozen-lockfile
|
|
29
|
+
|
|
30
|
+
- name: Build distribution
|
|
31
|
+
run: bun run build
|
|
32
|
+
|
|
33
|
+
# Create a zip file with all files required by the module to add to the release.
|
|
34
|
+
- name: Bundle into ZIP file
|
|
35
|
+
run: zip -r ./module.zip module.json assets/ dist/ packs/ lang/
|
|
36
|
+
|
|
37
|
+
# Create a release for this specific version.
|
|
38
|
+
- name: Update Release with Files
|
|
39
|
+
id: create_version_release
|
|
40
|
+
uses: ncipollo/release-action@v1
|
|
41
|
+
with:
|
|
42
|
+
allowUpdates: true # Set this to false if you want to prevent updating existing releases.
|
|
43
|
+
name: ${{ github.event.release.name }}
|
|
44
|
+
tag: ${{ github.event.release.tag_name }}
|
|
45
|
+
body: ${{ github.event.release.body }}
|
|
46
|
+
artifacts: "./module.json, ./module.zip"
|
|
47
|
+
omitDraftDuringUpdate: true
|
|
48
|
+
omitPrereleaseDuringUpdate: true
|
|
49
|
+
|
|
50
|
+
# https://stackoverflow.com/questions/61919141/read-json-file-in-github-actions
|
|
51
|
+
- id: set_var
|
|
52
|
+
run: echo "PACKAGE_JSON=$(jq -c . < module.json)" >> "$GITHUB_OUTPUT"
|
|
53
|
+
|
|
54
|
+
- name: Get Module ID
|
|
55
|
+
id: module_id
|
|
56
|
+
run: echo "module_id=${{ fromJson(steps.set_var.outputs.PACKAGE_JSON).id }}" >> "$GITHUB_OUTPUT"
|
|
57
|
+
|
|
58
|
+
- name: Get FTP Path
|
|
59
|
+
id: ftp
|
|
60
|
+
run: echo "ftp=${{ fromJson(steps.set_var.outputs.PACKAGE_JSON).flags.ftpPath || format('NEW/{0}', steps.module_id.outputs.module_id) }}" >> "$GITHUB_OUTPUT"
|
|
61
|
+
|
|
62
|
+
- name: Get Module Title
|
|
63
|
+
id: title
|
|
64
|
+
run: echo "title=${{fromJson(steps.set_var.outputs.PACKAGE_JSON).title}}" >> "$GITHUB_OUTPUT"
|
|
65
|
+
|
|
66
|
+
- name: Put Files into FTP Folder
|
|
67
|
+
env:
|
|
68
|
+
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
|
69
|
+
if: ${{ env.FTP_PASSWORD != '' }}
|
|
70
|
+
run: |
|
|
71
|
+
ls
|
|
72
|
+
mkdir _ftp
|
|
73
|
+
cp module.json _ftp/
|
|
74
|
+
cp module.zip _ftp/
|
|
75
|
+
mkdir _ftp/${{steps.module_id.outputs.module_id}}
|
|
76
|
+
cp module.json _ftp/${{steps.module_id.outputs.module_id}}/
|
|
77
|
+
|
|
78
|
+
- name: Upload FTP
|
|
79
|
+
uses: sebastianpopp/ftp-action@releases/v2
|
|
80
|
+
env:
|
|
81
|
+
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
|
82
|
+
if: ${{ env.FTP_PASSWORD != '' }}
|
|
83
|
+
with:
|
|
84
|
+
host: ${{ secrets.FTP_SERVER }}
|
|
85
|
+
user: ${{ secrets.FTP_USERNAME }}
|
|
86
|
+
password: ${{ env.FTP_PASSWORD }}
|
|
87
|
+
localDir: _ftp
|
|
88
|
+
remoteDir: ${{steps.ftp.outputs.ftp}}
|
|
89
|
+
|
|
90
|
+
- name: Send Discord Ping
|
|
91
|
+
uses: Ilshidur/action-discord@0.3.2
|
|
92
|
+
env:
|
|
93
|
+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
94
|
+
if: ${{ env.DISCORD_WEBHOOK != '' && !github.event.release.prerelease }}
|
|
95
|
+
with:
|
|
96
|
+
args: "${{steps.title.outputs.title}} has been updated to version `${{github.event.release.tag_name}}`!"
|
|
@@ -1,112 +1,115 @@
|
|
|
1
|
-
// Creates a .github/workflows/main.yml file.
|
|
2
|
-
// Additional options include:
|
|
3
|
-
// - Support for prereleases (requires a seperate branch)
|
|
4
|
-
// - Supports for uploading via FTP to external servers
|
|
5
|
-
// - Discord webhook notifications
|
|
6
|
-
|
|
7
|
-
import * as p from "@clack/prompts";
|
|
8
|
-
import { cyan } from "kolorist";
|
|
9
|
-
import { mkdir } from "fs/promises";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
mkdir _ftp
|
|
70
|
-
cp module.json _ftp
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (data.features.includes("
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1
|
+
// Creates a .github/workflows/main.yml file.
|
|
2
|
+
// Additional options include:
|
|
3
|
+
// - Support for prereleases (requires a seperate branch)
|
|
4
|
+
// - Supports for uploading via FTP to external servers
|
|
5
|
+
// - Discord webhook notifications
|
|
6
|
+
|
|
7
|
+
import * as p from "@clack/prompts";
|
|
8
|
+
import { cyan } from "kolorist";
|
|
9
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
10
|
+
import { dirname } from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
|
|
15
|
+
const data = await p.group(
|
|
16
|
+
{
|
|
17
|
+
features: () =>
|
|
18
|
+
p.multiselect({
|
|
19
|
+
message: "Additional features?",
|
|
20
|
+
initialValues: ["ftp", "discord"],
|
|
21
|
+
required: false,
|
|
22
|
+
options: [
|
|
23
|
+
// { label: "Prereleases", value: "prereleases" },
|
|
24
|
+
{ label: "Uploading via FTP", value: "ftp" },
|
|
25
|
+
{ label: "Discord webhook on updates", value: "discord" },
|
|
26
|
+
],
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
{ onCancel: () => process.exit(0) },
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// Grab main.yml template
|
|
33
|
+
const mainYmlTemplate = await readFile(`${__dirname}/main.yml`, "utf8");
|
|
34
|
+
|
|
35
|
+
// Get the module directory from environment variable
|
|
36
|
+
const moduleDir = process.env.MODULE_DIR || process.cwd();
|
|
37
|
+
|
|
38
|
+
let mainYml = mainYmlTemplate;
|
|
39
|
+
|
|
40
|
+
// I should probably just make this a JSON and convert it to accursed YAML at the end step...
|
|
41
|
+
if (data.features.includes("discord") || data.features.includes("ftp")) {
|
|
42
|
+
mainYml += `
|
|
43
|
+
# https://stackoverflow.com/questions/61919141/read-json-file-in-github-actions
|
|
44
|
+
- id: set_var
|
|
45
|
+
run: echo "PACKAGE_JSON=$(jq -c . < module.json)" >> $GITHUB_OUTPUT
|
|
46
|
+
|
|
47
|
+
- name: Get FTP Path
|
|
48
|
+
id: ftp
|
|
49
|
+
run: echo "ftp=\${{fromJson(steps.set_var.outputs.PACKAGE_JSON).flags.ftpPath}}" >> $GITHUB_OUTPUT
|
|
50
|
+
|
|
51
|
+
- name: Get Module ID
|
|
52
|
+
id: module_id
|
|
53
|
+
run: echo "module_id=\${{fromJson(steps.set_var.outputs.PACKAGE_JSON).id}}" >> $GITHUB_OUTPUT
|
|
54
|
+
|
|
55
|
+
- name: Get Module Title
|
|
56
|
+
id: title
|
|
57
|
+
run: echo "title=\${{fromJson(steps.set_var.outputs.PACKAGE_JSON).title}}" >> $GITHUB_OUTPUT
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (data.features.includes("ftp")) {
|
|
62
|
+
mainYml += `
|
|
63
|
+
- name: Put Files into FTP Folder
|
|
64
|
+
env:
|
|
65
|
+
FTP_PASSWORD: \${{ secrets.FTP_PASSWORD }}
|
|
66
|
+
if: \${{ env.FTP_PASSWORD != '' }}
|
|
67
|
+
run: |
|
|
68
|
+
ls
|
|
69
|
+
mkdir _ftp
|
|
70
|
+
cp module.json _ftp/
|
|
71
|
+
cp module.zip _ftp/
|
|
72
|
+
mkdir _ftp/\${{steps.module_id.outputs.module_id}}
|
|
73
|
+
cp module.json _ftp/\${{steps.module_id.outputs.module_id}}/
|
|
74
|
+
|
|
75
|
+
- name: Upload FTP
|
|
76
|
+
uses: sebastianpopp/ftp-action@releases/v2
|
|
77
|
+
env:
|
|
78
|
+
FTP_PASSWORD: \${{ secrets.FTP_PASSWORD }}
|
|
79
|
+
if: \${{ env.FTP_PASSWORD != '' }}
|
|
80
|
+
with:
|
|
81
|
+
host: \${{ secrets.FTP_SERVER }}
|
|
82
|
+
user: \${{ secrets.FTP_USERNAME }}
|
|
83
|
+
password: \${{ env.FTP_PASSWORD }}
|
|
84
|
+
localDir: _ftp
|
|
85
|
+
remoteDir: \${{steps.ftp.outputs.ftp}}
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (data.features.includes("discord")) {
|
|
90
|
+
mainYml += `
|
|
91
|
+
- name: Send Discord Ping
|
|
92
|
+
uses: Ilshidur/action-discord@0.3.2
|
|
93
|
+
env:
|
|
94
|
+
DISCORD_WEBHOOK: \${{ secrets.DISCORD_WEBHOOK }}
|
|
95
|
+
if: \${{ env.DISCORD_WEBHOOK != '' && !github.event.release.prerelease }}
|
|
96
|
+
with:
|
|
97
|
+
args: "\${{steps.title.outputs.title}} has been updated to version \`\${{github.event.release.tag_name}}\`!"
|
|
98
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Create main.yml file
|
|
102
|
+
const workflowDir = `${moduleDir}/.github/workflows`;
|
|
103
|
+
await mkdir(workflowDir, { recursive: true });
|
|
104
|
+
await writeFile(`${workflowDir}/main.yml`, mainYml);
|
|
105
|
+
|
|
106
|
+
let note = "✅ Installed!";
|
|
107
|
+
note += "\nThe Github workflow is triggered by making a new release. To make a new release go to your repository's Releases page which can be found in the sidebar on the right and press \"Draft a new release.\" Fill in the version number and you're done!"
|
|
108
|
+
|
|
109
|
+
if (data.features.includes("discord"))
|
|
110
|
+
note +=
|
|
111
|
+
"\n - For the Discord integration, make sure to create a DISCORD_WEBHOOK secret with the webhook url.";
|
|
112
|
+
if (data.features.includes("ftp"))
|
|
113
|
+
note += `\n - For the FTP integration, make sure to include the FTP_SERVER, FTP_USERNAME, and FTP_PASSWORD secrets.\n\tThe module JSON also can include a flag stating its subdirectory on the FTP server under ${cyan("flags.ftpPath")}.`;
|
|
114
|
+
|
|
115
|
+
p.note(note, "Github Workflow");
|