@adbayb/stack 0.0.0-next-0f6c3a3 → 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 +40 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -136,8 +136,8 @@ const eslint = (options)=>async (files = [])=>{
|
|
|
136
136
|
};
|
|
137
137
|
const turbo = async (command, options = {})=>{
|
|
138
138
|
try {
|
|
139
|
-
const { hasLiveOutput = true, ...restOptions } = options;
|
|
140
|
-
return await helpers.exec(`turbo run ${command}`, {
|
|
139
|
+
const { excludeExamples = false, hasLiveOutput = true, ...restOptions } = options;
|
|
140
|
+
return await helpers.exec(`turbo run ${command} ${excludeExamples ? "--filter !@examples/*" : ""}`, {
|
|
141
141
|
...restOptions,
|
|
142
142
|
hasLiveOutput
|
|
143
143
|
});
|
|
@@ -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({
|
|
@@ -220,7 +239,6 @@ const createReleaseCommand = (program)=>{
|
|
|
220
239
|
description: "Publish package(s) to the registry"
|
|
221
240
|
}).task({
|
|
222
241
|
async handler () {
|
|
223
|
-
// TODO: label instead?
|
|
224
242
|
helpers.message("New changelog entry\n");
|
|
225
243
|
await changeset("changeset");
|
|
226
244
|
},
|
|
@@ -250,7 +268,9 @@ const createInstallCommand = (program)=>{
|
|
|
250
268
|
}).task({
|
|
251
269
|
label: label$4("Install `git.pre-commit` hook"),
|
|
252
270
|
async handler () {
|
|
253
|
-
|
|
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`);
|
|
254
274
|
}
|
|
255
275
|
}).task({
|
|
256
276
|
label: label$4("Install `git.commit-msg` hook"),
|
|
@@ -303,10 +323,15 @@ const createFixCommand = (program)=>{
|
|
|
303
323
|
program.command({
|
|
304
324
|
name: "fix",
|
|
305
325
|
description: "Fix auto-fixable issues"
|
|
326
|
+
}).task({
|
|
327
|
+
handler (_, argv) {
|
|
328
|
+
logCheckableFiles(argv.operands);
|
|
329
|
+
}
|
|
306
330
|
}).task({
|
|
307
331
|
label: label$3("Prepare the project"),
|
|
308
332
|
async handler () {
|
|
309
333
|
await turbo("build", {
|
|
334
|
+
excludeExamples: true,
|
|
310
335
|
hasLiveOutput: false
|
|
311
336
|
});
|
|
312
337
|
}
|
|
@@ -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,10 +712,18 @@ 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 () {
|
|
693
725
|
await turbo("build", {
|
|
726
|
+
excludeExamples: true,
|
|
694
727
|
hasLiveOutput: false
|
|
695
728
|
});
|
|
696
729
|
},
|
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"
|