modpack-lock 0.6.2 → 0.7.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 +15 -14
- package/build/cli.d.ts +3 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +257 -0
- package/build/cli.js.map +1 -0
- package/build/config/api.d.ts +27 -0
- package/build/config/api.d.ts.map +1 -0
- package/{src → build}/config/api.js +2 -14
- package/build/config/api.js.map +1 -0
- package/build/config/constants.d.ts +17 -0
- package/build/config/constants.d.ts.map +1 -0
- package/{src → build}/config/constants.js +10 -10
- package/build/config/constants.js.map +1 -0
- package/build/config/defaults.d.ts +16 -0
- package/build/config/defaults.d.ts.map +1 -0
- package/build/config/defaults.js +60 -0
- package/build/config/defaults.js.map +1 -0
- package/build/config/files.d.ts +11 -0
- package/build/config/files.d.ts.map +1 -0
- package/{src → build}/config/files.js +1 -4
- package/build/config/files.js.map +1 -0
- package/build/config/index.d.ts +7 -0
- package/build/config/index.d.ts.map +1 -0
- package/{src → build}/config/index.js +1 -0
- package/build/config/index.js.map +1 -0
- package/build/config/options.d.ts +8 -0
- package/build/config/options.d.ts.map +1 -0
- package/{src → build}/config/options.js +7 -6
- package/build/config/options.js.map +1 -0
- package/build/config/strings.d.ts +35 -0
- package/build/config/strings.d.ts.map +1 -0
- package/{src → build}/config/strings.js +14 -19
- package/build/config/strings.js.map +1 -0
- package/build/directory_scanning.d.ts +26 -0
- package/build/directory_scanning.d.ts.map +1 -0
- package/{src → build}/directory_scanning.js +23 -36
- package/build/directory_scanning.js.map +1 -0
- package/build/generate_gitignore.d.ts +9 -0
- package/build/generate_gitignore.d.ts.map +1 -0
- package/{src → build}/generate_gitignore.js +21 -35
- package/build/generate_gitignore.js.map +1 -0
- package/build/generate_json.d.ts +11 -0
- package/build/generate_json.d.ts.map +1 -0
- package/{src → build}/generate_json.js +40 -39
- package/build/generate_json.js.map +1 -0
- package/build/generate_license.d.ts +11 -0
- package/build/generate_license.d.ts.map +1 -0
- package/build/generate_license.js +54 -0
- package/build/generate_license.js.map +1 -0
- package/build/generate_lockfile.d.ts +14 -0
- package/build/generate_lockfile.d.ts.map +1 -0
- package/{src → build}/generate_lockfile.js +19 -69
- package/build/generate_lockfile.js.map +1 -0
- package/build/generate_readme.d.ts +9 -0
- package/build/generate_readme.d.ts.map +1 -0
- package/{src → build}/generate_readme.js +46 -72
- package/build/generate_readme.js.map +1 -0
- package/build/github_interactions.d.ts +14 -0
- package/build/github_interactions.d.ts.map +1 -0
- package/{src → build}/github_interactions.js +16 -19
- package/build/github_interactions.js.map +1 -0
- package/build/logger.d.ts +96 -0
- package/build/logger.d.ts.map +1 -0
- package/{src → build}/logger.js +47 -55
- package/build/logger.js.map +1 -0
- package/build/modpack-lock.d.ts +25 -0
- package/build/modpack-lock.d.ts.map +1 -0
- package/{src → build}/modpack-lock.js +12 -38
- package/build/modpack-lock.js.map +1 -0
- package/build/modrinth_interactions.d.ts +31 -0
- package/build/modrinth_interactions.d.ts.map +1 -0
- package/{src → build}/modrinth_interactions.js +67 -55
- package/build/modrinth_interactions.js.map +1 -0
- package/build/types/Jsonfile.d.ts +15 -0
- package/build/types/Jsonfile.d.ts.map +1 -0
- package/build/types/Jsonfile.js +2 -0
- package/build/types/Jsonfile.js.map +1 -0
- package/build/types/Lockfile.d.ts +39 -0
- package/build/types/Lockfile.d.ts.map +1 -0
- package/build/types/Lockfile.js +2 -0
- package/build/types/Lockfile.js.map +1 -0
- package/build/types/ModpackInfo.d.ts +28 -0
- package/build/types/ModpackInfo.d.ts.map +1 -0
- package/build/types/ModpackInfo.js +2 -0
- package/build/types/ModpackInfo.js.map +1 -0
- package/build/types/OptionalFileOptions.d.ts +8 -0
- package/build/types/OptionalFileOptions.d.ts.map +1 -0
- package/build/types/OptionalFileOptions.js +2 -0
- package/build/types/OptionalFileOptions.js.map +1 -0
- package/build/types/contentFiles.d.ts +24 -0
- package/build/types/contentFiles.d.ts.map +1 -0
- package/build/types/contentFiles.js +2 -0
- package/build/types/contentFiles.js.map +1 -0
- package/build/types/githubResponses.d.ts +17 -0
- package/build/types/githubResponses.d.ts.map +1 -0
- package/build/types/githubResponses.js +2 -0
- package/build/types/githubResponses.js.map +1 -0
- package/build/types/index.d.ts +9 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +2 -0
- package/build/types/index.js.map +1 -0
- package/build/types/modrinthResponses.d.ts +135 -0
- package/build/types/modrinthResponses.d.ts.map +1 -0
- package/build/types/modrinthResponses.js +2 -0
- package/build/types/modrinthResponses.js.map +1 -0
- package/build/types/options.d.ts +70 -0
- package/build/types/options.d.ts.map +1 -0
- package/build/types/options.js +2 -0
- package/build/types/options.js.map +1 -0
- package/build/user_prompts.d.ts +16 -0
- package/build/user_prompts.d.ts.map +1 -0
- package/build/user_prompts.js +132 -0
- package/build/user_prompts.js.map +1 -0
- package/package.json +13 -6
- package/src/cli.js +0 -310
- package/src/config/defaults.js +0 -66
- package/src/config/types.js +0 -76
- package/src/generate_license.js +0 -54
- package/src/modpack_info.js +0 -200
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ContentVersion } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lockfile shape; contains detailed information about the modpack dependencies and their versions.
|
|
4
|
+
* @property version - The version of the lockfile
|
|
5
|
+
* @property generated - The date and time the lockfile was generated
|
|
6
|
+
* @property total - The total number of files in the modpack
|
|
7
|
+
* @property counts - An object containing the number of files in each dependency category
|
|
8
|
+
* @property dependencies - An object containing arrays with all the modpack's dependencies and their version information
|
|
9
|
+
*/
|
|
10
|
+
export type Lockfile = {
|
|
11
|
+
version: string;
|
|
12
|
+
generated: string;
|
|
13
|
+
total: number;
|
|
14
|
+
counts: Partial<Record<DependencyCategory, number>>;
|
|
15
|
+
dependencies: {
|
|
16
|
+
mods?: LockfileDependency[];
|
|
17
|
+
resourcepacks?: LockfileDependency[];
|
|
18
|
+
datapacks?: LockfileDependency[];
|
|
19
|
+
shaderpacks?: LockfileDependency[];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The categories of dependencies in the lockfile
|
|
24
|
+
* @property mods - The mods folder
|
|
25
|
+
* @property resourcepacks - The resourcepacks folder
|
|
26
|
+
* @property datapacks - The datapacks folder
|
|
27
|
+
* @property shaderpacks - The shaderpacks folder
|
|
28
|
+
*/
|
|
29
|
+
export type DependencyCategory = keyof Lockfile["dependencies"];
|
|
30
|
+
/**
|
|
31
|
+
* The shape of a dependency in the lockfile
|
|
32
|
+
* @property path - The path to the dependency file in the modpack directory
|
|
33
|
+
* @property version - The version of the dependency, or null if the dependency is not found on Modrinth
|
|
34
|
+
*/
|
|
35
|
+
export type LockfileDependency = {
|
|
36
|
+
path: string;
|
|
37
|
+
version: ContentVersion | null;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=Lockfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lockfile.d.ts","sourceRoot":"","sources":["../../src/types/Lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,YAAY,EAAE;QACV,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAC5B,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;QACrC,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;QACjC,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;KACtC,CAAC;CACL,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lockfile.js","sourceRoot":"","sources":["../../src/types/Lockfile.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains information about the modpack that is not dependent on the lockfile.
|
|
3
|
+
* @property name - The name of the modpack (Required)
|
|
4
|
+
* @property version - The modpack version (Required)
|
|
5
|
+
* @property description - A description of the modpack
|
|
6
|
+
* @property id - The modpack's slug/ID (Required)
|
|
7
|
+
* @property author - The author of the modpack (Required)
|
|
8
|
+
* @property projectUrl - The project's homepage URL
|
|
9
|
+
* @property sourceUrl - The project's source code URL
|
|
10
|
+
* @property license - The modpack's license
|
|
11
|
+
* @property modloader - The modpack's modloader (Required)
|
|
12
|
+
* @property targetModloaderVersion - The target modloader version
|
|
13
|
+
* @property targetMinecraftVersion - The target Minecraft version (Required)
|
|
14
|
+
*/
|
|
15
|
+
export type ModpackInfo = {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
description: string;
|
|
19
|
+
id: string;
|
|
20
|
+
author: string;
|
|
21
|
+
projectUrl: string;
|
|
22
|
+
sourceUrl: string;
|
|
23
|
+
license: string;
|
|
24
|
+
modloader: string;
|
|
25
|
+
targetModloaderVersion: string;
|
|
26
|
+
targetMinecraftVersion: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=ModpackInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModpackInfo.d.ts","sourceRoot":"","sources":["../../src/types/ModpackInfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,sBAAsB,EAAE,MAAM,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModpackInfo.js","sourceRoot":"","sources":["../../src/types/ModpackInfo.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The options available for the user to add optional files to the modpack
|
|
3
|
+
* @property addLicense - Whether to add the license text to the modpack
|
|
4
|
+
* @property addReadme - Whether to add the README.md file to the modpack
|
|
5
|
+
* @property addGitignore - Whether to add the .gitignore file to the modpack
|
|
6
|
+
*/
|
|
7
|
+
export type OptionalFileOptions = "addLicense" | "addReadme" | "addGitignore";
|
|
8
|
+
//# sourceMappingURL=OptionalFileOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionalFileOptions.d.ts","sourceRoot":"","sources":["../../src/types/OptionalFileOptions.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionalFileOptions.js","sourceRoot":"","sources":["../../src/types/OptionalFileOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DependencyCategory } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A directory that contains modpack content (e.g. mods, resourcepacks, datapacks, shaderpacks)
|
|
4
|
+
* @property name - The name of the directory
|
|
5
|
+
* @property path - The path to the directory
|
|
6
|
+
*/
|
|
7
|
+
export type ContentDirectory = {
|
|
8
|
+
name: DependencyCategory;
|
|
9
|
+
path: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A binary content file in the modpack -- a file tracked by the modpack lockfile
|
|
13
|
+
* @property path - The path to the file
|
|
14
|
+
* @property fullPath - The full path to the file
|
|
15
|
+
* @property hash - The hash of the file
|
|
16
|
+
* @property category - The content category of the file (e.g. mods, resourcepacks, datapacks, shaderpacks)
|
|
17
|
+
*/
|
|
18
|
+
export type ContentFile = {
|
|
19
|
+
path: string;
|
|
20
|
+
fullPath: string;
|
|
21
|
+
hash: string;
|
|
22
|
+
category: DependencyCategory;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=contentFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentFiles.d.ts","sourceRoot":"","sources":["../../src/types/contentFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,kBAAkB,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentFiles.js","sourceRoot":"","sources":["../../src/types/contentFiles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One of the license objects in a response from the GitHub API
|
|
3
|
+
* @property spdx_id - The SPDX ID of the license
|
|
4
|
+
* @property key - The key of the license
|
|
5
|
+
*/
|
|
6
|
+
export type LicenseResponseItem = {
|
|
7
|
+
spdx_id: string;
|
|
8
|
+
key: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The response from the GitHub API for a license text
|
|
12
|
+
* @property body - The text of the license
|
|
13
|
+
*/
|
|
14
|
+
export type LicenseTextResponse = {
|
|
15
|
+
body: string;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=githubResponses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubResponses.d.ts","sourceRoot":"","sources":["../../src/types/githubResponses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubResponses.js","sourceRoot":"","sources":["../../src/types/githubResponses.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type * from "./Lockfile.js";
|
|
2
|
+
export type * from "./Jsonfile.js";
|
|
3
|
+
export type * from "./ModpackInfo.js";
|
|
4
|
+
export type * from "./options.js";
|
|
5
|
+
export type * from "./modrinthResponses.js";
|
|
6
|
+
export type * from "./githubResponses.js";
|
|
7
|
+
export type * from "./contentFiles.js";
|
|
8
|
+
export type * from "./OptionalFileOptions.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of a dependency on another version of another project
|
|
3
|
+
* @property version_id - The ID of the dependency version
|
|
4
|
+
* @property project_id - The ID of the project
|
|
5
|
+
* @property file_name - The name of the file
|
|
6
|
+
* @property dependency_type - The type of dependency
|
|
7
|
+
*/
|
|
8
|
+
export type VersionDependency = {
|
|
9
|
+
version_id: string;
|
|
10
|
+
project_id: string;
|
|
11
|
+
file_name: string;
|
|
12
|
+
dependency_type: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A metadata for a specific version file of a project on Modrinth. Saved in the lockfile.
|
|
16
|
+
* @property id - The ID of the version
|
|
17
|
+
* @property project_id - The ID of the project
|
|
18
|
+
* @property author_id - The ID of the author
|
|
19
|
+
* @property date_published - The date the version was published
|
|
20
|
+
* @property downloads - The number of downloads of the version
|
|
21
|
+
* @property files - The files of the version
|
|
22
|
+
* @property game_versions - The game versions the version is compatible with
|
|
23
|
+
* @property loaders - The loaders the version is compatible with
|
|
24
|
+
* @property featured - Whether the version is featured
|
|
25
|
+
* @property name - The name of the version
|
|
26
|
+
* @property version_number - The version number
|
|
27
|
+
* @property changelog - The changelog of the version
|
|
28
|
+
* @property changelog_url - The URL of the changelog
|
|
29
|
+
* @property version_type - The type of version
|
|
30
|
+
* @property status - The status of the version
|
|
31
|
+
* @property requested_status - The requested status of the version
|
|
32
|
+
* @property dependencies - The dependencies for this version
|
|
33
|
+
*/
|
|
34
|
+
export type ContentVersion = {
|
|
35
|
+
id: string;
|
|
36
|
+
project_id: string;
|
|
37
|
+
author_id: string;
|
|
38
|
+
date_published: string;
|
|
39
|
+
downloads: number;
|
|
40
|
+
files: any[];
|
|
41
|
+
game_versions?: string[];
|
|
42
|
+
loaders?: string[];
|
|
43
|
+
featured?: boolean;
|
|
44
|
+
name?: string;
|
|
45
|
+
version_number?: string;
|
|
46
|
+
changelog?: string;
|
|
47
|
+
changelog_url?: string | null;
|
|
48
|
+
version_type?: string;
|
|
49
|
+
status?: string;
|
|
50
|
+
requested_status?: string | null;
|
|
51
|
+
dependencies?: VersionDependency[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The shape of a project response from the Modrinth API
|
|
55
|
+
*/
|
|
56
|
+
export type ProjectResponseItem = {
|
|
57
|
+
id: string;
|
|
58
|
+
project_type: string;
|
|
59
|
+
team: string;
|
|
60
|
+
published: string;
|
|
61
|
+
updated: string;
|
|
62
|
+
downloads: number;
|
|
63
|
+
followers: number;
|
|
64
|
+
slug?: string;
|
|
65
|
+
client_side?: string;
|
|
66
|
+
server_side?: string;
|
|
67
|
+
game_versions?: string[];
|
|
68
|
+
organization?: string | null;
|
|
69
|
+
title?: string;
|
|
70
|
+
description?: string;
|
|
71
|
+
body?: string;
|
|
72
|
+
body_url?: string | null;
|
|
73
|
+
approved?: string;
|
|
74
|
+
queued?: string | null;
|
|
75
|
+
status?: string;
|
|
76
|
+
requested_status?: string | null;
|
|
77
|
+
moderator_message?: string | null;
|
|
78
|
+
license?: any;
|
|
79
|
+
categories?: string[];
|
|
80
|
+
additional_categories?: string[];
|
|
81
|
+
loaders?: string[];
|
|
82
|
+
versions?: string[];
|
|
83
|
+
icon_url?: string;
|
|
84
|
+
issues_url?: string;
|
|
85
|
+
source_url?: string;
|
|
86
|
+
wiki_url?: string;
|
|
87
|
+
discord_url?: string;
|
|
88
|
+
donation_urls?: string[];
|
|
89
|
+
gallery?: string[];
|
|
90
|
+
color?: number;
|
|
91
|
+
thread_id?: string;
|
|
92
|
+
monetization_status?: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* The types of Minecraft versions that can be returned from the Modrinth API
|
|
96
|
+
*/
|
|
97
|
+
export type MinecraftVersionType = "release" | "alpha" | "beta" | "snapshot";
|
|
98
|
+
/**
|
|
99
|
+
* The shape of an item in the Minecraft versions response from the Modrinth API
|
|
100
|
+
*/
|
|
101
|
+
export type MinecraftVersionResponseItem = {
|
|
102
|
+
version: string;
|
|
103
|
+
version_type: MinecraftVersionType;
|
|
104
|
+
date: string;
|
|
105
|
+
major: boolean;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The shape of an item in the modloaders response from the Modrinth API
|
|
109
|
+
*/
|
|
110
|
+
export type ModloaderResponseItem = {
|
|
111
|
+
icon: string;
|
|
112
|
+
name: string;
|
|
113
|
+
supported_project_types: string[];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The shape of an item in the users response from the Modrinth API
|
|
117
|
+
*/
|
|
118
|
+
export type UserResponseItem = {
|
|
119
|
+
username: string;
|
|
120
|
+
id: string;
|
|
121
|
+
created: string;
|
|
122
|
+
role: "admin" | "moderator" | "developer";
|
|
123
|
+
name?: string;
|
|
124
|
+
email?: string | null;
|
|
125
|
+
bio?: string;
|
|
126
|
+
payout_data?: any;
|
|
127
|
+
avatar_url?: string;
|
|
128
|
+
badges?: number;
|
|
129
|
+
auth_providers?: string[];
|
|
130
|
+
email_verified?: boolean | null;
|
|
131
|
+
has_password?: boolean | null;
|
|
132
|
+
has_totp?: boolean | null;
|
|
133
|
+
github_id?: number | null;
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=modrinthResponses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modrinthResponses.d.ts","sourceRoot":"","sources":["../../src/types/modrinthResponses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAA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EG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB,EAAE,MAAM,EAAE,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modrinthResponses.js","sourceRoot":"","sources":["../../src/types/modrinthResponses.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains options for the generation of the modpack files.
|
|
3
|
+
* @property dryRun - Whether to run in dry-run mode (no files written)
|
|
4
|
+
* @property quiet - Whether to quiet the console output
|
|
5
|
+
* @property silent - Whether to silence the console output
|
|
6
|
+
* @property gitignore - Whether to generate a .gitignore file
|
|
7
|
+
* @property readme - Whether to generate README.md files
|
|
8
|
+
* @property licenseFile - Whether to generate a license file
|
|
9
|
+
* @property path - The modpack root directory
|
|
10
|
+
*/
|
|
11
|
+
export interface Options {
|
|
12
|
+
dryRun?: boolean;
|
|
13
|
+
quiet?: boolean;
|
|
14
|
+
silent?: boolean;
|
|
15
|
+
gitignore?: boolean;
|
|
16
|
+
readme?: boolean;
|
|
17
|
+
licenseFile?: boolean;
|
|
18
|
+
path?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Contains options for the initialization of the modpack files.
|
|
22
|
+
* @property folder - The modpack root directory
|
|
23
|
+
* @property noninteractive - Whether to initialize in non-interactive mode
|
|
24
|
+
* @property addLicense - Whether to add the license file to the modpack
|
|
25
|
+
* @property addGitignore - Whether to generate .gitignore rules
|
|
26
|
+
* @property addReadme - Whether to generate README.md files
|
|
27
|
+
* @property name - The option to set the modpack name
|
|
28
|
+
* @property version - The option to set the version
|
|
29
|
+
* @property id - The option to set the slug/ID
|
|
30
|
+
* @property description - The option to set the description
|
|
31
|
+
* @property author - The option to set the author
|
|
32
|
+
* @property projectUrl - The option to set the project URL
|
|
33
|
+
* @property sourceUrl - The option to set the source code URL
|
|
34
|
+
* @property license - The option to set the license
|
|
35
|
+
* @property modloader - The option to set the modloader
|
|
36
|
+
* @property targetModloaderVersion - The option to set the target modloader version
|
|
37
|
+
* @property targetMinecraftVersion - The option to set the target Minecraft version
|
|
38
|
+
* @property _init - Internal boolean added to indicate options come from the `init` command.
|
|
39
|
+
*/
|
|
40
|
+
export interface InitOptions extends Options {
|
|
41
|
+
folder?: string;
|
|
42
|
+
noninteractive?: boolean;
|
|
43
|
+
addLicense?: boolean;
|
|
44
|
+
addGitignore?: boolean;
|
|
45
|
+
addReadme?: boolean;
|
|
46
|
+
name?: string;
|
|
47
|
+
version?: string;
|
|
48
|
+
id?: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
author?: string;
|
|
51
|
+
projectUrl?: string;
|
|
52
|
+
sourceUrl?: string;
|
|
53
|
+
license?: string;
|
|
54
|
+
modloader?: string;
|
|
55
|
+
targetModloaderVersion?: string;
|
|
56
|
+
targetMinecraftVersion?: string;
|
|
57
|
+
_init?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Contains options for the running scripts defined in modpack.json.
|
|
61
|
+
* @property folder - The modpack root directory
|
|
62
|
+
* @property debug - Whether to print debug information
|
|
63
|
+
* @property _run - Internal boolean added to indicate options come from the `run` command.
|
|
64
|
+
*/
|
|
65
|
+
export interface RunOptions extends Options {
|
|
66
|
+
folder?: string;
|
|
67
|
+
debug?: boolean;
|
|
68
|
+
_run?: boolean;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,OAAO;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,OAAO;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import prompts from "prompts";
|
|
2
|
+
import type { OptionalFileOptions, InitOptions, Jsonfile, ModpackInfo } from "./types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Prompt the user for modpack information
|
|
5
|
+
* @param defaults - The default modpack information, used as the initial value for each prompt
|
|
6
|
+
* @returns The answers to the prompts from the user
|
|
7
|
+
*/
|
|
8
|
+
export declare function promptUserForInfo(defaults: Jsonfile): Promise<prompts.Answers<keyof ModpackInfo>>;
|
|
9
|
+
/**
|
|
10
|
+
* Prompt the user about adding the license text to the modpack
|
|
11
|
+
* @param modpackInfo - The Jsonfile object containing the modpack information
|
|
12
|
+
* @param options - The default options
|
|
13
|
+
* @returns The answers from the user
|
|
14
|
+
*/
|
|
15
|
+
export declare function promptUserAboutOptionalFiles(modpackInfo: Jsonfile, options: InitOptions): Promise<prompts.Answers<OptionalFileOptions>>;
|
|
16
|
+
//# sourceMappingURL=user_prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user_prompts.d.ts","sourceRoot":"","sources":["../src/user_prompts.ts"],"names":[],"mappings":"AAAA,OAAO,OAAkE,MAAM,SAAS,CAAC;AAKzF,OAAO,KAAK,EAAC,mBAAmB,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AA8G9F;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,WAAW,CAAC,CAAC,CA0DvG;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAC9C,WAAW,EAAE,QAAQ,EACrB,OAAO,EAAE,WAAW,GACrB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CA6B/C"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import prompts, {} from "prompts";
|
|
2
|
+
import slugify from "@sindresorhus/slugify";
|
|
3
|
+
import * as config from "./config/index.js";
|
|
4
|
+
import { getLicenseList, getLicenseText } from "./github_interactions.js";
|
|
5
|
+
import { getMinecraftVersions, getModloaders } from "./modrinth_interactions.js";
|
|
6
|
+
/**
|
|
7
|
+
* Capitalizes a string
|
|
8
|
+
*/
|
|
9
|
+
function capitalize(string) {
|
|
10
|
+
return `${string.charAt(0).toUpperCase()}${string.slice(1)}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a value is not empty
|
|
14
|
+
*/
|
|
15
|
+
function validateNotEmpty(value, field) {
|
|
16
|
+
if (value === undefined || value?.trim().length === 0) {
|
|
17
|
+
return `${field} cannot be empty`;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns a required text prompt
|
|
23
|
+
*/
|
|
24
|
+
function requiredText(name, message, initial) {
|
|
25
|
+
return {
|
|
26
|
+
type: "text",
|
|
27
|
+
name: name,
|
|
28
|
+
message: `${capitalize(message)}`,
|
|
29
|
+
initial: initial,
|
|
30
|
+
validate: (value) => {
|
|
31
|
+
return validateNotEmpty(value, name);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns an optional text prompt
|
|
37
|
+
*/
|
|
38
|
+
function optionalText(name, message, initial) {
|
|
39
|
+
return {
|
|
40
|
+
type: "text",
|
|
41
|
+
name: name,
|
|
42
|
+
message: `${capitalize(message)}`,
|
|
43
|
+
initial: initial,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the value of an "other" answer from the user
|
|
48
|
+
*/
|
|
49
|
+
async function getOtherAnswer(value, message, initial) {
|
|
50
|
+
if (value && value !== config.OTHER_OPTION.value) {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
const question = await prompts(requiredText("other", message, initial), config.PROMPTS_OPTIONS);
|
|
54
|
+
return question.other || config.OTHER_OPTION.value;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns a required autocomplete prompt with a fallback to the "other" option
|
|
58
|
+
*/
|
|
59
|
+
function requiredAutocomplete(name, message, initial, choices, defaultValue) {
|
|
60
|
+
initial = initial || defaultValue || config.OTHER_OPTION.value;
|
|
61
|
+
if (initial && !choices.some((choice) => choice.value === initial)) {
|
|
62
|
+
choices.push({ title: initial, value: initial });
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
type: "autocomplete",
|
|
66
|
+
name: name,
|
|
67
|
+
message: `${capitalize(message)}`,
|
|
68
|
+
initial: initial,
|
|
69
|
+
choices: choices,
|
|
70
|
+
//fallback: config.OTHER_OPTION.value,
|
|
71
|
+
format: async (value) => {
|
|
72
|
+
return await getOtherAnswer(value, ` └─ Other ${message}`, initial);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns a confirmation prompt to generate an optional file
|
|
78
|
+
*/
|
|
79
|
+
function fileGenerationConfirm(name, message, showPrompt) {
|
|
80
|
+
return {
|
|
81
|
+
type: showPrompt ? "confirm" : null,
|
|
82
|
+
name: name,
|
|
83
|
+
message: `${capitalize(message)}`,
|
|
84
|
+
initial: true,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Prompt the user for modpack information
|
|
89
|
+
* @param defaults - The default modpack information, used as the initial value for each prompt
|
|
90
|
+
* @returns The answers to the prompts from the user
|
|
91
|
+
*/
|
|
92
|
+
export async function promptUserForInfo(defaults) {
|
|
93
|
+
const licenseList = await getLicenseList();
|
|
94
|
+
const minecraftVersions = await getMinecraftVersions();
|
|
95
|
+
const modloaders = await getModloaders();
|
|
96
|
+
let answers = await prompts([
|
|
97
|
+
requiredText("name", config.infoFields.name.prompt, defaults.name),
|
|
98
|
+
requiredText("version", config.infoFields.version.prompt, defaults.version || config.DEFAULT_MODPACK_VERSION),
|
|
99
|
+
requiredText("id", config.infoFields.id.prompt, (prev, values) => {
|
|
100
|
+
return slugify(defaults.id || values.name, config.SLUGIFY_OPTIONS);
|
|
101
|
+
}),
|
|
102
|
+
optionalText("description", config.infoFields.description.prompt, defaults.description),
|
|
103
|
+
requiredText("author", config.infoFields.author.prompt, defaults.author),
|
|
104
|
+
optionalText("projectUrl", config.infoFields.projectUrl.prompt, (prev, values) => defaults.projectUrl || config.DEFAULT_PROJECT_URL(values.id)),
|
|
105
|
+
optionalText("sourceUrl", config.infoFields.sourceUrl.prompt, (prev, values) => defaults.sourceUrl || config.DEFAULT_SOURCE_URL(values.id, values.author)),
|
|
106
|
+
requiredAutocomplete("license", config.infoFields.license.prompt, defaults.license, licenseList, config.DEFAULT_MODPACK_LICENSE),
|
|
107
|
+
requiredAutocomplete("modloader", config.infoFields.modloader.prompt, defaults.modloader, modloaders, config.FALLBACK_MODLOADERS[0] ? config.FALLBACK_MODLOADERS[0].value : ""),
|
|
108
|
+
optionalText("targetModloaderVersion", config.infoFields.targetModloaderVersion.prompt, defaults.targetModloaderVersion),
|
|
109
|
+
requiredAutocomplete("targetMinecraftVersion", config.infoFields.targetMinecraftVersion.prompt, defaults.targetMinecraftVersion, minecraftVersions, minecraftVersions[0]?.value || ""),
|
|
110
|
+
], config.PROMPTS_OPTIONS);
|
|
111
|
+
return answers;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Prompt the user about adding the license text to the modpack
|
|
115
|
+
* @param modpackInfo - The Jsonfile object containing the modpack information
|
|
116
|
+
* @param options - The default options
|
|
117
|
+
* @returns The answers from the user
|
|
118
|
+
*/
|
|
119
|
+
export async function promptUserAboutOptionalFiles(modpackInfo, options) {
|
|
120
|
+
const licenseText = modpackInfo.license ? await getLicenseText(modpackInfo.license) : null;
|
|
121
|
+
const answers = await prompts([
|
|
122
|
+
fileGenerationConfirm("addLicense", `${config.fileFields.addLicense.prompt}?`, licenseText && options.addLicense === undefined ? true : false),
|
|
123
|
+
fileGenerationConfirm("addReadme", `${config.fileFields.addReadme.prompt}?`, options.addReadme === undefined),
|
|
124
|
+
fileGenerationConfirm("addGitignore", `${config.fileFields.addGitignore.prompt}?`, options.addGitignore === undefined),
|
|
125
|
+
], config.PROMPTS_OPTIONS);
|
|
126
|
+
answers.addLicense =
|
|
127
|
+
answers.addLicense === undefined ? (licenseText ? options.addLicense : false) : answers.addLicense;
|
|
128
|
+
answers.addReadme = answers.addReadme === undefined ? options.addReadme : answers.addReadme;
|
|
129
|
+
answers.addGitignore = answers.addGitignore === undefined ? options.addGitignore : answers.addGitignore;
|
|
130
|
+
return answers;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=user_prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user_prompts.js","sourceRoot":"","sources":["../src/user_prompts.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAyD,MAAM,SAAS,CAAC;AACzF,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,cAAc,EAAE,cAAc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