@donotdev/cli 0.0.13 → 0.0.15
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 +357 -89
- package/dist/bin/commands/agent-setup.d.ts +6 -0
- package/dist/bin/commands/agent-setup.d.ts.map +1 -0
- package/dist/bin/commands/agent-setup.js +629 -0
- package/dist/bin/commands/agent-setup.js.map +1 -0
- package/dist/bin/commands/build.js +131 -50
- package/dist/bin/commands/bump.js +137 -49
- package/dist/bin/commands/cacheout.js +50 -21
- package/dist/bin/commands/create-app.js +270 -261
- package/dist/bin/commands/create-project.js +418 -197
- package/dist/bin/commands/deploy.js +1752 -712
- package/dist/bin/commands/dev.js +151 -35
- package/dist/bin/commands/emu.js +228 -70
- package/dist/bin/commands/format.js +50 -21
- package/dist/bin/commands/lint.js +50 -21
- package/dist/bin/commands/preview.js +155 -35
- package/dist/bin/commands/supabase-setup.d.ts +6 -0
- package/dist/bin/commands/supabase-setup.d.ts.map +1 -0
- package/dist/bin/commands/supabase-setup.js +7 -0
- package/dist/bin/commands/supabase-setup.js.map +1 -0
- package/dist/bin/commands/sync-secrets.js +224 -46
- package/dist/bin/commands/type-check.d.ts +14 -0
- package/dist/bin/commands/type-check.d.ts.map +1 -0
- package/dist/bin/commands/type-check.js +314 -0
- package/dist/bin/commands/type-check.js.map +1 -0
- package/dist/bin/commands/wai.js +7399 -11
- package/dist/bin/dndev.js +27 -2
- package/dist/bin/donotdev.js +27 -2
- package/dist/index.js +3960 -2996
- package/package.json +2 -2
- package/templates/app-demo/src/App.tsx.example +1 -0
- package/templates/app-demo/src/pages/FullPage.tsx.example +2 -2
- package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +2 -2
- package/templates/app-demo/src/themes.css.example +5 -12
- package/templates/app-expo/.env.example +64 -0
- package/templates/app-expo/.expo/README.md.example +5 -0
- package/templates/app-expo/.gitignore.example +36 -0
- package/templates/app-expo/README.md.example +58 -0
- package/templates/app-expo/app/.gitkeep +2 -0
- package/templates/app-expo/app/_layout.tsx.example +41 -0
- package/templates/app-expo/app/form.tsx.example +52 -0
- package/templates/app-expo/app/index.tsx.example +89 -0
- package/templates/app-expo/app/list.tsx.example +32 -0
- package/templates/app-expo/app/profile.tsx.example +76 -0
- package/templates/app-expo/app/signin.tsx.example +53 -0
- package/templates/app-expo/app.json.example +39 -0
- package/templates/app-expo/babel.config.js.example +10 -0
- package/templates/app-expo/eas.json.example +20 -0
- package/templates/app-expo/expo-env.d.ts.example +4 -0
- package/templates/app-expo/metro.config.js.example +20 -0
- package/templates/app-expo/service-account-key.json.example +12 -0
- package/templates/app-expo/tsconfig.json.example +19 -0
- package/templates/app-next/.env.example +4 -33
- package/templates/app-next/src/app/ClientLayout.tsx.example +2 -0
- package/templates/app-next/src/app/layout.tsx.example +7 -6
- package/templates/app-next/src/globals.css.example +2 -11
- package/templates/app-next/src/pages/HomePage.tsx.example +1 -1
- package/templates/app-next/src/themes.css.example +10 -13
- package/templates/app-vite/.env.example +3 -32
- package/templates/app-vite/index.html.example +2 -24
- package/templates/app-vite/src/App.tsx.example +2 -0
- package/templates/app-vite/src/globals.css.example +2 -12
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -2
- package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
- package/templates/app-vite/src/themes.css.example +109 -79
- package/templates/app-vite/vercel.json.example +11 -0
- package/templates/functions-firebase/build.mjs.example +2 -72
- package/templates/functions-firebase/functions-firebase/.env.example.example +23 -25
- package/templates/functions-firebase/functions-firebase/build.mjs.example +2 -72
- package/templates/functions-firebase/functions-firebase/tsconfig.json.example +1 -1
- package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +11 -0
- package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +11 -0
- package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/crud/index.ts.example +16 -0
- package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +24 -0
- package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +22 -0
- package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +28 -0
- package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +28 -0
- package/templates/functions-vercel/functions-vercel/tsconfig.json.example +1 -1
- package/templates/functions-vercel/functions-vercel/vercel.json.example +1 -1
- package/templates/functions-vercel/vercel.json.example +1 -1
- package/templates/github/github/workflows/firebase-deploy.yml.example +1 -1
- package/templates/github/workflows/firebase-deploy.yml.example +1 -1
- package/templates/overlay-firebase/env.fragment.example +34 -0
- package/templates/overlay-firebase/env.fragment.expo.example +34 -0
- package/templates/overlay-firebase/env.fragment.nextjs.example +34 -0
- package/templates/overlay-firebase/src/config/providers.expo.ts.example +49 -0
- package/templates/overlay-firebase/src/config/providers.ts.example +23 -0
- package/templates/overlay-supabase/env.fragment.example +7 -0
- package/templates/overlay-supabase/env.fragment.expo.example +7 -0
- package/templates/overlay-supabase/env.fragment.nextjs.example +7 -0
- package/templates/overlay-supabase/src/config/providers.expo.ts.example +35 -0
- package/templates/overlay-supabase/src/config/providers.ts.example +33 -0
- package/templates/overlay-supabase/vercel.headers.example +23 -0
- package/templates/overlay-supabase/vercel.json.example +22 -0
- package/templates/overlay-vercel/env.fragment.example +34 -0
- package/templates/overlay-vercel/env.fragment.nextjs.example +34 -0
- package/templates/overlay-vercel/src/config/providers.ts.example +24 -0
- package/templates/root-consumer/.claude/agents/architect.md.example +2 -310
- package/templates/root-consumer/.claude/agents/builder.md.example +2 -326
- package/templates/root-consumer/.claude/agents/coder.md.example +2 -83
- package/templates/root-consumer/.claude/agents/extractor.md.example +2 -231
- package/templates/root-consumer/.claude/agents/polisher.md.example +2 -132
- package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +2 -81
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +1 -1
- package/templates/root-consumer/.claude/commands/build.md.example +1 -1
- package/templates/root-consumer/.claude/commands/design.md.example +1 -1
- package/templates/root-consumer/.claude/commands/grill.md.example +30 -0
- package/templates/root-consumer/.claude/commands/polish.md.example +1 -1
- package/templates/root-consumer/.claude/commands/techdebt.md.example +28 -0
- package/templates/root-consumer/.clinerules.example +1 -0
- package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +15 -0
- package/templates/root-consumer/.cursorrules.example +1 -0
- package/templates/root-consumer/.dndev/args.json.example +6 -0
- package/templates/root-consumer/.gemini/settings.json.example +2 -2
- package/templates/root-consumer/.github/copilot-instructions.md.example +1 -0
- package/templates/root-consumer/.windsurfrules.example +1 -0
- package/templates/root-consumer/AI.md.example +25 -108
- package/templates/root-consumer/CLAUDE.md.example +1 -128
- package/templates/root-consumer/CONVENTIONS.md.example +1 -0
- package/templates/root-consumer/GEMINI.md.example +1 -0
- package/templates/root-consumer/firebase.json.example +1 -1
- package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +54 -0
- package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -18
- package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +1 -1
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +99 -30
- package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +186 -0
- package/templates/root-consumer/guides/dndev/INDEX.md.example +4 -1
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +143 -12
- package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +9 -3
- package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +12 -7
- package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +234 -0
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +124 -0
- package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +6 -2
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +176 -0
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +5 -9
- package/templates/root-consumer/guides/dndev/essences_reference.css.example +174 -0
- package/templates/root-consumer/guides/wai-way/agents/builder.md.example +10 -0
- package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +25 -5
- package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +13 -2
- package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +2 -2
- package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +47 -11
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +15 -4
- package/templates/root-consumer/guides/wai-way/spec_template.md.example +7 -6
- package/templates/app-payload/.env.example +0 -28
- package/templates/app-payload/README.md.example +0 -233
- package/templates/app-payload/collections/Company.ts.example +0 -125
- package/templates/app-payload/collections/Hero.ts.example +0 -62
- package/templates/app-payload/collections/Media.ts.example +0 -41
- package/templates/app-payload/collections/Products.ts.example +0 -115
- package/templates/app-payload/collections/Services.ts.example +0 -104
- package/templates/app-payload/collections/Testimonials.ts.example +0 -92
- package/templates/app-payload/collections/Users.ts.example +0 -35
- package/templates/app-payload/src/server.ts.example +0 -79
- package/templates/app-payload/tsconfig.json.example +0 -24
|
@@ -2139,7 +2139,7 @@ var require_parse = __commonJS({
|
|
|
2139
2139
|
CHAR_NO_BREAK_SPACE,
|
|
2140
2140
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
2141
2141
|
} = require_constants();
|
|
2142
|
-
var
|
|
2142
|
+
var parse2 = (input, options = {}) => {
|
|
2143
2143
|
if (typeof input !== "string") {
|
|
2144
2144
|
throw new TypeError("Expected a string");
|
|
2145
2145
|
}
|
|
@@ -2339,7 +2339,7 @@ var require_parse = __commonJS({
|
|
|
2339
2339
|
push({ type: "eos" });
|
|
2340
2340
|
return ast;
|
|
2341
2341
|
};
|
|
2342
|
-
module.exports =
|
|
2342
|
+
module.exports = parse2;
|
|
2343
2343
|
}
|
|
2344
2344
|
});
|
|
2345
2345
|
|
|
@@ -2351,7 +2351,7 @@ var require_braces = __commonJS({
|
|
|
2351
2351
|
var stringify2 = require_stringify();
|
|
2352
2352
|
var compile = require_compile();
|
|
2353
2353
|
var expand = require_expand();
|
|
2354
|
-
var
|
|
2354
|
+
var parse2 = require_parse();
|
|
2355
2355
|
var braces = (input, options = {}) => {
|
|
2356
2356
|
let output = [];
|
|
2357
2357
|
if (Array.isArray(input)) {
|
|
@@ -2371,7 +2371,7 @@ var require_braces = __commonJS({
|
|
|
2371
2371
|
}
|
|
2372
2372
|
return output;
|
|
2373
2373
|
};
|
|
2374
|
-
braces.parse = (input, options = {}) =>
|
|
2374
|
+
braces.parse = (input, options = {}) => parse2(input, options);
|
|
2375
2375
|
braces.stringify = (input, options = {}) => {
|
|
2376
2376
|
if (typeof input === "string") {
|
|
2377
2377
|
return stringify2(braces.parse(input, options), options);
|
|
@@ -3028,7 +3028,7 @@ var require_parse2 = __commonJS({
|
|
|
3028
3028
|
var syntaxError = (type, char) => {
|
|
3029
3029
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
3030
3030
|
};
|
|
3031
|
-
var
|
|
3031
|
+
var parse2 = (input, options) => {
|
|
3032
3032
|
if (typeof input !== "string") {
|
|
3033
3033
|
throw new TypeError("Expected a string");
|
|
3034
3034
|
}
|
|
@@ -3177,7 +3177,7 @@ var require_parse2 = __commonJS({
|
|
|
3177
3177
|
output = token.close = `)$))${extglobStar}`;
|
|
3178
3178
|
}
|
|
3179
3179
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
3180
|
-
const expression =
|
|
3180
|
+
const expression = parse2(rest, { ...options, fastpaths: false }).output;
|
|
3181
3181
|
output = token.close = `)${expression})${extglobStar})`;
|
|
3182
3182
|
}
|
|
3183
3183
|
if (token.prev.type === "bos") {
|
|
@@ -3702,7 +3702,7 @@ var require_parse2 = __commonJS({
|
|
|
3702
3702
|
}
|
|
3703
3703
|
return state;
|
|
3704
3704
|
};
|
|
3705
|
-
|
|
3705
|
+
parse2.fastpaths = (input, options) => {
|
|
3706
3706
|
const opts = { ...options };
|
|
3707
3707
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3708
3708
|
const len = input.length;
|
|
@@ -3768,7 +3768,7 @@ var require_parse2 = __commonJS({
|
|
|
3768
3768
|
}
|
|
3769
3769
|
return source;
|
|
3770
3770
|
};
|
|
3771
|
-
module.exports =
|
|
3771
|
+
module.exports = parse2;
|
|
3772
3772
|
}
|
|
3773
3773
|
});
|
|
3774
3774
|
|
|
@@ -3779,7 +3779,7 @@ var require_picomatch = __commonJS({
|
|
|
3779
3779
|
init_utils();
|
|
3780
3780
|
var path = __require("path");
|
|
3781
3781
|
var scan = require_scan();
|
|
3782
|
-
var
|
|
3782
|
+
var parse2 = require_parse2();
|
|
3783
3783
|
var utils = require_utils2();
|
|
3784
3784
|
var constants2 = require_constants2();
|
|
3785
3785
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -3867,7 +3867,7 @@ var require_picomatch = __commonJS({
|
|
|
3867
3867
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
3868
3868
|
picomatch.parse = (pattern, options) => {
|
|
3869
3869
|
if (Array.isArray(pattern)) return pattern.map((p2) => picomatch.parse(p2, options));
|
|
3870
|
-
return
|
|
3870
|
+
return parse2(pattern, { ...options, fastpaths: false });
|
|
3871
3871
|
};
|
|
3872
3872
|
picomatch.scan = (input, options) => scan(input, options);
|
|
3873
3873
|
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
@@ -3893,10 +3893,10 @@ var require_picomatch = __commonJS({
|
|
|
3893
3893
|
}
|
|
3894
3894
|
let parsed = { negated: false, fastpaths: true };
|
|
3895
3895
|
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
3896
|
-
parsed.output =
|
|
3896
|
+
parsed.output = parse2.fastpaths(input, options);
|
|
3897
3897
|
}
|
|
3898
3898
|
if (!parsed.output) {
|
|
3899
|
-
parsed =
|
|
3899
|
+
parsed = parse2(input, options);
|
|
3900
3900
|
}
|
|
3901
3901
|
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
3902
3902
|
};
|
|
@@ -7757,119 +7757,6 @@ var init_PathResolver = __esm({
|
|
|
7757
7757
|
}
|
|
7758
7758
|
});
|
|
7759
7759
|
|
|
7760
|
-
// packages/tooling/src/utils/errors.ts
|
|
7761
|
-
var DoNotDevError;
|
|
7762
|
-
var init_errors = __esm({
|
|
7763
|
-
"packages/tooling/src/utils/errors.ts"() {
|
|
7764
|
-
"use strict";
|
|
7765
|
-
init_utils();
|
|
7766
|
-
DoNotDevError = class _DoNotDevError extends Error {
|
|
7767
|
-
/** The error code categorizing this error */
|
|
7768
|
-
code;
|
|
7769
|
-
/** Original error if this is wrapping another error */
|
|
7770
|
-
originalError;
|
|
7771
|
-
/** Additional context for the error */
|
|
7772
|
-
context;
|
|
7773
|
-
/** Whether this error should be displayed to the user */
|
|
7774
|
-
displayable;
|
|
7775
|
-
/**
|
|
7776
|
-
* Creates a new DoNotDev error
|
|
7777
|
-
*
|
|
7778
|
-
* @param {string} message - Error message
|
|
7779
|
-
* @param {DoNotDevErrorCode} code - Error code
|
|
7780
|
-
* @param {object} [options] - Additional error options
|
|
7781
|
-
* @param {Error} [options.originalError] - Original error if wrapping
|
|
7782
|
-
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7783
|
-
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7784
|
-
*/
|
|
7785
|
-
constructor(message, code = "unknown-error", options) {
|
|
7786
|
-
super(message);
|
|
7787
|
-
this.name = "DoNotDevError";
|
|
7788
|
-
this.code = code;
|
|
7789
|
-
this.originalError = options?.originalError;
|
|
7790
|
-
this.context = options?.context;
|
|
7791
|
-
this.displayable = options?.displayable !== false;
|
|
7792
|
-
Object.setPrototypeOf(this, _DoNotDevError.prototype);
|
|
7793
|
-
if (Error.captureStackTrace) {
|
|
7794
|
-
Error.captureStackTrace(this, _DoNotDevError);
|
|
7795
|
-
}
|
|
7796
|
-
}
|
|
7797
|
-
/**
|
|
7798
|
-
* Formats the error for logging or display
|
|
7799
|
-
*
|
|
7800
|
-
* @returns {string} Formatted error message with code
|
|
7801
|
-
*/
|
|
7802
|
-
format() {
|
|
7803
|
-
return `[${this.code}] ${this.message}`;
|
|
7804
|
-
}
|
|
7805
|
-
/**
|
|
7806
|
-
* Creates a wrapped error from another error
|
|
7807
|
-
*
|
|
7808
|
-
* @param {Error} error - Original error to wrap
|
|
7809
|
-
* @param {string} [context] - Additional context for the error
|
|
7810
|
-
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
7811
|
-
* @param {object} [options] - Additional error options
|
|
7812
|
-
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7813
|
-
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7814
|
-
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
7815
|
-
*/
|
|
7816
|
-
static from(error2, context, code = "unknown-error", options) {
|
|
7817
|
-
if (!(error2 instanceof Error)) {
|
|
7818
|
-
return new _DoNotDevError(
|
|
7819
|
-
`Unknown error: ${String(error2)}`,
|
|
7820
|
-
code,
|
|
7821
|
-
options
|
|
7822
|
-
);
|
|
7823
|
-
}
|
|
7824
|
-
if (error2 instanceof _DoNotDevError) {
|
|
7825
|
-
if (!context) {
|
|
7826
|
-
return error2;
|
|
7827
|
-
}
|
|
7828
|
-
return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
|
|
7829
|
-
originalError: error2.originalError || error2,
|
|
7830
|
-
context: { ...error2.context, ...options?.context || {} },
|
|
7831
|
-
displayable: options?.displayable ?? error2.displayable
|
|
7832
|
-
});
|
|
7833
|
-
}
|
|
7834
|
-
const message = context ? `${context}: ${error2.message}` : error2.message;
|
|
7835
|
-
return new _DoNotDevError(message, code, {
|
|
7836
|
-
originalError: error2,
|
|
7837
|
-
context: options?.context,
|
|
7838
|
-
displayable: options?.displayable
|
|
7839
|
-
});
|
|
7840
|
-
}
|
|
7841
|
-
/**
|
|
7842
|
-
* Maps common error types to DoNotDevErrorCode
|
|
7843
|
-
*
|
|
7844
|
-
* @param {Error} error - Error to analyze
|
|
7845
|
-
* @returns {DoNotDevErrorCode} Mapped error code
|
|
7846
|
-
*/
|
|
7847
|
-
static getErrorCodeFromError(error2) {
|
|
7848
|
-
if (error2 instanceof _DoNotDevError) {
|
|
7849
|
-
return error2.code;
|
|
7850
|
-
}
|
|
7851
|
-
const message = error2.message.toLowerCase();
|
|
7852
|
-
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
7853
|
-
return "validation-error";
|
|
7854
|
-
}
|
|
7855
|
-
if (message.includes("not found") || message.includes("no such file")) {
|
|
7856
|
-
return "file-not-found";
|
|
7857
|
-
}
|
|
7858
|
-
if (message.includes("permission") || message.includes("access denied")) {
|
|
7859
|
-
return "permission-denied";
|
|
7860
|
-
}
|
|
7861
|
-
if (message.includes("timeout") || message.includes("timed out")) {
|
|
7862
|
-
return "timeout-error";
|
|
7863
|
-
}
|
|
7864
|
-
if (message.includes("dependency") || message.includes("module not found")) {
|
|
7865
|
-
return "dependency-error";
|
|
7866
|
-
}
|
|
7867
|
-
return "unknown-error";
|
|
7868
|
-
}
|
|
7869
|
-
};
|
|
7870
|
-
}
|
|
7871
|
-
});
|
|
7872
|
-
|
|
7873
7760
|
// packages/tooling/src/utils/pathResolver.ts
|
|
7874
7761
|
var pathResolver_exports = {};
|
|
7875
7762
|
__export(pathResolver_exports, {
|
|
@@ -7884,6 +7771,7 @@ __export(pathResolver_exports, {
|
|
|
7884
7771
|
ensureDirSync: () => ensureDirSync,
|
|
7885
7772
|
findFiles: () => findFiles,
|
|
7886
7773
|
findNodeModulesDir: () => findNodeModulesDir,
|
|
7774
|
+
findPackageRootUp: () => findPackageRootUp,
|
|
7887
7775
|
fromAppRoot: () => fromAppRoot,
|
|
7888
7776
|
getAppRoot: () => getAppRoot,
|
|
7889
7777
|
getBasename: () => getBasename,
|
|
@@ -7900,7 +7788,6 @@ __export(pathResolver_exports, {
|
|
|
7900
7788
|
getRelativePathBetween: () => getRelativePathBetween,
|
|
7901
7789
|
getRepoRoot: () => getRepoRoot,
|
|
7902
7790
|
getTemplatesRoot: () => getTemplatesRoot,
|
|
7903
|
-
getToolingPath: () => getToolingPath,
|
|
7904
7791
|
glob: () => glob,
|
|
7905
7792
|
globSync: () => globSync,
|
|
7906
7793
|
isAbsolute: () => isAbsolute,
|
|
@@ -7939,6 +7826,7 @@ import {
|
|
|
7939
7826
|
extname as extname2,
|
|
7940
7827
|
relative as relative2,
|
|
7941
7828
|
resolve as resolve2,
|
|
7829
|
+
parse,
|
|
7942
7830
|
isAbsolute as pathIsAbsolute
|
|
7943
7831
|
} from "node:path";
|
|
7944
7832
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -7995,37 +7883,22 @@ function getBinPath(binaryName) {
|
|
|
7995
7883
|
}
|
|
7996
7884
|
return binaryName;
|
|
7997
7885
|
}
|
|
7998
|
-
function getToolingPath() {
|
|
7999
|
-
const mode = detectExecutionMode();
|
|
8000
|
-
if (mode === "development") {
|
|
8001
|
-
const repoRoot = getRepoRoot();
|
|
8002
|
-
const packagesToolingPath = normalizePath(repoRoot, PACKAGE_PATHS.TOOLING);
|
|
8003
|
-
if (pathExists(packagesToolingPath)) {
|
|
8004
|
-
return normalizePath(packagesToolingPath);
|
|
8005
|
-
}
|
|
8006
|
-
}
|
|
8007
|
-
throw new DoNotDevError(
|
|
8008
|
-
"Could not find tooling package. This function is only available in development mode.",
|
|
8009
|
-
"path-resolution-error"
|
|
8010
|
-
);
|
|
8011
|
-
}
|
|
8012
7886
|
function detectExecutionMode() {
|
|
8013
|
-
const
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
return "development";
|
|
7887
|
+
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
7888
|
+
if (fileUrlPath.includes("node_modules")) {
|
|
7889
|
+
return "published";
|
|
8017
7890
|
}
|
|
8018
|
-
|
|
8019
|
-
if (fileUrlPath.includes("node_modules/@donotdev/cli")) {
|
|
7891
|
+
if (fileUrlPath.includes("/dist/")) {
|
|
8020
7892
|
return "published";
|
|
8021
7893
|
}
|
|
8022
|
-
return "
|
|
7894
|
+
return "development";
|
|
8023
7895
|
}
|
|
8024
7896
|
function getTemplatesRoot() {
|
|
8025
7897
|
const mode = detectExecutionMode();
|
|
8026
7898
|
if (mode === "development") {
|
|
8027
|
-
const
|
|
8028
|
-
|
|
7899
|
+
const fileUrlPath = fileURLToPath2(import.meta.url);
|
|
7900
|
+
const frameworkRoot = normalizePath(dirname2(fileUrlPath), "../../../..");
|
|
7901
|
+
return normalizePath(frameworkRoot, PACKAGE_PATHS.CLI, "templates");
|
|
8029
7902
|
} else {
|
|
8030
7903
|
try {
|
|
8031
7904
|
const cliRoot2 = resolveFrameworkPackage("@donotdev/cli");
|
|
@@ -8047,10 +7920,43 @@ function getTemplatesRoot() {
|
|
|
8047
7920
|
}
|
|
8048
7921
|
} catch {
|
|
8049
7922
|
}
|
|
7923
|
+
try {
|
|
7924
|
+
const currentScriptDir = getDirnameFromUrl(import.meta.url);
|
|
7925
|
+
const packageRoot = findPackageRootUp(currentScriptDir, "@donotdev/cli");
|
|
7926
|
+
if (packageRoot) {
|
|
7927
|
+
const templatesPath = normalizePath(packageRoot, "templates");
|
|
7928
|
+
if (pathExists(templatesPath)) {
|
|
7929
|
+
return templatesPath;
|
|
7930
|
+
}
|
|
7931
|
+
}
|
|
7932
|
+
} catch {
|
|
7933
|
+
}
|
|
8050
7934
|
const cliRoot = getCliRootFromBundle();
|
|
8051
7935
|
return normalizePath(cliRoot, "templates");
|
|
8052
7936
|
}
|
|
8053
7937
|
}
|
|
7938
|
+
function findPackageRootUp(startDir, packageName) {
|
|
7939
|
+
let currentDir = normalizePath(startDir);
|
|
7940
|
+
const root = parse(currentDir).root;
|
|
7941
|
+
const fs2 = createRequire2(import.meta.url)("node:fs");
|
|
7942
|
+
while (currentDir !== root) {
|
|
7943
|
+
const packageJsonPath = joinPath(currentDir, "package.json");
|
|
7944
|
+
if (fs2.existsSync(packageJsonPath)) {
|
|
7945
|
+
try {
|
|
7946
|
+
const content = fs2.readFileSync(packageJsonPath, "utf8");
|
|
7947
|
+
const pkg = JSON.parse(content);
|
|
7948
|
+
if (pkg.name === packageName) {
|
|
7949
|
+
return currentDir;
|
|
7950
|
+
}
|
|
7951
|
+
} catch {
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7954
|
+
const parentDir = getDirname(currentDir);
|
|
7955
|
+
if (parentDir === currentDir) break;
|
|
7956
|
+
currentDir = parentDir;
|
|
7957
|
+
}
|
|
7958
|
+
return null;
|
|
7959
|
+
}
|
|
8054
7960
|
function getCliRootFromBundle() {
|
|
8055
7961
|
const currentDir = getDirnameFromUrl(import.meta.url);
|
|
8056
7962
|
return normalizePath(currentDir, "..", "..", "..");
|
|
@@ -8170,7 +8076,6 @@ var init_pathResolver = __esm({
|
|
|
8170
8076
|
"use strict";
|
|
8171
8077
|
init_utils();
|
|
8172
8078
|
init_PathResolver();
|
|
8173
|
-
init_errors();
|
|
8174
8079
|
pathResolverInstance = PathResolver.getInstance({ debug: false });
|
|
8175
8080
|
getPathResolver = (options) => PathResolver.getInstance(options);
|
|
8176
8081
|
getRepoRoot = () => pathResolverInstance.getRepoRoot();
|
|
@@ -8271,23 +8176,12 @@ var init_utils = __esm({
|
|
|
8271
8176
|
}
|
|
8272
8177
|
});
|
|
8273
8178
|
|
|
8274
|
-
// packages/cli/src/bin/commands/create-app.ts
|
|
8275
|
-
init_utils();
|
|
8276
|
-
|
|
8277
|
-
// packages/tooling/src/index.ts
|
|
8278
|
-
init_utils();
|
|
8279
|
-
|
|
8280
|
-
// packages/tooling/src/cli/index.ts
|
|
8281
|
-
init_utils();
|
|
8282
|
-
|
|
8283
8179
|
// packages/tooling/src/utils/cli-input.ts
|
|
8284
|
-
init_utils();
|
|
8285
|
-
init_dist2();
|
|
8286
8180
|
async function askForInput(message, defaultValue = "") {
|
|
8287
8181
|
const result = await he({
|
|
8288
8182
|
message,
|
|
8289
8183
|
placeholder: defaultValue || void 0,
|
|
8290
|
-
|
|
8184
|
+
defaultValue: defaultValue || void 0
|
|
8291
8185
|
});
|
|
8292
8186
|
if (pD(result)) {
|
|
8293
8187
|
xe("Operation cancelled.");
|
|
@@ -8323,6 +8217,22 @@ async function askForSelection(message, choices, defaultValue = 0) {
|
|
|
8323
8217
|
}
|
|
8324
8218
|
return result;
|
|
8325
8219
|
}
|
|
8220
|
+
var init_cli_input = __esm({
|
|
8221
|
+
"packages/tooling/src/utils/cli-input.ts"() {
|
|
8222
|
+
"use strict";
|
|
8223
|
+
init_utils();
|
|
8224
|
+
init_dist2();
|
|
8225
|
+
}
|
|
8226
|
+
});
|
|
8227
|
+
|
|
8228
|
+
// packages/cli/src/bin/commands/create-app.ts
|
|
8229
|
+
init_utils();
|
|
8230
|
+
|
|
8231
|
+
// packages/tooling/src/index.ts
|
|
8232
|
+
init_utils();
|
|
8233
|
+
|
|
8234
|
+
// packages/tooling/src/cli/index.ts
|
|
8235
|
+
init_utils();
|
|
8326
8236
|
|
|
8327
8237
|
// packages/tooling/src/utils/create-utils.ts
|
|
8328
8238
|
init_utils();
|
|
@@ -8558,6 +8468,10 @@ var APP_QUESTIONNAIRE = [
|
|
|
8558
8468
|
{
|
|
8559
8469
|
title: "Next.js \u2014 Static content/SEO (SSR, SSG) \u2014 BETA",
|
|
8560
8470
|
value: "nextjs"
|
|
8471
|
+
},
|
|
8472
|
+
{
|
|
8473
|
+
title: "Expo \u2014 Mobile app (iOS + Android)",
|
|
8474
|
+
value: "expo"
|
|
8561
8475
|
}
|
|
8562
8476
|
]
|
|
8563
8477
|
},
|
|
@@ -8584,6 +8498,10 @@ var APP_QUESTIONNAIRE = [
|
|
|
8584
8498
|
{
|
|
8585
8499
|
title: "Vercel \u2014 Serverless functions (edge + node.js)",
|
|
8586
8500
|
value: "vercel"
|
|
8501
|
+
},
|
|
8502
|
+
{
|
|
8503
|
+
title: "Supabase \u2014 Postgres + Auth + Storage",
|
|
8504
|
+
value: "supabase"
|
|
8587
8505
|
}
|
|
8588
8506
|
]
|
|
8589
8507
|
}
|
|
@@ -8650,6 +8568,7 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
|
|
|
8650
8568
|
|
|
8651
8569
|
// packages/tooling/src/scaffolding/create-app.ts
|
|
8652
8570
|
init_utils();
|
|
8571
|
+
init_cli_input();
|
|
8653
8572
|
init_cli_output();
|
|
8654
8573
|
|
|
8655
8574
|
// packages/tooling/src/utils/dependency-resolver.ts
|
|
@@ -8683,6 +8602,15 @@ function generateScripts(templateName, options) {
|
|
|
8683
8602
|
scripts.preview = "next start";
|
|
8684
8603
|
scripts.lint = "eslint src/";
|
|
8685
8604
|
scripts["type-check"] = "tsc --noEmit";
|
|
8605
|
+
} else if (templateName.includes("expo")) {
|
|
8606
|
+
scripts.dev = "expo start";
|
|
8607
|
+
scripts.start = "expo start";
|
|
8608
|
+
scripts.android = "expo start --android";
|
|
8609
|
+
scripts.ios = "expo start --ios";
|
|
8610
|
+
scripts.web = "expo start --web";
|
|
8611
|
+
scripts.build = "expo export";
|
|
8612
|
+
scripts.lint = "eslint .";
|
|
8613
|
+
scripts["type-check"] = "tsc --noEmit";
|
|
8686
8614
|
} else if (templateName === "consumer-root") {
|
|
8687
8615
|
scripts.dev = "turbo run dev";
|
|
8688
8616
|
scripts.build = "turbo run build";
|
|
@@ -8771,7 +8699,7 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
8771
8699
|
result.main = "./index.ts";
|
|
8772
8700
|
result.types = "./index.ts";
|
|
8773
8701
|
}
|
|
8774
|
-
if (templateName.includes("vite") || templateName.includes("nextjs") || templateName.includes("functions")) {
|
|
8702
|
+
if (templateName.includes("vite") || templateName.includes("nextjs") || templateName.includes("expo") || templateName.includes("functions")) {
|
|
8775
8703
|
if (!dependencies.entities) {
|
|
8776
8704
|
dependencies.entities = "workspace:*";
|
|
8777
8705
|
}
|
|
@@ -8819,6 +8747,40 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
8819
8747
|
// packages/tooling/src/scaffolding/create-app.ts
|
|
8820
8748
|
init_pathResolver();
|
|
8821
8749
|
init_pathResolver();
|
|
8750
|
+
|
|
8751
|
+
// packages/tooling/src/scaffolding/scaffold-matrix.ts
|
|
8752
|
+
init_utils();
|
|
8753
|
+
var MATRIX = [
|
|
8754
|
+
{ builder: "vite", backend: "none", baseTemplate: "app-vite", overlay: null, deployConfig: null, functionsTemplate: null },
|
|
8755
|
+
{ builder: "vite", backend: "firebase", baseTemplate: "app-vite", overlay: "overlay-firebase", deployConfig: "firebase", functionsTemplate: "functions-firebase" },
|
|
8756
|
+
{ builder: "vite", backend: "supabase", baseTemplate: "app-vite", overlay: "overlay-supabase", deployConfig: "vercel-supabase", functionsTemplate: null },
|
|
8757
|
+
{ builder: "vite", backend: "vercel", baseTemplate: "app-vite", overlay: "overlay-vercel", deployConfig: "vercel-vercel", functionsTemplate: "functions-vercel" },
|
|
8758
|
+
{ builder: "nextjs", backend: "none", baseTemplate: "app-next", overlay: null, deployConfig: null, functionsTemplate: null },
|
|
8759
|
+
{ builder: "nextjs", backend: "firebase", baseTemplate: "app-next", overlay: "overlay-firebase", deployConfig: "firebase", functionsTemplate: "functions-firebase" },
|
|
8760
|
+
{ builder: "nextjs", backend: "supabase", baseTemplate: "app-next", overlay: "overlay-supabase", deployConfig: "vercel-supabase", functionsTemplate: null },
|
|
8761
|
+
{ builder: "nextjs", backend: "vercel", baseTemplate: "app-next", overlay: "overlay-vercel", deployConfig: "vercel-vercel", functionsTemplate: "functions-vercel" },
|
|
8762
|
+
{ builder: "expo", backend: "none", baseTemplate: "app-expo", overlay: null, deployConfig: null, functionsTemplate: null },
|
|
8763
|
+
{ builder: "expo", backend: "firebase", baseTemplate: "app-expo", overlay: "overlay-firebase", deployConfig: null, functionsTemplate: "functions-firebase" },
|
|
8764
|
+
{ builder: "expo", backend: "supabase", baseTemplate: "app-expo", overlay: "overlay-supabase", deployConfig: null, functionsTemplate: null },
|
|
8765
|
+
{ builder: "demo", backend: "none", baseTemplate: "app-demo", overlay: null, deployConfig: null, functionsTemplate: null }
|
|
8766
|
+
];
|
|
8767
|
+
function comboKey(builder, backend) {
|
|
8768
|
+
return `${builder}-${backend}`;
|
|
8769
|
+
}
|
|
8770
|
+
var ROWS_BY_KEY = /* @__PURE__ */ new Map();
|
|
8771
|
+
for (const row of MATRIX) {
|
|
8772
|
+
ROWS_BY_KEY.set(comboKey(row.builder, row.backend), row);
|
|
8773
|
+
}
|
|
8774
|
+
function getScaffoldRow(builder, backend) {
|
|
8775
|
+
const key = comboKey(builder, backend);
|
|
8776
|
+
const row = ROWS_BY_KEY.get(key);
|
|
8777
|
+
if (!row) {
|
|
8778
|
+
throw new Error(`Unsupported scaffold combo: ${key}. Supported: ${[...ROWS_BY_KEY.keys()].join(", ")}`);
|
|
8779
|
+
}
|
|
8780
|
+
return row;
|
|
8781
|
+
}
|
|
8782
|
+
|
|
8783
|
+
// packages/tooling/src/scaffolding/create-app.ts
|
|
8822
8784
|
var SHOW_WIP = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
|
|
8823
8785
|
async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
8824
8786
|
const isInteractive = !appName || !appConfig;
|
|
@@ -8904,14 +8866,19 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
8904
8866
|
const s = Y2();
|
|
8905
8867
|
s.start(`Creating app: ${appName}`);
|
|
8906
8868
|
await ensureDir(appDir);
|
|
8907
|
-
const
|
|
8869
|
+
const builder = appTemplate;
|
|
8870
|
+
const backend = appConfig.needsBackend && appConfig.backendPlatform ? appConfig.backendPlatform : "none";
|
|
8871
|
+
const row = getScaffoldRow(builder, backend);
|
|
8872
|
+
const templateDir = row.baseTemplate;
|
|
8908
8873
|
const firebaseProjectId = (appConfig?.firebaseProjectId ?? "").trim() || appName.toLowerCase().replace(/\s+/g, "-");
|
|
8909
8874
|
const firebaseRegion = appConfig?.firebaseRegion ?? "europe-west1";
|
|
8875
|
+
const backendPlatform = appConfig.backendPlatform ?? "firebase";
|
|
8876
|
+
const deployConfig = row.deployConfig;
|
|
8910
8877
|
const replacements = {
|
|
8911
8878
|
projectName: appName,
|
|
8912
8879
|
appName,
|
|
8913
8880
|
appShortName: appName.toUpperCase().replace(/-/g, " "),
|
|
8914
|
-
includeFunctions: Boolean(
|
|
8881
|
+
includeFunctions: Boolean(row.functionsTemplate),
|
|
8915
8882
|
needsCRUD: Boolean(appConfig.needsCRUD),
|
|
8916
8883
|
setupGithubActions: false,
|
|
8917
8884
|
appNames: [appName],
|
|
@@ -8921,8 +8888,13 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
8921
8888
|
monorepoRelativePath: "../../packages/tooling",
|
|
8922
8889
|
appTemplate,
|
|
8923
8890
|
isNextjs: appTemplate === "nextjs",
|
|
8891
|
+
isExpo: appTemplate === "expo",
|
|
8924
8892
|
YOUR_FIREBASE_PROJECT_ID: firebaseProjectId,
|
|
8925
|
-
YOUR_REGION: firebaseRegion
|
|
8893
|
+
YOUR_REGION: firebaseRegion,
|
|
8894
|
+
backendPlatform,
|
|
8895
|
+
isFirebase: backendPlatform === "firebase",
|
|
8896
|
+
isSupabase: backendPlatform === "supabase",
|
|
8897
|
+
isVercel: backendPlatform === "vercel"
|
|
8926
8898
|
};
|
|
8927
8899
|
const templateSourceDir = joinPath(templatesRoot, templateDir);
|
|
8928
8900
|
const templateFiles = await glob("**/*", {
|
|
@@ -8943,118 +8915,155 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
8943
8915
|
await replacePlaceholders(destPath, replacements);
|
|
8944
8916
|
}
|
|
8945
8917
|
}
|
|
8918
|
+
if (row.overlay) {
|
|
8919
|
+
const overlayDir = joinPath(templatesRoot, row.overlay);
|
|
8920
|
+
if (pathExists(overlayDir)) {
|
|
8921
|
+
const overlayFiles = await glob("**/*", {
|
|
8922
|
+
cwd: overlayDir,
|
|
8923
|
+
dot: true,
|
|
8924
|
+
onlyFiles: true
|
|
8925
|
+
});
|
|
8926
|
+
for (const file of overlayFiles) {
|
|
8927
|
+
if (file.startsWith("env.fragment")) continue;
|
|
8928
|
+
if (file === "vercel.headers.example") continue;
|
|
8929
|
+
if (file === "vercel.json.example") continue;
|
|
8930
|
+
if (file === "src/config/providers.ts.example") {
|
|
8931
|
+
const variantFile = `src/config/providers.${appTemplate}.ts.example`;
|
|
8932
|
+
if (overlayFiles.includes(variantFile)) continue;
|
|
8933
|
+
}
|
|
8934
|
+
const providersVariant = file.match(/^src\/config\/providers\.(\w+)\.ts\.example$/);
|
|
8935
|
+
if (providersVariant) {
|
|
8936
|
+
if (providersVariant[1] !== appTemplate) continue;
|
|
8937
|
+
const destPath2 = joinPath(appDir, "src/config/providers.ts");
|
|
8938
|
+
await ensureDir(getDirname(destPath2));
|
|
8939
|
+
await copy(joinPath(overlayDir, file), destPath2);
|
|
8940
|
+
if (await isTextFile(destPath2)) await replacePlaceholders(destPath2, replacements);
|
|
8941
|
+
continue;
|
|
8942
|
+
}
|
|
8943
|
+
const sourcePath = joinPath(overlayDir, file);
|
|
8944
|
+
let destFileName = file;
|
|
8945
|
+
if (destFileName.endsWith(".example")) {
|
|
8946
|
+
destFileName = destFileName.slice(0, -8);
|
|
8947
|
+
}
|
|
8948
|
+
const destPath = joinPath(appDir, destFileName);
|
|
8949
|
+
await ensureDir(getDirname(destPath));
|
|
8950
|
+
await copy(sourcePath, destPath);
|
|
8951
|
+
if (await isTextFile(destPath)) {
|
|
8952
|
+
await replacePlaceholders(destPath, replacements);
|
|
8953
|
+
}
|
|
8954
|
+
}
|
|
8955
|
+
const fragmentName = appTemplate === "nextjs" ? "env.fragment.nextjs.example" : appTemplate === "expo" ? "env.fragment.expo.example" : "env.fragment.example";
|
|
8956
|
+
const fragmentPath = joinPath(overlayDir, fragmentName);
|
|
8957
|
+
const envPath = joinPath(appDir, ".env");
|
|
8958
|
+
if (pathExists(fragmentPath) && pathExists(envPath)) {
|
|
8959
|
+
const baseEnv = readSync(envPath);
|
|
8960
|
+
const fragment = readSync(fragmentPath);
|
|
8961
|
+
await write(envPath, baseEnv + "\n" + fragment, { overwrite: true });
|
|
8962
|
+
}
|
|
8963
|
+
if (deployConfig === "vercel-supabase") {
|
|
8964
|
+
const vercelPath = joinPath(appDir, "vercel.json");
|
|
8965
|
+
const headersFragmentPath = joinPath(overlayDir, "vercel.headers.example");
|
|
8966
|
+
const fullVercelPath = joinPath(overlayDir, "vercel.json.example");
|
|
8967
|
+
if (pathExists(vercelPath) && pathExists(headersFragmentPath)) {
|
|
8968
|
+
const vercelJson = readSync(vercelPath, { format: "json" });
|
|
8969
|
+
const headersFragment = readSync(headersFragmentPath, { format: "json" });
|
|
8970
|
+
vercelJson.headers = [...vercelJson.headers ?? [], ...headersFragment];
|
|
8971
|
+
await write(vercelPath, vercelJson, { format: "json", overwrite: true });
|
|
8972
|
+
} else if (pathExists(fullVercelPath)) {
|
|
8973
|
+
await copy(fullVercelPath, vercelPath);
|
|
8974
|
+
if (await isTextFile(vercelPath)) await replacePlaceholders(vercelPath, replacements);
|
|
8975
|
+
}
|
|
8976
|
+
}
|
|
8977
|
+
}
|
|
8978
|
+
}
|
|
8946
8979
|
const executionMode = detectExecutionMode();
|
|
8947
8980
|
const templateName = appTemplate === "demo" ? "demo" : executionMode === "development" ? `dev-${appTemplate}` : `consumer-${appTemplate}`;
|
|
8948
8981
|
const packageJson = generatePackageJson(templateName, executionMode, {
|
|
8949
8982
|
appName,
|
|
8950
8983
|
template: appTemplate === "demo" ? "vite" : appTemplate,
|
|
8951
|
-
includeFunctions: Boolean(
|
|
8984
|
+
includeFunctions: Boolean(row.functionsTemplate),
|
|
8985
|
+
platform: appTemplate === "demo" ? void 0 : backendPlatform
|
|
8952
8986
|
});
|
|
8953
8987
|
const packageJsonPath = joinPath(appDir, "package.json");
|
|
8954
8988
|
await write(packageJsonPath, packageJson, {
|
|
8955
8989
|
format: "json",
|
|
8956
8990
|
overwrite: true
|
|
8957
8991
|
});
|
|
8958
|
-
if (
|
|
8959
|
-
const platform = appConfig.backendPlatform;
|
|
8992
|
+
if (row.functionsTemplate) {
|
|
8960
8993
|
const functionsRootDir = joinPath(appDir, "functions");
|
|
8961
|
-
const functionsTemplateName =
|
|
8962
|
-
const
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
templatesRoot,
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
await replacePlaceholders(destPath, {
|
|
9000
|
-
...replacements,
|
|
9001
|
-
APP_NAME: appName
|
|
9002
|
-
});
|
|
8994
|
+
const functionsTemplateName = row.functionsTemplate;
|
|
8995
|
+
const functionsTemplateExists = pathExists(joinPath(templatesRoot, functionsTemplateName));
|
|
8996
|
+
if (!functionsTemplateExists) {
|
|
8997
|
+
log.warn(`Functions template "${functionsTemplateName}" not found \u2014 skipping functions scaffolding.`);
|
|
8998
|
+
} else {
|
|
8999
|
+
const functionsPackageJson = generatePackageJson(
|
|
9000
|
+
functionsTemplateName,
|
|
9001
|
+
executionMode,
|
|
9002
|
+
{ appName, platform: row.functionsTemplate.replace("functions-", "") }
|
|
9003
|
+
);
|
|
9004
|
+
const packageJsonPath2 = joinPath(functionsRootDir, "package.json");
|
|
9005
|
+
await ensureDir(functionsRootDir);
|
|
9006
|
+
await write(packageJsonPath2, functionsPackageJson, {
|
|
9007
|
+
format: "json",
|
|
9008
|
+
overwrite: true
|
|
9009
|
+
});
|
|
9010
|
+
const templateDir2 = joinPath(templatesRoot, functionsTemplateName);
|
|
9011
|
+
const templateFiles2 = await glob("**/*", {
|
|
9012
|
+
cwd: templateDir2,
|
|
9013
|
+
dot: true,
|
|
9014
|
+
onlyFiles: true
|
|
9015
|
+
});
|
|
9016
|
+
for (const file of templateFiles2) {
|
|
9017
|
+
if (file === "package.json.example") continue;
|
|
9018
|
+
const sourcePath = joinPath(templateDir2, file);
|
|
9019
|
+
let destFileName = file;
|
|
9020
|
+
if (destFileName.endsWith(".example")) {
|
|
9021
|
+
destFileName = destFileName.slice(0, -8);
|
|
9022
|
+
}
|
|
9023
|
+
const destPath = joinPath(functionsRootDir, destFileName);
|
|
9024
|
+
await ensureDir(getDirname(destPath));
|
|
9025
|
+
await copy(sourcePath, destPath);
|
|
9026
|
+
if (await isTextFile(destPath)) {
|
|
9027
|
+
await replacePlaceholders(destPath, {
|
|
9028
|
+
...replacements,
|
|
9029
|
+
APP_NAME: appName
|
|
9030
|
+
});
|
|
9031
|
+
}
|
|
9003
9032
|
}
|
|
9004
9033
|
}
|
|
9005
9034
|
}
|
|
9006
9035
|
const deploymentTemplateDir = joinPath(templatesRoot, "root-consumer");
|
|
9007
|
-
|
|
9008
|
-
deploymentTemplateDir,
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9036
|
+
if (deployConfig === "firebase") {
|
|
9037
|
+
const firebaseJsonSource = joinPath(deploymentTemplateDir, "firebase.json.example");
|
|
9038
|
+
if (pathExists(firebaseJsonSource)) {
|
|
9039
|
+
await copy(firebaseJsonSource, joinPath(appDir, "firebase.json"));
|
|
9040
|
+
const firebaseJsonDest = joinPath(appDir, "firebase.json");
|
|
9041
|
+
if (await isTextFile(firebaseJsonDest)) await replacePlaceholders(firebaseJsonDest, replacements);
|
|
9042
|
+
}
|
|
9043
|
+
const firebasercSource = joinPath(deploymentTemplateDir, ".firebaserc.example");
|
|
9044
|
+
if (pathExists(firebasercSource)) {
|
|
9045
|
+
await copy(firebasercSource, joinPath(appDir, ".firebaserc"));
|
|
9046
|
+
const firebasercDest = joinPath(appDir, ".firebaserc");
|
|
9047
|
+
if (await isTextFile(firebasercDest)) await replacePlaceholders(firebasercDest, replacements);
|
|
9048
|
+
}
|
|
9049
|
+
if (row.functionsTemplate === "functions-firebase") {
|
|
9050
|
+
for (const example of ["firestore.rules.example", "firestore.indexes.json.example", "storage.rules.example"]) {
|
|
9051
|
+
const src = joinPath(deploymentTemplateDir, example);
|
|
9052
|
+
if (pathExists(src)) {
|
|
9053
|
+
await copy(src, joinPath(appDir, example.replace(".example", "")));
|
|
9054
|
+
}
|
|
9055
|
+
}
|
|
9016
9056
|
}
|
|
9017
9057
|
}
|
|
9018
|
-
|
|
9019
|
-
deploymentTemplateDir,
|
|
9020
|
-
".firebaserc.example"
|
|
9021
|
-
);
|
|
9022
|
-
if (pathExists(firebasercSource)) {
|
|
9023
|
-
const firebasercDest = joinPath(appDir, ".firebaserc");
|
|
9024
|
-
await copy(firebasercSource, firebasercDest);
|
|
9025
|
-
if (await isTextFile(firebasercDest)) {
|
|
9026
|
-
await replacePlaceholders(firebasercDest, replacements);
|
|
9027
|
-
}
|
|
9028
|
-
}
|
|
9029
|
-
if (appConfig.needsBackend && appConfig.backendPlatform === "firebase") {
|
|
9030
|
-
const rulesFiles = [
|
|
9031
|
-
"firestore.rules.example",
|
|
9032
|
-
"firestore.indexes.json.example",
|
|
9033
|
-
"storage.rules.example"
|
|
9034
|
-
];
|
|
9035
|
-
for (const example of rulesFiles) {
|
|
9036
|
-
const src = joinPath(deploymentTemplateDir, example);
|
|
9037
|
-
if (pathExists(src)) {
|
|
9038
|
-
const destName = example.replace(".example", "");
|
|
9039
|
-
const dest = joinPath(appDir, destName);
|
|
9040
|
-
await copy(src, dest);
|
|
9041
|
-
}
|
|
9042
|
-
}
|
|
9043
|
-
}
|
|
9044
|
-
if (appTemplate === "nextjs" || appConfig.needsBackend && appConfig.backendPlatform === "vercel") {
|
|
9045
|
-
const vercelJsonSource = joinPath(
|
|
9046
|
-
deploymentTemplateDir,
|
|
9047
|
-
"vercel.json.example"
|
|
9048
|
-
);
|
|
9058
|
+
if (deployConfig === "vercel-vercel") {
|
|
9059
|
+
const vercelJsonSource = joinPath(deploymentTemplateDir, "vercel.json.example");
|
|
9049
9060
|
if (pathExists(vercelJsonSource)) {
|
|
9061
|
+
await copy(vercelJsonSource, joinPath(appDir, "vercel.json"));
|
|
9050
9062
|
const vercelJsonDest = joinPath(appDir, "vercel.json");
|
|
9051
|
-
await
|
|
9052
|
-
if (await isTextFile(vercelJsonDest)) {
|
|
9053
|
-
await replacePlaceholders(vercelJsonDest, replacements);
|
|
9054
|
-
}
|
|
9063
|
+
if (await isTextFile(vercelJsonDest)) await replacePlaceholders(vercelJsonDest, replacements);
|
|
9055
9064
|
}
|
|
9056
9065
|
}
|
|
9057
|
-
const backendInfo =
|
|
9066
|
+
const backendInfo = row.functionsTemplate ? ` with ${row.functionsTemplate.replace("functions-", "")} functions` : "";
|
|
9058
9067
|
s.stop(`Created ${appName}${backendInfo}`);
|
|
9059
9068
|
const rootPackageJsonPath = joinPath(workspaceRoot, "package.json");
|
|
9060
9069
|
if (pathExists(rootPackageJsonPath)) {
|
|
@@ -9066,7 +9075,7 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9066
9075
|
}
|
|
9067
9076
|
if (isInteractive) {
|
|
9068
9077
|
Se("\u{1F389} App created successfully!");
|
|
9069
|
-
const firebaseStep =
|
|
9078
|
+
const firebaseStep = row.functionsTemplate === "functions-firebase" ? `2. Set Firebase project: cd apps/${appName} && firebase use --add (or edit .firebaserc)
|
|
9070
9079
|
3. bun install
|
|
9071
9080
|
4. bun run dev` : `2. bun install
|
|
9072
9081
|
3. bun run dev`;
|
|
@@ -9083,8 +9092,8 @@ Happy coding!`,
|
|
|
9083
9092
|
}
|
|
9084
9093
|
async function main(options) {
|
|
9085
9094
|
try {
|
|
9086
|
-
const
|
|
9087
|
-
if (
|
|
9095
|
+
const hasExplicitFlags = options?.builder !== void 0 || options?.functions !== void 0;
|
|
9096
|
+
if (hasExplicitFlags && options?.name) {
|
|
9088
9097
|
const appName = options.name;
|
|
9089
9098
|
const builder = options.builder || "vite";
|
|
9090
9099
|
const includeFunctions = options.functions ?? false;
|
|
@@ -9099,7 +9108,7 @@ async function main(options) {
|
|
|
9099
9108
|
);
|
|
9100
9109
|
}
|
|
9101
9110
|
const appConfig = {
|
|
9102
|
-
template: builder === "next" ? "nextjs" : "vite",
|
|
9111
|
+
template: builder === "next" ? "nextjs" : builder === "expo" ? "expo" : "vite",
|
|
9103
9112
|
needsBackend: includeFunctions,
|
|
9104
9113
|
backendPlatform: includeFunctions ? "firebase" : void 0,
|
|
9105
9114
|
needsCRUD: true,
|
|
@@ -9112,7 +9121,7 @@ async function main(options) {
|
|
|
9112
9121
|
};
|
|
9113
9122
|
await createApp(appName, appConfig);
|
|
9114
9123
|
} else {
|
|
9115
|
-
await createApp();
|
|
9124
|
+
await createApp(options?.name);
|
|
9116
9125
|
}
|
|
9117
9126
|
} catch (error2) {
|
|
9118
9127
|
log.error("\n\u274C Error creating app:", error2);
|