kist 0.1.60 → 0.1.62
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.
|
@@ -110,7 +110,12 @@ class VersionWriteAction extends Action_1.Action {
|
|
|
110
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
111
|
try {
|
|
112
112
|
const content = yield fs_1.promises.readFile(filePath, "utf8");
|
|
113
|
+
const endsWithNewline = content.endsWith("\n");
|
|
113
114
|
const lines = content.split("\n");
|
|
115
|
+
// Remove empty string at end if file ended with newline
|
|
116
|
+
if (endsWithNewline && lines[lines.length - 1] === "") {
|
|
117
|
+
lines.pop();
|
|
118
|
+
}
|
|
114
119
|
const updatedLines = lines.map((line) => {
|
|
115
120
|
const regex = new RegExp(`^\\s*${key}\\s*\\d+\\.\\d+\\.\\d+`);
|
|
116
121
|
if (regex.test(line)) {
|
|
@@ -118,7 +123,11 @@ class VersionWriteAction extends Action_1.Action {
|
|
|
118
123
|
}
|
|
119
124
|
return line;
|
|
120
125
|
});
|
|
121
|
-
|
|
126
|
+
// Preserve original newline ending behavior
|
|
127
|
+
const finalContent = endsWithNewline
|
|
128
|
+
? updatedLines.join("\n") + "\n"
|
|
129
|
+
: updatedLines.join("\n");
|
|
130
|
+
yield fs_1.promises.writeFile(filePath, finalContent, "utf8");
|
|
122
131
|
this.logInfo(`Version replaced in file "${filePath}" for key "${key}".`);
|
|
123
132
|
}
|
|
124
133
|
catch (error) {
|
|
@@ -140,7 +140,11 @@ class PluginManager extends AbstractProcess_1.AbstractProcess {
|
|
|
140
140
|
for (const pkg of packages) {
|
|
141
141
|
for (const prefix of prefixes) {
|
|
142
142
|
const scopePrefix = prefix.split("/")[1]; // Extract "plugin-" from "@getkist/plugin-"
|
|
143
|
-
if
|
|
143
|
+
// Check if entry is a directory or a symlink pointing to a directory
|
|
144
|
+
const pkgPath = (0, path_1.join)(scopePath, pkg.name);
|
|
145
|
+
const isDir = pkg.isDirectory() ||
|
|
146
|
+
(pkg.isSymbolicLink() && (0, fs_1.statSync)(pkgPath).isDirectory());
|
|
147
|
+
if (isDir &&
|
|
144
148
|
scopePrefix &&
|
|
145
149
|
pkg.name.startsWith(scopePrefix)) {
|
|
146
150
|
const fullName = `${scopePath.split("/").pop()}/${pkg.name}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kist",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.62",
|
|
4
4
|
"description": "Lightweight Package Pipeline Processor with Plugin Architecture",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kist",
|
|
@@ -57,9 +57,7 @@
|
|
|
57
57
|
"url": "https://github.com/sponsors/scape-foundation"
|
|
58
58
|
}
|
|
59
59
|
],
|
|
60
|
-
"bin":
|
|
61
|
-
"kist": "js/cli.js"
|
|
62
|
-
},
|
|
60
|
+
"bin": "dist/js/cli.js",
|
|
63
61
|
"dependencies": {
|
|
64
62
|
"@babel/core": "^7.29.0",
|
|
65
63
|
"@babel/preset-env": "^7.29.0",
|
|
@@ -97,8 +95,8 @@
|
|
|
97
95
|
},
|
|
98
96
|
"exports": {
|
|
99
97
|
".": {
|
|
100
|
-
"types": "./
|
|
101
|
-
"import": "./
|
|
98
|
+
"types": "./js/index.d.ts",
|
|
99
|
+
"import": "./js/index.js"
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
}
|
|
@@ -131,8 +131,14 @@ export class VersionWriteAction extends Action {
|
|
|
131
131
|
): Promise<void> {
|
|
132
132
|
try {
|
|
133
133
|
const content = await fs.readFile(filePath, "utf8");
|
|
134
|
+
const endsWithNewline = content.endsWith("\n");
|
|
134
135
|
const lines = content.split("\n");
|
|
135
136
|
|
|
137
|
+
// Remove empty string at end if file ended with newline
|
|
138
|
+
if (endsWithNewline && lines[lines.length - 1] === "") {
|
|
139
|
+
lines.pop();
|
|
140
|
+
}
|
|
141
|
+
|
|
136
142
|
const updatedLines = lines.map((line) => {
|
|
137
143
|
const regex = new RegExp(`^\\s*${key}\\s*\\d+\\.\\d+\\.\\d+`);
|
|
138
144
|
if (regex.test(line)) {
|
|
@@ -141,11 +147,12 @@ export class VersionWriteAction extends Action {
|
|
|
141
147
|
return line;
|
|
142
148
|
});
|
|
143
149
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
updatedLines.join("\n") + "\n"
|
|
147
|
-
"
|
|
148
|
-
|
|
150
|
+
// Preserve original newline ending behavior
|
|
151
|
+
const finalContent = endsWithNewline
|
|
152
|
+
? updatedLines.join("\n") + "\n"
|
|
153
|
+
: updatedLines.join("\n");
|
|
154
|
+
|
|
155
|
+
await fs.writeFile(filePath, finalContent, "utf8");
|
|
149
156
|
this.logInfo(
|
|
150
157
|
`Version replaced in file "${filePath}" for key "${key}".`,
|
|
151
158
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Import
|
|
3
3
|
// ============================================================================
|
|
4
4
|
|
|
5
|
-
import { readdirSync } from "fs";
|
|
5
|
+
import { readdirSync, statSync } from "fs";
|
|
6
6
|
import { join } from "path";
|
|
7
7
|
import { ActionInterface } from "../../interface/ActionInterface";
|
|
8
8
|
import { ActionPlugin } from "../../interface/ActionPlugin";
|
|
@@ -132,8 +132,12 @@ export class PluginManager extends AbstractProcess {
|
|
|
132
132
|
for (const pkg of packages) {
|
|
133
133
|
for (const prefix of prefixes) {
|
|
134
134
|
const scopePrefix = prefix.split("/")[1]; // Extract "plugin-" from "@getkist/plugin-"
|
|
135
|
+
// Check if entry is a directory or a symlink pointing to a directory
|
|
136
|
+
const pkgPath = join(scopePath, pkg.name);
|
|
137
|
+
const isDir = pkg.isDirectory() ||
|
|
138
|
+
(pkg.isSymbolicLink() && statSync(pkgPath).isDirectory());
|
|
135
139
|
if (
|
|
136
|
-
|
|
140
|
+
isDir &&
|
|
137
141
|
scopePrefix &&
|
|
138
142
|
pkg.name.startsWith(scopePrefix)
|
|
139
143
|
) {
|