modpack-lock 0.4.1 → 0.5.0

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 CHANGED
@@ -47,7 +47,7 @@ The script will:
47
47
  - Query the Modrinth API for matching versions
48
48
  - Generate a `modpack.lock` file (and update `modpack.json` dependencies if present)
49
49
 
50
- Use flags to generate `README.md` files for each category or print `.gitignore` rules for files that are not hosted on Modrinth.
50
+ Use flags to generate `README.md` files for each category or update the `.gitignore` to ignore content hosted on Modrinth.
51
51
 
52
52
  ```text
53
53
  Usage: modpack-lock [options] [command]
@@ -59,7 +59,7 @@ Options:
59
59
  -d, --dry-run Dry-run mode - no files will be written
60
60
 
61
61
  GENERATION
62
- -g, --gitignore Print .gitignore rules for files not hosted on Modrinth
62
+ -g, --gitignore Update the .gitignore file to ignore content hosted on Modrinth
63
63
  -r, --readme Generate README.md files for each category
64
64
 
65
65
  LOGGING
@@ -72,9 +72,14 @@ INFORMATION
72
72
 
73
73
  Commands:
74
74
  init [options] This utility will walk you through creating a modpack.json file. It only covers the most common items, and tries to guess sensible defaults.
75
- run [options] <script> Run a script (shell command) defined in modpack.json's 'scripts' object
75
+ run [options] <script> Run a script defined in the modpack.json file's 'scripts' field
76
76
  ```
77
77
 
78
+ > [!TIP]
79
+ >
80
+ > #### Did you know?
81
+ >
82
+ > You can generate summary files for each category by running `modpack-lock -r`. This will generate a `README.md` file in each of the content folders, detailing the scanned files and important attribution information for them.
78
83
 
79
84
  ### Initialization
80
85
 
@@ -100,7 +105,9 @@ This utility will walk you through creating a modpack.json file. It only covers
100
105
  Options:
101
106
  -f, --folder <path> Path to the modpack directory
102
107
  -n, --noninteractive Non-interactive mode - must provide options for required fields
103
- --add-license Add the license file to the modpack
108
+ --add-license Add the LICENSE file to the modpack
109
+ --add-gitignore Update the .gitignore file to ignore content hosted on Modrinth
110
+ --add-readme Generate README.md files for each category
104
111
 
105
112
  MODPACK INFORMATION
106
113
  --name <name> Modpack name; defaults to the directory name
@@ -108,12 +115,12 @@ MODPACK INFORMATION
108
115
  --id <id> Modpack slug/ID; defaults to the directory name slugified
109
116
  --description <description> Modpack description
110
117
  --author <author> Modpack author; required
111
- --projectUrl <projectUrl> Modpack URL
112
- --sourceUrl <sourceUrl> Modpack source code URL
113
- --license <license> Modpack license
114
- --modloader <modloader> Modpack modloader; required
118
+ --projectUrl <projectUrl> Modpack URL; defaults to a guessed Modrinth project URL
119
+ --sourceUrl <sourceUrl> Modpack source code URL; defaults to a guessed GitHub repository URL
120
+ --license <license> Modpack license, popular licenses fetched from GitHub; defaults to MIT in interactive mode
121
+ --modloader <modloader> Modpack modloader, list of loaders fetched from Modrinth; required
115
122
  --targetModloaderVersion <targetModloaderVersion> Target modloader version
116
- --targetMinecraftVersion <targetMinecraftVersion> Target Minecraft version; required
123
+ --targetMinecraftVersion <targetMinecraftVersion> Target Minecraft version, list of versions fetched from Modrinth; required
117
124
 
118
125
  INFORMATION
119
126
  -h, --help display help for modpack-lock init
@@ -144,7 +151,7 @@ The `scripts` field in `modpack.json` is a key-value pair of script names and th
144
151
  ```text
145
152
  Usage: modpack-lock run [options] <script>
146
153
 
147
- Run a script (shell command) defined in modpack.json's 'scripts' object
154
+ Run a script defined in the modpack.json file's 'scripts' field
148
155
 
149
156
  Arguments:
150
157
  script The name of the script to run
@@ -152,6 +159,8 @@ Arguments:
152
159
  Options:
153
160
  -f, --folder <path> Path to the modpack directory
154
161
  -D, --debug Debug mode -- show more information about how the command is being parsed
162
+
163
+ INFORMATION
155
164
  -h, --help display help for modpack-lock run
156
165
  ```
157
166
 
@@ -231,23 +240,28 @@ The JSON file contains your modpack metadata and a dependency list:
231
240
  }
232
241
  ```
233
242
 
234
- > [!TIP]
243
+ > [!IMPORTANT]
235
244
  >
236
- > ### Don't commit binaries
245
+ > #### Don't commit binaries
237
246
  >
238
- > Consider adding these rules to your `.gitignore` to ensure you don't commit the modpack contents to your repository, with exceptions for any files that are not Modrinth-hosted:
247
+ > Use `modpack-lock -g` to automatically update your `.gitignore` file with rules to ignore modpack contents, with exceptions for any files that are not hosted by Modrinth:
239
248
  >
240
249
  > ```txt
250
+ > # .gitignore
251
+ >
252
+ > # modpack-lock:start
241
253
  > mods/*.jar
242
254
  > resourcepacks/*.zip
243
255
  > datapacks/*.zip
244
256
  > shaderpacks/*.zip
257
+ > */**/*.disabled
245
258
  >
246
259
  > ## Exceptions
247
- > # !mods/example.jar
260
+ > !mods/example.jar
261
+ > # modpack-lock:end
248
262
  > ```
249
263
  >
250
- > Use `modpack-lock -g` to generate and print the rules for your project to the console.
264
+ > This section is managed by modpack-lock and will be updated automatically when you run `modpack-lock -g`. Changes made inside this section will be overwritten, but any changes you make outside of this section will be preserved.
251
265
 
252
266
  ## License
253
267
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modpack-lock",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Creates a modpack lockfile for files hosted on Modrinth (mods, resource packs, shaders and datapacks)",
5
5
  "bugs": {
6
6
  "url": "https://github.com/nickesc/modpack-lock/issues"
package/src/cli.js CHANGED
@@ -6,7 +6,7 @@ import path from 'path';
6
6
  import { spawn } from 'child_process';
7
7
  import {generateLockfile} from './generate_lockfile.js';
8
8
  import { generateModpackFiles } from './modpack-lock.js';
9
- import { promptUserForInfo, promptUserAboutLicenseText } from './modpack_info.js';
9
+ import { promptUserForInfo, promptUserAboutOptionalFiles } from './modpack_info.js';
10
10
  import { getModpackInfo } from './directory_scanning.js';
11
11
  import generateLicense from './generate_license.js';
12
12
  import * as config from './config/index.js';
@@ -70,16 +70,16 @@ modpackLock
70
70
  .name(pkg.name)
71
71
  .description(pkg.description)
72
72
  .summary("Create a modpack lockfile")
73
- .optionsGroup("Options:")
73
+ .optionsGroup(config.headings.options)
74
74
  .option('-p, --path <path>', 'Path to the modpack directory')
75
75
  .option('-d, --dry-run', 'Dry-run mode - no files will be written')
76
- .optionsGroup("GENERATION")
77
- .option('-g, --gitignore', 'Print .gitignore rules for files not hosted on Modrinth')
78
- .option('-r, --readme', 'Generate README.md files for each category')
79
- .optionsGroup("LOGGING")
76
+ .optionsGroup(config.headings.generation)
77
+ .option('-g, --gitignore', config.fileFields.addGitignore.option)
78
+ .option('-r, --readme', config.fileFields.addReadme.option)
79
+ .optionsGroup(config.headings.logging)
80
80
  .option('-q, --quiet', 'Quiet mode - only show errors and warnings')
81
81
  .option('-s, --silent', 'Silent mode - no output')
82
- .optionsGroup("INFORMATION")
82
+ .optionsGroup(config.headings.information)
83
83
  .helpOption("-h, --help", `display help for ${pkg.name}`)
84
84
  .version(pkg.version, '-V')
85
85
  .action(async (options) => {
@@ -108,23 +108,25 @@ const jsonDescription = `This utility will walk you through creating a ${config.
108
108
 
109
109
  modpackLock.command('init')
110
110
  .description(jsonDescription)
111
- .optionsGroup("Options:")
111
+ .optionsGroup(config.headings.options)
112
112
  .option('-f, --folder <path>', 'Path to the modpack directory')
113
113
  .option("-n, --noninteractive", 'Non-interactive mode - must provide options for required fields')
114
- .option('--add-license', 'Add the license file to the modpack')
115
- .optionsGroup("MODPACK INFORMATION")
116
- .option('--name <name>', 'Modpack name; defaults to the directory name')
117
- .option('--version <version>', 'Modpack version; defaults to 1.0.0')
118
- .option('--id <id>', 'Modpack slug/ID; defaults to the directory name slugified')
119
- .option('--description <description>', 'Modpack description')
120
- .option('--author <author>', 'Modpack author; required')
121
- .option('--projectUrl <projectUrl>', 'Modpack URL')
122
- .option('--sourceUrl <sourceUrl>', 'Modpack source code URL')
123
- .option('--license <license>', 'Modpack license')
124
- .option('--modloader <modloader>', 'Modpack modloader; required')
125
- .option('--targetModloaderVersion <targetModloaderVersion>', 'Target modloader version')
126
- .option('--targetMinecraftVersion <targetMinecraftVersion>', 'Target Minecraft version; required')
127
- .optionsGroup("INFORMATION")
114
+ .option('--add-license', config.fileFields.addLicense.option)
115
+ .option('--add-gitignore', config.fileFields.addGitignore.option)
116
+ .option('--add-readme', config.fileFields.addReadme.option)
117
+ .optionsGroup(config.headings.packInfo)
118
+ .option('--name <name>', config.infoFields.name.option)
119
+ .option('--version <version>', config.infoFields.version.option)
120
+ .option('--id <id>', config.infoFields.id.option)
121
+ .option('--description <description>', config.infoFields.description.option)
122
+ .option('--author <author>', config.infoFields.author.option)
123
+ .option('--projectUrl <projectUrl>', config.infoFields.projectUrl.option)
124
+ .option('--sourceUrl <sourceUrl>', config.infoFields.sourceUrl.option)
125
+ .option('--license <license>', config.infoFields.license.option)
126
+ .option('--modloader <modloader>', config.infoFields.modloader.option)
127
+ .option('--targetModloaderVersion <targetModloaderVersion>', config.infoFields.targetModloaderVersion.option)
128
+ .option('--targetMinecraftVersion <targetMinecraftVersion>', config.infoFields.targetMinecraftVersion.option)
129
+ .optionsGroup(config.headings.information)
128
130
  .helpOption("-h, --help", `display help for ${pkg.name} init`)
129
131
  .action(async (options) => {
130
132
  options._init = true;
@@ -161,6 +163,9 @@ modpackLock.command('init')
161
163
  await generateLicense(modpackInfo, currDir, options);
162
164
  }
163
165
 
166
+ options.readme = options.addReadme;
167
+ options.gitignore = options.addGitignore;
168
+
164
169
  // generate the modpack files
165
170
  try {
166
171
  await generateModpackFiles(modpackInfo, currDir, options);
@@ -194,14 +199,16 @@ modpackLock.command('init')
194
199
  );
195
200
 
196
201
  // prompt user if they want to add the license text
197
- const licenseText = options.addLicense === undefined ? await promptUserAboutLicenseText(modpackInfo) : options.addLicense;
202
+ const optionalFiles = await promptUserAboutOptionalFiles(modpackInfo, options);
198
203
  console.log();
199
- if (licenseText) {
204
+ if (options.addLicense || optionalFiles.addLicense) {
200
205
  await generateLicense(modpackInfo, currDir, options);
201
206
  }
202
207
  console.log();
203
208
 
204
209
  // generate the modpack files
210
+ options.readme = optionalFiles.addReadme;
211
+ options.gitignore = optionalFiles.addGitignore;
205
212
  await generateModpackFiles(modpackInfo, currDir, options);
206
213
  } catch (error) {
207
214
  console.error('Error:', error);
@@ -211,10 +218,12 @@ modpackLock.command('init')
211
218
  });
212
219
 
213
220
  modpackLock.command('run')
214
- .description(`Run a script (shell command) defined in ${config.MODPACK_JSON_NAME}\'s \'scripts\' object`)
221
+ .description(`Run a script defined in the ${config.MODPACK_JSON_NAME} file's 'scripts' field`)
215
222
  .argument('<script>', 'The name of the script to run')
223
+ .optionsGroup(config.headings.options)
216
224
  .option('-f, --folder <path>', 'Path to the modpack directory')
217
225
  .option('-D, --debug', 'Debug mode -- show more information about how the command is being parsed')
226
+ .optionsGroup(config.headings.information)
218
227
  .helpOption("-h, --help", `display help for ${pkg.name} run`)
219
228
  .allowExcessArguments(true)
220
229
  .allowUnknownOption(true)
@@ -230,13 +239,13 @@ modpackLock.command('run')
230
239
 
231
240
  // verify neccecary files and information exist
232
241
  if (!modpackInfo) {
233
- throw new Error('No modpack.json file found');
242
+ throw new Error(`No ${config.MODPACK_JSON_NAME} file found`);
234
243
  }
235
244
  if (!modpackInfo.scripts) {
236
- throw new Error('No scripts defined in modpack.json');
245
+ throw new Error(`No scripts defined in ${config.MODPACK_JSON_NAME}`);
237
246
  }
238
247
  if (!modpackInfo.scripts[script]) {
239
- throw new Error(`Script ${script} not found in modpack.json`);
248
+ throw new Error(`Script ${script} not found in ${config.MODPACK_JSON_NAME}`);
240
249
  }
241
250
 
242
251
  // build the full command
@@ -1,3 +1,5 @@
1
+ import pkg from '../../package.json' with { type: 'json' };
2
+
1
3
  /** Lockfile format version -- increment on changes to the format */
2
4
  export const LOCKFILE_VERSION = "1.0.1";
3
5
 
@@ -20,63 +22,17 @@ export const DEPENDENCY_CATEGORIES = [
20
22
  ];
21
23
 
22
24
  /** Minecraft version types */
23
- export const MINECRAFT_VERSION_TYPES = ["release", "alpha", "beta", "snapshot"];
24
-
25
- /** All-Rights-Reserved license text */
26
- export const ARR_LICENSE_TEXT =
27
- "Copyright (c) [year] [fullname]\n" +
28
- "\n" +
29
- "All rights reserved.\n";
30
-
31
- /** All-Rights-Reserved license option */
32
- export const ALL_RIGHTS_RESERVED_LICENSE = { title: 'All-Rights-Reserved', value: 'all-rights-reserved' };
33
-
34
- /** Other option */
35
- export const OTHER_OPTION = { title: 'Other', value: 'other' };
36
-
37
- /** Fallback licenses */
38
- export const FALLBACK_LICENSES = [
39
- { title: 'MIT', value: 'mit' },
40
- { title: 'Apache-2.0', value: 'apache-2.0' },
41
- { title: 'GPL-3.0', value: 'gpl-3.0' },
42
- { title: 'CC0-1.0', value: 'cc0-1.0' }
25
+ export const MINECRAFT_VERSION_TYPES = [
26
+ "release",
27
+ "alpha",
28
+ "beta",
29
+ "snapshot"
43
30
  ];
44
31
 
45
- /** Fallback modloaders */
46
- export const FALLBACK_MODLOADERS = [
47
- { title: 'fabric', value: 'fabric' },
48
- { title: 'forge', value: 'forge' },
49
- { title: 'neoforge', value: 'neoforge' },
50
- { title: 'paper', value: 'paper' },
51
- { title: 'purpur', value: 'purpur' },
52
- { title: 'quilt', value: 'quilt' },
53
- { title: 'sponge', value: 'sponge' },
54
- { title: 'spigot', value: 'spigot' },
55
- { title: 'vanilla', value: 'vanilla' }
56
- ];
32
+ const gitignoreMarker = (mode) => `# ${pkg.name}:${mode}`;
57
33
 
58
- /** Fallback target Minecraft versions */
59
- export const FALLBACK_TARGET_MINECRAFT_VERSIONS = [
60
- { title: '1.21.x'},
61
- { title: '1.20.x'},
62
- { title: '1.19.x'},
63
- { title: '1.18.x'},
64
- { title: '1.17.x'},
65
- { title: '1.16.x'},
66
- { title: '1.15.x'},
67
- { title: '1.14.x'},
68
- { title: '1.13.x'},
69
- { title: '1.12.x'},
70
- { title: '1.11.x'},
71
- { title: '1.10.x'},
72
- { title: '1.9.x'},
73
- { title: '1.8.x'},
74
- { title: '1.7.x'},
75
- { title: '1.6.x'},
76
- { title: '1.5.x'},
77
- { title: '1.4.x'},
78
- { title: '1.3.x'},
79
- { title: '1.2.x'},
80
- { title: '1.1.x'},
81
- { title: '1.0.x'}
82
- ];
34
+ /** Gitignore section start marker */
35
+ export const GITIGNORE_START_MARKER = gitignoreMarker('start');
36
+
37
+ /** Gitignore section end marker */
38
+ export const GITIGNORE_END_MARKER = gitignoreMarker('end');
@@ -1,8 +1,66 @@
1
1
  export const DEFAULT_MODPACK_VERSION = '1.0.0';
2
+
2
3
  export const DEFAULT_MODPACK_LICENSE = 'MIT';
4
+
3
5
  export const DEFAULT_PROJECT_URL = (id) => {
4
6
  return `https://modrinth.com/modpack/${id}`;
5
7
  };
6
8
  export const DEFAULT_SOURCE_URL = (id, author) => {
7
9
  return `https://github.com/${author}/${id}`;
8
10
  };
11
+
12
+ /** All-Rights-Reserved license option */
13
+ export const ALL_RIGHTS_RESERVED_LICENSE = { title: 'All-Rights-Reserved', value: 'all-rights-reserved' };
14
+
15
+ /** Other option */
16
+ export const OTHER_OPTION = { title: 'Other', value: 'other' };
17
+
18
+ /** Fallback licenses */
19
+ export const FALLBACK_LICENSES = [
20
+ { title: 'MIT', value: 'mit' },
21
+ { title: 'Apache-2.0', value: 'apache-2.0' },
22
+ { title: 'GPL-3.0', value: 'gpl-3.0' },
23
+ { title: 'CC0-1.0', value: 'cc0-1.0' }
24
+ ];
25
+
26
+ /** Fallback modloaders */
27
+ export const FALLBACK_MODLOADERS = [
28
+ { title: 'fabric', value: 'fabric' },
29
+ { title: 'forge', value: 'forge' },
30
+ { title: 'neoforge', value: 'neoforge' },
31
+ { title: 'paper', value: 'paper' },
32
+ { title: 'purpur', value: 'purpur' },
33
+ { title: 'quilt', value: 'quilt' },
34
+ { title: 'sponge', value: 'sponge' },
35
+ { title: 'spigot', value: 'spigot' },
36
+ { title: 'vanilla', value: 'vanilla' }
37
+ ];
38
+
39
+ /** Fallback target Minecraft versions */
40
+ export const FALLBACK_TARGET_MINECRAFT_VERSIONS = [
41
+ { title: '1.21.x', value: '1.21.x'},
42
+ { title: '1.20.x', value: '1.20.x'},
43
+ { title: '1.19.x', value: '1.19.x'},
44
+ { title: '1.18.x', value: '1.18.x'},
45
+ { title: '1.17.x', value: '1.17.x'},
46
+ { title: '1.16.x', value: '1.16.x'},
47
+ { title: '1.15.x', value: '1.15.x'},
48
+ { title: '1.14.x', value: '1.14.x'},
49
+ { title: '1.13.x', value: '1.13.x'},
50
+ { title: '1.12.x', value: '1.12.x'},
51
+ { title: '1.11.x', value: '1.11.x'},
52
+ { title: '1.10.x', value: '1.10.x'},
53
+ { title: '1.9.x', value: '1.9.x'},
54
+ { title: '1.8.x', value: '1.8.x'},
55
+ { title: '1.7.x', value: '1.7.x'},
56
+ { title: '1.6.x', value: '1.6.x'},
57
+ { title: '1.5.x', value: '1.5.x'},
58
+ { title: '1.4.x', value: '1.4.x'},
59
+ { title: '1.3.x', value: '1.3.x'},
60
+ { title: '1.2.x', value: '1.2.x'},
61
+ { title: '1.1.x', value: '1.1.x'},
62
+ { title: '1.0.x', value: '1.0.x'},
63
+ { title: 'snapshot', value: 'snapshot'},
64
+ { title: 'beta', value: 'beta'},
65
+ { title: 'alpha', value: 'alpha'},
66
+ ];
@@ -6,3 +6,9 @@ export const MODPACK_JSON_NAME = "modpack.json";
6
6
 
7
7
  /** License file name */
8
8
  export const MODPACK_LICENSE_NAME = "LICENSE";
9
+
10
+ /** Gitignore file name */
11
+ export const GITIGNORE_NAME = ".gitignore";
12
+
13
+ /** README.md file name */
14
+ export const README_NAME = "README.md";
@@ -3,3 +3,4 @@ export * from './api.js';
3
3
  export * from './files.js';
4
4
  export * from './options.js';
5
5
  export * from './defaults.js';
6
+ export * from './strings.js';
@@ -1,2 +1,16 @@
1
1
  /** Options for slugify */
2
- export const SLUGIFY_OPTIONS = { lower: true, strict: true, separator: '-', locale: 'en', trim: true };
2
+ export const SLUGIFY_OPTIONS = {
3
+ lower: true,
4
+ strict: true,
5
+ separator: '-',
6
+ locale: 'en',
7
+ trim: true
8
+ };
9
+
10
+ /** Options for prompts */
11
+ export const PROMPTS_OPTIONS = {
12
+ onCancel: () => {
13
+ console.warn('Modpack initialization was interrupted');
14
+ process.exit(1);
15
+ }
16
+ };
@@ -0,0 +1,85 @@
1
+ import * as defaults from './defaults.js';
2
+ import pkg from '../../package.json' with { type: 'json' };
3
+
4
+ export const infoFields = {
5
+ name: {
6
+ prompt: 'modpack name',
7
+ option: 'Modpack name; defaults to the directory name'
8
+ },
9
+ version: {
10
+ prompt: 'modpack version',
11
+ option: `Modpack version; defaults to ${defaults.DEFAULT_MODPACK_VERSION}`
12
+ },
13
+ id: {
14
+ prompt: 'modpack slug/ID',
15
+ option: 'Modpack slug/ID; defaults to the directory name slugified'
16
+ },
17
+ description: {
18
+ prompt: 'modpack description',
19
+ option: 'Modpack description'
20
+ },
21
+ author: {
22
+ prompt: 'modpack author',
23
+ option: 'Modpack author; required'
24
+ },
25
+ projectUrl: {
26
+ prompt: 'modpack URL',
27
+ option: 'Modpack URL; defaults to a guessed Modrinth project URL'
28
+ },
29
+ sourceUrl: {
30
+ prompt: 'modpack source code URL',
31
+ option: 'Modpack source code URL; defaults to a guessed GitHub repository URL'
32
+ },
33
+ license: {
34
+ prompt: 'modpack license',
35
+ option: `Modpack license, popular licenses fetched from GitHub; defaults to ${defaults.DEFAULT_MODPACK_LICENSE} in interactive mode`
36
+ },
37
+ modloader: {
38
+ prompt: 'modpack modloader',
39
+ option: 'Modpack modloader, list of loaders fetched from Modrinth; required'
40
+ },
41
+ targetModloaderVersion: {
42
+ prompt: 'target modloader version',
43
+ option: 'Target modloader version'
44
+ },
45
+ targetMinecraftVersion: {
46
+ prompt: 'target Minecraft version',
47
+ option: 'Target Minecraft version, list of versions fetched from Modrinth; required'
48
+ }
49
+ }
50
+
51
+ export const fileFields = {
52
+ addLicense: {
53
+ prompt: 'Add the LICENSE file',
54
+ option: 'Add the LICENSE file to the modpack'
55
+ },
56
+ addGitignore: {
57
+ prompt: 'Update the .gitignore file',
58
+ option: 'Update the .gitignore file to ignore content hosted on Modrinth'
59
+ },
60
+ addReadme: {
61
+ prompt: 'Generate README.md files',
62
+ option: 'Generate README.md files for each category'
63
+ }
64
+ }
65
+
66
+ export const headings = {
67
+ options: "Options:",
68
+ generation: "GENERATION",
69
+ logging: "LOGGING",
70
+ packInfo: "MODPACK INFORMATION",
71
+ information: "INFORMATION"
72
+ };
73
+
74
+ export const dryRunText = (filename, location) => {
75
+ return `[DRY RUN] Would write ${filename} to: ${location}`;
76
+ }
77
+
78
+ /** All-Rights-Reserved license text */
79
+ export const ARR_LICENSE_TEXT =
80
+ "Copyright (c) [year] [fullname]\n" +
81
+ "\n" +
82
+ "All rights reserved.\n";
83
+
84
+
85
+ export {pkg};
@@ -48,6 +48,8 @@
48
48
  * @property {string} folder - The folder to generate the modpack files in
49
49
  * @property {boolean} noninteractive - Whether to run the interactive mode
50
50
  * @property {boolean} addLicense - Whether to add the license file to the modpack
51
+ * @property {boolean} gitignore - Whether to generate .gitignore rules
52
+ * @property {boolean} readme - Whether to generate README.md files
51
53
  * @property {string} name - The name of the modpack
52
54
  * @property {string} version - The version of the modpack
53
55
  * @property {string} id - The slug/ID of the modpack
@@ -1,8 +1,7 @@
1
1
  import fs from 'fs/promises';
2
2
  import crypto from 'crypto';
3
3
  import path from 'path';
4
- import * as files from './config/files.js';
5
- import * as constants from './config/constants.js';
4
+ import * as config from './config/index.js';
6
5
 
7
6
  /**
8
7
  * @typedef {import('./config/types.js').ModpackInfo} ModpackInfo
@@ -16,7 +15,7 @@ import * as constants from './config/constants.js';
16
15
  */
17
16
  export function getScanDirectories(directoryPath) {
18
17
  const scanDirectories = [];
19
- for (const category of constants.DEPENDENCY_CATEGORIES) {
18
+ for (const category of config.DEPENDENCY_CATEGORIES) {
20
19
  scanDirectories.push({ name: category, path: path.join(directoryPath, category) });
21
20
  }
22
21
  return scanDirectories;
@@ -105,7 +104,7 @@ async function getJsonFile(directoryPath, filename) {
105
104
  * @returns {Promise<ModpackInfo|null>} The modpack info JSON object if the file exists, otherwise null
106
105
  */
107
106
  export async function getModpackInfo(directoryPath) {
108
- return getJsonFile(directoryPath, files.MODPACK_JSON_NAME);
107
+ return getJsonFile(directoryPath, config.MODPACK_JSON_NAME);
109
108
  }
110
109
 
111
110
  /**
@@ -114,5 +113,5 @@ export async function getModpackInfo(directoryPath) {
114
113
  * @returns {Lockfile|null} The JSON object if the file exists, otherwise null
115
114
  */
116
115
  export async function getLockfile(directoryPath) {
117
- return getJsonFile(directoryPath, files.MODPACK_LOCKFILE_NAME);
116
+ return getJsonFile(directoryPath, config.MODPACK_LOCKFILE_NAME);
118
117
  }
@@ -85,7 +85,6 @@ export default async function generateJson(modpackInfo, lockfile, outputDir, opt
85
85
  packDependencies[category].push(projectSlug);
86
86
  }
87
87
  }
88
- //packDependencies[category].push(...packDependencies[category].map(item => item.path));
89
88
  }
90
89
  }
91
90
 
@@ -94,7 +93,7 @@ export default async function generateJson(modpackInfo, lockfile, outputDir, opt
94
93
 
95
94
  // Write modpack JSON object to disk
96
95
  if (options.dryRun) {
97
- console.log(`[DRY RUN] Would write ${config.MODPACK_JSON_NAME} to: ${path.join(outputDir, config.MODPACK_JSON_NAME)}`);
96
+ console.log(config.dryRunText(config.MODPACK_JSON_NAME, path.join(outputDir, config.MODPACK_JSON_NAME)));
98
97
  } else {
99
98
  await writeJson(jsonObject, outputDir);
100
99
  }
@@ -38,13 +38,13 @@ export default async function generateLicense(modpackInfo, outputPath, options =
38
38
  licenseText = licenseText.replace('{{project}}', modpackInfo.name);
39
39
 
40
40
  if (options.dryRun) {
41
- console.log(`[DRY RUN] Would write ${config.MODPACK_LICENSE_NAME} to: ${path.join(outputPath, config.MODPACK_LICENSE_NAME)}`);
41
+ console.log(config.dryRunText(config.MODPACK_LICENSE_NAME, path.join(outputPath, config.MODPACK_LICENSE_NAME)));
42
42
  } else {
43
43
  await writeLicense(licenseText, outputPath);
44
44
  }
45
45
  return licenseText;
46
46
  } catch (error) {
47
- console.warn(`Warning: unable to generate license for: ${modpackInfo.license}`, error);
47
+ console.warn(`Warning: unable to generate license for: ${modpackInfo.license}`);
48
48
  return null;
49
49
  }
50
50
  }