sprawlify 0.0.94 → 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.
- package/dist/index.mjs +318 -9
- 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.
|
|
11
|
+
var version = "0.0.95";
|
|
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:
|
|
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
|
|
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 +
|
|
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,7 +536,7 @@ export default defineConfig({
|
|
|
529
536
|
path: "src/main.tsx",
|
|
530
537
|
content: `/* @refresh reload */
|
|
531
538
|
import { render } from "solid-js/web"
|
|
532
|
-
import
|
|
539
|
+
import Root from "./root"
|
|
533
540
|
]import "./globals.css"
|
|
534
541
|
|
|
535
542
|
const root = document.getElementById('root')
|
|
@@ -680,8 +687,310 @@ export default defineConfig({
|
|
|
680
687
|
})`
|
|
681
688
|
}
|
|
682
689
|
] }),
|
|
683
|
-
svelte: createTemplate({ files: [
|
|
684
|
-
|
|
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
|
+
})`
|
|
843
|
+
}
|
|
844
|
+
] }),
|
|
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
|
+
] })
|
|
685
994
|
};
|
|
686
995
|
//#endregion
|
|
687
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.
|
|
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",
|