@donotdev/cli 0.0.5 → 0.0.7
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/dependencies-matrix.json +76 -34
- package/dist/bin/commands/build.js +165 -161
- package/dist/bin/commands/bump.js +172 -160
- package/dist/bin/commands/cacheout.js +163 -157
- package/dist/bin/commands/create-app.js +205 -163
- package/dist/bin/commands/create-project.js +176 -161
- package/dist/bin/commands/deploy.js +480 -472
- package/dist/bin/commands/dev.js +164 -158
- package/dist/bin/commands/emu.js +164 -158
- package/dist/bin/commands/format.js +163 -157
- package/dist/bin/commands/lint.js +166 -157
- package/dist/bin/commands/make-admin.d.ts +11 -0
- package/dist/bin/commands/make-admin.d.ts.map +1 -0
- package/dist/bin/commands/make-admin.js +12 -0
- package/dist/bin/commands/make-admin.js.map +1 -0
- package/dist/bin/commands/preview.js +164 -158
- package/dist/bin/commands/sync-secrets.js +164 -158
- package/dist/bin/commands/wai.d.ts +11 -0
- package/dist/bin/commands/wai.d.ts.map +1 -0
- package/dist/bin/commands/wai.js +12 -0
- package/dist/bin/commands/wai.js.map +1 -0
- package/dist/bin/dndev.js +24 -8
- package/dist/bin/donotdev.js +24 -8
- package/dist/index.js +557 -514
- package/package.json +1 -1
- package/templates/app-demo/index.html.example +4 -0
- package/templates/app-demo/src/App.tsx.example +28 -10
- package/templates/app-demo/src/config/app.ts.example +68 -0
- package/templates/app-next/src/app/ClientLayout.tsx.example +4 -3
- package/templates/app-next/src/app/layout.tsx.example +17 -25
- package/templates/app-next/src/config/app.ts.example +75 -48
- package/templates/app-next/src/globals.css.example +10 -7
- package/templates/app-next/src/locales/dndev_en.json.example +68 -0
- package/templates/app-next/src/pages/locales/example_en.json.example +5 -0
- package/templates/app-vite/index.html.example +71 -34
- package/templates/app-vite/src/config/app.ts.example +75 -47
- package/templates/app-vite/src/globals.css.example +14 -6
- package/templates/app-vite/src/locales/dndev_en.json.example +68 -0
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +152 -0
- package/templates/app-vite/src/pages/HomePage.tsx.example +81 -134
- package/templates/app-vite/src/pages/ListPageExample.tsx.example +88 -0
- package/templates/functions-firebase/README.md.example +25 -0
- package/templates/functions-firebase/build.mjs.example +8 -1
- package/templates/functions-firebase/functions-firebase/build.mjs.example +8 -1
- package/templates/functions-firebase/functions-firebase/src/index.ts.example +19 -25
- package/templates/functions-firebase/functions.config.js.example +35 -0
- package/templates/functions-firebase/tsconfig.json.example +3 -13
- package/templates/functions-vercel/tsconfig.json.example +1 -13
- package/templates/root-consumer/entities/ExampleEntity.ts.example +223 -0
- package/templates/root-consumer/entities/demo.ts.example +562 -0
- package/templates/root-consumer/entities/index.ts.example +15 -0
- package/templates/root-consumer/firebase.json.example +1 -1
- package/templates/root-consumer/guides/{AGENT_START_HERE.md.example → dndev/AGENT_START_HERE.md.example} +22 -0
- package/templates/root-consumer/guides/{COMPONENTS_ADV.md.example → dndev/COMPONENTS_ADV.md.example} +456 -360
- package/templates/root-consumer/guides/{COMPONENTS_ATOMIC.md.example → dndev/COMPONENTS_ATOMIC.md.example} +42 -0
- package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +231 -0
- package/templates/root-consumer/guides/{INDEX.md.example → dndev/INDEX.md.example} +3 -0
- package/templates/root-consumer/guides/{SETUP_APP_CONFIG.md.example → dndev/SETUP_APP_CONFIG.md.example} +5 -2
- package/templates/root-consumer/guides/{SETUP_AUTH.md.example → dndev/SETUP_AUTH.md.example} +30 -0
- package/templates/root-consumer/guides/{SETUP_BILLING.md.example → dndev/SETUP_BILLING.md.example} +44 -4
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +473 -0
- package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +116 -0
- package/templates/root-consumer/guides/{SETUP_PAGES.md.example → dndev/SETUP_PAGES.md.example} +17 -0
- package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +213 -0
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +503 -0
- package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +404 -0
- package/templates/root-consumer/guides/wai-way/agents/architect.md.example +78 -0
- package/templates/root-consumer/guides/wai-way/agents/builder.md.example +87 -0
- package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +325 -0
- package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +100 -0
- package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +281 -0
- package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +77 -0
- package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +104 -0
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +124 -0
- package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +165 -0
- package/templates/root-consumer/guides/wai-way/context_map.json.example +95 -0
- package/templates/root-consumer/guides/wai-way/entity_patterns.md.example +840 -0
- package/templates/root-consumer/guides/wai-way/page_patterns.md.example +686 -0
- package/templates/root-consumer/guides/wai-way/presets_guide.md.example +217 -0
- package/templates/root-consumer/guides/wai-way/spec_template.md.example +312 -0
- package/templates/root-consumer/vercel.json.example +315 -20
- package/templates/app-demo/src/Routes.tsx.example +0 -20
- package/templates/app-vite/src/Routes.tsx.example +0 -16
- package/templates/app-vite/src/pages/locales/README.md.example +0 -1
- package/templates/functions-firebase/functions-firebase/src/crud/createEntity.ts.example +0 -19
- package/templates/functions-firebase/functions-firebase/src/crud/deleteEntity.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/crud/getEntity.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/crud/index.ts.example +0 -12
- package/templates/functions-firebase/functions-firebase/src/crud/listEntities.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/crud/updateEntity.ts.example +0 -14
- package/templates/root-consumer/guides/COMPONENTS_CRUD.md.example +0 -70
- package/templates/root-consumer/guides/SETUP_FUNCTIONS.md.example +0 -62
- /package/templates/root-consumer/guides/{COMPONENTS_UI.md.example → dndev/COMPONENTS_UI.md.example} +0 -0
- /package/templates/root-consumer/guides/{ENV_SETUP.md.example → dndev/ENV_SETUP.md.example} +0 -0
- /package/templates/root-consumer/guides/{SETUP_I18N.md.example → dndev/SETUP_I18N.md.example} +0 -0
- /package/templates/root-consumer/guides/{SETUP_LAYOUTS.md.example → dndev/SETUP_LAYOUTS.md.example} +0 -0
- /package/templates/root-consumer/guides/{SETUP_OAUTH.md.example → dndev/SETUP_OAUTH.md.example} +0 -0
- /package/templates/root-consumer/guides/{SETUP_THEMES.md.example → dndev/SETUP_THEMES.md.example} +0 -0
- /package/templates/root-consumer/guides/{advanced → dndev/advanced}/APP_CHECK.md.example +0 -0
- /package/templates/root-consumer/guides/{advanced → dndev/advanced}/COOKIE_REFERENCE.md.example +0 -0
- /package/templates/root-consumer/guides/{advanced → dndev/advanced}/EMULATORS.md.example +0 -0
- /package/templates/root-consumer/guides/{advanced → dndev/advanced}/VERSION_CONTROL.md.example +0 -0
|
@@ -942,155 +942,6 @@ var init_cli_output = __esm({
|
|
|
942
942
|
}
|
|
943
943
|
});
|
|
944
944
|
|
|
945
|
-
// packages/core/config/constants.js
|
|
946
|
-
function getPatternsFor(type, repoRoot = null) {
|
|
947
|
-
const patterns = SCAN_PATTERNS[type];
|
|
948
|
-
if (!patterns) {
|
|
949
|
-
throw new Error(`Unknown pattern type: ${type}`);
|
|
950
|
-
}
|
|
951
|
-
if (repoRoot && patterns.framework) {
|
|
952
|
-
return {
|
|
953
|
-
...patterns,
|
|
954
|
-
framework: patterns.framework.map((pattern) => `${repoRoot}/${pattern}`)
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
return patterns;
|
|
958
|
-
}
|
|
959
|
-
function getGlobOptionsFor(type) {
|
|
960
|
-
return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
|
|
961
|
-
}
|
|
962
|
-
var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
|
|
963
|
-
var init_constants = __esm({
|
|
964
|
-
"packages/core/config/constants.js"() {
|
|
965
|
-
"use strict";
|
|
966
|
-
init_utils();
|
|
967
|
-
I18N_PATHS = {
|
|
968
|
-
// Monorepo source structure (locales at root, not in src/)
|
|
969
|
-
SOURCE_ROOT: "packages/core/i18n",
|
|
970
|
-
SOURCE_LOCALES: "packages/core/i18n/locales",
|
|
971
|
-
SOURCE_EAGER: "packages/core/i18n/locales/eager",
|
|
972
|
-
SOURCE_LAZY: "packages/core/i18n/locales/lazy",
|
|
973
|
-
// Published structure (same as source - no flattening needed)
|
|
974
|
-
PUBLISHED_ROOT: "i18n",
|
|
975
|
-
PUBLISHED_LOCALES: "i18n/locales",
|
|
976
|
-
PUBLISHED_EAGER: "i18n/locales/eager",
|
|
977
|
-
PUBLISHED_LAZY: "i18n/locales/lazy"
|
|
978
|
-
};
|
|
979
|
-
SCAN_PATTERNS = {
|
|
980
|
-
routes: {
|
|
981
|
-
consumer: ["src/**/*Page.tsx", "src/pages/**/*Page.tsx"],
|
|
982
|
-
exclude: [
|
|
983
|
-
"**/node_modules/**",
|
|
984
|
-
"**/dist/**",
|
|
985
|
-
"**/build/**",
|
|
986
|
-
"**/*.test.tsx",
|
|
987
|
-
"**/*.stories.tsx"
|
|
988
|
-
],
|
|
989
|
-
extensions: [".tsx"]
|
|
990
|
-
},
|
|
991
|
-
css: {
|
|
992
|
-
consumer: ["src/**/*.css"],
|
|
993
|
-
themes: ["src/**/*.css"],
|
|
994
|
-
extensions: [".css", ".scss", ".sass"],
|
|
995
|
-
framework: [
|
|
996
|
-
"packages/ui/src/**/*.css",
|
|
997
|
-
"packages/core/components/src/**/*.css",
|
|
998
|
-
"packages/core/templates/src/**/*.css"
|
|
999
|
-
]
|
|
1000
|
-
},
|
|
1001
|
-
i18n: {
|
|
1002
|
-
eager: ["src/locales/*_*.json"],
|
|
1003
|
-
lazy: ["src/**/locales/*_*.json", "!src/locales/*_*.json"],
|
|
1004
|
-
framework: {
|
|
1005
|
-
eager: [`${I18N_PATHS.SOURCE_EAGER}/*_*.json`],
|
|
1006
|
-
lazy: [`${I18N_PATHS.SOURCE_LAZY}/*_*.json`]
|
|
1007
|
-
},
|
|
1008
|
-
extensions: [".json"]
|
|
1009
|
-
},
|
|
1010
|
-
assets: {
|
|
1011
|
-
consumer: ["public/**/*"],
|
|
1012
|
-
fallback: ["manifest.json"],
|
|
1013
|
-
modern: [
|
|
1014
|
-
"logo.svg",
|
|
1015
|
-
"favicon.svg",
|
|
1016
|
-
"apple-touch-icon.png",
|
|
1017
|
-
"android-chrome-192x192.png",
|
|
1018
|
-
"android-chrome-512x512.png"
|
|
1019
|
-
],
|
|
1020
|
-
patterns: [
|
|
1021
|
-
"favicon.svg",
|
|
1022
|
-
"favicon.ico",
|
|
1023
|
-
"favicon-*.png",
|
|
1024
|
-
"logo.svg",
|
|
1025
|
-
"logo.png",
|
|
1026
|
-
"logo.webp",
|
|
1027
|
-
"logo.avif",
|
|
1028
|
-
"apple-touch-icon*.png",
|
|
1029
|
-
"android-chrome-*.png",
|
|
1030
|
-
"manifest.json"
|
|
1031
|
-
],
|
|
1032
|
-
fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
|
|
1033
|
-
framework: ["packages/ui/assets/**/*"]
|
|
1034
|
-
},
|
|
1035
|
-
pwa: {
|
|
1036
|
-
consumer: [
|
|
1037
|
-
"public/manifest.json",
|
|
1038
|
-
"public/service-worker.js",
|
|
1039
|
-
"public/sw.js",
|
|
1040
|
-
"public/icon-192x192.png",
|
|
1041
|
-
"public/icon-512x512.png",
|
|
1042
|
-
"public/favicon.ico",
|
|
1043
|
-
"public/favicon.svg",
|
|
1044
|
-
"public/apple-touch-icon.png",
|
|
1045
|
-
"public/logo.svg"
|
|
1046
|
-
],
|
|
1047
|
-
exclude: ["**/node_modules/**", "**/dist/**", "**/build/**"],
|
|
1048
|
-
extensions: [".json", ".js", ".png", ".svg", ".ico"],
|
|
1049
|
-
framework: ["packages/ui/assets/**/*"]
|
|
1050
|
-
},
|
|
1051
|
-
globalIgnore: [
|
|
1052
|
-
"**/node_modules/**",
|
|
1053
|
-
"**/dist/**",
|
|
1054
|
-
"**/build/**",
|
|
1055
|
-
"**/.git/**",
|
|
1056
|
-
"**/coverage/**",
|
|
1057
|
-
"**/test/**"
|
|
1058
|
-
]
|
|
1059
|
-
};
|
|
1060
|
-
GLOB_OPTIONS = {
|
|
1061
|
-
base: {
|
|
1062
|
-
absolute: true,
|
|
1063
|
-
onlyFiles: true,
|
|
1064
|
-
ignore: SCAN_PATTERNS.globalIgnore
|
|
1065
|
-
},
|
|
1066
|
-
css: {
|
|
1067
|
-
absolute: true,
|
|
1068
|
-
onlyFiles: true,
|
|
1069
|
-
ignore: [...SCAN_PATTERNS.globalIgnore, "**/*.test.css"]
|
|
1070
|
-
},
|
|
1071
|
-
routes: {
|
|
1072
|
-
absolute: true,
|
|
1073
|
-
onlyFiles: true,
|
|
1074
|
-
ignore: [
|
|
1075
|
-
...SCAN_PATTERNS.globalIgnore,
|
|
1076
|
-
"**/*.test.tsx",
|
|
1077
|
-
"**/*.stories.tsx"
|
|
1078
|
-
]
|
|
1079
|
-
},
|
|
1080
|
-
i18n: {
|
|
1081
|
-
absolute: true,
|
|
1082
|
-
onlyFiles: true,
|
|
1083
|
-
ignore: SCAN_PATTERNS.globalIgnore
|
|
1084
|
-
},
|
|
1085
|
-
assets: {
|
|
1086
|
-
absolute: true,
|
|
1087
|
-
onlyFiles: true,
|
|
1088
|
-
ignore: SCAN_PATTERNS.globalIgnore
|
|
1089
|
-
}
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
|
|
1094
945
|
// node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
|
|
1095
946
|
var require_array = __commonJS({
|
|
1096
947
|
"node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
|
|
@@ -6675,69 +6526,218 @@ var require_out4 = __commonJS({
|
|
|
6675
6526
|
}
|
|
6676
6527
|
});
|
|
6677
6528
|
|
|
6678
|
-
// packages/core/config/
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
}
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
function safeExecuteAsync(fn, message) {
|
|
6692
|
-
return fn().catch((error2) => {
|
|
6693
|
-
throw new Error(
|
|
6694
|
-
`${message}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
6695
|
-
);
|
|
6696
|
-
});
|
|
6529
|
+
// packages/core/config/constants.js
|
|
6530
|
+
function getPatternsFor(type, repoRoot = null) {
|
|
6531
|
+
const patterns = SCAN_PATTERNS[type];
|
|
6532
|
+
if (!patterns) {
|
|
6533
|
+
throw new Error(`Unknown pattern type: ${type}`);
|
|
6534
|
+
}
|
|
6535
|
+
if (repoRoot && patterns.framework) {
|
|
6536
|
+
return {
|
|
6537
|
+
...patterns,
|
|
6538
|
+
framework: patterns.framework.map((pattern) => `${repoRoot}/${pattern}`)
|
|
6539
|
+
};
|
|
6540
|
+
}
|
|
6541
|
+
return patterns;
|
|
6697
6542
|
}
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6543
|
+
function getGlobOptionsFor(type) {
|
|
6544
|
+
return GLOB_OPTIONS[type] || GLOB_OPTIONS.base;
|
|
6545
|
+
}
|
|
6546
|
+
var I18N_PATHS, SCAN_PATTERNS, GLOB_OPTIONS;
|
|
6547
|
+
var init_constants = __esm({
|
|
6548
|
+
"packages/core/config/constants.js"() {
|
|
6701
6549
|
"use strict";
|
|
6702
6550
|
init_utils();
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6551
|
+
I18N_PATHS = {
|
|
6552
|
+
// Monorepo source structure (locales at root, not in src/)
|
|
6553
|
+
SOURCE_ROOT: "packages/core/i18n",
|
|
6554
|
+
SOURCE_LOCALES: "packages/core/i18n/locales",
|
|
6555
|
+
SOURCE_EAGER: "packages/core/i18n/locales/eager",
|
|
6556
|
+
SOURCE_LAZY: "packages/core/i18n/locales/lazy",
|
|
6557
|
+
// Published structure (same as source - no flattening needed)
|
|
6558
|
+
PUBLISHED_ROOT: "i18n",
|
|
6559
|
+
PUBLISHED_LOCALES: "i18n/locales",
|
|
6560
|
+
PUBLISHED_EAGER: "i18n/locales/eager",
|
|
6561
|
+
PUBLISHED_LAZY: "i18n/locales/lazy"
|
|
6710
6562
|
};
|
|
6711
|
-
|
|
6712
|
-
|
|
6563
|
+
SCAN_PATTERNS = {
|
|
6564
|
+
routes: {
|
|
6565
|
+
consumer: ["src/**/*Page.tsx", "src/pages/**/*Page.tsx"],
|
|
6566
|
+
exclude: [
|
|
6567
|
+
"**/node_modules/**",
|
|
6568
|
+
"**/dist/**",
|
|
6569
|
+
"**/build/**",
|
|
6570
|
+
"**/*.test.tsx",
|
|
6571
|
+
"**/*.stories.tsx"
|
|
6572
|
+
],
|
|
6573
|
+
extensions: [".tsx"]
|
|
6713
6574
|
},
|
|
6714
|
-
|
|
6575
|
+
css: {
|
|
6576
|
+
consumer: ["src/**/*.css"],
|
|
6577
|
+
themes: ["src/**/*.css"],
|
|
6578
|
+
extensions: [".css", ".scss", ".sass"],
|
|
6579
|
+
framework: [
|
|
6580
|
+
"packages/ui/src/**/*.css",
|
|
6581
|
+
"packages/core/components/src/**/*.css",
|
|
6582
|
+
"packages/core/templates/src/**/*.css"
|
|
6583
|
+
]
|
|
6715
6584
|
},
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6585
|
+
i18n: {
|
|
6586
|
+
eager: ["src/locales/*_*.json"],
|
|
6587
|
+
lazy: ["src/**/locales/*_*.json", "!src/locales/*_*.json"],
|
|
6588
|
+
framework: {
|
|
6589
|
+
eager: [`${I18N_PATHS.SOURCE_EAGER}/*_*.json`],
|
|
6590
|
+
lazy: [`${I18N_PATHS.SOURCE_LAZY}/*_*.json`]
|
|
6591
|
+
},
|
|
6592
|
+
extensions: [".json"]
|
|
6593
|
+
},
|
|
6594
|
+
assets: {
|
|
6595
|
+
consumer: ["public/**/*"],
|
|
6596
|
+
fallback: ["manifest.json"],
|
|
6597
|
+
modern: [
|
|
6598
|
+
"logo.svg",
|
|
6599
|
+
"favicon.svg",
|
|
6600
|
+
"apple-touch-icon.png",
|
|
6601
|
+
"android-chrome-192x192.png",
|
|
6602
|
+
"android-chrome-512x512.png"
|
|
6603
|
+
],
|
|
6604
|
+
patterns: [
|
|
6605
|
+
"favicon.svg",
|
|
6606
|
+
"favicon.ico",
|
|
6607
|
+
"favicon-*.png",
|
|
6608
|
+
"logo.svg",
|
|
6609
|
+
"logo.png",
|
|
6610
|
+
"logo.webp",
|
|
6611
|
+
"logo.avif",
|
|
6612
|
+
"apple-touch-icon*.png",
|
|
6613
|
+
"android-chrome-*.png",
|
|
6614
|
+
"manifest.json"
|
|
6615
|
+
],
|
|
6616
|
+
fonts: ["fonts/**/*.woff2", "fonts/**/*.woff", "fonts/**/*.ttf"],
|
|
6617
|
+
framework: ["packages/ui/assets/**/*"]
|
|
6618
|
+
},
|
|
6619
|
+
pwa: {
|
|
6620
|
+
consumer: [
|
|
6621
|
+
"public/manifest.json",
|
|
6622
|
+
"public/service-worker.js",
|
|
6623
|
+
"public/sw.js",
|
|
6624
|
+
"public/icon-192x192.png",
|
|
6625
|
+
"public/icon-512x512.png",
|
|
6626
|
+
"public/favicon.ico",
|
|
6627
|
+
"public/favicon.svg",
|
|
6628
|
+
"public/apple-touch-icon.png",
|
|
6629
|
+
"public/logo.svg"
|
|
6630
|
+
],
|
|
6631
|
+
exclude: ["**/node_modules/**", "**/dist/**", "**/build/**"],
|
|
6632
|
+
extensions: [".json", ".js", ".png", ".svg", ".ico"],
|
|
6633
|
+
framework: ["packages/ui/assets/**/*"]
|
|
6634
|
+
},
|
|
6635
|
+
globalIgnore: [
|
|
6636
|
+
"**/node_modules/**",
|
|
6637
|
+
"**/dist/**",
|
|
6638
|
+
"**/build/**",
|
|
6639
|
+
"**/.git/**",
|
|
6640
|
+
"**/coverage/**",
|
|
6641
|
+
"**/test/**"
|
|
6642
|
+
]
|
|
6643
|
+
};
|
|
6644
|
+
GLOB_OPTIONS = {
|
|
6645
|
+
base: {
|
|
6646
|
+
absolute: true,
|
|
6647
|
+
onlyFiles: true,
|
|
6648
|
+
ignore: SCAN_PATTERNS.globalIgnore
|
|
6649
|
+
},
|
|
6650
|
+
css: {
|
|
6651
|
+
absolute: true,
|
|
6652
|
+
onlyFiles: true,
|
|
6653
|
+
ignore: [...SCAN_PATTERNS.globalIgnore, "**/*.test.css"]
|
|
6654
|
+
},
|
|
6655
|
+
routes: {
|
|
6656
|
+
absolute: true,
|
|
6657
|
+
onlyFiles: true,
|
|
6658
|
+
ignore: [
|
|
6659
|
+
...SCAN_PATTERNS.globalIgnore,
|
|
6660
|
+
"**/*.test.tsx",
|
|
6661
|
+
"**/*.stories.tsx"
|
|
6662
|
+
]
|
|
6663
|
+
},
|
|
6664
|
+
i18n: {
|
|
6665
|
+
absolute: true,
|
|
6666
|
+
onlyFiles: true,
|
|
6667
|
+
ignore: SCAN_PATTERNS.globalIgnore
|
|
6668
|
+
},
|
|
6669
|
+
assets: {
|
|
6670
|
+
absolute: true,
|
|
6671
|
+
onlyFiles: true,
|
|
6672
|
+
ignore: SCAN_PATTERNS.globalIgnore
|
|
6673
|
+
}
|
|
6674
|
+
};
|
|
6675
|
+
}
|
|
6676
|
+
});
|
|
6677
|
+
|
|
6678
|
+
// packages/core/config/utils/PathResolver.ts
|
|
6679
|
+
import * as fs from "node:fs";
|
|
6680
|
+
import { createRequire } from "node:module";
|
|
6681
|
+
import {
|
|
6682
|
+
resolve,
|
|
6683
|
+
join,
|
|
6684
|
+
dirname,
|
|
6685
|
+
relative,
|
|
6686
|
+
normalize,
|
|
6687
|
+
sep,
|
|
6688
|
+
extname
|
|
6689
|
+
} from "node:path";
|
|
6690
|
+
import { fileURLToPath } from "node:url";
|
|
6691
|
+
function safeExecuteAsync(fn, message) {
|
|
6692
|
+
return fn().catch((error2) => {
|
|
6693
|
+
throw new Error(
|
|
6694
|
+
`${message}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
6695
|
+
);
|
|
6696
|
+
});
|
|
6697
|
+
}
|
|
6698
|
+
var import_fast_glob, constants, log2, PACKAGE_PATHS, PathResolver;
|
|
6699
|
+
var init_PathResolver = __esm({
|
|
6700
|
+
"packages/core/config/utils/PathResolver.ts"() {
|
|
6701
|
+
"use strict";
|
|
6702
|
+
init_utils();
|
|
6703
|
+
import_fast_glob = __toESM(require_out4(), 1);
|
|
6704
|
+
init_constants();
|
|
6705
|
+
constants = {
|
|
6706
|
+
getGlobOptionsFor: getGlobOptionsFor || void 0,
|
|
6707
|
+
SCAN_PATTERNS: SCAN_PATTERNS || void 0,
|
|
6708
|
+
getPatternsFor: getPatternsFor || void 0,
|
|
6709
|
+
I18N_PATHS: I18N_PATHS || void 0
|
|
6710
|
+
};
|
|
6711
|
+
log2 = {
|
|
6712
|
+
error: (message, error2) => {
|
|
6713
|
+
},
|
|
6714
|
+
warn: (message, error2) => {
|
|
6715
|
+
},
|
|
6716
|
+
info: (message) => {
|
|
6717
|
+
}
|
|
6718
|
+
};
|
|
6719
|
+
PACKAGE_PATHS = {
|
|
6720
|
+
CLI: "packages/cli",
|
|
6721
|
+
COMPONENTS: "packages/core/components",
|
|
6722
|
+
CONFIG: "packages/core/config",
|
|
6723
|
+
// I18n paths - single source of truth (use I18N_PATHS from constants.js)
|
|
6724
|
+
CORE: "packages/core",
|
|
6725
|
+
CRUD: "packages/core/crud",
|
|
6726
|
+
FEATURES: "packages/features",
|
|
6727
|
+
HOOKS: "packages/core/hooks",
|
|
6728
|
+
I18N: "packages/core/i18n",
|
|
6729
|
+
SCHEMAS: "packages/core/schemas",
|
|
6730
|
+
STORES: "packages/core/stores",
|
|
6731
|
+
TEMPLATES: "packages/templates",
|
|
6732
|
+
TOOLING: "packages/tooling",
|
|
6733
|
+
TYPES: "packages/core/types",
|
|
6734
|
+
UI: "packages/ui",
|
|
6735
|
+
UTILS: "packages/core/utils",
|
|
6736
|
+
AUTH: "packages/features/auth",
|
|
6737
|
+
BILLING: "packages/features/billing",
|
|
6738
|
+
OAUTH: "packages/features/oauth",
|
|
6739
|
+
FIREBASE: "packages/providers/firebase",
|
|
6740
|
+
FUNCTIONS: "packages/functions"
|
|
6741
6741
|
};
|
|
6742
6742
|
PathResolver = class _PathResolver {
|
|
6743
6743
|
static _instance = null;
|
|
@@ -7616,11 +7616,17 @@ var init_PathResolver = __esm({
|
|
|
7616
7616
|
/**
|
|
7617
7617
|
* Get path to empty.js module for optional dependency aliasing
|
|
7618
7618
|
* Used by Vite and Turbopack to alias missing optional deps
|
|
7619
|
-
* @returns
|
|
7619
|
+
* @param returnPackageSpecifier - If true, returns package specifier '@donotdev/core/empty' for Turbopack. If false, returns absolute path for Vite.
|
|
7620
|
+
* @returns Package specifier or absolute path to empty.js
|
|
7620
7621
|
*/
|
|
7621
|
-
getEmptyModulePath() {
|
|
7622
|
+
getEmptyModulePath(returnPackageSpecifier = false) {
|
|
7623
|
+
if (returnPackageSpecifier) {
|
|
7624
|
+
return "@donotdev/core/empty";
|
|
7625
|
+
}
|
|
7626
|
+
const resolved = this.resolvePackage("@donotdev/core/empty");
|
|
7627
|
+
if (resolved) return resolved;
|
|
7622
7628
|
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
7623
|
-
return this.normalizePath(join(thisDir, "../
|
|
7629
|
+
return this.normalizePath(join(thisDir, "../empty.js"));
|
|
7624
7630
|
}
|
|
7625
7631
|
// === PRIVATE METHODS ===
|
|
7626
7632
|
/**
|
|
@@ -7795,13 +7801,14 @@ import {
|
|
|
7795
7801
|
function readdirSync2(dirPath, options) {
|
|
7796
7802
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
7797
7803
|
}
|
|
7798
|
-
var pathResolverInstance, normalizePath, pathExists, readSync, writeSync, removeSync, statSync2, ensureDirSync, joinPath;
|
|
7804
|
+
var pathResolverInstance, resolvePackage, normalizePath, pathExists, readSync, writeSync, removeSync, statSync2, ensureDirSync, joinPath;
|
|
7799
7805
|
var init_pathResolver = __esm({
|
|
7800
7806
|
"packages/tooling/src/utils/pathResolver.ts"() {
|
|
7801
7807
|
"use strict";
|
|
7802
7808
|
init_utils();
|
|
7803
7809
|
init_PathResolver();
|
|
7804
7810
|
pathResolverInstance = PathResolver.getInstance({ debug: false });
|
|
7811
|
+
resolvePackage = (spec, from) => pathResolverInstance.resolvePackage(spec, from || null);
|
|
7805
7812
|
normalizePath = (...pathSegments) => {
|
|
7806
7813
|
return pathResolverInstance.normalizePath(join2(...pathSegments));
|
|
7807
7814
|
};
|
|
@@ -7818,11 +7825,11 @@ var init_pathResolver = __esm({
|
|
|
7818
7825
|
});
|
|
7819
7826
|
|
|
7820
7827
|
// packages/tooling/src/bundler/utils.ts
|
|
7828
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
7821
7829
|
import { createRequire as createRequire2 } from "node:module";
|
|
7822
|
-
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7823
7830
|
import { dirname as dirname3, resolve as resolve3 } from "node:path";
|
|
7824
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
7825
7831
|
import process from "node:process";
|
|
7832
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7826
7833
|
var require2, __filename, __dirname;
|
|
7827
7834
|
var init_utils = __esm({
|
|
7828
7835
|
"packages/tooling/src/bundler/utils.ts"() {
|
|
@@ -7924,12 +7931,7 @@ function executeFirebaseCommand(args, options) {
|
|
|
7924
7931
|
env: deployEnv
|
|
7925
7932
|
};
|
|
7926
7933
|
let result;
|
|
7927
|
-
|
|
7928
|
-
const firebaseCmd = "C:\\Program Files\\nodejs\\firebase.cmd";
|
|
7929
|
-
result = spawnSync(firebaseCmd, args, { ...spawnOptions, shell: false });
|
|
7930
|
-
} else {
|
|
7931
|
-
result = spawnSync("firebase", args, { ...spawnOptions, shell: true });
|
|
7932
|
-
}
|
|
7934
|
+
result = spawnSync("firebase", args, { ...spawnOptions, shell: true });
|
|
7933
7935
|
if (result.error) {
|
|
7934
7936
|
return {
|
|
7935
7937
|
success: false,
|
|
@@ -8020,10 +8022,11 @@ function safeRemove(path, options = {}) {
|
|
|
8020
8022
|
|
|
8021
8023
|
// packages/tooling/src/apps/deploy.ts
|
|
8022
8024
|
init_utils();
|
|
8023
|
-
init_cli_output();
|
|
8024
|
-
init_cli_output();
|
|
8025
8025
|
import { execSync as execSync3 } from "node:child_process";
|
|
8026
8026
|
|
|
8027
|
+
// packages/tooling/src/apps/deploy-frontend.ts
|
|
8028
|
+
init_utils();
|
|
8029
|
+
|
|
8027
8030
|
// packages/tooling/src/utils/cli-tools.ts
|
|
8028
8031
|
init_utils();
|
|
8029
8032
|
init_dist2();
|
|
@@ -8273,36 +8276,265 @@ function requireCLI(tool, additionalContext) {
|
|
|
8273
8276
|
return true;
|
|
8274
8277
|
}
|
|
8275
8278
|
|
|
8276
|
-
// packages/tooling/src/apps/deploy.ts
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
+
// packages/tooling/src/apps/deploy-frontend.ts
|
|
8280
|
+
async function deployFrontend(appDir, serviceAccountPath, projectId, config) {
|
|
8281
|
+
const s = Y2();
|
|
8282
|
+
s.start("Deploying frontend to Firebase Hosting...");
|
|
8283
|
+
const args = buildFirebaseDeployArgs("hosting", projectId, config.debug);
|
|
8284
|
+
const result = executeFirebaseCommand(args, {
|
|
8285
|
+
cwd: appDir,
|
|
8286
|
+
serviceAccountPath,
|
|
8287
|
+
projectId,
|
|
8288
|
+
debug: config.debug
|
|
8289
|
+
});
|
|
8290
|
+
if (result.error) {
|
|
8291
|
+
s.stop("Deployment failed");
|
|
8292
|
+
throw result.error;
|
|
8293
|
+
}
|
|
8294
|
+
if (!result.success) {
|
|
8295
|
+
s.stop("Deployment failed");
|
|
8296
|
+
handleDeploymentFailure(
|
|
8297
|
+
result,
|
|
8298
|
+
`firebase ${args.join(" ")}`,
|
|
8299
|
+
serviceAccountPath
|
|
8300
|
+
);
|
|
8301
|
+
}
|
|
8302
|
+
s.stop("Frontend deployed successfully");
|
|
8303
|
+
}
|
|
8279
8304
|
|
|
8280
|
-
// packages/tooling/src/apps/deploy-
|
|
8305
|
+
// packages/tooling/src/apps/deploy-functions.ts
|
|
8281
8306
|
init_utils();
|
|
8282
|
-
import {
|
|
8307
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
8283
8308
|
init_pathResolver();
|
|
8284
|
-
function
|
|
8285
|
-
const
|
|
8286
|
-
const
|
|
8287
|
-
|
|
8288
|
-
|
|
8309
|
+
function backupFiles(functionsDir) {
|
|
8310
|
+
const backupDir = joinPath(functionsDir, ".deploy-backup");
|
|
8311
|
+
const packageJsonPath = joinPath(functionsDir, "package.json");
|
|
8312
|
+
const packageLockJsonPath = joinPath(functionsDir, "package-lock.json");
|
|
8313
|
+
try {
|
|
8314
|
+
ensureDirSync(backupDir);
|
|
8315
|
+
const backupPackageJson = joinPath(backupDir, "package.json");
|
|
8316
|
+
const backupPackageLockJson = joinPath(backupDir, "package-lock.json");
|
|
8317
|
+
if (pathExists(packageJsonPath)) {
|
|
8318
|
+
const content = readSync(packageJsonPath, { format: "text" });
|
|
8319
|
+
if (!content) {
|
|
8320
|
+
throw new Error(`Failed to read package.json: ${packageJsonPath}`);
|
|
8321
|
+
}
|
|
8322
|
+
writeSync(backupPackageJson, content, { overwrite: true });
|
|
8323
|
+
}
|
|
8324
|
+
if (pathExists(packageLockJsonPath)) {
|
|
8325
|
+
const content = readSync(packageLockJsonPath, { format: "text" });
|
|
8326
|
+
if (!content) {
|
|
8327
|
+
throw new Error(
|
|
8328
|
+
`Failed to read package-lock.json: ${packageLockJsonPath}`
|
|
8329
|
+
);
|
|
8330
|
+
}
|
|
8331
|
+
writeSync(backupPackageLockJson, content, { overwrite: true });
|
|
8332
|
+
}
|
|
8333
|
+
return {
|
|
8334
|
+
packageJson: backupPackageJson,
|
|
8335
|
+
packageLockJson: backupPackageLockJson
|
|
8336
|
+
};
|
|
8337
|
+
} catch (error2) {
|
|
8338
|
+
log.warn(
|
|
8339
|
+
`Failed to backup files: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
8340
|
+
);
|
|
8341
|
+
return null;
|
|
8289
8342
|
}
|
|
8290
|
-
return readdirSync2(appsDir).filter((item) => {
|
|
8291
|
-
const itemPath = joinPath(appsDir, item);
|
|
8292
|
-
const stat = statSync2(itemPath);
|
|
8293
|
-
return stat?.isDirectory() === true;
|
|
8294
|
-
}).filter((app) => {
|
|
8295
|
-
const firebaseJsonPath = joinPath(appsDir, app, "firebase.json");
|
|
8296
|
-
return pathExists(firebaseJsonPath);
|
|
8297
|
-
}).sort();
|
|
8298
8343
|
}
|
|
8299
|
-
function
|
|
8300
|
-
const
|
|
8301
|
-
|
|
8302
|
-
if (!pathExists(appDir)) {
|
|
8344
|
+
function generateCleanPackageJson(functionsDir) {
|
|
8345
|
+
const packageJsonPath = joinPath(functionsDir, "package.json");
|
|
8346
|
+
if (!pathExists(packageJsonPath)) {
|
|
8303
8347
|
throw new DoNotDevError(
|
|
8304
|
-
`
|
|
8305
|
-
"file-not-found"
|
|
8348
|
+
`package.json not found: ${packageJsonPath}`,
|
|
8349
|
+
"file-not-found"
|
|
8350
|
+
);
|
|
8351
|
+
}
|
|
8352
|
+
const packageJson = readSync(packageJsonPath, { format: "json" });
|
|
8353
|
+
if (!packageJson) {
|
|
8354
|
+
throw new Error(
|
|
8355
|
+
`package.json is empty or invalid JSON at ${packageJsonPath}`
|
|
8356
|
+
);
|
|
8357
|
+
}
|
|
8358
|
+
const cleanPackageJson = { ...packageJson };
|
|
8359
|
+
if (cleanPackageJson.dependencies) {
|
|
8360
|
+
cleanPackageJson.dependencies = Object.fromEntries(
|
|
8361
|
+
Object.entries(cleanPackageJson.dependencies).filter(
|
|
8362
|
+
([, version]) => !String(version).startsWith("file:") && !String(version).startsWith("workspace:")
|
|
8363
|
+
)
|
|
8364
|
+
);
|
|
8365
|
+
}
|
|
8366
|
+
if (cleanPackageJson.devDependencies) {
|
|
8367
|
+
cleanPackageJson.devDependencies = Object.fromEntries(
|
|
8368
|
+
Object.entries(cleanPackageJson.devDependencies).filter(
|
|
8369
|
+
([, version]) => !String(version).startsWith("file:") && !String(version).startsWith("workspace:")
|
|
8370
|
+
)
|
|
8371
|
+
);
|
|
8372
|
+
}
|
|
8373
|
+
if (cleanPackageJson.scripts?.preinstall) {
|
|
8374
|
+
delete cleanPackageJson.scripts.preinstall;
|
|
8375
|
+
}
|
|
8376
|
+
const content = JSON.stringify(cleanPackageJson, null, 2) + "\n";
|
|
8377
|
+
writeSync(packageJsonPath, content, { overwrite: true });
|
|
8378
|
+
}
|
|
8379
|
+
function prepareFunctionsForDeployment(functionsDir, verbose = false) {
|
|
8380
|
+
const s = Y2();
|
|
8381
|
+
s.start("Preparing functions for deployment...");
|
|
8382
|
+
try {
|
|
8383
|
+
backupFiles(functionsDir);
|
|
8384
|
+
generateCleanPackageJson(functionsDir);
|
|
8385
|
+
safeRemove(joinPath(functionsDir, "package-lock.json"), {
|
|
8386
|
+
logSuccess: true,
|
|
8387
|
+
successMessage: "Removed package-lock.json - Firebase Cloud Build will generate its own"
|
|
8388
|
+
});
|
|
8389
|
+
s.stop("Functions prepared for deployment");
|
|
8390
|
+
} catch (error2) {
|
|
8391
|
+
s.stop("Preparation failed");
|
|
8392
|
+
throw error2;
|
|
8393
|
+
}
|
|
8394
|
+
}
|
|
8395
|
+
function restoreFunctionsAfterDeployment(functionsDir) {
|
|
8396
|
+
const backupDir = joinPath(functionsDir, ".deploy-backup");
|
|
8397
|
+
const backupPackageJson = joinPath(backupDir, "package.json");
|
|
8398
|
+
const backupPackageLockJson = joinPath(backupDir, "package-lock.json");
|
|
8399
|
+
const packageJsonPath = joinPath(functionsDir, "package.json");
|
|
8400
|
+
const packageLockJsonPath = joinPath(functionsDir, "package-lock.json");
|
|
8401
|
+
try {
|
|
8402
|
+
if (pathExists(backupPackageJson)) {
|
|
8403
|
+
const content = readSync(backupPackageJson, { format: "text" });
|
|
8404
|
+
if (!content) {
|
|
8405
|
+
throw new Error(
|
|
8406
|
+
`Failed to read backup package.json: ${backupPackageJson}`
|
|
8407
|
+
);
|
|
8408
|
+
}
|
|
8409
|
+
writeSync(packageJsonPath, content, { overwrite: true });
|
|
8410
|
+
}
|
|
8411
|
+
if (pathExists(backupPackageLockJson)) {
|
|
8412
|
+
const content = readSync(backupPackageLockJson, { format: "text" });
|
|
8413
|
+
if (!content) {
|
|
8414
|
+
throw new Error(
|
|
8415
|
+
`Failed to read backup package-lock.json: ${backupPackageLockJson}`
|
|
8416
|
+
);
|
|
8417
|
+
}
|
|
8418
|
+
writeSync(packageLockJsonPath, content, { overwrite: true });
|
|
8419
|
+
}
|
|
8420
|
+
safeRemove(backupDir, { silent: true });
|
|
8421
|
+
} catch (error2) {
|
|
8422
|
+
log.warn(
|
|
8423
|
+
`Failed to restore files: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
8424
|
+
);
|
|
8425
|
+
log.warn(` Backup directory: ${backupDir}`);
|
|
8426
|
+
}
|
|
8427
|
+
}
|
|
8428
|
+
async function deployFunctions(appDir, serviceAccountPath, projectId, config) {
|
|
8429
|
+
const functionsDir = joinPath(appDir, "functions");
|
|
8430
|
+
if (!pathExists(functionsDir)) {
|
|
8431
|
+
throw new DoNotDevError(
|
|
8432
|
+
`Functions directory not found: ${functionsDir}`,
|
|
8433
|
+
"file-not-found"
|
|
8434
|
+
);
|
|
8435
|
+
}
|
|
8436
|
+
const s = Y2();
|
|
8437
|
+
s.start("Validating function dependencies...");
|
|
8438
|
+
const requiredPackages = ["firebase-functions", "firebase-admin"];
|
|
8439
|
+
const missingPackages = requiredPackages.filter((pkg) => {
|
|
8440
|
+
try {
|
|
8441
|
+
resolvePackage(pkg, functionsDir);
|
|
8442
|
+
return false;
|
|
8443
|
+
} catch {
|
|
8444
|
+
return true;
|
|
8445
|
+
}
|
|
8446
|
+
});
|
|
8447
|
+
if (missingPackages.length > 0) {
|
|
8448
|
+
s.stop("Missing dependencies");
|
|
8449
|
+
throw new DoNotDevError(
|
|
8450
|
+
`Missing required dependencies: ${missingPackages.join(", ")}
|
|
8451
|
+
|
|
8452
|
+
To fix this, run:
|
|
8453
|
+
cd ${functionsDir}
|
|
8454
|
+
npm install --production`,
|
|
8455
|
+
"file-not-found",
|
|
8456
|
+
{ context: { missingPackages, functionsDir } }
|
|
8457
|
+
);
|
|
8458
|
+
}
|
|
8459
|
+
s.stop("Dependencies validated");
|
|
8460
|
+
prepareFunctionsForDeployment(functionsDir, config.verbose);
|
|
8461
|
+
log.debug("Waiting for file system sync...");
|
|
8462
|
+
await new Promise((resolve4) => setTimeout(resolve4, 1e3));
|
|
8463
|
+
try {
|
|
8464
|
+
if (!config.skipBuild) {
|
|
8465
|
+
const s2 = Y2();
|
|
8466
|
+
s2.start("Building functions...");
|
|
8467
|
+
try {
|
|
8468
|
+
execSync2("bun run build", {
|
|
8469
|
+
cwd: functionsDir,
|
|
8470
|
+
stdio: config.verbose ? "inherit" : "pipe"
|
|
8471
|
+
});
|
|
8472
|
+
s2.stop("Functions built");
|
|
8473
|
+
} catch (error2) {
|
|
8474
|
+
s2.stop("Build failed");
|
|
8475
|
+
throw error2;
|
|
8476
|
+
}
|
|
8477
|
+
}
|
|
8478
|
+
s.start("Deploying functions to Firebase...");
|
|
8479
|
+
const firebaseProjectDir = pathExists(joinPath(appDir, "firebase.json")) ? appDir : functionsDir;
|
|
8480
|
+
log.debug(`Using service account: ${serviceAccountPath}`);
|
|
8481
|
+
log.debug(`Firebase project directory: ${firebaseProjectDir}`);
|
|
8482
|
+
const args = buildFirebaseDeployArgs(
|
|
8483
|
+
"functions",
|
|
8484
|
+
projectId,
|
|
8485
|
+
config.debug,
|
|
8486
|
+
config.force
|
|
8487
|
+
);
|
|
8488
|
+
const result = executeFirebaseCommand(args, {
|
|
8489
|
+
cwd: firebaseProjectDir,
|
|
8490
|
+
serviceAccountPath,
|
|
8491
|
+
projectId,
|
|
8492
|
+
debug: config.debug
|
|
8493
|
+
});
|
|
8494
|
+
if (result.error) {
|
|
8495
|
+
s.stop("Deployment failed");
|
|
8496
|
+
throw result.error;
|
|
8497
|
+
}
|
|
8498
|
+
if (!result.success) {
|
|
8499
|
+
s.stop("Deployment failed");
|
|
8500
|
+
handleDeploymentFailure(
|
|
8501
|
+
result,
|
|
8502
|
+
`firebase ${args.join(" ")}`,
|
|
8503
|
+
serviceAccountPath
|
|
8504
|
+
);
|
|
8505
|
+
}
|
|
8506
|
+
s.stop("Functions deployed successfully");
|
|
8507
|
+
} finally {
|
|
8508
|
+
restoreFunctionsAfterDeployment(functionsDir);
|
|
8509
|
+
}
|
|
8510
|
+
}
|
|
8511
|
+
|
|
8512
|
+
// packages/tooling/src/apps/deploy-utils.ts
|
|
8513
|
+
init_utils();
|
|
8514
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
8515
|
+
init_pathResolver();
|
|
8516
|
+
function detectAvailableApps() {
|
|
8517
|
+
const currentDir = process.cwd();
|
|
8518
|
+
const appsDir = joinPath(currentDir, "apps");
|
|
8519
|
+
if (!pathExists(appsDir)) {
|
|
8520
|
+
return [];
|
|
8521
|
+
}
|
|
8522
|
+
return readdirSync2(appsDir).filter((item) => {
|
|
8523
|
+
const itemPath = joinPath(appsDir, item);
|
|
8524
|
+
const stat = statSync2(itemPath);
|
|
8525
|
+
return stat?.isDirectory() === true;
|
|
8526
|
+
}).filter((app) => {
|
|
8527
|
+
const firebaseJsonPath = joinPath(appsDir, app, "firebase.json");
|
|
8528
|
+
return pathExists(firebaseJsonPath);
|
|
8529
|
+
}).sort();
|
|
8530
|
+
}
|
|
8531
|
+
function detectAppDir(appName) {
|
|
8532
|
+
const currentDir = process.cwd();
|
|
8533
|
+
const appDir = joinPath(currentDir, "apps", appName);
|
|
8534
|
+
if (!pathExists(appDir)) {
|
|
8535
|
+
throw new DoNotDevError(
|
|
8536
|
+
`App directory not found: ${appDir}`,
|
|
8537
|
+
"file-not-found",
|
|
8306
8538
|
{ context: { appName, expectedPath: appDir } }
|
|
8307
8539
|
);
|
|
8308
8540
|
}
|
|
@@ -8520,235 +8752,11 @@ function clearFirebaseCache(appDir) {
|
|
|
8520
8752
|
}
|
|
8521
8753
|
}
|
|
8522
8754
|
|
|
8523
|
-
// packages/tooling/src/apps/deploy-frontend.ts
|
|
8524
|
-
init_utils();
|
|
8525
|
-
async function deployFrontend(appDir, serviceAccountPath, projectId, config) {
|
|
8526
|
-
const s = Y2();
|
|
8527
|
-
s.start("Deploying frontend to Firebase Hosting...");
|
|
8528
|
-
const args = buildFirebaseDeployArgs("hosting", projectId, config.debug);
|
|
8529
|
-
const result = executeFirebaseCommand(args, {
|
|
8530
|
-
cwd: appDir,
|
|
8531
|
-
serviceAccountPath,
|
|
8532
|
-
projectId,
|
|
8533
|
-
debug: config.debug
|
|
8534
|
-
});
|
|
8535
|
-
if (result.error) {
|
|
8536
|
-
s.stop("Deployment failed");
|
|
8537
|
-
throw result.error;
|
|
8538
|
-
}
|
|
8539
|
-
if (!result.success) {
|
|
8540
|
-
s.stop("Deployment failed");
|
|
8541
|
-
handleDeploymentFailure(
|
|
8542
|
-
result,
|
|
8543
|
-
`firebase ${args.join(" ")}`,
|
|
8544
|
-
serviceAccountPath
|
|
8545
|
-
);
|
|
8546
|
-
}
|
|
8547
|
-
s.stop("Frontend deployed successfully");
|
|
8548
|
-
}
|
|
8549
|
-
|
|
8550
|
-
// packages/tooling/src/apps/deploy-functions.ts
|
|
8551
|
-
init_utils();
|
|
8552
|
-
import { execSync as execSync2 } from "node:child_process";
|
|
8553
|
-
init_pathResolver();
|
|
8554
|
-
function backupFiles(functionsDir) {
|
|
8555
|
-
const backupDir = joinPath(functionsDir, ".deploy-backup");
|
|
8556
|
-
const packageJsonPath = joinPath(functionsDir, "package.json");
|
|
8557
|
-
const packageLockJsonPath = joinPath(functionsDir, "package-lock.json");
|
|
8558
|
-
try {
|
|
8559
|
-
ensureDirSync(backupDir);
|
|
8560
|
-
const backupPackageJson = joinPath(backupDir, "package.json");
|
|
8561
|
-
const backupPackageLockJson = joinPath(backupDir, "package-lock.json");
|
|
8562
|
-
if (pathExists(packageJsonPath)) {
|
|
8563
|
-
const content = readSync(packageJsonPath, { format: "text" });
|
|
8564
|
-
if (!content) {
|
|
8565
|
-
throw new Error(`Failed to read package.json: ${packageJsonPath}`);
|
|
8566
|
-
}
|
|
8567
|
-
writeSync(backupPackageJson, content, { overwrite: true });
|
|
8568
|
-
}
|
|
8569
|
-
if (pathExists(packageLockJsonPath)) {
|
|
8570
|
-
const content = readSync(packageLockJsonPath, { format: "text" });
|
|
8571
|
-
if (!content) {
|
|
8572
|
-
throw new Error(
|
|
8573
|
-
`Failed to read package-lock.json: ${packageLockJsonPath}`
|
|
8574
|
-
);
|
|
8575
|
-
}
|
|
8576
|
-
writeSync(backupPackageLockJson, content, { overwrite: true });
|
|
8577
|
-
}
|
|
8578
|
-
return {
|
|
8579
|
-
packageJson: backupPackageJson,
|
|
8580
|
-
packageLockJson: backupPackageLockJson
|
|
8581
|
-
};
|
|
8582
|
-
} catch (error2) {
|
|
8583
|
-
log.warn(
|
|
8584
|
-
`Failed to backup files: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
8585
|
-
);
|
|
8586
|
-
return null;
|
|
8587
|
-
}
|
|
8588
|
-
}
|
|
8589
|
-
function generateCleanPackageJson(functionsDir) {
|
|
8590
|
-
const packageJsonPath = joinPath(functionsDir, "package.json");
|
|
8591
|
-
if (!pathExists(packageJsonPath)) {
|
|
8592
|
-
throw new DoNotDevError(
|
|
8593
|
-
`package.json not found: ${packageJsonPath}`,
|
|
8594
|
-
"file-not-found"
|
|
8595
|
-
);
|
|
8596
|
-
}
|
|
8597
|
-
const packageJson = readSync(packageJsonPath, { format: "json" });
|
|
8598
|
-
if (!packageJson) {
|
|
8599
|
-
throw new Error(
|
|
8600
|
-
`package.json is empty or invalid JSON at ${packageJsonPath}`
|
|
8601
|
-
);
|
|
8602
|
-
}
|
|
8603
|
-
const cleanPackageJson = { ...packageJson };
|
|
8604
|
-
if (cleanPackageJson.dependencies) {
|
|
8605
|
-
cleanPackageJson.dependencies = Object.fromEntries(
|
|
8606
|
-
Object.entries(cleanPackageJson.dependencies).filter(
|
|
8607
|
-
([, version]) => !String(version).startsWith("file:") && !String(version).startsWith("workspace:")
|
|
8608
|
-
)
|
|
8609
|
-
);
|
|
8610
|
-
}
|
|
8611
|
-
if (cleanPackageJson.devDependencies) {
|
|
8612
|
-
cleanPackageJson.devDependencies = Object.fromEntries(
|
|
8613
|
-
Object.entries(cleanPackageJson.devDependencies).filter(
|
|
8614
|
-
([, version]) => !String(version).startsWith("file:") && !String(version).startsWith("workspace:")
|
|
8615
|
-
)
|
|
8616
|
-
);
|
|
8617
|
-
}
|
|
8618
|
-
if (cleanPackageJson.scripts?.preinstall) {
|
|
8619
|
-
delete cleanPackageJson.scripts.preinstall;
|
|
8620
|
-
}
|
|
8621
|
-
const content = JSON.stringify(cleanPackageJson, null, 2) + "\n";
|
|
8622
|
-
writeSync(packageJsonPath, content, { overwrite: true });
|
|
8623
|
-
}
|
|
8624
|
-
function prepareFunctionsForDeployment(functionsDir, verbose = false) {
|
|
8625
|
-
const s = Y2();
|
|
8626
|
-
s.start("Preparing functions for deployment...");
|
|
8627
|
-
try {
|
|
8628
|
-
backupFiles(functionsDir);
|
|
8629
|
-
generateCleanPackageJson(functionsDir);
|
|
8630
|
-
safeRemove(joinPath(functionsDir, "package-lock.json"), {
|
|
8631
|
-
logSuccess: true,
|
|
8632
|
-
successMessage: "Removed package-lock.json - Firebase Cloud Build will generate its own"
|
|
8633
|
-
});
|
|
8634
|
-
s.stop("Functions prepared for deployment");
|
|
8635
|
-
} catch (error2) {
|
|
8636
|
-
s.stop("Preparation failed");
|
|
8637
|
-
throw error2;
|
|
8638
|
-
}
|
|
8639
|
-
}
|
|
8640
|
-
function restoreFunctionsAfterDeployment(functionsDir) {
|
|
8641
|
-
const backupDir = joinPath(functionsDir, ".deploy-backup");
|
|
8642
|
-
const backupPackageJson = joinPath(backupDir, "package.json");
|
|
8643
|
-
const backupPackageLockJson = joinPath(backupDir, "package-lock.json");
|
|
8644
|
-
const packageJsonPath = joinPath(functionsDir, "package.json");
|
|
8645
|
-
const packageLockJsonPath = joinPath(functionsDir, "package-lock.json");
|
|
8646
|
-
try {
|
|
8647
|
-
if (pathExists(backupPackageJson)) {
|
|
8648
|
-
const content = readSync(backupPackageJson, { format: "text" });
|
|
8649
|
-
if (!content) {
|
|
8650
|
-
throw new Error(
|
|
8651
|
-
`Failed to read backup package.json: ${backupPackageJson}`
|
|
8652
|
-
);
|
|
8653
|
-
}
|
|
8654
|
-
writeSync(packageJsonPath, content, { overwrite: true });
|
|
8655
|
-
}
|
|
8656
|
-
if (pathExists(backupPackageLockJson)) {
|
|
8657
|
-
const content = readSync(backupPackageLockJson, { format: "text" });
|
|
8658
|
-
if (!content) {
|
|
8659
|
-
throw new Error(
|
|
8660
|
-
`Failed to read backup package-lock.json: ${backupPackageLockJson}`
|
|
8661
|
-
);
|
|
8662
|
-
}
|
|
8663
|
-
writeSync(packageLockJsonPath, content, { overwrite: true });
|
|
8664
|
-
}
|
|
8665
|
-
safeRemove(backupDir, { silent: true });
|
|
8666
|
-
} catch (error2) {
|
|
8667
|
-
log.warn(
|
|
8668
|
-
`Failed to restore files: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
8669
|
-
);
|
|
8670
|
-
log.warn(` Backup directory: ${backupDir}`);
|
|
8671
|
-
}
|
|
8672
|
-
}
|
|
8673
|
-
async function deployFunctions(appDir, serviceAccountPath, projectId, config) {
|
|
8674
|
-
const functionsDir = joinPath(appDir, "functions");
|
|
8675
|
-
if (!pathExists(functionsDir)) {
|
|
8676
|
-
throw new DoNotDevError(
|
|
8677
|
-
`Functions directory not found: ${functionsDir}`,
|
|
8678
|
-
"file-not-found"
|
|
8679
|
-
);
|
|
8680
|
-
}
|
|
8681
|
-
const s = Y2();
|
|
8682
|
-
s.start("Validating function dependencies...");
|
|
8683
|
-
const nodeModulesPath = joinPath(functionsDir, "node_modules");
|
|
8684
|
-
const requiredPackages = ["firebase-functions", "firebase-admin"];
|
|
8685
|
-
const missingPackages = requiredPackages.filter(
|
|
8686
|
-
(pkg) => !pathExists(joinPath(nodeModulesPath, pkg))
|
|
8687
|
-
);
|
|
8688
|
-
if (missingPackages.length > 0) {
|
|
8689
|
-
s.stop("Missing dependencies");
|
|
8690
|
-
throw new DoNotDevError(
|
|
8691
|
-
`Missing required dependencies: ${missingPackages.join(", ")}
|
|
8692
|
-
|
|
8693
|
-
To fix this, run:
|
|
8694
|
-
cd ${functionsDir}
|
|
8695
|
-
npm install --production`,
|
|
8696
|
-
"file-not-found",
|
|
8697
|
-
{ context: { missingPackages, functionsDir } }
|
|
8698
|
-
);
|
|
8699
|
-
}
|
|
8700
|
-
s.stop("Dependencies validated");
|
|
8701
|
-
prepareFunctionsForDeployment(functionsDir, config.verbose);
|
|
8702
|
-
try {
|
|
8703
|
-
if (!config.skipBuild) {
|
|
8704
|
-
const s2 = Y2();
|
|
8705
|
-
s2.start("Building functions...");
|
|
8706
|
-
try {
|
|
8707
|
-
execSync2("bun run build", {
|
|
8708
|
-
cwd: functionsDir,
|
|
8709
|
-
stdio: config.verbose ? "inherit" : "pipe"
|
|
8710
|
-
});
|
|
8711
|
-
s2.stop("Functions built");
|
|
8712
|
-
} catch (error2) {
|
|
8713
|
-
s2.stop("Build failed");
|
|
8714
|
-
throw error2;
|
|
8715
|
-
}
|
|
8716
|
-
}
|
|
8717
|
-
s.start("Deploying functions to Firebase...");
|
|
8718
|
-
const firebaseProjectDir = pathExists(joinPath(appDir, "firebase.json")) ? appDir : functionsDir;
|
|
8719
|
-
log.debug(`Using service account: ${serviceAccountPath}`);
|
|
8720
|
-
log.debug(`Firebase project directory: ${firebaseProjectDir}`);
|
|
8721
|
-
const args = buildFirebaseDeployArgs(
|
|
8722
|
-
"functions",
|
|
8723
|
-
projectId,
|
|
8724
|
-
config.debug,
|
|
8725
|
-
config.force
|
|
8726
|
-
);
|
|
8727
|
-
const result = executeFirebaseCommand(args, {
|
|
8728
|
-
cwd: firebaseProjectDir,
|
|
8729
|
-
serviceAccountPath,
|
|
8730
|
-
projectId,
|
|
8731
|
-
debug: config.debug
|
|
8732
|
-
});
|
|
8733
|
-
if (result.error) {
|
|
8734
|
-
s.stop("Deployment failed");
|
|
8735
|
-
throw result.error;
|
|
8736
|
-
}
|
|
8737
|
-
if (!result.success) {
|
|
8738
|
-
s.stop("Deployment failed");
|
|
8739
|
-
handleDeploymentFailure(
|
|
8740
|
-
result,
|
|
8741
|
-
`firebase ${args.join(" ")}`,
|
|
8742
|
-
serviceAccountPath
|
|
8743
|
-
);
|
|
8744
|
-
}
|
|
8745
|
-
s.stop("Functions deployed successfully");
|
|
8746
|
-
} finally {
|
|
8747
|
-
restoreFunctionsAfterDeployment(functionsDir);
|
|
8748
|
-
}
|
|
8749
|
-
}
|
|
8750
|
-
|
|
8751
8755
|
// packages/tooling/src/apps/deploy.ts
|
|
8756
|
+
init_cli_output();
|
|
8757
|
+
init_cli_output();
|
|
8758
|
+
init_errors();
|
|
8759
|
+
init_pathResolver();
|
|
8752
8760
|
async function main(options = {}) {
|
|
8753
8761
|
const config = {
|
|
8754
8762
|
app: options.app,
|