sprawlify 0.0.94 → 0.0.96

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 +328 -12
  2. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -6,8 +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 { faker } from "@faker-js/faker";
9
10
  //#region package.json
10
- var version = "0.0.94";
11
+ var version = "0.0.96";
11
12
  //#endregion
12
13
  //#region src/utils/file-helper.ts
13
14
  const FILE_BACKUP_SUFFIX = ".bak";
@@ -247,6 +248,12 @@ function exitForInvalidOption(optionName, receivedValue, allowedValues) {
247
248
  process.exit(1);
248
249
  }
249
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
250
257
  //#region src/commands/init/prompts.ts
251
258
  async function promptForMissingSelections(options) {
252
259
  if (!options.name) {
@@ -254,7 +261,7 @@ async function promptForMissingSelections(options) {
254
261
  type: "text",
255
262
  name: "name",
256
263
  message: "What is your project name?",
257
- initial: "my-project",
264
+ initial: generateProjectName(),
258
265
  validate: (value) => value.trim().length > 0 || "Project name is required."
259
266
  });
260
267
  if (!name) {
@@ -344,7 +351,7 @@ const templates = {
344
351
  react: createTemplate({ files: [
345
352
  {
346
353
  path: "src/root.tsx",
347
- content: `export function Root() {
354
+ content: `export default function Root() {
348
355
  return (
349
356
  <div>
350
357
  <h1 className="text-2xl font-bold">Welcome to Sprawlify + React!</h1>
@@ -357,7 +364,7 @@ const templates = {
357
364
  path: "src/main.tsx",
358
365
  content: `import { StrictMode } from 'react'
359
366
  import { createRoot } from 'react-dom/client'
360
- import { Root } from './root'
367
+ import Root from './root'
361
368
  import './globals.css'
362
369
 
363
370
  createRoot(document.getElementById('root')!).render(
@@ -516,10 +523,10 @@ export default defineConfig({
516
523
  solid: createTemplate({ files: [
517
524
  {
518
525
  path: "src/root.tsx",
519
- content: `export function Root() {
526
+ content: `export default function Root() {
520
527
  return (
521
528
  <div>
522
- <h1 class="text-2xl font-bold">Welcome to Sprawlify + React!</h1>
529
+ <h1 class="text-2xl font-bold">Welcome to Sprawlify + Solid!</h1>
523
530
  <p class="mt-4 text-lg">This is your root component.</p>
524
531
  </div>
525
532
  )
@@ -529,8 +536,8 @@ export default defineConfig({
529
536
  path: "src/main.tsx",
530
537
  content: `/* @refresh reload */
531
538
  import { render } from "solid-js/web"
532
- import { Root } from "./root"
533
- ]import "./globals.css"
539
+ import Root from "./root"
540
+ import "./globals.css"
534
541
 
535
542
  const root = document.getElementById('root')
536
543
 
@@ -594,13 +601,14 @@ dist-ssr
594
601
  "solid-js": "^1.9.11"
595
602
  },
596
603
  "devDependencies": {
604
+ "@tailwindcss/vite": "^4.2.1",
597
605
  "@types/node": "^24.12.0",
606
+ "tailwindcss": "^4.2.1",
598
607
  "typescript": "~5.9.3",
599
608
  "vite": "^8.0.0",
600
609
  "vite-plugin-solid": "^2.11.11"
601
610
  }
602
- }
603
- `
611
+ }`
604
612
  },
605
613
  {
606
614
  path: "tsconfig.app.json",
@@ -680,8 +688,316 @@ export default defineConfig({
680
688
  })`
681
689
  }
682
690
  ] }),
683
- svelte: createTemplate({ files: [] }),
684
- vue: createTemplate({ files: [] })
691
+ svelte: createTemplate({ files: [
692
+ {
693
+ path: "src/root.svelte",
694
+ content: `<div>
695
+ <h1 class="text-2xl font-bold">Welcome to Sprawlify + Svelte!</h1>
696
+ <p class="mt-4 text-lg">This is your root component.</p>
697
+ </div>`
698
+ },
699
+ {
700
+ path: "src/main.ts",
701
+ content: `import { mount } from 'svelte'
702
+ import './globals.css'
703
+ import Root from './root.svelte'
704
+
705
+ const root = mount(Root, {
706
+ target: document.getElementById('root')!,
707
+ })
708
+
709
+ export default root`
710
+ },
711
+ {
712
+ path: ".gitignore",
713
+ content: `# Logs
714
+ logs
715
+ *.log
716
+ npm-debug.log*
717
+ yarn-debug.log*
718
+ yarn-error.log*
719
+ pnpm-debug.log*
720
+ lerna-debug.log*
721
+
722
+ node_modules
723
+ dist
724
+ dist-ssr
725
+ *.local
726
+
727
+ # Editor directories and files
728
+ .vscode/*
729
+ !.vscode/extensions.json
730
+ .idea
731
+ .DS_Store
732
+ *.suo
733
+ *.ntvs*
734
+ *.njsproj
735
+ *.sln
736
+ *.sw?`
737
+ },
738
+ {
739
+ path: "index.html",
740
+ content: `<!DOCTYPE html>
741
+ <html lang="en">
742
+ <head>
743
+ <meta charset="UTF-8" />
744
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
745
+ <title>Sprawlify + Svelte</title>
746
+ </head>
747
+ <body>
748
+ <div id="root"></div>
749
+ <script type="module" src="/src/main.ts"><\/script>
750
+ </body>
751
+ </html>`
752
+ },
753
+ {
754
+ path: "package.json",
755
+ content: `{
756
+ "private": true,
757
+ "version": "0.0.0",
758
+ "type": "module",
759
+ "scripts": {
760
+ "dev": "vite",
761
+ "build": "vite build",
762
+ "preview": "vite preview",
763
+ "check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
764
+ },
765
+ "devDependencies": {
766
+ "@sveltejs/vite-plugin-svelte": "^7.0.0",
767
+ "@tailwindcss/vite": "^4.2.1",
768
+ "@tsconfig/svelte": "^5.0.8",
769
+ "@types/node": "^24.12.0",
770
+ "svelte": "^5.54.0",
771
+ "svelte-check": "^4.4.5",
772
+ "tailwindcss": "^4.2.1",
773
+ "typescript": "~5.9.3",
774
+ "vite": "^8.0.0"
775
+ }
776
+ }`
777
+ },
778
+ {
779
+ path: "svelte.config.js",
780
+ content: `/** @type {import("@sveltejs/vite-plugin-svelte").SvelteConfig} */
781
+ export default {}`
782
+ },
783
+ {
784
+ path: "tsconfig.app.json",
785
+ content: `{
786
+ "extends": "@tsconfig/svelte/tsconfig.json",
787
+ "compilerOptions": {
788
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
789
+ "target": "ES2023",
790
+ "useDefineForClassFields": true,
791
+ "module": "ESNext",
792
+ "types": ["svelte", "vite/client"],
793
+ "noEmit": true,
794
+ "allowJs": true,
795
+ "checkJs": true,
796
+ "moduleDetection": "force"
797
+ },
798
+ "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
799
+ }`
800
+ },
801
+ {
802
+ path: "tsconfig.json",
803
+ content: `{
804
+ "files": [],
805
+ "references": [
806
+ { "path": "./tsconfig.app.json" },
807
+ { "path": "./tsconfig.node.json" }
808
+ ]
809
+ }`
810
+ },
811
+ {
812
+ path: "tsconfig.node.json",
813
+ content: `{
814
+ "compilerOptions": {
815
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
816
+ "target": "ES2023",
817
+ "lib": ["ES2023"],
818
+ "module": "ESNext",
819
+ "types": ["node"],
820
+ "skipLibCheck": true,
821
+ /* Bundler mode */
822
+ "moduleResolution": "bundler",
823
+ "allowImportingTsExtensions": true,
824
+ "verbatimModuleSyntax": true,
825
+ "moduleDetection": "force",
826
+ "noEmit": true,
827
+ /* Linting */
828
+ "strict": true,
829
+ "noUnusedLocals": true,
830
+ "noUnusedParameters": true,
831
+ "erasableSyntaxOnly": true,
832
+ "noFallthroughCasesInSwitch": true,
833
+ "noUncheckedSideEffectImports": true
834
+ },
835
+ "include": ["vite.config.ts"]
836
+ }`
837
+ },
838
+ {
839
+ path: "vite.config.ts",
840
+ content: `import { defineConfig } from "vite"
841
+ import { svelte } from "@sveltejs/vite-plugin-svelte"
842
+ import tailwindcss from "@tailwindcss/vite"
843
+
844
+ export default defineConfig({
845
+ plugins: [tailwindcss(), svelte()],
846
+ })`
847
+ }
848
+ ] }),
849
+ vue: createTemplate({ files: [
850
+ {
851
+ path: "src/root.vue",
852
+ content: `<template>
853
+ <div>
854
+ <h1 class="text-2xl font-bold">Welcome to Sprawlify + Vue!</h1>
855
+ <p class="mt-4 text-lg">This is your root component.</p>
856
+ </div>
857
+ </template>`
858
+ },
859
+ {
860
+ path: "src/main.ts",
861
+ content: `import { createApp } from "vue"
862
+ import Root from './root.vue'
863
+ import './globals.css'
864
+
865
+ createApp(Root).mount('#root')`
866
+ },
867
+ {
868
+ path: ".gitignore",
869
+ content: `# Logs
870
+ logs
871
+ *.log
872
+ npm-debug.log*
873
+ yarn-debug.log*
874
+ yarn-error.log*
875
+ pnpm-debug.log*
876
+ lerna-debug.log*
877
+
878
+ node_modules
879
+ dist
880
+ dist-ssr
881
+ *.local
882
+
883
+ # Editor directories and files
884
+ .vscode/*
885
+ !.vscode/extensions.json
886
+ .idea
887
+ .DS_Store
888
+ *.suo
889
+ *.ntvs*
890
+ *.njsproj
891
+ *.sln
892
+ *.sw?`
893
+ },
894
+ {
895
+ path: "index.html",
896
+ content: `<!DOCTYPE html>
897
+ <html lang="en">
898
+ <head>
899
+ <meta charset="UTF-8" />
900
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
901
+ <title>Sprawlify + Vue</title>
902
+ </head>
903
+ <body>
904
+ <div id="root"></div>
905
+ <script type="module" src="/src/main.ts"><\/script>
906
+ </body>
907
+ </html>`
908
+ },
909
+ {
910
+ path: "package.json",
911
+ content: `{
912
+ "private": true,
913
+ "version": "0.0.0",
914
+ "type": "module",
915
+ "scripts": {
916
+ "dev": "vite",
917
+ "build": "vue-tsc -b && vite build",
918
+ "preview": "vite preview"
919
+ },
920
+ "dependencies": {
921
+ "vue": "^3.5.30"
922
+ },
923
+ "devDependencies": {
924
+ "@tailwindcss/vite": "^4.2.1",
925
+ "@types/node": "^24.12.0",
926
+ "@vitejs/plugin-vue": "^6.0.5",
927
+ "@vue/tsconfig": "^0.9.0",
928
+ "tailwindcss": "^4.2.1",
929
+ "typescript": "~5.9.3",
930
+ "vite": "^8.0.0",
931
+ "vue-tsc": "^3.2.6"
932
+ }
933
+ }`
934
+ },
935
+ {
936
+ path: "tsconfig.app.json",
937
+ content: `{
938
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
939
+ "compilerOptions": {
940
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
941
+ "types": ["vite/client"],
942
+ /* Linting */
943
+ "strict": true,
944
+ "noUnusedLocals": true,
945
+ "noUnusedParameters": true,
946
+ "erasableSyntaxOnly": true,
947
+ "noFallthroughCasesInSwitch": true,
948
+ "noUncheckedSideEffectImports": true
949
+ },
950
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
951
+ }`
952
+ },
953
+ {
954
+ path: "tsconfig.json",
955
+ content: `{
956
+ "files": [],
957
+ "references": [
958
+ { "path": "./tsconfig.app.json" },
959
+ { "path": "./tsconfig.node.json" }
960
+ ]
961
+ }`
962
+ },
963
+ {
964
+ path: "tsconfig.node.json",
965
+ content: `{
966
+ "compilerOptions": {
967
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
968
+ "target": "ES2023",
969
+ "lib": ["ES2023"],
970
+ "module": "ESNext",
971
+ "types": ["node"],
972
+ "skipLibCheck": true,
973
+ /* Bundler mode */
974
+ "moduleResolution": "bundler",
975
+ "allowImportingTsExtensions": true,
976
+ "verbatimModuleSyntax": true,
977
+ "moduleDetection": "force",
978
+ "noEmit": true,
979
+ /* Linting */
980
+ "strict": true,
981
+ "noUnusedLocals": true,
982
+ "noUnusedParameters": true,
983
+ "erasableSyntaxOnly": true,
984
+ "noFallthroughCasesInSwitch": true,
985
+ "noUncheckedSideEffectImports": true
986
+ },
987
+ "include": ["vite.config.ts"]
988
+ }`
989
+ },
990
+ {
991
+ path: "vite.config.ts",
992
+ content: `import { defineConfig } from "vite"
993
+ import vue from "@vitejs/plugin-vue"
994
+ import tailwindcss from "@tailwindcss/vite"
995
+
996
+ export default defineConfig({
997
+ plugins: [tailwindcss(), vue()],
998
+ })`
999
+ }
1000
+ ] })
685
1001
  };
686
1002
  //#endregion
687
1003
  //#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.94",
3
+ "version": "0.0.96",
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",