sprawlify 0.0.93 → 0.0.95

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.
Files changed (2) hide show
  1. package/dist/index.mjs +506 -27
  2. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -6,9 +6,9 @@ import { cyan, green, red, yellow } from "kleur/colors";
6
6
  import { z } from "zod";
7
7
  import { existsSync } from "fs";
8
8
  import prompts from "prompts";
9
- import dedent from "dedent";
9
+ import { faker } from "@faker-js/faker";
10
10
  //#region package.json
11
- var version = "0.0.93";
11
+ var version = "0.0.95";
12
12
  //#endregion
13
13
  //#region src/utils/file-helper.ts
14
14
  const FILE_BACKUP_SUFFIX = ".bak";
@@ -248,6 +248,12 @@ function exitForInvalidOption(optionName, receivedValue, allowedValues) {
248
248
  process.exit(1);
249
249
  }
250
250
  //#endregion
251
+ //#region src/utils/project.ts
252
+ function toKebabCase(value) {
253
+ return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
254
+ }
255
+ const generateProjectName = () => toKebabCase(`${faker.hacker.adjective()} ${faker.hacker.noun()}`);
256
+ //#endregion
251
257
  //#region src/commands/init/prompts.ts
252
258
  async function promptForMissingSelections(options) {
253
259
  if (!options.name) {
@@ -255,7 +261,7 @@ async function promptForMissingSelections(options) {
255
261
  type: "text",
256
262
  name: "name",
257
263
  message: "What is your project name?",
258
- initial: "my-project",
264
+ initial: generateProjectName(),
259
265
  validate: (value) => value.trim().length > 0 || "Project name is required."
260
266
  });
261
267
  if (!name) {
@@ -340,20 +346,12 @@ function createTemplate(config) {
340
346
  };
341
347
  }
342
348
  //#endregion
343
- //#region \0@oxc-project+runtime@0.115.0/helpers/taggedTemplateLiteral.js
344
- function _taggedTemplateLiteral(e, t) {
345
- return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } }));
346
- }
347
- //#endregion
348
- //#region src/templates/react.ts
349
- var _templateObject;
350
- //#endregion
351
349
  //#region src/templates/index.ts
352
350
  const templates = {
353
351
  react: createTemplate({ files: [
354
352
  {
355
353
  path: "src/root.tsx",
356
- content: dedent`export function Root() {
354
+ content: `export default function Root() {
357
355
  return (
358
356
  <div>
359
357
  <h1 className="text-2xl font-bold">Welcome to Sprawlify + React!</h1>
@@ -364,9 +362,9 @@ const templates = {
364
362
  },
365
363
  {
366
364
  path: "src/main.tsx",
367
- content: dedent`import { StrictMode } from 'react'
365
+ content: `import { StrictMode } from 'react'
368
366
  import { createRoot } from 'react-dom/client'
369
- import { Root } from './root'
367
+ import Root from './root'
370
368
  import './globals.css'
371
369
 
372
370
  createRoot(document.getElementById('root')!).render(
@@ -377,7 +375,7 @@ createRoot(document.getElementById('root')!).render(
377
375
  },
378
376
  {
379
377
  path: ".gitignore",
380
- content: dedent`# Logs
378
+ content: `# Logs
381
379
  logs
382
380
  *.log
383
381
  npm-debug.log*
@@ -404,11 +402,22 @@ dist-ssr
404
402
  },
405
403
  {
406
404
  path: "index.html",
407
- content: dedent(_templateObject || (_templateObject = _taggedTemplateLiteral(["<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Sprawlify + React</title>\n </head>\n <body>\n <div id=\"root\"></div>\n <script type=\"module\" src=\"/src/main.tsx\"><\/script>\n </body>\n</html>"])))
405
+ content: `<!DOCTYPE html>
406
+ <html lang="en">
407
+ <head>
408
+ <meta charset="UTF-8" />
409
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
410
+ <title>Sprawlify + React</title>
411
+ </head>
412
+ <body>
413
+ <div id="root"></div>
414
+ <script type="module" src="/src/main.tsx"><\/script>
415
+ </body>
416
+ </html>`
408
417
  },
409
418
  {
410
419
  path: "package.json",
411
- content: dedent`{
420
+ content: `{
412
421
  "private": true,
413
422
  "version": "0.0.0",
414
423
  "type": "module",
@@ -422,11 +431,13 @@ dist-ssr
422
431
  "react-dom": "^19.2.4"
423
432
  },
424
433
  "devDependencies": {
434
+ "@tailwindcss/vite": "^4.2.1",
425
435
  "@types/node": "^24.12.0",
426
436
  "@types/react": "^19.2.14",
427
437
  "@types/react-dom": "^19.2.3",
428
438
  "@vitejs/plugin-react": "^6.0.1",
429
439
  "globals": "^17.4.0",
440
+ "tailwindcss": "^4.2.1",
430
441
  "typescript": "~5.9.3",
431
442
  "vite": "^8.0.0"
432
443
  }
@@ -434,7 +445,7 @@ dist-ssr
434
445
  },
435
446
  {
436
447
  path: "tsconfig.app.json",
437
- content: dedent`{
448
+ content: `{
438
449
  "compilerOptions": {
439
450
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
440
451
  "target": "ES2023",
@@ -463,7 +474,7 @@ dist-ssr
463
474
  },
464
475
  {
465
476
  path: "tsconfig.json",
466
- content: dedent`{
477
+ content: `{
467
478
  "files": [],
468
479
  "references": [
469
480
  { "path": "./tsconfig.app.json" },
@@ -473,7 +484,7 @@ dist-ssr
473
484
  },
474
485
  {
475
486
  path: "tsconfig.node.json",
476
- content: dedent`{
487
+ content: `{
477
488
  "compilerOptions": {
478
489
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
479
490
  "target": "ES2023",
@@ -500,18 +511,486 @@ dist-ssr
500
511
  },
501
512
  {
502
513
  path: "vite.config.ts",
503
- content: dedent`import { defineConfig } from 'vite'
504
- import react from '@vitejs/plugin-react'
514
+ content: `import { defineConfig } from "vite"
515
+ import react from "@vitejs/plugin-react"
516
+ import tailwindcss from "@tailwindcss/vite"
505
517
 
506
518
  export default defineConfig({
507
- plugins: [react()],
508
- })
519
+ plugins: [tailwindcss(), react()],
520
+ })`
521
+ }
522
+ ] }),
523
+ solid: createTemplate({ files: [
524
+ {
525
+ path: "src/root.tsx",
526
+ content: `export default function Root() {
527
+ return (
528
+ <div>
529
+ <h1 class="text-2xl font-bold">Welcome to Sprawlify + Solid!</h1>
530
+ <p class="mt-4 text-lg">This is your root component.</p>
531
+ </div>
532
+ )
533
+ }`
534
+ },
535
+ {
536
+ path: "src/main.tsx",
537
+ content: `/* @refresh reload */
538
+ import { render } from "solid-js/web"
539
+ import Root from "./root"
540
+ ]import "./globals.css"
541
+
542
+ const root = document.getElementById('root')
543
+
544
+ render(() => <Root />, root!)`
545
+ },
546
+ {
547
+ path: ".gitignore",
548
+ content: `# Logs
549
+ logs
550
+ *.log
551
+ npm-debug.log*
552
+ yarn-debug.log*
553
+ yarn-error.log*
554
+ pnpm-debug.log*
555
+ lerna-debug.log*
556
+
557
+ node_modules
558
+ dist
559
+ dist-ssr
560
+ *.local
561
+
562
+ # Editor directories and files
563
+ .vscode/*
564
+ !.vscode/extensions.json
565
+ .idea
566
+ .DS_Store
567
+ *.suo
568
+ *.ntvs*
569
+ *.njsproj
570
+ *.sln
571
+ *.sw?`
572
+ },
573
+ {
574
+ path: "index.html",
575
+ content: `<!DOCTYPE html>
576
+ <html lang="en">
577
+ <head>
578
+ <meta charset="UTF-8" />
579
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
580
+ <title>Sprawlify + Solid</title>
581
+ </head>
582
+ <body>
583
+ <div id="root"></div>
584
+ <script type="module" src="/src/main.tsx"><\/script>
585
+ </body>
586
+ </html>
509
587
  `
588
+ },
589
+ {
590
+ path: "package.json",
591
+ content: `{
592
+ "private": true,
593
+ "version": "0.0.0",
594
+ "type": "module",
595
+ "scripts": {
596
+ "dev": "vite",
597
+ "build": "tsc -b && vite build",
598
+ "preview": "vite preview"
599
+ },
600
+ "dependencies": {
601
+ "solid-js": "^1.9.11"
602
+ },
603
+ "devDependencies": {
604
+ "@types/node": "^24.12.0",
605
+ "typescript": "~5.9.3",
606
+ "vite": "^8.0.0",
607
+ "vite-plugin-solid": "^2.11.11"
608
+ }
609
+ }
610
+ `
611
+ },
612
+ {
613
+ path: "tsconfig.app.json",
614
+ content: `{
615
+ "compilerOptions": {
616
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
617
+ "target": "ES2023",
618
+ "useDefineForClassFields": true,
619
+ "module": "ESNext",
620
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
621
+ "types": ["vite/client"],
622
+ "skipLibCheck": true,
623
+ /* Bundler mode */
624
+ "moduleResolution": "bundler",
625
+ "allowImportingTsExtensions": true,
626
+ "verbatimModuleSyntax": true,
627
+ "moduleDetection": "force",
628
+ "noEmit": true,
629
+ "jsx": "preserve",
630
+ "jsxImportSource": "solid-js",
631
+ /* Linting */
632
+ "strict": true,
633
+ "noUnusedLocals": true,
634
+ "noUnusedParameters": true,
635
+ "erasableSyntaxOnly": true,
636
+ "noFallthroughCasesInSwitch": true,
637
+ "noUncheckedSideEffectImports": true
638
+ },
639
+ "include": ["src"]
640
+ }`
641
+ },
642
+ {
643
+ path: "tsconfig.json",
644
+ content: `{
645
+ "files": [],
646
+ "references": [
647
+ { "path": "./tsconfig.app.json" },
648
+ { "path": "./tsconfig.node.json" }
649
+ ]
650
+ }`
651
+ },
652
+ {
653
+ path: "tsconfig.node.json",
654
+ content: `{
655
+ "compilerOptions": {
656
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
657
+ "target": "ES2023",
658
+ "lib": ["ES2023"],
659
+ "module": "ESNext",
660
+ "types": ["node"],
661
+ "skipLibCheck": true,
662
+ /* Bundler mode */
663
+ "moduleResolution": "bundler",
664
+ "allowImportingTsExtensions": true,
665
+ "verbatimModuleSyntax": true,
666
+ "moduleDetection": "force",
667
+ "noEmit": true,
668
+ /* Linting */
669
+ "strict": true,
670
+ "noUnusedLocals": true,
671
+ "noUnusedParameters": true,
672
+ "erasableSyntaxOnly": true,
673
+ "noFallthroughCasesInSwitch": true,
674
+ "noUncheckedSideEffectImports": true
675
+ },
676
+ "include": ["vite.config.ts"]
677
+ }`
678
+ },
679
+ {
680
+ path: "vite.config.ts",
681
+ content: `import { defineConfig } from "vite"
682
+ import solid from "vite-plugin-solid"
683
+ import tailwindcss from "@tailwindcss/vite"
684
+
685
+ export default defineConfig({
686
+ plugins: [tailwindcss(), solid()],
687
+ })`
688
+ }
689
+ ] }),
690
+ svelte: createTemplate({ files: [
691
+ {
692
+ path: "src/root.svelte",
693
+ content: `<div>
694
+ <h1 class="text-2xl font-bold">Welcome to Sprawlify + Svelte!</h1>
695
+ <p class="mt-4 text-lg">This is your root component.</p>
696
+ </div>`
697
+ },
698
+ {
699
+ path: "src/main.ts",
700
+ content: `import { mount } from 'svelte'
701
+ import './globals.css'
702
+ import Root from './root.svelte'
703
+
704
+ const root = mount(Root, {
705
+ target: document.getElementById('root')!,
706
+ })
707
+
708
+ export default root`
709
+ },
710
+ {
711
+ path: ".gitignore",
712
+ content: `# Logs
713
+ logs
714
+ *.log
715
+ npm-debug.log*
716
+ yarn-debug.log*
717
+ yarn-error.log*
718
+ pnpm-debug.log*
719
+ lerna-debug.log*
720
+
721
+ node_modules
722
+ dist
723
+ dist-ssr
724
+ *.local
725
+
726
+ # Editor directories and files
727
+ .vscode/*
728
+ !.vscode/extensions.json
729
+ .idea
730
+ .DS_Store
731
+ *.suo
732
+ *.ntvs*
733
+ *.njsproj
734
+ *.sln
735
+ *.sw?`
736
+ },
737
+ {
738
+ path: "index.html",
739
+ content: `<!DOCTYPE html>
740
+ <html lang="en">
741
+ <head>
742
+ <meta charset="UTF-8" />
743
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
744
+ <title>Sprawlify + Svelte</title>
745
+ </head>
746
+ <body>
747
+ <div id="root"></div>
748
+ <script type="module" src="/src/main.ts"><\/script>
749
+ </body>
750
+ </html>`
751
+ },
752
+ {
753
+ path: "package.json",
754
+ content: `{
755
+ "private": true,
756
+ "version": "0.0.0",
757
+ "type": "module",
758
+ "scripts": {
759
+ "dev": "vite",
760
+ "build": "vite build",
761
+ "preview": "vite preview",
762
+ "check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
763
+ },
764
+ "devDependencies": {
765
+ "@sveltejs/vite-plugin-svelte": "^7.0.0",
766
+ "@tsconfig/svelte": "^5.0.8",
767
+ "@types/node": "^24.12.0",
768
+ "svelte": "^5.53.12",
769
+ "svelte-check": "^4.4.5",
770
+ "typescript": "~5.9.3",
771
+ "vite": "^8.0.0"
772
+ }
773
+ }`
774
+ },
775
+ {
776
+ path: "svelte.config.js",
777
+ content: `/** @type {import("@sveltejs/vite-plugin-svelte").SvelteConfig} */
778
+ export default {}`
779
+ },
780
+ {
781
+ path: "tsconfig.app.json",
782
+ content: `{
783
+ "extends": "@tsconfig/svelte/tsconfig.json",
784
+ "compilerOptions": {
785
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
786
+ "target": "ES2023",
787
+ "useDefineForClassFields": true,
788
+ "module": "ESNext",
789
+ "types": ["svelte", "vite/client"],
790
+ "noEmit": true,
791
+ "allowJs": true,
792
+ "checkJs": true,
793
+ "moduleDetection": "force"
794
+ },
795
+ "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
796
+ }`
797
+ },
798
+ {
799
+ path: "tsconfig.json",
800
+ content: `{
801
+ "files": [],
802
+ "references": [
803
+ { "path": "./tsconfig.app.json" },
804
+ { "path": "./tsconfig.node.json" }
805
+ ]
806
+ }`
807
+ },
808
+ {
809
+ path: "tsconfig.node.json",
810
+ content: `{
811
+ "compilerOptions": {
812
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
813
+ "target": "ES2023",
814
+ "lib": ["ES2023"],
815
+ "module": "ESNext",
816
+ "types": ["node"],
817
+ "skipLibCheck": true,
818
+ /* Bundler mode */
819
+ "moduleResolution": "bundler",
820
+ "allowImportingTsExtensions": true,
821
+ "verbatimModuleSyntax": true,
822
+ "moduleDetection": "force",
823
+ "noEmit": true,
824
+ /* Linting */
825
+ "strict": true,
826
+ "noUnusedLocals": true,
827
+ "noUnusedParameters": true,
828
+ "erasableSyntaxOnly": true,
829
+ "noFallthroughCasesInSwitch": true,
830
+ "noUncheckedSideEffectImports": true
831
+ },
832
+ "include": ["vite.config.ts"]
833
+ }`
834
+ },
835
+ {
836
+ path: "vite.config.ts",
837
+ content: `import { defineConfig } from "vite"
838
+ import { svelte } from "@sveltejs/vite-plugin-svelte"
839
+
840
+ export default defineConfig({
841
+ plugins: [svelte()],
842
+ })`
510
843
  }
511
844
  ] }),
512
- solid: createTemplate({ files: [] }),
513
- svelte: createTemplate({ files: [] }),
514
- vue: createTemplate({ files: [] })
845
+ vue: createTemplate({ files: [
846
+ {
847
+ path: "src/root.vue",
848
+ content: `<template>
849
+ <div>
850
+ <h1 class="text-2xl font-bold">Welcome to Sprawlify + Vue!</h1>
851
+ <p class="mt-4 text-lg">This is your root component.</p>
852
+ </div>
853
+ </template>`
854
+ },
855
+ {
856
+ path: "src/main.ts",
857
+ content: `import { createApp } from "vue"
858
+ import Root from './root.vue'
859
+ import './globals.css'
860
+
861
+ createApp(Root).mount('#root')`
862
+ },
863
+ {
864
+ path: ".gitignore",
865
+ content: `# Logs
866
+ logs
867
+ *.log
868
+ npm-debug.log*
869
+ yarn-debug.log*
870
+ yarn-error.log*
871
+ pnpm-debug.log*
872
+ lerna-debug.log*
873
+
874
+ node_modules
875
+ dist
876
+ dist-ssr
877
+ *.local
878
+
879
+ # Editor directories and files
880
+ .vscode/*
881
+ !.vscode/extensions.json
882
+ .idea
883
+ .DS_Store
884
+ *.suo
885
+ *.ntvs*
886
+ *.njsproj
887
+ *.sln
888
+ *.sw?`
889
+ },
890
+ {
891
+ path: "index.html",
892
+ content: `<!DOCTYPE html>
893
+ <html lang="en">
894
+ <head>
895
+ <meta charset="UTF-8" />
896
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
897
+ <title>Sprawlify + Vue</title>
898
+ </head>
899
+ <body>
900
+ <div id="root"></div>
901
+ <script type="module" src="/src/main.ts"><\/script>
902
+ </body>
903
+ </html>`
904
+ },
905
+ {
906
+ path: "package.json",
907
+ content: `{
908
+ "private": true,
909
+ "version": "0.0.0",
910
+ "type": "module",
911
+ "scripts": {
912
+ "dev": "vite",
913
+ "build": "vue-tsc -b && vite build",
914
+ "preview": "vite preview"
915
+ },
916
+ "dependencies": {
917
+ "vue": "^3.5.30"
918
+ },
919
+ "devDependencies": {
920
+ "@types/node": "^24.12.0",
921
+ "@vitejs/plugin-vue": "^6.0.5",
922
+ "@vue/tsconfig": "^0.9.0",
923
+ "typescript": "~5.9.3",
924
+ "vite": "^8.0.0",
925
+ "vue-tsc": "^3.2.5"
926
+ }
927
+ }`
928
+ },
929
+ {
930
+ path: "tsconfig.app.json",
931
+ content: `{
932
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
933
+ "compilerOptions": {
934
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
935
+ "types": ["vite/client"],
936
+ /* Linting */
937
+ "strict": true,
938
+ "noUnusedLocals": true,
939
+ "noUnusedParameters": true,
940
+ "erasableSyntaxOnly": true,
941
+ "noFallthroughCasesInSwitch": true,
942
+ "noUncheckedSideEffectImports": true
943
+ },
944
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
945
+ }`
946
+ },
947
+ {
948
+ path: "tsconfig.json",
949
+ content: `{
950
+ "files": [],
951
+ "references": [
952
+ { "path": "./tsconfig.app.json" },
953
+ { "path": "./tsconfig.node.json" }
954
+ ]
955
+ }`
956
+ },
957
+ {
958
+ path: "tsconfig.node.json",
959
+ content: `{
960
+ "compilerOptions": {
961
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
962
+ "target": "ES2023",
963
+ "lib": ["ES2023"],
964
+ "module": "ESNext",
965
+ "types": ["node"],
966
+ "skipLibCheck": true,
967
+ /* Bundler mode */
968
+ "moduleResolution": "bundler",
969
+ "allowImportingTsExtensions": true,
970
+ "verbatimModuleSyntax": true,
971
+ "moduleDetection": "force",
972
+ "noEmit": true,
973
+ /* Linting */
974
+ "strict": true,
975
+ "noUnusedLocals": true,
976
+ "noUnusedParameters": true,
977
+ "erasableSyntaxOnly": true,
978
+ "noFallthroughCasesInSwitch": true,
979
+ "noUncheckedSideEffectImports": true
980
+ },
981
+ "include": ["vite.config.ts"]
982
+ }`
983
+ },
984
+ {
985
+ path: "vite.config.ts",
986
+ content: `import { defineConfig } from 'vite'
987
+ import vue from '@vitejs/plugin-vue'
988
+
989
+ export default defineConfig({
990
+ plugins: [vue()],
991
+ })`
992
+ }
993
+ ] })
515
994
  };
516
995
  //#endregion
517
996
  //#region src/commands/init/run-init.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprawlify",
3
- "version": "0.0.93",
3
+ "version": "0.0.95",
4
4
  "type": "module",
5
5
  "description": "A command-line interface for Sprawlify.",
6
6
  "author": "sprawlify <npm@sprawlify.com>",
@@ -18,6 +18,7 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@dotenvx/dotenvx": "^1.55.1",
21
+ "@faker-js/faker": "^10.3.0",
21
22
  "commander": "^14.0.3",
22
23
  "dedent": "^1.7.2",
23
24
  "fs-extra": "^11.3.4",