@wolfstar/create-http-framework 1.0.1 → 2.0.1

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.
Files changed (3) hide show
  1. package/dist/index.js +201 -81
  2. package/package.json +57 -53
  3. package/LICENSE +0 -201
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { cancel, confirm, intro, isCancel, outro, spinner, text } from "@clack/prompts";
2
+ import { cancel, confirm, intro, isCancel, log, outro, select, spinner, text } from "@clack/prompts";
3
+ import { determineAgent } from "@vercel/detect-agent";
4
+ import mri from "mri";
3
5
  import { dirname, join, relative, resolve } from "node:path";
4
- import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
6
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
5
7
  import { execFileSync } from "node:child_process";
6
8
  import { resolveCommand } from "package-manager-detector/commands";
7
9
  import { detect } from "package-manager-detector/detect";
@@ -10,7 +12,21 @@ import { fileURLToPath } from "node:url";
10
12
 
11
13
  //#region src/tools/fileSystem.ts
12
14
  function directoryExists(path) {
13
- return existsSync(path);
15
+ return existsSync(path) && statSync(path).isDirectory();
16
+ }
17
+ function isEmpty(path) {
18
+ try {
19
+ return readdirSync(path).length === 0;
20
+ } catch (error) {
21
+ if (error.code === "ENOENT") return true;
22
+ throw error;
23
+ }
24
+ }
25
+ function emptyDir(dir) {
26
+ for (const entry of readdirSync(dir, { withFileTypes: true })) rmSync(join(dir, entry.name), {
27
+ recursive: true,
28
+ force: true
29
+ });
14
30
  }
15
31
  function writeFile(filePath, content) {
16
32
  mkdirSync(dirname(filePath), { recursive: true });
@@ -19,47 +35,58 @@ function writeFile(filePath, content) {
19
35
 
20
36
  //#endregion
21
37
  //#region src/tools/npmHelpers.ts
22
- function fetchVersion(packageName) {
23
- try {
24
- return execFileSync("npm", [
25
- "show",
26
- packageName,
27
- "version"
28
- ], {
29
- encoding: "utf-8",
30
- stdio: "pipe"
31
- }).trim();
32
- } catch {
33
- return "latest";
34
- }
38
+ async function fetchVersion(packageName) {
39
+ const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
40
+ if (!response.ok) throw new Error(`Failed to resolve latest version for ${packageName}: ${response.status} ${response.statusText}`);
41
+ return (await response.json()).version;
35
42
  }
36
- function fetchDependencyVersions() {
43
+ async function fetchDependencyVersions() {
44
+ const [httpFramework, httpFrameworkI18n, discordApiTypes, typescript, tsNode, typesNode, discordJsBuilders] = await Promise.all([
45
+ fetchVersion("@wolfstar/http-framework"),
46
+ fetchVersion("@wolfstar/http-framework-i18n"),
47
+ fetchVersion("discord-api-types"),
48
+ fetchVersion("typescript"),
49
+ fetchVersion("ts-node"),
50
+ fetchVersion("@types/node"),
51
+ fetchVersion("@discordjs/builders")
52
+ ]);
37
53
  return {
38
- httpFramework: fetchVersion("@wolfstar/http-framework"),
39
- httpFrameworkI18n: fetchVersion("@wolfstar/http-framework-i18n"),
40
- discordApiTypes: fetchVersion("discord-api-types"),
41
- typescript: fetchVersion("typescript"),
42
- tsNode: fetchVersion("ts-node"),
43
- typesNode: fetchVersion("@types/node"),
44
- discordJsBuilders: fetchVersion("@discordjs/builders")
54
+ httpFramework,
55
+ httpFrameworkI18n,
56
+ discordApiTypes,
57
+ typescript,
58
+ tsNode,
59
+ typesNode,
60
+ discordJsBuilders
45
61
  };
46
62
  }
47
63
 
48
64
  //#endregion
49
65
  //#region src/tools/packageManager.ts
50
- async function detectPackageManager(installIn) {
66
+ async function detectPackageManager() {
51
67
  const detected = await detect({ cwd: process.cwd() });
52
- const agent = detected?.agent ?? "npm";
53
- const name = detected?.name ?? "npm";
54
- if (installIn) {
55
- const resolved = resolveCommand(agent, "install", []);
56
- if (!resolved) throw new Error(`Could not resolve install command for ${agent}`);
57
- execFileSync(resolved.command, resolved.args, {
58
- cwd: installIn,
59
- stdio: process.env["DEBUG"] ? "inherit" : "pipe"
60
- });
68
+ if (detected?.name) return detected.name;
69
+ const userAgent = process.env["npm_config_user_agent"];
70
+ if (userAgent) {
71
+ const name = userAgent.split("/")[0];
72
+ if ([
73
+ "npm",
74
+ "yarn",
75
+ "pnpm",
76
+ "bun",
77
+ "deno"
78
+ ].includes(name)) return name;
61
79
  }
62
- return name;
80
+ return "npm";
81
+ }
82
+ async function installDependencies(pm, dir) {
83
+ const agent = (await detect({ cwd: process.cwd() }))?.agent ?? pm;
84
+ const resolved = resolveCommand(agent, "install", []);
85
+ if (!resolved) throw new Error(`Could not resolve install command for ${agent}`);
86
+ execFileSync(resolved.command, resolved.args, {
87
+ cwd: dir,
88
+ stdio: process.env["DEBUG"] ? "inherit" : "pipe"
89
+ });
63
90
  }
64
91
 
65
92
  //#endregion
@@ -67,7 +94,7 @@ async function detectPackageManager(installIn) {
67
94
  Handlebars.registerHelper("eq", (a, b) => a === b);
68
95
  Handlebars.registerHelper("or", (...args) => args.slice(0, -1).some(Boolean));
69
96
  Handlebars.registerHelper("and", (...args) => args.slice(0, -1).every(Boolean));
70
- const templateDir = join(fileURLToPath(import.meta.url), "../../..", "template");
97
+ const templateDir = join(fileURLToPath(import.meta.url), "../..", "template");
71
98
  function walkDir(dir) {
72
99
  const entries = readdirSync(dir);
73
100
  const files = [];
@@ -90,64 +117,157 @@ function processTemplate(outputDir, context) {
90
117
 
91
118
  //#endregion
92
119
  //#region src/index.ts
93
- const NAME_PATTERN = /^[a-z0-9_-]+$/;
120
+ function isValidPackageName(name) {
121
+ return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name);
122
+ }
123
+ function toValidPackageName(name) {
124
+ return name.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]+/, "").replace(/[^a-z0-9-._~]/g, "-");
125
+ }
126
+ function printHelp() {
127
+ process.stdout.write(`
128
+ Usage: create-http-framework [project-name] [options]
129
+
130
+ Options:
131
+ --overwrite Overwrite target directory if it already exists
132
+ --yes, -y Skip prompts and use defaults (port 3000, no i18n, auto-install)
133
+ --interactive, -i Force interactive prompts even when an AI agent is detected
134
+ --help, -h Print this message and exit
135
+
136
+ `);
137
+ process.exit(0);
138
+ }
94
139
  async function main() {
140
+ const argv = mri(process.argv.slice(2), {
141
+ boolean: [
142
+ "overwrite",
143
+ "yes",
144
+ "help",
145
+ "interactive"
146
+ ],
147
+ alias: {
148
+ y: "yes",
149
+ h: "help",
150
+ i: "interactive"
151
+ }
152
+ });
153
+ if (argv["help"]) {
154
+ printHelp();
155
+ return;
156
+ }
157
+ const argProjectName = argv._[0];
158
+ const flagOverwrite = argv["overwrite"];
159
+ const flagYes = argv["yes"];
160
+ const flagInteractive = argv["interactive"];
161
+ const { isAgent, agent } = await determineAgent();
162
+ const agentMode = isAgent && !flagInteractive;
163
+ const effectiveYes = flagYes || agentMode;
95
164
  intro("Welcome to the WolfStar HTTP Framework!");
165
+ if (agentMode && !flagYes) log.info(`AI agent detected (${agent.name}) — running in non-interactive mode`);
96
166
  const packageManager = await detectPackageManager();
97
- const projectNameArg = process.argv[2];
98
- const projectName = await text({
99
- message: "What is the name of your project?",
100
- placeholder: "my-discord-bot",
101
- initialValue: projectNameArg ?? "",
102
- validate(value) {
103
- if (!value) return "Project name cannot be empty.";
104
- if (!NAME_PATTERN.test(value)) return "Use only lowercase letters, numbers, dashes, and underscores.";
105
- if (directoryExists(resolve(value))) return `Directory "${value}" already exists.`;
167
+ let projectName;
168
+ if (effectiveYes) {
169
+ if (!argProjectName) {
170
+ cancel("A project name argument is required in non-interactive mode.");
171
+ process.exit(1);
106
172
  }
107
- });
108
- if (isCancel(projectName)) {
109
- cancel("Operation cancelled.");
110
- process.exit(0);
173
+ const normalized = isValidPackageName(argProjectName) ? argProjectName : toValidPackageName(argProjectName);
174
+ if (!normalized || !isValidPackageName(normalized)) {
175
+ cancel("Provide a valid npm-compatible project name in non-interactive mode.");
176
+ process.exit(1);
177
+ }
178
+ projectName = normalized;
179
+ } else {
180
+ const suggested = argProjectName ? toValidPackageName(argProjectName) : "";
181
+ const nameResult = await text({
182
+ message: "What is the name of your project?",
183
+ placeholder: "my-discord-bot",
184
+ initialValue: argProjectName && isValidPackageName(argProjectName) ? argProjectName : suggested,
185
+ validate(value) {
186
+ if (!value) return "Project name cannot be empty.";
187
+ if (!isValidPackageName(value)) return "Use lowercase letters, numbers, dashes, dots, or underscores (npm-compatible).";
188
+ }
189
+ });
190
+ if (isCancel(nameResult)) {
191
+ cancel("Operation cancelled.");
192
+ process.exit(0);
193
+ }
194
+ projectName = nameResult;
111
195
  }
112
- const portInput = await text({
113
- message: "Which port should the HTTP server listen on?",
114
- placeholder: "3000",
115
- initialValue: "3000",
116
- validate(value) {
117
- const n = Number(value);
118
- if (!value || Number.isNaN(n) || !Number.isInteger(n) || n < 1 || n > 65535) return "Enter a valid port number (1–65535).";
196
+ const targetDir = resolve(projectName);
197
+ if (directoryExists(targetDir) && !isEmpty(targetDir)) if (flagOverwrite) emptyDir(targetDir);
198
+ else if (effectiveYes) {
199
+ cancel(`"${projectName}" already exists. Use --overwrite to overwrite it.`);
200
+ process.exit(1);
201
+ } else {
202
+ const choice = await select({
203
+ message: `"${projectName}" already exists. What would you like to do?`,
204
+ options: [{
205
+ value: "overwrite",
206
+ label: "Overwrite the directory"
207
+ }, {
208
+ value: "cancel",
209
+ label: "Cancel"
210
+ }]
211
+ });
212
+ if (isCancel(choice) || choice === "cancel") {
213
+ cancel("Operation cancelled.");
214
+ process.exit(0);
119
215
  }
120
- });
121
- if (isCancel(portInput)) {
122
- cancel("Operation cancelled.");
123
- process.exit(0);
216
+ emptyDir(targetDir);
124
217
  }
125
- const wantsI18n = await confirm({
126
- message: "Would you like to add i18n support? (@wolfstar/http-framework-i18n)",
127
- initialValue: false
128
- });
129
- if (isCancel(wantsI18n)) {
130
- cancel("Operation cancelled.");
131
- process.exit(0);
218
+ let port;
219
+ if (effectiveYes) port = 3e3;
220
+ else {
221
+ const portResult = await text({
222
+ message: "Which port should the HTTP server listen on?",
223
+ placeholder: "3000",
224
+ initialValue: "3000",
225
+ validate(value) {
226
+ const n = Number(value);
227
+ if (!value || Number.isNaN(n) || !Number.isInteger(n) || n < 1 || n > 65535) return "Enter a valid port number (1–65535).";
228
+ }
229
+ });
230
+ if (isCancel(portResult)) {
231
+ cancel("Operation cancelled.");
232
+ process.exit(0);
233
+ }
234
+ port = Number(portResult);
132
235
  }
133
- const wantsInstall = await confirm({
134
- message: `Would you like to automatically install dependencies with ${packageManager}?`,
135
- initialValue: true
136
- });
137
- if (isCancel(wantsInstall)) {
138
- cancel("Operation cancelled.");
139
- process.exit(0);
236
+ let wantsI18n;
237
+ if (effectiveYes) wantsI18n = false;
238
+ else {
239
+ const i18nResult = await confirm({
240
+ message: "Would you like to add i18n support? (@wolfstar/http-framework-i18n)",
241
+ initialValue: false
242
+ });
243
+ if (isCancel(i18nResult)) {
244
+ cancel("Operation cancelled.");
245
+ process.exit(0);
246
+ }
247
+ wantsI18n = Boolean(i18nResult);
248
+ }
249
+ let wantsInstall;
250
+ if (effectiveYes) wantsInstall = true;
251
+ else {
252
+ const installResult = await confirm({
253
+ message: `Would you like to automatically install dependencies with ${packageManager}?`,
254
+ initialValue: true
255
+ });
256
+ if (isCancel(installResult)) {
257
+ cancel("Operation cancelled.");
258
+ process.exit(0);
259
+ }
260
+ wantsInstall = Boolean(installResult);
140
261
  }
141
262
  const s = spinner();
142
263
  s.start("Fetching latest dependency versions...");
143
- const versions = fetchDependencyVersions();
264
+ const versions = await fetchDependencyVersions();
144
265
  s.stop("Versions fetched.");
145
266
  s.start("Generating project files...");
146
- const outputDir = join(process.cwd(), projectName);
147
- processTemplate(outputDir, {
267
+ processTemplate(targetDir, {
148
268
  name: projectName,
149
- port: Number(portInput),
150
- i18n: Boolean(wantsI18n),
269
+ port,
270
+ i18n: wantsI18n,
151
271
  packageManager,
152
272
  todaysDate: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
153
273
  versions
@@ -155,7 +275,7 @@ async function main() {
155
275
  s.stop("Project files generated.");
156
276
  if (wantsInstall) {
157
277
  s.start(`Installing dependencies with ${packageManager}...`);
158
- await detectPackageManager(outputDir);
278
+ await installDependencies(packageManager, targetDir);
159
279
  s.stop("Dependencies installed.");
160
280
  }
161
281
  outro(`Done! To get started:\n\n cd ${projectName}\n${wantsInstall ? "" : ` ${packageManager} install\n`} ${packageManager} run dev`);
package/package.json CHANGED
@@ -1,54 +1,58 @@
1
1
  {
2
- "name": "@wolfstar/create-http-framework",
3
- "version": "1.0.1",
4
- "description": "Create a new WolfStar HTTP Framework bot project",
5
- "keywords": [
6
- "cli",
7
- "create",
8
- "discord",
9
- "http",
10
- "scaffold",
11
- "wolfstar"
12
- ],
13
- "homepage": "https://github.com/wolfstar-project/stars-components/tree/main/packages/create-http-framework",
14
- "bugs": {
15
- "url": "https://github.com/wolfstar-project/stars-components/issues"
16
- },
17
- "license": "Apache-2.0",
18
- "author": "@wolfstar",
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/wolfstar-project/stars-components.git",
22
- "directory": "packages/create-http-framework"
23
- },
24
- "bin": {
25
- "create-http-framework": "./dist/index.js"
26
- },
27
- "files": [
28
- "dist/",
29
- "template/"
30
- ],
31
- "type": "module",
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
- "dependencies": {
36
- "@clack/prompts": "^1.6.0",
37
- "handlebars": "^4.7.9",
38
- "package-manager-detector": "^1.6.0"
39
- },
40
- "devDependencies": {
41
- "@types/handlebars": "^4.1.0",
42
- "@types/node": "22.15.21",
43
- "tsdown": "^0.22.3",
44
- "typescript": "~5.8.3"
45
- },
46
- "engines": {
47
- "node": ">=20"
48
- },
49
- "scripts": {
50
- "build": "tsdown --config-loader unrun",
51
- "typecheck": "tsc -p ../../tsconfig.json",
52
- "lint": "oxlint src --fix"
53
- }
54
- }
2
+ "name": "@wolfstar/create-http-framework",
3
+ "version": "2.0.1",
4
+ "description": "Create a new WolfStar HTTP Framework bot project",
5
+ "keywords": [
6
+ "cli",
7
+ "create",
8
+ "discord",
9
+ "http",
10
+ "scaffold",
11
+ "wolfstar"
12
+ ],
13
+ "homepage": "https://github.com/wolfstar-project/stars-components/tree/main/packages/create-http-framework",
14
+ "bugs": {
15
+ "url": "https://github.com/wolfstar-project/stars-components/issues"
16
+ },
17
+ "license": "Apache-2.0",
18
+ "author": "@wolfstar",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/wolfstar-project/stars-components.git",
22
+ "directory": "packages/create-http-framework"
23
+ },
24
+ "bin": {
25
+ "create-http-framework": "./dist/index.js"
26
+ },
27
+ "files": [
28
+ "dist/",
29
+ "template/"
30
+ ],
31
+ "type": "module",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "build": "tsdown --config-loader unrun",
37
+ "typecheck": "tsc -p ../../tsconfig.json",
38
+ "lint": "oxlint src --fix",
39
+ "prepack": "pnpm run build"
40
+ },
41
+ "dependencies": {
42
+ "@clack/prompts": "^1.6.0",
43
+ "@vercel/detect-agent": "^1.2.3",
44
+ "handlebars": "^4.7.9",
45
+ "mri": "^1.2.0",
46
+ "package-manager-detector": "^1.6.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/handlebars": "^4.1.0",
50
+ "@types/mri": "^1.2.0",
51
+ "@types/node": "22.15.21",
52
+ "tsdown": "^0.22.3",
53
+ "typescript": "~5.8.3"
54
+ },
55
+ "engines": {
56
+ "node": ">=20"
57
+ }
58
+ }
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2022 Wolfstar Project
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.