@mayrlabs/setup-project 0.1.3 โ 0.1.4
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/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/README.md +18 -47
- package/dist/index.js +304 -96
- package/dist/index.mjs +358 -99
- package/dist/licenses/Apache-2.0.txt +190 -0
- package/dist/licenses/ISC.txt +15 -0
- package/dist/licenses/MIT.txt +21 -0
- package/package.json +6 -2
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MayR Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,65 +1,36 @@
|
|
|
1
1
|
# @mayrlabs/setup-project
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Interactive CLI to verify and configure common project tools for modern JavaScript/TypeScript applications.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- **
|
|
15
|
-
|
|
16
|
-
- Creates configuration files (`.prettierrc`, `.eslintrc.json`, `.lintstagedrc`, etc.).
|
|
17
|
-
- Sets up `pre-commit` hooks.
|
|
18
|
-
- Generates typesafe environment validation files (`env.ts` or `env/server.ts` + `env/client.ts`).
|
|
7
|
+
- ๐ถ **Husky**: Set up git hooks effortlessly.
|
|
8
|
+
- ๐
**Formatter**: Choose between **Prettier** or **Oxfmt**.
|
|
9
|
+
- ๐งน **Linter**: Choose between **ESLint** or **Oxlint**.
|
|
10
|
+
- ๐ซ **Lint-staged**: Automatically lint/format staged files with broad extension support.
|
|
11
|
+
- ๐ณ **Env Validation**: Set up **@t3-oss/env** for Next.js, Nuxt, or Core, with optional presets.
|
|
12
|
+
- ๐งช **Testing**: Configure **Vitest** or **Jest**.
|
|
13
|
+
- โ๏ธ **EditorConfig**: Generate standardized `.editorconfig` files.
|
|
14
|
+
- ๐ **License**: Generate MIT, ISC, or Apache-2.0 licenses.
|
|
15
|
+
- ๐ก๏ธ **Git Safety**: Checks for uncommitted changes before making modifications.
|
|
19
16
|
|
|
20
17
|
## Usage
|
|
21
18
|
|
|
22
|
-
Run the following command in your project
|
|
19
|
+
Run the following command in your project directory:
|
|
23
20
|
|
|
24
21
|
```bash
|
|
25
22
|
npx @mayrlabs/setup-project@latest
|
|
26
23
|
```
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
The CLI will guide you through an interactive survey to select the tools you want to configure. No changes are made until you confirm the summary at the end.
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
> This tool modifies configuration files. It is recommended to use it on a fresh project or commit your changes before running it.
|
|
27
|
+
## How it works
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- Initializes Husky.
|
|
38
|
-
- Options to set up `lint-staged` or a custom script as a pre-commit hook.
|
|
39
|
-
|
|
40
|
-
### Formatter
|
|
41
|
-
|
|
42
|
-
- Choose between **Prettier** and **Oxfmt**.
|
|
43
|
-
- Generates standard configuration.
|
|
44
|
-
|
|
45
|
-
### Linter
|
|
46
|
-
|
|
47
|
-
- Choose between **ESLint** and **Oxlint**.
|
|
48
|
-
- Generates standard configuration.
|
|
49
|
-
|
|
50
|
-
### Lint-staged
|
|
51
|
-
|
|
52
|
-
- configure linting for js, ts, jsx, tsx.
|
|
53
|
-
- configure formatting for md, css, json.
|
|
54
|
-
- Automatically uses the selected linter and formatter.
|
|
55
|
-
|
|
56
|
-
### Env Validation
|
|
57
|
-
|
|
58
|
-
- Supports Next.js, Nuxt, and Core variants.
|
|
59
|
-
- Choose validator: Zod, Valibot, or Arktype.
|
|
60
|
-
- Install presets for common platforms (Vercel, Railway, etc.).
|
|
61
|
-
- Generate split (`env/client.ts`, `env/server.ts`) or joined (`env.ts`) files.
|
|
29
|
+
1. **Git Check**: Ensures your working directory is clean (or offers to commit changes).
|
|
30
|
+
2. **Survey**: Asks you which tools you want to set up and collects your preferences.
|
|
31
|
+
3. **Summary**: Shows a summary of the actions to be taken.
|
|
32
|
+
4. **Execution**: Installs dependencies and creates configuration files tailored to your choices.
|
|
62
33
|
|
|
63
34
|
## License
|
|
64
35
|
|
|
65
|
-
MIT
|
|
36
|
+
MIT ยฉ [MayR Labs](https://mayrlabs.com)
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
|
|
35
35
|
// src/index.ts
|
|
36
|
-
var
|
|
36
|
+
var import_prompts9 = require("@clack/prompts");
|
|
37
37
|
var import_picocolors = __toESM(require("picocolors"));
|
|
38
38
|
var import_commander = require("commander");
|
|
39
39
|
|
|
@@ -376,6 +376,145 @@ export const env = createEnv({
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
// src/services/test.ts
|
|
380
|
+
var import_prompts6 = require("@clack/prompts");
|
|
381
|
+
var import_fs_extra6 = __toESM(require("fs-extra"));
|
|
382
|
+
async function promptTest(config) {
|
|
383
|
+
const runner = await (0, import_prompts6.select)({
|
|
384
|
+
message: "Select a test runner:",
|
|
385
|
+
options: [
|
|
386
|
+
{ value: "vitest", label: "Vitest" },
|
|
387
|
+
{ value: "jest", label: "Jest" }
|
|
388
|
+
]
|
|
389
|
+
});
|
|
390
|
+
config.testRunner = runner;
|
|
391
|
+
}
|
|
392
|
+
async function installTest(config) {
|
|
393
|
+
if (config.testRunner === "vitest") {
|
|
394
|
+
await installPackages(["vitest"], true);
|
|
395
|
+
const configFile = "vitest.config.ts";
|
|
396
|
+
if (!await import_fs_extra6.default.pathExists(configFile)) {
|
|
397
|
+
await import_fs_extra6.default.outputFile(
|
|
398
|
+
configFile,
|
|
399
|
+
`import { defineConfig } from 'vitest/config';
|
|
400
|
+
|
|
401
|
+
export default defineConfig({
|
|
402
|
+
test: {
|
|
403
|
+
environment: 'node',
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
`
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
} else if (config.testRunner === "jest") {
|
|
410
|
+
await installPackages(["jest", "ts-jest", "@types/jest"], true);
|
|
411
|
+
const configFile = "jest.config.js";
|
|
412
|
+
if (!await import_fs_extra6.default.pathExists(configFile)) {
|
|
413
|
+
await import_fs_extra6.default.outputFile(
|
|
414
|
+
configFile,
|
|
415
|
+
`/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
416
|
+
module.exports = {
|
|
417
|
+
preset: 'ts-jest',
|
|
418
|
+
testEnvironment: 'node',
|
|
419
|
+
};
|
|
420
|
+
`
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// src/services/editor-config.ts
|
|
427
|
+
var import_prompts7 = require("@clack/prompts");
|
|
428
|
+
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
429
|
+
async function promptEditorConfig(config) {
|
|
430
|
+
const preset = await (0, import_prompts7.select)({
|
|
431
|
+
message: "Select EditorConfig preset:",
|
|
432
|
+
options: [
|
|
433
|
+
{ value: "default", label: "Default (Spaces 2)" },
|
|
434
|
+
{ value: "spaces4", label: "Spaces 4" },
|
|
435
|
+
{ value: "tabs", label: "Tabs" }
|
|
436
|
+
]
|
|
437
|
+
});
|
|
438
|
+
config.editorConfigPreset = preset;
|
|
439
|
+
}
|
|
440
|
+
async function installEditorConfig(config) {
|
|
441
|
+
let content = "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n";
|
|
442
|
+
if (config.editorConfigPreset === "default" || config.editorConfigPreset === "spaces2") {
|
|
443
|
+
content += "indent_style = space\nindent_size = 2\n";
|
|
444
|
+
} else if (config.editorConfigPreset === "spaces4") {
|
|
445
|
+
content += "indent_style = space\nindent_size = 4\n";
|
|
446
|
+
} else if (config.editorConfigPreset === "tabs") {
|
|
447
|
+
content += "indent_style = tab\n";
|
|
448
|
+
}
|
|
449
|
+
await import_fs_extra7.default.outputFile(".editorconfig", content);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// src/services/license.ts
|
|
453
|
+
var import_prompts8 = require("@clack/prompts");
|
|
454
|
+
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
455
|
+
var import_path2 = __toESM(require("path"));
|
|
456
|
+
async function promptLicense(config) {
|
|
457
|
+
const name = await (0, import_prompts8.text)({
|
|
458
|
+
message: "License Holder Name:",
|
|
459
|
+
placeholder: "John Doe",
|
|
460
|
+
initialValue: config.authorName || ""
|
|
461
|
+
});
|
|
462
|
+
config.licenseName = name;
|
|
463
|
+
const email = await (0, import_prompts8.text)({
|
|
464
|
+
message: "License Holder Email:",
|
|
465
|
+
placeholder: "john@example.com"
|
|
466
|
+
});
|
|
467
|
+
config.licenseEmail = email;
|
|
468
|
+
const website = await (0, import_prompts8.text)({
|
|
469
|
+
message: "License Holder Website:",
|
|
470
|
+
placeholder: "https://example.com"
|
|
471
|
+
});
|
|
472
|
+
config.licenseWebsite = website;
|
|
473
|
+
const type = await (0, import_prompts8.select)({
|
|
474
|
+
message: "Select License Type:",
|
|
475
|
+
options: [
|
|
476
|
+
{ value: "MIT", label: "MIT" },
|
|
477
|
+
{ value: "ISC", label: "ISC" },
|
|
478
|
+
{ value: "Apache-2.0", label: "Apache 2.0" },
|
|
479
|
+
{ value: "UNLICENSED", label: "UNLICENSED" }
|
|
480
|
+
]
|
|
481
|
+
});
|
|
482
|
+
config.licenseType = type;
|
|
483
|
+
}
|
|
484
|
+
async function installLicense(config) {
|
|
485
|
+
if (config.licenseType !== "UNLICENSED") {
|
|
486
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear().toString();
|
|
487
|
+
const templatePath = import_path2.default.join(
|
|
488
|
+
__dirname,
|
|
489
|
+
"licenses",
|
|
490
|
+
`${config.licenseType}.txt`
|
|
491
|
+
);
|
|
492
|
+
if (await import_fs_extra8.default.pathExists(templatePath)) {
|
|
493
|
+
let licenseContent = await import_fs_extra8.default.readFile(templatePath, "utf-8");
|
|
494
|
+
licenseContent = licenseContent.replace(/{YEAR}/g, year);
|
|
495
|
+
licenseContent = licenseContent.replace(/{HOLDER}/g, config.licenseName);
|
|
496
|
+
licenseContent = licenseContent.replace(/{EMAIL}/g, config.licenseEmail);
|
|
497
|
+
licenseContent = licenseContent.replace(
|
|
498
|
+
/{WEBSITE}/g,
|
|
499
|
+
config.licenseWebsite
|
|
500
|
+
);
|
|
501
|
+
await import_fs_extra8.default.outputFile("LICENSE", licenseContent);
|
|
502
|
+
} else {
|
|
503
|
+
const simpleContent = `Copyright (c) ${year} ${config.licenseName}
|
|
504
|
+
Licensed under ${config.licenseType}`;
|
|
505
|
+
await import_fs_extra8.default.outputFile("LICENSE", simpleContent);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (await import_fs_extra8.default.pathExists("package.json")) {
|
|
509
|
+
const pkg = await import_fs_extra8.default.readJson("package.json");
|
|
510
|
+
pkg.license = config.licenseType;
|
|
511
|
+
if (config.licenseName) {
|
|
512
|
+
pkg.author = `${config.licenseName} <${config.licenseEmail}> (${config.licenseWebsite})`;
|
|
513
|
+
}
|
|
514
|
+
await import_fs_extra8.default.writeJson("package.json", pkg, { spaces: 2 });
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
379
518
|
// src/utils/git.ts
|
|
380
519
|
var import_execa3 = require("execa");
|
|
381
520
|
async function isGitRepository() {
|
|
@@ -402,7 +541,7 @@ async function commitChanges(message) {
|
|
|
402
541
|
// package.json
|
|
403
542
|
var package_default = {
|
|
404
543
|
name: "@mayrlabs/setup-project",
|
|
405
|
-
version: "0.1.
|
|
544
|
+
version: "0.1.4",
|
|
406
545
|
description: "Interactive CLI to setup project tools",
|
|
407
546
|
private: false,
|
|
408
547
|
publishConfig: {
|
|
@@ -435,7 +574,11 @@ var package_default = {
|
|
|
435
574
|
directory: "packages/setup-project"
|
|
436
575
|
},
|
|
437
576
|
license: "MIT",
|
|
438
|
-
author:
|
|
577
|
+
author: {
|
|
578
|
+
name: "Aghogho Meyoron",
|
|
579
|
+
email: "youngmayor.dev@gmail.com",
|
|
580
|
+
url: "https://mayrlabs.com"
|
|
581
|
+
},
|
|
439
582
|
type: "commonjs",
|
|
440
583
|
main: "dist/index.js",
|
|
441
584
|
scripts: {
|
|
@@ -459,106 +602,172 @@ var package_default = {
|
|
|
459
602
|
}
|
|
460
603
|
};
|
|
461
604
|
|
|
605
|
+
// src/utils/logger.ts
|
|
606
|
+
var import_fs_extra9 = __toESM(require("fs-extra"));
|
|
607
|
+
var import_path3 = __toESM(require("path"));
|
|
608
|
+
var LOG_DIR = ".mayrlabs/setup-project";
|
|
609
|
+
var ERRORS_DIR = import_path3.default.join(LOG_DIR, "errors");
|
|
610
|
+
async function logError(error) {
|
|
611
|
+
try {
|
|
612
|
+
await import_fs_extra9.default.ensureDir(ERRORS_DIR);
|
|
613
|
+
const gitignorePath = import_path3.default.join(LOG_DIR, ".gitignore");
|
|
614
|
+
if (!await import_fs_extra9.default.pathExists(gitignorePath)) {
|
|
615
|
+
await import_fs_extra9.default.outputFile(gitignorePath, "*\n");
|
|
616
|
+
}
|
|
617
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
618
|
+
const logFile = import_path3.default.join(ERRORS_DIR, `log-${timestamp}.txt`);
|
|
619
|
+
const errorMessage = error instanceof Error ? error.stack || error.message : String(error);
|
|
620
|
+
const logContent = `Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
621
|
+
|
|
622
|
+
Error:
|
|
623
|
+
${errorMessage}
|
|
624
|
+
`;
|
|
625
|
+
await import_fs_extra9.default.outputFile(logFile, logContent);
|
|
626
|
+
return logFile;
|
|
627
|
+
} catch (e) {
|
|
628
|
+
console.error("Failed to log error:", e);
|
|
629
|
+
return "";
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
462
633
|
// src/index.ts
|
|
463
634
|
async function main() {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
if (await
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
(
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
635
|
+
try {
|
|
636
|
+
(0, import_prompts9.intro)(import_picocolors.default.bgCyan(import_picocolors.default.black(" @mayrlabs/setup-project ")));
|
|
637
|
+
if (await isGitRepository()) {
|
|
638
|
+
if (await isGitDirty()) {
|
|
639
|
+
const shouldCommit = await (0, import_prompts9.confirm)({
|
|
640
|
+
message: "Your working directory is dirty. Would you like to commit changes before proceeding?"
|
|
641
|
+
});
|
|
642
|
+
if (shouldCommit) {
|
|
643
|
+
const message = await import("@clack/prompts").then(
|
|
644
|
+
(m) => m.text({
|
|
645
|
+
message: "Enter commit message:",
|
|
646
|
+
placeholder: "wip: pre-setup commit",
|
|
647
|
+
validate(value) {
|
|
648
|
+
if (value.length === 0) return "Commit message is required";
|
|
649
|
+
}
|
|
650
|
+
})
|
|
651
|
+
);
|
|
652
|
+
if (typeof message === "string") {
|
|
653
|
+
const s2 = (0, import_prompts9.spinner)();
|
|
654
|
+
s2.start("Committing changes...");
|
|
655
|
+
await commitChanges(message);
|
|
656
|
+
s2.stop("Changes committed.");
|
|
657
|
+
}
|
|
485
658
|
}
|
|
486
659
|
}
|
|
487
660
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
661
|
+
const tools = await (0, import_prompts9.multiselect)({
|
|
662
|
+
message: "Select tools to configure:",
|
|
663
|
+
options: [
|
|
664
|
+
{ value: "husky", label: "Husky" },
|
|
665
|
+
{ value: "formatter", label: "Formatter (Prettier/Oxfmt)" },
|
|
666
|
+
{ value: "linter", label: "Linter (Eslint/Oxlint)" },
|
|
667
|
+
{ value: "lint-staged", label: "Lint-staged" },
|
|
668
|
+
{ value: "env", label: "Env Validation (@t3-oss/env)" },
|
|
669
|
+
{ value: "test", label: "Test Runner (Vitest/Jest)" },
|
|
670
|
+
{ value: "editorConfig", label: "EditorConfig" },
|
|
671
|
+
{ value: "license", label: "License" }
|
|
672
|
+
],
|
|
673
|
+
required: false
|
|
674
|
+
});
|
|
675
|
+
if ((0, import_prompts9.isCancel)(tools)) {
|
|
676
|
+
(0, import_prompts9.cancel)("Operation cancelled.");
|
|
677
|
+
process.exit(0);
|
|
678
|
+
}
|
|
679
|
+
const selectedTools = tools;
|
|
680
|
+
const config = {
|
|
681
|
+
husky: selectedTools.includes("husky"),
|
|
682
|
+
formatter: selectedTools.includes("formatter"),
|
|
683
|
+
linter: selectedTools.includes("linter"),
|
|
684
|
+
lintStaged: selectedTools.includes("lint-staged"),
|
|
685
|
+
env: selectedTools.includes("env"),
|
|
686
|
+
test: selectedTools.includes("test"),
|
|
687
|
+
editorConfig: selectedTools.includes("editorConfig"),
|
|
688
|
+
license: selectedTools.includes("license")
|
|
689
|
+
};
|
|
690
|
+
if (config.husky) await promptHusky(config);
|
|
691
|
+
if (config.formatter) await promptFormatter(config);
|
|
692
|
+
if (config.linter) await promptLinter(config);
|
|
693
|
+
if (config.lintStaged) await promptLintStaged(config);
|
|
694
|
+
if (config.env) await promptEnv(config);
|
|
695
|
+
if (config.test) await promptTest(config);
|
|
696
|
+
if (config.editorConfig) await promptEditorConfig(config);
|
|
697
|
+
if (config.license) await promptLicense(config);
|
|
698
|
+
let summary = "The following actions will be performed:\n\n";
|
|
699
|
+
if (config.husky) summary += "- Install and configure Husky\n";
|
|
700
|
+
if (config.formatter)
|
|
701
|
+
summary += `- Install and configure ${config.formatterChoice}
|
|
521
702
|
`;
|
|
522
|
-
|
|
523
|
-
|
|
703
|
+
if (config.linter)
|
|
704
|
+
summary += `- Install and configure ${config.linterChoice}
|
|
524
705
|
`;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
706
|
+
if (config.lintStaged) summary += "- Install and configure Lint-staged\n";
|
|
707
|
+
if (config.env) summary += "- Install and configure @t3-oss/env\n";
|
|
708
|
+
if (config.test)
|
|
709
|
+
summary += `- Install and configure ${config.testRunner}
|
|
710
|
+
`;
|
|
711
|
+
if (config.editorConfig) summary += "- Create .editorconfig\n";
|
|
712
|
+
if (config.license) summary += `- Create LICENSE (${config.licenseType})
|
|
713
|
+
`;
|
|
714
|
+
(0, import_prompts9.note)(summary, "Configuration Summary");
|
|
715
|
+
const proceed = await (0, import_prompts9.confirm)({
|
|
716
|
+
message: "Do you want to proceed with the installation?"
|
|
717
|
+
});
|
|
718
|
+
if (!proceed || (0, import_prompts9.isCancel)(proceed)) {
|
|
719
|
+
(0, import_prompts9.cancel)("Installation cancelled. Configuration saved.");
|
|
720
|
+
process.exit(0);
|
|
721
|
+
}
|
|
722
|
+
const s = (0, import_prompts9.spinner)();
|
|
723
|
+
if (config.husky) {
|
|
724
|
+
s.start("Setting up Husky...");
|
|
725
|
+
await installHusky(config);
|
|
726
|
+
s.stop("Husky setup complete.");
|
|
727
|
+
}
|
|
728
|
+
if (config.formatter) {
|
|
729
|
+
s.start(`Setting up ${config.formatterChoice}...`);
|
|
730
|
+
await installFormatter(config);
|
|
731
|
+
s.stop(`${config.formatterChoice} setup complete.`);
|
|
732
|
+
}
|
|
733
|
+
if (config.linter) {
|
|
734
|
+
s.start(`Setting up ${config.linterChoice}...`);
|
|
735
|
+
await installLinter(config);
|
|
736
|
+
s.stop(`${config.linterChoice} setup complete.`);
|
|
737
|
+
}
|
|
738
|
+
if (config.lintStaged) {
|
|
739
|
+
s.start("Setting up Lint-staged...");
|
|
740
|
+
await installLintStaged(config);
|
|
741
|
+
s.stop("Lint-staged setup complete.");
|
|
742
|
+
}
|
|
743
|
+
if (config.env) {
|
|
744
|
+
s.start("Setting up Env Validation...");
|
|
745
|
+
await installEnv(config);
|
|
746
|
+
s.stop("Env Validation setup complete.");
|
|
747
|
+
}
|
|
748
|
+
if (config.test) {
|
|
749
|
+
s.start(`Setting up ${config.testRunner}...`);
|
|
750
|
+
await installTest(config);
|
|
751
|
+
s.stop(`${config.testRunner} setup complete.`);
|
|
752
|
+
}
|
|
753
|
+
if (config.editorConfig) {
|
|
754
|
+
s.start("Creating .editorconfig...");
|
|
755
|
+
await installEditorConfig(config);
|
|
756
|
+
s.stop(".editorconfig created.");
|
|
757
|
+
}
|
|
758
|
+
if (config.license) {
|
|
759
|
+
s.start("Creating LICENSE...");
|
|
760
|
+
await installLicense(config);
|
|
761
|
+
s.stop("LICENSE created.");
|
|
762
|
+
}
|
|
763
|
+
(0, import_prompts9.outro)(import_picocolors.default.green("Setup complete!"));
|
|
764
|
+
} catch (error) {
|
|
765
|
+
const logPath = await logError(error);
|
|
766
|
+
(0, import_prompts9.outro)(import_picocolors.default.red(`
|
|
767
|
+
Something went wrong!
|
|
768
|
+
Error log saved to: ${logPath}`));
|
|
769
|
+
process.exit(1);
|
|
560
770
|
}
|
|
561
|
-
(0, import_prompts6.outro)(import_picocolors.default.green("Setup complete!"));
|
|
562
771
|
}
|
|
563
772
|
import_commander.program.name("setup-project").description("Interactive setup for common project tools").version(package_default.version).action(main);
|
|
564
773
|
import_commander.program.parse();
|
|
@@ -568,4 +777,3 @@ import_commander.program.parse();
|
|
|
568
777
|
* Software should feel intentional.
|
|
569
778
|
*/
|
|
570
779
|
|
|
571
|
-
//# sourceMappingURL=index.js.map
|