@adbayb/stack 0.0.0-next-389cf5e → 0.0.0-next-695c49a
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/index.js +36 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -145,6 +145,25 @@ const turbo = async (command, options = {})=>{
|
|
|
145
145
|
throw createError("turbo", error);
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
+
const logCheckableFiles = (files)=>{
|
|
149
|
+
if (files.length === 0) {
|
|
150
|
+
helpers.message("The whole project will be checked.", {
|
|
151
|
+
label: false,
|
|
152
|
+
lineBreak: {
|
|
153
|
+
end: true,
|
|
154
|
+
start: false
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
helpers.message(files.join("\n "), {
|
|
160
|
+
label: "Following files will be checked:",
|
|
161
|
+
lineBreak: {
|
|
162
|
+
end: true,
|
|
163
|
+
start: false
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
};
|
|
148
167
|
const changeset = async (command)=>{
|
|
149
168
|
try {
|
|
150
169
|
return await helpers.exec(command, {
|
|
@@ -167,7 +186,7 @@ const ESLINT_EXTENSIONS = [
|
|
|
167
186
|
"mdx"
|
|
168
187
|
];
|
|
169
188
|
|
|
170
|
-
var version = "0.0.0-next-
|
|
189
|
+
var version = "0.0.0-next-695c49a";
|
|
171
190
|
|
|
172
191
|
const createWatchCommand = (program)=>{
|
|
173
192
|
program.command({
|
|
@@ -249,7 +268,9 @@ const createInstallCommand = (program)=>{
|
|
|
249
268
|
}).task({
|
|
250
269
|
label: label$4("Install `git.pre-commit` hook"),
|
|
251
270
|
async handler () {
|
|
252
|
-
|
|
271
|
+
const lineBreakMatcher = String.raw`\n|\r\n`;
|
|
272
|
+
const modifiedFilesCommand = `node -e 'console.log(require("child_process").execSync("git status --porcelain", {encoding: "utf8"}).split(/${lineBreakMatcher}/).filter(Boolean).map(item => item.split(" ").at(-1)).join(" "))'`;
|
|
273
|
+
await installGitHook("pre-commit", `${getStackCommand(`fix $(${modifiedFilesCommand})`, false)} && git add -A`);
|
|
253
274
|
}
|
|
254
275
|
}).task({
|
|
255
276
|
label: label$4("Install `git.commit-msg` hook"),
|
|
@@ -302,6 +323,10 @@ const createFixCommand = (program)=>{
|
|
|
302
323
|
program.command({
|
|
303
324
|
name: "fix",
|
|
304
325
|
description: "Fix auto-fixable issues"
|
|
326
|
+
}).task({
|
|
327
|
+
handler (_, argv) {
|
|
328
|
+
logCheckableFiles(argv.operands);
|
|
329
|
+
}
|
|
305
330
|
}).task({
|
|
306
331
|
label: label$3("Prepare the project"),
|
|
307
332
|
async handler () {
|
|
@@ -636,7 +661,7 @@ const createPackagesVersionMismatchChecker = ()=>{
|
|
|
636
661
|
}
|
|
637
662
|
const isSameMonorepoVersion = depVersion === storedVersion;
|
|
638
663
|
if (!isSameMonorepoVersion) {
|
|
639
|
-
throw createPackageError(`Mismatched versions: received version \`${depVersion}\` while others use \`${storedVersion}\`. To prevent issues with singleton-like code (React contexts, …), please make sure to update all packages to use the same \`${dependencyName}\` version (either \`${storedVersion}\` or \`${depVersion}
|
|
664
|
+
throw createPackageError(`Mismatched versions: received version \`${depVersion}\` while others use \`${storedVersion}\`. To prevent issues with singleton-like code (React contexts, …), please make sure to update all packages to use the same \`${dependencyName}\` version (either \`${storedVersion}\` or \`${depVersion}\`).`, {
|
|
640
665
|
name: dependencyName,
|
|
641
666
|
consumedBy: packageName
|
|
642
667
|
});
|
|
@@ -649,7 +674,7 @@ const createPackagesVersionMismatchChecker = ()=>{
|
|
|
649
674
|
};
|
|
650
675
|
};
|
|
651
676
|
const createPackageError = (message, context)=>{
|
|
652
|
-
return createError("stack check", !context ? message : `\`${context.name}\` consumed by \`${context.consumedBy}\` doesn't conform to
|
|
677
|
+
return createError("stack check", !context ? message : `\`${context.name}\` consumed by \`${context.consumedBy}\` doesn't conform to package guidelines.\n${message}`);
|
|
653
678
|
};
|
|
654
679
|
function assertVersion(version, { name, consumedBy }) {
|
|
655
680
|
assert(version, ()=>createPackageError(`\`${name}\` must have a valid version specified (current version equals to \`${String(version)}\`).`, {
|
|
@@ -687,6 +712,13 @@ const createCheckCommand = (program)=>{
|
|
|
687
712
|
name: "only",
|
|
688
713
|
description: `Run only one specified task (accepted value: ${ONLY_VALUES.join(", ")})`,
|
|
689
714
|
defaultValue: undefined
|
|
715
|
+
}).task({
|
|
716
|
+
handler (_, argv) {
|
|
717
|
+
logCheckableFiles(argv.operands);
|
|
718
|
+
},
|
|
719
|
+
skip ({ only }) {
|
|
720
|
+
return only === "commit";
|
|
721
|
+
}
|
|
690
722
|
}).task({
|
|
691
723
|
label: label("Prepare the project"),
|
|
692
724
|
async handler () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adbayb/stack",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-695c49a",
|
|
4
4
|
"description": "My opinionated JavaScript-based toolchain",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"fdir": "^6.4.2",
|
|
75
75
|
"globals": "^15.12.0",
|
|
76
76
|
"prettier": "^3.3.3",
|
|
77
|
-
"termost": "^1.
|
|
77
|
+
"termost": "^1.4.0",
|
|
78
78
|
"turbo": "^2.3.0",
|
|
79
79
|
"typescript-eslint": "^8.14.0",
|
|
80
80
|
"typescript": "^5.6.3"
|