@shell-shock/plugin-changelog 0.1.11 → 0.1.14
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/dist/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/components/changelog-command.cjs +51 -1
- package/dist/components/changelog-command.d.cts +1 -3
- package/dist/components/changelog-command.d.cts.map +1 -1
- package/dist/components/changelog-command.d.mts +1 -3
- package/dist/components/changelog-command.d.mts.map +1 -1
- package/dist/components/changelog-command.mjs +50 -1
- package/dist/components/changelog-command.mjs.map +1 -1
- package/dist/components/index.cjs +4 -1
- package/dist/components/index.mjs +3 -1
- package/dist/helpers/resolve-changelog.cjs +50 -1
- package/dist/helpers/resolve-changelog.mjs +50 -1
- package/dist/helpers/resolve-changelog.mjs.map +1 -1
- package/dist/index.cjs +67 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +63 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +14 -16
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
|
@@ -1 +1,51 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
4
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
5
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
7
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
8
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
+
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
10
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
11
|
+
|
|
12
|
+
//#region src/components/changelog-command.tsx
|
|
13
|
+
/**
|
|
14
|
+
* The Changelog command's handler wrapper for the Shell Shock project.
|
|
15
|
+
*/
|
|
16
|
+
function ChangelogCommand({ changelog }) {
|
|
17
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
18
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
19
|
+
get path() {
|
|
20
|
+
return (0, _stryke_path_join.joinPaths)(context.entryPath, "changelog", "command.ts");
|
|
21
|
+
},
|
|
22
|
+
builtinImports: { console: [
|
|
23
|
+
"textColors",
|
|
24
|
+
"bold",
|
|
25
|
+
"writeLine",
|
|
26
|
+
"error",
|
|
27
|
+
"warn"
|
|
28
|
+
] },
|
|
29
|
+
get children() {
|
|
30
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
31
|
+
return `Display the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} changelog.`;
|
|
32
|
+
} }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
33
|
+
"export": true,
|
|
34
|
+
"default": true,
|
|
35
|
+
name: "handler",
|
|
36
|
+
get children() {
|
|
37
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
38
|
+
get when() {
|
|
39
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(changelog);
|
|
40
|
+
},
|
|
41
|
+
fallback: _alloy_js_core.code` return warn("There is no changelog available for display."); `,
|
|
42
|
+
children: _alloy_js_core.code`console.log(${changelog});`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
})];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.ChangelogCommand = ChangelogCommand;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/changelog-command.d.ts
|
|
4
2
|
interface ChangelogCommandProps {
|
|
5
3
|
changelog: string;
|
|
@@ -9,7 +7,7 @@ interface ChangelogCommandProps {
|
|
|
9
7
|
*/
|
|
10
8
|
declare function ChangelogCommand({
|
|
11
9
|
changelog
|
|
12
|
-
}: ChangelogCommandProps):
|
|
10
|
+
}: ChangelogCommandProps): import("@alloy-js/core").Children;
|
|
13
11
|
//#endregion
|
|
14
12
|
export { ChangelogCommand, ChangelogCommandProps };
|
|
15
13
|
//# sourceMappingURL=changelog-command.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog-command.d.cts","names":[],"sources":["../../src/components/changelog-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"changelog-command.d.cts","names":[],"sources":["../../src/components/changelog-command.tsx"],"mappings":";UA4BiB,qBAAA;EACf,SAAS;AAAA;;;AAAA;iBAMK,gBAAA;EAAmB;AAAA,GAAa,qBAAqB,4BAAA,QAAA"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/changelog-command.d.ts
|
|
4
2
|
interface ChangelogCommandProps {
|
|
5
3
|
changelog: string;
|
|
@@ -9,7 +7,7 @@ interface ChangelogCommandProps {
|
|
|
9
7
|
*/
|
|
10
8
|
declare function ChangelogCommand({
|
|
11
9
|
changelog
|
|
12
|
-
}: ChangelogCommandProps):
|
|
10
|
+
}: ChangelogCommandProps): import("@alloy-js/core").Children;
|
|
13
11
|
//#endregion
|
|
14
12
|
export { ChangelogCommand, ChangelogCommandProps };
|
|
15
13
|
//# sourceMappingURL=changelog-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog-command.d.mts","names":[],"sources":["../../src/components/changelog-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"changelog-command.d.mts","names":[],"sources":["../../src/components/changelog-command.tsx"],"mappings":""}
|
|
@@ -1,2 +1,51 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
3
|
+
import { joinPaths } from "@stryke/path/join";
|
|
4
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
5
|
+
import { Show, code } from "@alloy-js/core";
|
|
6
|
+
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
7
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
8
|
+
import { TypescriptFile } from "@powerlines/plugin-alloy/typescript";
|
|
9
|
+
import { TSDoc } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
10
|
+
|
|
11
|
+
//#region src/components/changelog-command.tsx
|
|
12
|
+
/**
|
|
13
|
+
* The Changelog command's handler wrapper for the Shell Shock project.
|
|
14
|
+
*/
|
|
15
|
+
function ChangelogCommand({ changelog }) {
|
|
16
|
+
const context = usePowerlines();
|
|
17
|
+
return createComponent(TypescriptFile, {
|
|
18
|
+
get path() {
|
|
19
|
+
return joinPaths(context.entryPath, "changelog", "command.ts");
|
|
20
|
+
},
|
|
21
|
+
builtinImports: { console: [
|
|
22
|
+
"textColors",
|
|
23
|
+
"bold",
|
|
24
|
+
"writeLine",
|
|
25
|
+
"error",
|
|
26
|
+
"warn"
|
|
27
|
+
] },
|
|
28
|
+
get children() {
|
|
29
|
+
return [createComponent(TSDoc, { get heading() {
|
|
30
|
+
return `Display the ${getAppTitle(context)} changelog.`;
|
|
31
|
+
} }), createComponent(FunctionDeclaration, {
|
|
32
|
+
"export": true,
|
|
33
|
+
"default": true,
|
|
34
|
+
name: "handler",
|
|
35
|
+
get children() {
|
|
36
|
+
return createComponent(Show, {
|
|
37
|
+
get when() {
|
|
38
|
+
return isSetString(changelog);
|
|
39
|
+
},
|
|
40
|
+
fallback: code` return warn("There is no changelog available for display."); `,
|
|
41
|
+
children: code`console.log(${changelog});`
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
})];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ChangelogCommand };
|
|
2
51
|
//# sourceMappingURL=changelog-command.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog-command.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"changelog-command.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_components_changelog_command = require('./changelog-command.cjs');
|
|
3
|
+
|
|
4
|
+
exports.ChangelogCommand = require_components_changelog_command.ChangelogCommand;
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
2
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
3
|
+
let _stryke_path = require("@stryke/path");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
|
|
6
|
+
//#region src/helpers/resolve-changelog.ts
|
|
7
|
+
const CHANGELOG_FILE_EXTENSIONS = [
|
|
8
|
+
"md",
|
|
9
|
+
"markdown",
|
|
10
|
+
"txt"
|
|
11
|
+
];
|
|
12
|
+
const CHANGELOG_FILE_NAMES = [
|
|
13
|
+
"CHANGELOG",
|
|
14
|
+
"changelog",
|
|
15
|
+
"Changelog",
|
|
16
|
+
"RELEASE-NOTES",
|
|
17
|
+
"release-notes",
|
|
18
|
+
"Release-Notes",
|
|
19
|
+
"RELEASE_NOTES",
|
|
20
|
+
"release_notes",
|
|
21
|
+
"Release_Notes",
|
|
22
|
+
"RELEASES",
|
|
23
|
+
"releases",
|
|
24
|
+
"Releases",
|
|
25
|
+
"HISTORY",
|
|
26
|
+
"history",
|
|
27
|
+
"History"
|
|
28
|
+
];
|
|
29
|
+
function resolveChangelogFile(context, fileName) {
|
|
30
|
+
for (const ext of CHANGELOG_FILE_EXTENSIONS) if (fileName && (0, node_fs.existsSync)((0, powerlines_plugin_utils.replacePathTokens)(context, (0, _stryke_path_join.joinPaths)("{root}", (0, _stryke_path.appendExtension)(fileName, ext))))) return (0, _stryke_path_join.joinPaths)("{root}", (0, _stryke_path.appendExtension)(fileName, ext));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolves the path to the changelog file based on the provided options and context. If a specific file is provided in the options, it will attempt to resolve that file first. If not, it will look for common changelog file names in the application's root directory.
|
|
34
|
+
*
|
|
35
|
+
* @param context - The unresolved context of the plugin, which includes information about the application's root directory and other relevant data for resolving paths.
|
|
36
|
+
* @param options - The options provided for the changelog plugin, which may include a specific file name to look for.
|
|
37
|
+
* @returns The resolved path to the changelog file if found, or undefined if no valid changelog file could be resolved.
|
|
38
|
+
*/
|
|
39
|
+
function resolveChangelog(context, options) {
|
|
40
|
+
let changelogFile = resolveChangelogFile(context, options.file);
|
|
41
|
+
if (changelogFile) return changelogFile;
|
|
42
|
+
for (const name of CHANGELOG_FILE_NAMES) {
|
|
43
|
+
changelogFile = resolveChangelogFile(context, name);
|
|
44
|
+
if (changelogFile) return changelogFile;
|
|
45
|
+
}
|
|
46
|
+
return changelogFile;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.resolveChangelog = resolveChangelog;
|
|
@@ -1,2 +1,51 @@
|
|
|
1
|
-
import{joinPaths
|
|
1
|
+
import { joinPaths } from "@stryke/path/join";
|
|
2
|
+
import { replacePathTokens } from "powerlines/plugin-utils";
|
|
3
|
+
import { appendExtension } from "@stryke/path";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
|
|
6
|
+
//#region src/helpers/resolve-changelog.ts
|
|
7
|
+
const CHANGELOG_FILE_EXTENSIONS = [
|
|
8
|
+
"md",
|
|
9
|
+
"markdown",
|
|
10
|
+
"txt"
|
|
11
|
+
];
|
|
12
|
+
const CHANGELOG_FILE_NAMES = [
|
|
13
|
+
"CHANGELOG",
|
|
14
|
+
"changelog",
|
|
15
|
+
"Changelog",
|
|
16
|
+
"RELEASE-NOTES",
|
|
17
|
+
"release-notes",
|
|
18
|
+
"Release-Notes",
|
|
19
|
+
"RELEASE_NOTES",
|
|
20
|
+
"release_notes",
|
|
21
|
+
"Release_Notes",
|
|
22
|
+
"RELEASES",
|
|
23
|
+
"releases",
|
|
24
|
+
"Releases",
|
|
25
|
+
"HISTORY",
|
|
26
|
+
"history",
|
|
27
|
+
"History"
|
|
28
|
+
];
|
|
29
|
+
function resolveChangelogFile(context, fileName) {
|
|
30
|
+
for (const ext of CHANGELOG_FILE_EXTENSIONS) if (fileName && existsSync(replacePathTokens(context, joinPaths("{root}", appendExtension(fileName, ext))))) return joinPaths("{root}", appendExtension(fileName, ext));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolves the path to the changelog file based on the provided options and context. If a specific file is provided in the options, it will attempt to resolve that file first. If not, it will look for common changelog file names in the application's root directory.
|
|
34
|
+
*
|
|
35
|
+
* @param context - The unresolved context of the plugin, which includes information about the application's root directory and other relevant data for resolving paths.
|
|
36
|
+
* @param options - The options provided for the changelog plugin, which may include a specific file name to look for.
|
|
37
|
+
* @returns The resolved path to the changelog file if found, or undefined if no valid changelog file could be resolved.
|
|
38
|
+
*/
|
|
39
|
+
function resolveChangelog(context, options) {
|
|
40
|
+
let changelogFile = resolveChangelogFile(context, options.file);
|
|
41
|
+
if (changelogFile) return changelogFile;
|
|
42
|
+
for (const name of CHANGELOG_FILE_NAMES) {
|
|
43
|
+
changelogFile = resolveChangelogFile(context, name);
|
|
44
|
+
if (changelogFile) return changelogFile;
|
|
45
|
+
}
|
|
46
|
+
return changelogFile;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { resolveChangelog };
|
|
2
51
|
//# sourceMappingURL=resolve-changelog.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-changelog.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"resolve-changelog.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,67 @@
|
|
|
1
|
-
Object.defineProperties(exports,
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_components_changelog_command = require('./components/changelog-command.cjs');
|
|
4
|
+
require('./components/index.cjs');
|
|
5
|
+
const require_resolve_changelog = require('./helpers/resolve-changelog.cjs');
|
|
6
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
8
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
9
|
+
let _shell_shock_unified_markdown = require("@shell-shock/unified/markdown");
|
|
10
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
11
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
12
|
+
let defu = require("defu");
|
|
13
|
+
defu = require_runtime.__toESM(defu);
|
|
14
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
15
|
+
|
|
16
|
+
//#region src/index.tsx
|
|
17
|
+
/**
|
|
18
|
+
* The Changelog - Shell Shock plugin to add version check functionality and changelog commands to a Shell Shock application.
|
|
19
|
+
*/
|
|
20
|
+
const plugin = (options = {}) => {
|
|
21
|
+
return {
|
|
22
|
+
name: "shell-shock/changelog",
|
|
23
|
+
config() {
|
|
24
|
+
this.debug("Providing default configuration for the Shell Shock `changelog` plugin.");
|
|
25
|
+
return { changelog: (0, defu.default)({ command: { name: (0, _stryke_type_checks_is_set_string.isSetString)(options.command) ? options.command : "changelog" } }, options) };
|
|
26
|
+
},
|
|
27
|
+
async configResolved() {
|
|
28
|
+
this.debug("Adding the CLI changelog commands to the application context.");
|
|
29
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(this.config.changelog.file)) this.config.changelog.file = require_resolve_changelog.resolveChangelog(this, options);
|
|
30
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.changelog.file)) this.config.changelog.file = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.changelog.file);
|
|
31
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(this.config.changelog.file) || !this.fs.existsSync(this.config.changelog.file)) {
|
|
32
|
+
this.warn(`The changelog file could not be found at the resolved path: ${this.config.changelog.file}. The \`${this.config.changelog.command.name}\` command will not be added to the application. Please ensure that the changelog file exists at the specified path or adjust the \`changelog.file\` option to point to the correct location.`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.inputs ??= [];
|
|
36
|
+
if (this.inputs.some((input) => input.id === this.config.changelog.command.name)) this.info("The `changelog` command already exists in the commands list. If you would like the changelog command to be managed by the `@shell-shock/plugin-changelog` package, please remove or rename the command.");
|
|
37
|
+
else {
|
|
38
|
+
const content = await this.fs.read(this.config.changelog.file);
|
|
39
|
+
if (content) {
|
|
40
|
+
this.inputs.push({
|
|
41
|
+
id: this.config.changelog.command.name,
|
|
42
|
+
path: this.config.changelog.command.name,
|
|
43
|
+
segments: [this.config.changelog.command.name],
|
|
44
|
+
title: "Changelog",
|
|
45
|
+
icon: "🗃",
|
|
46
|
+
tags: ["Utility"],
|
|
47
|
+
description: `Display the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(this)} changelog.`,
|
|
48
|
+
entry: {
|
|
49
|
+
file: (0, _stryke_path_join.joinPaths)(this.entryPath, "changelog", "index.ts"),
|
|
50
|
+
input: { file: (0, _stryke_path_join.joinPaths)(this.entryPath, "changelog", "command.ts") }
|
|
51
|
+
},
|
|
52
|
+
virtual: false,
|
|
53
|
+
...this.config.changelog.command
|
|
54
|
+
});
|
|
55
|
+
this.debug("Rendering changelog command module for the Shell Shock `changelog` plugin.");
|
|
56
|
+
await (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_changelog_command.ChangelogCommand, { get changelog() {
|
|
57
|
+
return `\`${(0, _shell_shock_unified_markdown.renderMarkdown)(content).split("\n").map((line) => (0, _stryke_type_checks_is_set_string.isSetString)(line) ? `\${${line}}` : "").join("\n")}\``;
|
|
58
|
+
} }));
|
|
59
|
+
} else this.warn(`The changelog file at the resolved path: ${this.config.changelog.file} could not be read or is empty. The \`${this.config.changelog.command.name}\` command will not be added to the application. Please ensure that the changelog file exists at the specified path and contains valid content.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.default = plugin;
|
|
67
|
+
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -7,5 +7,5 @@ import { Plugin } from "powerlines";
|
|
|
7
7
|
*/
|
|
8
8
|
declare const plugin: <TContext extends ChangelogPluginContext = ChangelogPluginContext>(options?: ChangelogPluginOptions) => Plugin<TContext>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { ChangelogPluginContext, ChangelogPluginOptions, ChangelogPluginResolvedConfig, ChangelogPluginUserConfig, plugin as default, plugin };
|
|
10
|
+
export { type ChangelogPluginContext, type ChangelogPluginOptions, type ChangelogPluginResolvedConfig, type ChangelogPluginUserConfig, plugin as default, plugin };
|
|
11
11
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -7,5 +7,5 @@ import { Plugin } from "powerlines";
|
|
|
7
7
|
*/
|
|
8
8
|
declare const plugin: <TContext extends ChangelogPluginContext = ChangelogPluginContext>(options?: ChangelogPluginOptions) => Plugin<TContext>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { ChangelogPluginContext, ChangelogPluginOptions, ChangelogPluginResolvedConfig, ChangelogPluginUserConfig, plugin as default, plugin };
|
|
10
|
+
export { type ChangelogPluginContext, type ChangelogPluginOptions, type ChangelogPluginResolvedConfig, type ChangelogPluginUserConfig, plugin as default, plugin };
|
|
11
11
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
import{ChangelogCommand
|
|
1
|
+
import { ChangelogCommand } from "./components/changelog-command.mjs";
|
|
2
|
+
import "./components/index.mjs";
|
|
3
|
+
import { resolveChangelog } from "./helpers/resolve-changelog.mjs";
|
|
4
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { render } from "@powerlines/plugin-alloy/render";
|
|
6
|
+
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
7
|
+
import { renderMarkdown } from "@shell-shock/unified/markdown";
|
|
8
|
+
import { joinPaths } from "@stryke/path/join";
|
|
9
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
10
|
+
import defu from "defu";
|
|
11
|
+
import { replacePathTokens } from "powerlines/plugin-utils";
|
|
12
|
+
|
|
13
|
+
//#region src/index.tsx
|
|
14
|
+
/**
|
|
15
|
+
* The Changelog - Shell Shock plugin to add version check functionality and changelog commands to a Shell Shock application.
|
|
16
|
+
*/
|
|
17
|
+
const plugin = (options = {}) => {
|
|
18
|
+
return {
|
|
19
|
+
name: "shell-shock/changelog",
|
|
20
|
+
config() {
|
|
21
|
+
this.debug("Providing default configuration for the Shell Shock `changelog` plugin.");
|
|
22
|
+
return { changelog: defu({ command: { name: isSetString(options.command) ? options.command : "changelog" } }, options) };
|
|
23
|
+
},
|
|
24
|
+
async configResolved() {
|
|
25
|
+
this.debug("Adding the CLI changelog commands to the application context.");
|
|
26
|
+
if (!isSetString(this.config.changelog.file)) this.config.changelog.file = resolveChangelog(this, options);
|
|
27
|
+
if (isSetString(this.config.changelog.file)) this.config.changelog.file = replacePathTokens(this, this.config.changelog.file);
|
|
28
|
+
if (!isSetString(this.config.changelog.file) || !this.fs.existsSync(this.config.changelog.file)) {
|
|
29
|
+
this.warn(`The changelog file could not be found at the resolved path: ${this.config.changelog.file}. The \`${this.config.changelog.command.name}\` command will not be added to the application. Please ensure that the changelog file exists at the specified path or adjust the \`changelog.file\` option to point to the correct location.`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.inputs ??= [];
|
|
33
|
+
if (this.inputs.some((input) => input.id === this.config.changelog.command.name)) this.info("The `changelog` command already exists in the commands list. If you would like the changelog command to be managed by the `@shell-shock/plugin-changelog` package, please remove or rename the command.");
|
|
34
|
+
else {
|
|
35
|
+
const content = await this.fs.read(this.config.changelog.file);
|
|
36
|
+
if (content) {
|
|
37
|
+
this.inputs.push({
|
|
38
|
+
id: this.config.changelog.command.name,
|
|
39
|
+
path: this.config.changelog.command.name,
|
|
40
|
+
segments: [this.config.changelog.command.name],
|
|
41
|
+
title: "Changelog",
|
|
42
|
+
icon: "🗃",
|
|
43
|
+
tags: ["Utility"],
|
|
44
|
+
description: `Display the ${getAppTitle(this)} changelog.`,
|
|
45
|
+
entry: {
|
|
46
|
+
file: joinPaths(this.entryPath, "changelog", "index.ts"),
|
|
47
|
+
input: { file: joinPaths(this.entryPath, "changelog", "command.ts") }
|
|
48
|
+
},
|
|
49
|
+
virtual: false,
|
|
50
|
+
...this.config.changelog.command
|
|
51
|
+
});
|
|
52
|
+
this.debug("Rendering changelog command module for the Shell Shock `changelog` plugin.");
|
|
53
|
+
await render(this, createComponent(ChangelogCommand, { get changelog() {
|
|
54
|
+
return `\`${renderMarkdown(content).split("\n").map((line) => isSetString(line) ? `\${${line}}` : "").join("\n")}\``;
|
|
55
|
+
} }));
|
|
56
|
+
} else this.warn(`The changelog file at the resolved path: ${this.config.changelog.file} could not be read or is empty. The \`${this.config.changelog.command.name}\` command will not be added to the application. Please ensure that the changelog file exists at the specified path and contains valid content.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { plugin as default, plugin };
|
|
2
64
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;UA0BiB,sBAAA;;AAAjB
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;UA0BiB,sBAAA;;AAAjB;;;;;;;;;AAgEiC;AAGjC;;;;;;;;AAImC;AAGnC;;;;;;;;;;;;;;;;;;;;;;AAQ+C;AAI/C;;;;;;;;;;EAhCE,IAAA;EAkCE;;;;AACuB;;;;EAzBzB,OAAA,GAAU,OAAO,CAAC,aAAA;AAAA;AAAA,KAGR,yBAAA,GAA4B,UAAA;;;;EAItC,SAAA,EAAW,sBAAsB;AAAA;AAAA,KAGvB,6BAAA,GAAgC,cAAA;;;;EAI1C,SAAA,EAAW,QAAA,CAAS,IAAA,CAAK,sBAAA;;;;IAIvB,OAAA,EAAS,YAAA,CAAa,OAAA,CAAQ,aAAA;EAAA;AAAA;AAAA,KAItB,sBAAA,yBACc,6BAAA,GACtB,6BAAA,IACA,OAAA,CAAQ,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/plugin-changelog",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to manage upgrading the local application's version.",
|
|
6
6
|
"keywords": [
|
|
@@ -121,25 +121,23 @@
|
|
|
121
121
|
"module": "./dist/index.mjs",
|
|
122
122
|
"types": "./dist/index.d.cts",
|
|
123
123
|
"typings": "dist/index.d.mts",
|
|
124
|
-
"files": ["dist
|
|
124
|
+
"files": ["dist"],
|
|
125
125
|
"dependencies": {
|
|
126
|
-
"@alloy-js/core": "0.23.
|
|
127
|
-
"@alloy-js/typescript": "0.23.0
|
|
128
|
-
"@powerlines/
|
|
129
|
-
"@
|
|
130
|
-
"@
|
|
131
|
-
"@
|
|
132
|
-
"@
|
|
133
|
-
"@stryke/
|
|
134
|
-
"@stryke/type-checks": "^0.6.4",
|
|
135
|
-
"@stryke/types": "^0.11.6",
|
|
126
|
+
"@alloy-js/core": "^0.23.1",
|
|
127
|
+
"@alloy-js/typescript": "^0.23.0",
|
|
128
|
+
"@powerlines/plugin-alloy": "^0.26.217",
|
|
129
|
+
"@shell-shock/core": "0.17.11",
|
|
130
|
+
"@shell-shock/unified": "0.2.9",
|
|
131
|
+
"@stryke/path": "^0.29.11",
|
|
132
|
+
"@stryke/type-checks": "^0.6.17",
|
|
133
|
+
"@stryke/types": "^0.12.12",
|
|
136
134
|
"defu": "^6.1.7",
|
|
137
|
-
"powerlines": "^0.
|
|
135
|
+
"powerlines": "^0.47.124"
|
|
138
136
|
},
|
|
139
137
|
"devDependencies": {
|
|
140
|
-
"@powerlines/plugin-
|
|
141
|
-
"@types/node": "^25.
|
|
138
|
+
"@powerlines/plugin-plugin": "^0.12.536",
|
|
139
|
+
"@types/node": "^25.9.1"
|
|
142
140
|
},
|
|
143
141
|
"publishConfig": { "access": "public" },
|
|
144
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "9401c1de122d800040306fc89ad1835930c1a826"
|
|
145
143
|
}
|