@adbayb/stack 2.40.0-next-f8ad939 โ 2.40.0-next-314d883
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/bin/index.js +1 -3
- package/configs/oxlint/index.ts +21 -0
- package/dist/index.js +17 -15
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const pkg = createRequire(import.meta.url)("../package.json");
|
|
3
|
+
import pkg from "../package.json" with { type: "json" };
|
|
6
4
|
|
|
7
5
|
void import(new URL(`../${pkg.exports["."].default}`, import.meta.url));
|
package/configs/oxlint/index.ts
CHANGED
|
@@ -15,10 +15,31 @@ export default defineConfig({
|
|
|
15
15
|
"unicorn",
|
|
16
16
|
"vitest",
|
|
17
17
|
],
|
|
18
|
+
// TODO: add jsPlugins for perfectionist and padding-line-between-statements + add React rules (such as set-state-in-effect) from React X https://github.com/oxc-project/oxc/issues/1022
|
|
18
19
|
categories: {
|
|
19
20
|
correctness: "error",
|
|
21
|
+
pedantic: "error",
|
|
20
22
|
perf: "error",
|
|
21
23
|
suspicious: "error",
|
|
24
|
+
nursery: "error",
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
"no-undef": "off",
|
|
28
|
+
"prefer-readonly-parameter-types": "off",
|
|
29
|
+
"strict-boolean-expressions": "off",
|
|
30
|
+
"max-lines": "off",
|
|
31
|
+
"max-lines-per-function": "off",
|
|
32
|
+
"max-classes-per-file": "off",
|
|
33
|
+
"import/max-dependencies": "off",
|
|
34
|
+
"react/jsx-max-depth": "off",
|
|
35
|
+
"jsdoc/require-param-type": "off",
|
|
36
|
+
"jsdoc/require-property-type": "off",
|
|
37
|
+
"jsdoc/require-returns-type": "off",
|
|
38
|
+
"no-warning-comments": "off",
|
|
39
|
+
"array-callback-return": ["error", { allowImplicit: true }],
|
|
40
|
+
"typescript/consistent-return": "off",
|
|
41
|
+
"typescript/no-unsafe-type-assertion": "off",
|
|
42
|
+
// TODO: disable typescript/no-unsafe-type-assertion and check previous code to reinsert as assertion
|
|
22
43
|
},
|
|
23
44
|
options: {
|
|
24
45
|
denyWarnings: true,
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ const setPackageManager = async () => {
|
|
|
91
91
|
*
|
|
92
92
|
* @see {@link https://github.com/nodejs/corepack/issues/613}
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
await helpers.exec("pnx corepack enable");
|
|
95
95
|
};
|
|
96
96
|
async function getRequest(url, responseType) {
|
|
97
97
|
const response = await fetch(url);
|
|
@@ -221,7 +221,7 @@ const checkDependencyVersionRange = ({ dependencies, devDependencies, name, peer
|
|
|
221
221
|
consumedBy: name,
|
|
222
222
|
name: dependencyName
|
|
223
223
|
});
|
|
224
|
-
if (version !== "workspace:*" && !isExcluded(version) && !/^\d
|
|
224
|
+
if (version !== "workspace:*" && !isExcluded(version) && !/^\d/u.test(version)) throw createPackageError(`As a dev dependency, \`${dependencyName}\` version must be fixed (or set as "workspace:*" for local packages) to reduce accidental breaking change risks due to an implicit semver upgrade.`, {
|
|
225
225
|
consumedBy: name,
|
|
226
226
|
name: dependencyName
|
|
227
227
|
});
|
|
@@ -283,7 +283,7 @@ function assertVersion(version, { consumedBy, name }) {
|
|
|
283
283
|
}));
|
|
284
284
|
}
|
|
285
285
|
const isExcluded = (version) => {
|
|
286
|
-
const isPreReleaseVersion = /\d+\.\d+\.\d+-(alpha|beta|experimental|next|rc)
|
|
286
|
+
const isPreReleaseVersion = /\d+\.\d+\.\d+-(alpha|beta|experimental|next|rc).*/u.exec(version);
|
|
287
287
|
return version.startsWith("npm:") || isPreReleaseVersion;
|
|
288
288
|
};
|
|
289
289
|
const hasCaret = (version) => version.startsWith("^");
|
|
@@ -401,22 +401,24 @@ const createCleanCommand = (program) => {
|
|
|
401
401
|
};
|
|
402
402
|
const label$3 = (message) => `${message} ๐งน`;
|
|
403
403
|
const cleanFiles = async (files) => {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
404
|
+
await Promise.all(files.map(async (file) => {
|
|
405
|
+
await rm(file, {
|
|
406
|
+
force: true,
|
|
407
|
+
recursive: true
|
|
408
|
+
});
|
|
409
|
+
}));
|
|
408
410
|
};
|
|
409
411
|
const isDirectoryExistAndNotEmpty = (path) => {
|
|
410
412
|
return existsSync(path) && readdirSync(path).length > 0;
|
|
411
413
|
};
|
|
412
414
|
const retrieveIgnoredFiles = async () => {
|
|
413
|
-
return (await helpers.exec("git clean -fdXn")).split(/\n|\r\n/).filter((cleanOutput) => PRESERVE_FILES.every((excludedFile) => !cleanOutput.includes(excludedFile))).map((cleanOutput) => cleanOutput.split(" ").at(-1) ?? "").filter(Boolean);
|
|
415
|
+
return (await helpers.exec("git clean -fdXn")).split(/\n|\r\n/u).filter((cleanOutput) => PRESERVE_FILES.every((excludedFile) => !cleanOutput.includes(excludedFile))).map((cleanOutput) => cleanOutput.split(" ").at(-1) ?? "").filter(Boolean);
|
|
414
416
|
};
|
|
415
417
|
const PRESERVE_FILES = ["node_modules"];
|
|
416
418
|
|
|
417
419
|
//#endregion
|
|
418
420
|
//#region package.json
|
|
419
|
-
var version = "2.40.0-next-
|
|
421
|
+
var version = "2.40.0-next-314d883";
|
|
420
422
|
|
|
421
423
|
//#endregion
|
|
422
424
|
//#region src/commands/create.ts
|
|
@@ -457,7 +459,7 @@ const createCreateCommand = (program) => {
|
|
|
457
459
|
}).task({
|
|
458
460
|
async handler({ inputDescription, inputName, inputTemplate, inputUrl }) {
|
|
459
461
|
if (!inputName) throw createError("stack create", "The project name is not optional. Make sure to provide a valid value (non-empty string).");
|
|
460
|
-
const { repoName, repoOwner } = (inputUrl.startsWith("git") ? /^git@.*:(?<repoOwner>.*)\/(?<repoName>.*)\.git$/ : /^https?:\/\/.*\/(?<repoOwner>.*)\/(?<repoName>.*)\.git$/).exec(inputUrl)?.groups ?? {};
|
|
462
|
+
const { repoName, repoOwner } = (inputUrl.startsWith("git") ? /^git@.*:(?<repoOwner>.*)\/(?<repoName>.*)\.git$/u : /^https?:\/\/.*\/(?<repoOwner>.*)\/(?<repoName>.*)\.git$/u).exec(inputUrl)?.groups ?? {};
|
|
461
463
|
if (!repoOwner || !repoName) throw createError("git", "The owner and repository name can not be extracted. Please make sure to follow either `/^git@.*:(?<repoOwner>.*)/(?<repoName>.*).git$/` or `/^https?://.*/(?<repoOwner>.*)/(?<repoName>.*).git$/` pattern.");
|
|
462
464
|
const nodeVersion = await request.get("https://resolve-node.vercel.app/lts", "text");
|
|
463
465
|
const { version: pnpmVersion } = await request.get("https://registry.npmjs.org/pnpm/latest", "json");
|
|
@@ -487,7 +489,7 @@ const createCreateCommand = (program) => {
|
|
|
487
489
|
},
|
|
488
490
|
type: "confirm",
|
|
489
491
|
validate({ canRemoveExistingDirectoryInput, data: { projectName } }) {
|
|
490
|
-
if (canRemoveExistingDirectoryInput) return
|
|
492
|
+
if (canRemoveExistingDirectoryInput) return;
|
|
491
493
|
return createError("mkdir", `Remove or rename the \`${projectName}\` existing directory to apply the template from a clean state.`);
|
|
492
494
|
}
|
|
493
495
|
}).task({
|
|
@@ -568,7 +570,7 @@ const createCreateCommand = (program) => {
|
|
|
568
570
|
};
|
|
569
571
|
const label$2 = (message) => `${message} ๐จ`;
|
|
570
572
|
const slugify = (input) => {
|
|
571
|
-
return input.toLowerCase().replaceAll(/[^a-z0-9\s-]/
|
|
573
|
+
return input.toLowerCase().replaceAll(/[^a-z0-9\s-]/gu, "").trim().replaceAll(/\s+/gu, "-").replaceAll(/-+/gu, "-");
|
|
572
574
|
};
|
|
573
575
|
const toCapitalLetter = (input) => {
|
|
574
576
|
return input.charAt(0).toUpperCase() + input.slice(1);
|
|
@@ -588,7 +590,7 @@ const createTemplateEngine = async (workingPath, { projectName, templateModel, t
|
|
|
588
590
|
return {
|
|
589
591
|
async processContents() {
|
|
590
592
|
await Promise.all(templateEntries.filter(({ type }) => type === "content").map(async (entry) => {
|
|
591
|
-
|
|
593
|
+
await writeFile(entry.path, setTemplateVariables(entry, templateModel));
|
|
592
594
|
}));
|
|
593
595
|
},
|
|
594
596
|
async processPaths() {
|
|
@@ -623,7 +625,7 @@ const getTemplateEntries = async (path) => {
|
|
|
623
625
|
content: await readFile(entryPath, "utf8"),
|
|
624
626
|
type: "content"
|
|
625
627
|
}]).map(({ content, type }) => {
|
|
626
|
-
if (!hasTemplateVariable(content)) return
|
|
628
|
+
if (!hasTemplateVariable(content)) return;
|
|
627
629
|
return {
|
|
628
630
|
content,
|
|
629
631
|
path: entryPath,
|
|
@@ -637,7 +639,7 @@ const setTemplateVariables = (entry, model) => {
|
|
|
637
639
|
return model[dataModelKey] ?? match;
|
|
638
640
|
});
|
|
639
641
|
};
|
|
640
|
-
const TEMPLATE_VARIABLE_MATCHER =
|
|
642
|
+
const TEMPLATE_VARIABLE_MATCHER = /\{\{(.*?)\}\}/giu;
|
|
641
643
|
const hasTemplateVariable = (input) => {
|
|
642
644
|
/**
|
|
643
645
|
* TemplateVariableMatcher.test() is not used since the `RegExp` is stateful when the global is
|