@cedarjs/cli 7.0.1-next.333 → 7.0.1-next.467
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/deploy/baremetal/baremetalHandler.js +363 -72
- package/dist/commands/deploy/baremetal/monitors.js +66 -0
- package/dist/commands/deploy/baremetal.js +6 -0
- package/dist/commands/destroy/scaffold/scaffoldHandler.js +63 -25
- package/dist/commands/dev/devHandler.js +13 -1
- package/dist/commands/generate/dbAuth/templates/login.webAuthn.tsx.template +20 -12
- package/dist/commands/generate/helpers.js +26 -0
- package/dist/commands/generate/ogImage/templates/ogImage.og.tsx.template +1 -1
- package/dist/commands/generate/package/templates/tsconfig.json.template +1 -0
- package/dist/commands/generate/realtime/templates/liveQueries/blank/blank.service.ts.template +12 -4
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.service.ts.template +2 -2
- package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +3 -3
- package/dist/commands/generate/scaffold/scaffold.js +1 -1
- package/dist/commands/generate/scaffold/scaffoldHandler.js +83 -44
- package/dist/commands/generate/scaffold/templates/assets/scaffold.tailwind.css.template +12 -7
- package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +7 -7
- package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +7 -6
- package/dist/commands/generate/scaffold/templates/layouts/NamesScaffoldLayout.tsx.template +18 -0
- package/dist/commands/generate/scaffold/templates/lib/formatters.tsx.template +3 -3
- package/dist/commands/generate/script/templates/tsconfig.json.template +1 -0
- package/dist/commands/generate/sdl/sdlHandler.js +8 -3
- package/dist/commands/generate/service/serviceHandler.js +32 -11
- package/dist/commands/generate/service/templates/service.ts.template +21 -8
- package/dist/commands/generate/service/templates/test.ts.template +7 -5
- package/dist/commands/jobsHandler.js +5 -3
- package/dist/commands/setup/cache/templates/memcached.ts.template +14 -17
- package/dist/commands/setup/cache/templates/redis.ts.template +12 -20
- package/dist/commands/setup/deploy/helpers/index.js +3 -1
- package/dist/commands/setup/deploy/providers/baremetal.js +7 -0
- package/dist/commands/setup/deploy/providers/baremetalHandler.js +128 -20
- package/dist/commands/setup/deploy/providers/netlifyHandler.js +25 -3
- package/dist/commands/setup/deploy/templates/baremetal.js +119 -9
- package/dist/commands/setup/deploy/templates/netlifyUD.js +3 -0
- package/dist/commands/setup/jobs/jobsHandler.js +2 -0
- package/dist/commands/setup/monitoring/sentry/sentryHandler.js +5 -2
- package/dist/commands/setup/monitoring/sentry/templates/sentryApi.ts.template +1 -4
- package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +7 -4
- package/dist/commands/setup/realtime/templates/defer/fastAndSlowFields/fastAndSlowFields.ts.template +4 -1
- package/dist/commands/setup/realtime/templates/liveQueries/auctions/auctions.ts.template +12 -4
- package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +1 -1
- package/dist/commands/setup/tenancy/signupCodemod.js +2 -1
- package/dist/commands/setup/tenancy/templates/InvitePage.tsx.template +10 -1
- package/dist/commands/setup/tenancy/templates/organizations.scenarios.ts.template +0 -2
- package/dist/commands/setup/tenancy/templates/organizations.test.ts.template +0 -8
- package/dist/commands/setup/tenancy/templates/organizations.ts.template +1 -1
- package/dist/commands/setup/tenancy/templates/requireMembership.test.ts.template +1 -1
- package/dist/commands/setup/tenancy/tenancyHandler.js +1 -1
- package/dist/commands/setup/ui/libraries/tailwindcssHandler.js +61 -81
- package/dist/commands/setup/uploads/gitignore.js +17 -0
- package/dist/commands/setup/uploads/templates/uploads.ts.template +14 -5
- package/dist/commands/setup/uploads/uploadsHandler.js +22 -1
- package/dist/lib/index.js +10 -6
- package/package.json +24 -24
- package/dist/commands/setup/ui/templates/postcss.config.cjs.template +0 -9
|
@@ -321,7 +321,7 @@ export const removeMember: MutationResolvers['removeMember'] = async ({
|
|
|
321
321
|
|
|
322
322
|
export const Membership: MembershipRelationResolvers = {
|
|
323
323
|
organization: (_obj, { root }) =>
|
|
324
|
-
db.membership.
|
|
324
|
+
db.membership.findUniqueOrThrow({ where: { id: root.id } }).organization(),
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
interface EnsureDefaultOrganizationArgs {
|
|
@@ -7,7 +7,7 @@ import requireMembership from './requireMembership.js'
|
|
|
7
7
|
* selects more fields than these tests need.
|
|
8
8
|
*/
|
|
9
9
|
const asCurrentUser = (user: { id: string; memberships?: unknown[] }) =>
|
|
10
|
-
user as unknown as typeof context.currentUser
|
|
10
|
+
user as unknown as NonNullable<typeof context.currentUser>
|
|
11
11
|
|
|
12
12
|
describe('requireMembership directive', () => {
|
|
13
13
|
it('declares the directive sdl as schema, with the correct name', () => {
|
|
@@ -6,7 +6,6 @@ import { Listr } from "listr2";
|
|
|
6
6
|
import { terminalLink } from "termi-link";
|
|
7
7
|
import { colors as c } from "@cedarjs/cli-helpers/colors";
|
|
8
8
|
import { formatCedarCommand } from "@cedarjs/cli-helpers/packageManager/display";
|
|
9
|
-
import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
10
9
|
import {
|
|
11
10
|
addRootPackages,
|
|
12
11
|
addWorkspacePackages
|
|
@@ -14,36 +13,24 @@ import {
|
|
|
14
13
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
15
14
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
16
15
|
import { getPaths, usingVSCode } from "../../../../lib/index.js";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
];
|
|
22
|
-
const tailwindDirectivesExist = (indexCSS) => tailwindDirectives.every(
|
|
23
|
-
(tailwindDirective) => indexCSS.includes(tailwindDirective)
|
|
24
|
-
);
|
|
25
|
-
const tailwindImportsAndNotes = [
|
|
16
|
+
import { insertPluginsBeforeCedar } from "../../deploy/helpers/index.js";
|
|
17
|
+
const tailwindImport = "@import 'tailwindcss';";
|
|
18
|
+
const tailwindImportRegExp = /@import\s+['"]tailwindcss['"]/;
|
|
19
|
+
const tailwindImportAndNotes = [
|
|
26
20
|
"/**",
|
|
27
21
|
" * START --- SETUP TAILWINDCSS EDIT",
|
|
28
22
|
" *",
|
|
29
|
-
` * \`${formatCedarCommand(["setup", "ui", "tailwindcss"])}\` placed
|
|
23
|
+
` * \`${formatCedarCommand(["setup", "ui", "tailwindcss"])}\` placed this import here`,
|
|
30
24
|
" * to inject Tailwind's styles into your CSS.",
|
|
31
25
|
" * For more information, see: https://tailwindcss.com/docs/installation",
|
|
32
26
|
" */",
|
|
33
|
-
|
|
27
|
+
tailwindImport,
|
|
34
28
|
"/**",
|
|
35
29
|
" * END --- SETUP TAILWINDCSS EDIT",
|
|
36
30
|
" */\n"
|
|
37
31
|
];
|
|
38
|
-
const recommendedVSCodeExtensions = [
|
|
39
|
-
"csstools.postcss",
|
|
40
|
-
"bradlc.vscode-tailwindcss"
|
|
41
|
-
];
|
|
32
|
+
const recommendedVSCodeExtensions = ["bradlc.vscode-tailwindcss"];
|
|
42
33
|
const recommendationTexts = {
|
|
43
|
-
"csstools.postcss": terminalLink(
|
|
44
|
-
"PostCSS Language Support",
|
|
45
|
-
"https://marketplace.visualstudio.com/items?itemName=csstools.postcss"
|
|
46
|
-
),
|
|
47
34
|
"bradlc.vscode-tailwindcss": terminalLink(
|
|
48
35
|
"Tailwind CSS IntelliSense",
|
|
49
36
|
"https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss"
|
|
@@ -87,9 +74,8 @@ const handler = async ({
|
|
|
87
74
|
const rwPaths = getPaths();
|
|
88
75
|
const projectPackages = ["prettier-plugin-tailwindcss@^0.8.0"];
|
|
89
76
|
const webWorkspacePackages = [
|
|
90
|
-
"
|
|
91
|
-
"tailwindcss@^3.
|
|
92
|
-
"autoprefixer"
|
|
77
|
+
"tailwindcss@^4.3.3",
|
|
78
|
+
"@tailwindcss/vite@^4.3.3"
|
|
93
79
|
];
|
|
94
80
|
const tasks = new Listr(
|
|
95
81
|
[
|
|
@@ -140,62 +126,45 @@ const handler = async ({
|
|
|
140
126
|
}
|
|
141
127
|
},
|
|
142
128
|
{
|
|
143
|
-
title: "
|
|
144
|
-
task: () => {
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
129
|
+
title: "Adding the Tailwind CSS plugin to the Vite config...",
|
|
130
|
+
task: (_ctx, task) => {
|
|
131
|
+
const viteConfigPath = rwPaths.web.viteConfig;
|
|
132
|
+
if (!viteConfigPath || !fs.existsSync(viteConfigPath)) {
|
|
133
|
+
throw new Error("Could not find web/vite.config.{ts,js}");
|
|
134
|
+
}
|
|
135
|
+
const viteConfig = fs.readFileSync(viteConfigPath, "utf-8");
|
|
136
|
+
if (viteConfig.includes("@tailwindcss/vite")) {
|
|
137
|
+
task.skip("The Tailwind CSS Vite plugin is already configured");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const viteConfigWithPlugin = insertPluginsBeforeCedar({
|
|
141
|
+
content: viteConfig,
|
|
142
|
+
pluginCodes: ["tailwindcss()"]
|
|
143
|
+
});
|
|
144
|
+
if (!viteConfigWithPlugin) {
|
|
147
145
|
throw new Error(
|
|
148
|
-
|
|
146
|
+
`Could not find \`cedar()\` in the plugins array in ${viteConfigPath}.
|
|
147
|
+
Add \`import tailwindcss from '@tailwindcss/vite'\` to the top of the file and \`tailwindcss()\` to the plugins array yourself, and then run this command again.`
|
|
149
148
|
);
|
|
150
|
-
} else {
|
|
151
|
-
const postCSSConfig = fs.readFileSync(
|
|
152
|
-
path.join(
|
|
153
|
-
import.meta.dirname,
|
|
154
|
-
"../templates/postcss.config.cjs.template"
|
|
155
|
-
),
|
|
156
|
-
"utf-8"
|
|
157
|
-
);
|
|
158
|
-
fs.mkdirSync(path.dirname(postCSSConfigPath), { recursive: true });
|
|
159
|
-
return fs.writeFileSync(postCSSConfigPath, postCSSConfig);
|
|
160
149
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
rwPaths.web.config,
|
|
168
|
-
"tailwind.config.cjs"
|
|
150
|
+
const tailwindPluginImport = "import tailwindcss from '@tailwindcss/vite'\n";
|
|
151
|
+
const importAnchor = /^import .* from ['"]vite['"]/m.exec(viteConfigWithPlugin) ?? /^import /m.exec(viteConfigWithPlugin);
|
|
152
|
+
const insertAt = importAnchor?.index ?? 0;
|
|
153
|
+
fs.writeFileSync(
|
|
154
|
+
viteConfigPath,
|
|
155
|
+
viteConfigWithPlugin.slice(0, insertAt) + tailwindPluginImport + viteConfigWithPlugin.slice(insertAt)
|
|
169
156
|
);
|
|
170
|
-
if (fs.existsSync(tailwindConfigPath)) {
|
|
171
|
-
if (force) {
|
|
172
|
-
fs.unlinkSync(tailwindConfigPath);
|
|
173
|
-
} else {
|
|
174
|
-
throw new Error(
|
|
175
|
-
"Tailwind CSS config already exists.\nUse --force to override existing config."
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
await runBin("tailwindcss", ["init", tailwindConfigPath], {
|
|
180
|
-
cwd: rwPaths.web.base
|
|
181
|
-
});
|
|
182
|
-
const tailwindConfig = fs.readFileSync(tailwindConfigPath, "utf-8");
|
|
183
|
-
const newTailwindConfig = 'const { join } = require("node:path");\n\n' + tailwindConfig.replace(
|
|
184
|
-
"content: []",
|
|
185
|
-
"content: [join(__dirname, '../src/**/*.{js,jsx,ts,tsx}')]"
|
|
186
|
-
).replace("export default {", "module.exports = {");
|
|
187
|
-
fs.writeFileSync(tailwindConfigPath, newTailwindConfig);
|
|
188
157
|
}
|
|
189
158
|
},
|
|
190
159
|
{
|
|
191
|
-
title: "Adding
|
|
160
|
+
title: "Adding Tailwind CSS import to index.css...",
|
|
192
161
|
task: (_ctx, task) => {
|
|
193
162
|
const INDEX_CSS_PATH = path.join(rwPaths.web.src, "index.css");
|
|
194
163
|
const indexCSS = fs.readFileSync(INDEX_CSS_PATH, "utf-8");
|
|
195
|
-
if (
|
|
196
|
-
task.skip("
|
|
164
|
+
if (tailwindImportRegExp.test(indexCSS)) {
|
|
165
|
+
task.skip("Tailwind CSS import already exists in index.css");
|
|
197
166
|
} else {
|
|
198
|
-
const newIndexCSS =
|
|
167
|
+
const newIndexCSS = tailwindImportAndNotes.join("\n") + indexCSS;
|
|
199
168
|
fs.writeFileSync(INDEX_CSS_PATH, newIndexCSS);
|
|
200
169
|
}
|
|
201
170
|
}
|
|
@@ -276,7 +245,9 @@ const handler = async ({
|
|
|
276
245
|
"activeClassName",
|
|
277
246
|
"errorClassName"
|
|
278
247
|
];
|
|
248
|
+
const fileAssociations = { "*.css": "tailwindcss" };
|
|
279
249
|
let newSettingsJson = {
|
|
250
|
+
["files.associations"]: fileAssociations,
|
|
280
251
|
["tailwindCSS.classAttributes"]: classAttributes
|
|
281
252
|
};
|
|
282
253
|
if (fs.existsSync(VS_CODE_SETTINGS_PATH)) {
|
|
@@ -294,8 +265,13 @@ const handler = async ({
|
|
|
294
265
|
const mergedClassAttributes = Array.from(
|
|
295
266
|
/* @__PURE__ */ new Set([...classAttributes, ...originalTwClassAttributesJson])
|
|
296
267
|
);
|
|
268
|
+
const existingAssociations = originalSettingsJson["files.associations"];
|
|
297
269
|
newSettingsJson = {
|
|
298
270
|
...originalSettingsJson,
|
|
271
|
+
["files.associations"]: {
|
|
272
|
+
...existingAssociations && typeof existingAssociations === "object" && !Array.isArray(existingAssociations) ? existingAssociations : {},
|
|
273
|
+
...fileAssociations
|
|
274
|
+
},
|
|
299
275
|
["tailwindCSS.classAttributes"]: mergedClassAttributes
|
|
300
276
|
};
|
|
301
277
|
}
|
|
@@ -306,34 +282,38 @@ const handler = async ({
|
|
|
306
282
|
}
|
|
307
283
|
},
|
|
308
284
|
{
|
|
309
|
-
title: "Adding tailwind
|
|
285
|
+
title: "Adding tailwind stylesheet entry in prettier...",
|
|
310
286
|
task: async (_ctx) => {
|
|
311
287
|
const prettierConfigPath = path.join(
|
|
312
288
|
rwPaths.base,
|
|
313
289
|
"prettier.config.cjs"
|
|
314
290
|
);
|
|
315
291
|
const prettierConfig = fs.readFileSync(prettierConfigPath, "utf-8");
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
path.posix.join(rwPaths.web.config, "tailwind.config.cjs")
|
|
319
|
-
).replaceAll("\\", "/");
|
|
292
|
+
const tailwindStylesheetPath = path.relative(rwPaths.base, path.join(rwPaths.web.src, "index.css")).replaceAll("\\", "/");
|
|
293
|
+
const tailwindStylesheetEntry = `tailwindStylesheet: './${tailwindStylesheetPath}',`;
|
|
320
294
|
let newPrettierConfig = prettierConfig;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
295
|
+
const stringEntryRegExp = /tailwindStylesheet:\s*(['"`])[^'"`\n]*\1,?/;
|
|
296
|
+
if (newPrettierConfig.includes("tailwindStylesheet")) {
|
|
297
|
+
if (!force) {
|
|
298
|
+
throw new Error(
|
|
299
|
+
"tailwindStylesheet setting already exists in prettier configuration.\nUse --force to override existing config."
|
|
326
300
|
);
|
|
327
|
-
}
|
|
301
|
+
}
|
|
302
|
+
if (!stringEntryRegExp.test(newPrettierConfig)) {
|
|
328
303
|
throw new Error(
|
|
329
|
-
|
|
304
|
+
`Could not update the tailwindStylesheet setting in ${prettierConfigPath}.
|
|
305
|
+
Set it to './${tailwindStylesheetPath}' yourself.`
|
|
330
306
|
);
|
|
331
307
|
}
|
|
308
|
+
newPrettierConfig = newPrettierConfig.replace(
|
|
309
|
+
stringEntryRegExp,
|
|
310
|
+
tailwindStylesheetEntry
|
|
311
|
+
);
|
|
332
312
|
} else {
|
|
333
313
|
newPrettierConfig = newPrettierConfig.replace(
|
|
334
314
|
/,(\n\s*)(\}\n?)$/,
|
|
335
315
|
`,
|
|
336
|
-
|
|
316
|
+
${tailwindStylesheetEntry}$1$2`
|
|
337
317
|
);
|
|
338
318
|
}
|
|
339
319
|
fs.writeFileSync(prettierConfigPath, newPrettierConfig);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const UPLOADS_GITIGNORE_ENTRY = "api/.uploads";
|
|
2
|
+
function transformGitignore(source) {
|
|
3
|
+
const activeLines = source.split("\n").map((line) => line.trimEnd()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
4
|
+
if (activeLines.includes(UPLOADS_GITIGNORE_ENTRY)) {
|
|
5
|
+
return source;
|
|
6
|
+
}
|
|
7
|
+
if (/^dev\.db\*$/m.test(source)) {
|
|
8
|
+
return source.replace(/^(dev\.db\*)$/m, `$1
|
|
9
|
+
${UPLOADS_GITIGNORE_ENTRY}`);
|
|
10
|
+
}
|
|
11
|
+
const prefix = source === "" || source.endsWith("\n") ? source : source + "\n";
|
|
12
|
+
return prefix + UPLOADS_GITIGNORE_ENTRY + "\n";
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
UPLOADS_GITIGNORE_ENTRY,
|
|
16
|
+
transformGitignore
|
|
17
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
acceptedContentType,
|
|
2
3
|
confirmUpload as confirmUploadRecord,
|
|
3
4
|
createPresignedUpload,
|
|
4
5
|
getUploadTokenPayload,
|
|
5
|
-
isMimeTypeAllowed,
|
|
6
6
|
issueUploadToken,
|
|
7
7
|
resolveProfile,
|
|
8
8
|
resolveTarget,
|
|
@@ -71,18 +71,27 @@ export const uploadFile = async ({
|
|
|
71
71
|
)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
// Checked by what the bytes are, not the type the client claimed, and
|
|
75
|
+
// stored under the type returned
|
|
76
|
+
const data = Buffer.from(input.data, 'base64')
|
|
77
|
+
const mimeType = acceptedContentType(
|
|
78
|
+
data,
|
|
79
|
+
profile.allowedMimeTypes,
|
|
80
|
+
input.mimeType,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if (!mimeType) {
|
|
75
84
|
throw new UploadError(
|
|
76
85
|
'MIME_TYPE_NOT_ALLOWED',
|
|
77
|
-
`
|
|
86
|
+
`That file is not a type allowed for upload profile '${profile.name}'.`,
|
|
78
87
|
)
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
return storeFile(target, {
|
|
82
91
|
db,
|
|
83
92
|
filename: input.filename,
|
|
84
|
-
mimeType
|
|
85
|
-
data
|
|
93
|
+
mimeType,
|
|
94
|
+
data,
|
|
86
95
|
maxSize: profile.maxFileSize,
|
|
87
96
|
userId: context.currentUser ? String(context.currentUser.id) : undefined,
|
|
88
97
|
})
|
|
@@ -18,6 +18,7 @@ import { getPaths, transformTSToJS, writeFile } from "../../../lib/index.js";
|
|
|
18
18
|
import { isTypeScriptProject } from "../../../lib/project.js";
|
|
19
19
|
import { generateSecret } from "../../generate/secret/secret.js";
|
|
20
20
|
import { setupServerFileTasks } from "../server-file/serverFileHandler.js";
|
|
21
|
+
import { transformGitignore } from "./gitignore.js";
|
|
21
22
|
import { addUploadModel } from "./schemaPrisma.js";
|
|
22
23
|
import {
|
|
23
24
|
addUploadsPlugin,
|
|
@@ -39,6 +40,12 @@ const S3_CLIENT = `
|
|
|
39
40
|
export const s3Client = new S3Client({
|
|
40
41
|
region: process.env.AWS_REGION,
|
|
41
42
|
})
|
|
43
|
+
|
|
44
|
+
const s3Bucket = process.env.S3_BUCKET_UPLOADS
|
|
45
|
+
|
|
46
|
+
if (!s3Bucket) {
|
|
47
|
+
throw new Error('Set S3_BUCKET_UPLOADS in .env to use the S3 storage target')
|
|
48
|
+
}
|
|
42
49
|
`;
|
|
43
50
|
const TARGET_BLOCKS = {
|
|
44
51
|
fs: ` // Files uploaded through the api server and stored on local disk. Good for
|
|
@@ -55,7 +62,7 @@ const TARGET_BLOCKS = {
|
|
|
55
62
|
s3: ` // Files uploaded straight from the browser to S3 with presigned URLs.
|
|
56
63
|
files: createS3Provider({
|
|
57
64
|
client: s3Client,
|
|
58
|
-
bucket:
|
|
65
|
+
bucket: s3Bucket,
|
|
59
66
|
region: process.env.AWS_REGION,
|
|
60
67
|
keyPrefix: 'uploads/',
|
|
61
68
|
}),
|
|
@@ -264,6 +271,20 @@ const handler = async ({ targets, force }) => {
|
|
|
264
271
|
}
|
|
265
272
|
}
|
|
266
273
|
},
|
|
274
|
+
{
|
|
275
|
+
title: "Adding the fs upload directory to .gitignore...",
|
|
276
|
+
skip: () => wantsFs ? false : "No fs target selected; skipping.",
|
|
277
|
+
task: (_ctx, task) => {
|
|
278
|
+
const gitignorePath = path.join(paths.base, ".gitignore");
|
|
279
|
+
const source = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, "utf-8") : "";
|
|
280
|
+
const updated = transformGitignore(source);
|
|
281
|
+
if (updated === source) {
|
|
282
|
+
task.skip(".gitignore already up to date");
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
fs.writeFileSync(gitignorePath, updated, "utf-8");
|
|
286
|
+
}
|
|
287
|
+
},
|
|
267
288
|
{
|
|
268
289
|
title: "Prettifying changed files",
|
|
269
290
|
task: async (_ctx, task) => {
|
package/dist/lib/index.js
CHANGED
|
@@ -286,18 +286,17 @@ const cleanupEmptyDirsTask = (files) => {
|
|
|
286
286
|
})
|
|
287
287
|
);
|
|
288
288
|
};
|
|
289
|
-
function wrapWithSet(routesContent, layout, routes, newLineAndIndent,
|
|
289
|
+
function wrapWithSet(routesContent, layout, routes, newLineAndIndent, privateSetProps) {
|
|
290
290
|
const [_, indentOne, indentTwo] = routesContent.match(
|
|
291
291
|
/([ \t]*)<Router.*?>[^<]*[\r\n]+([ \t]+)/
|
|
292
292
|
) || ["", "", ""];
|
|
293
293
|
const oneLevelIndent = indentTwo.slice(0, indentTwo.length - indentOne.length);
|
|
294
|
-
const propsString = Object.entries(props).map((values) => `${values[0]}="${values[1]}"`).join(" ");
|
|
295
294
|
if (!privateSetProps) {
|
|
296
295
|
const newRoutesWithExtraIndent2 = routes.map(
|
|
297
296
|
(route) => oneLevelIndent + route
|
|
298
297
|
);
|
|
299
298
|
return [
|
|
300
|
-
`<Set wrap={${layout}}
|
|
299
|
+
`<Set wrap={${layout}}>`,
|
|
301
300
|
...newRoutesWithExtraIndent2,
|
|
302
301
|
`</Set>`
|
|
303
302
|
].join(newLineAndIndent);
|
|
@@ -308,13 +307,13 @@ function wrapWithSet(routesContent, layout, routes, newLineAndIndent, props = {}
|
|
|
308
307
|
);
|
|
309
308
|
return [
|
|
310
309
|
`<PrivateSet${privateSetPropsString && " " + privateSetPropsString}>`,
|
|
311
|
-
`${oneLevelIndent}<Set wrap={${layout}}
|
|
310
|
+
`${oneLevelIndent}<Set wrap={${layout}}>`,
|
|
312
311
|
...newRoutesWithExtraIndent,
|
|
313
312
|
`${oneLevelIndent}</Set>`,
|
|
314
313
|
`</PrivateSet>`
|
|
315
314
|
].join(newLineAndIndent);
|
|
316
315
|
}
|
|
317
|
-
function addRoutesToRouterTask(routes, layout,
|
|
316
|
+
function addRoutesToRouterTask(routes, layout, privateSetProps) {
|
|
318
317
|
const cedarPaths = getPaths();
|
|
319
318
|
const routesContent = readFile(cedarPaths.web.routes).toString();
|
|
320
319
|
let newRoutes = routes.filter((route) => !routesContent.match(route));
|
|
@@ -338,7 +337,6 @@ ${route}`);
|
|
|
338
337
|
layout,
|
|
339
338
|
newRoutes,
|
|
340
339
|
newLineAndIndent,
|
|
341
|
-
setProps,
|
|
342
340
|
privateSetProps
|
|
343
341
|
) : newRoutes.join(newLineAndIndent);
|
|
344
342
|
const newRoutesContent = routesContent.replace(
|
|
@@ -377,6 +375,12 @@ function removeEmtpySet(routesContent, layout) {
|
|
|
377
375
|
if (child.length > 0) {
|
|
378
376
|
return routesContent;
|
|
379
377
|
}
|
|
378
|
+
const privateSetWithLayoutReg = new RegExp(
|
|
379
|
+
`\\s*<PrivateSet[^>]*>\\s*<Set[^>]*wrap={${layout}}[^<]*>\\s*</Set>\\s*</PrivateSet>`
|
|
380
|
+
);
|
|
381
|
+
if (privateSetWithLayoutReg.test(routesContent)) {
|
|
382
|
+
return routesContent.replace(privateSetWithLayoutReg, "");
|
|
383
|
+
}
|
|
380
384
|
return routesContent.replace(setWithLayoutReg, "");
|
|
381
385
|
}
|
|
382
386
|
function removeRoutesFromRouterTask(routes, layout) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "7.0.1-next.
|
|
3
|
+
"version": "7.0.1-next.467",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,25 +34,25 @@
|
|
|
34
34
|
"@babel/core": "^7.26.10",
|
|
35
35
|
"@babel/parser": "7.29.9",
|
|
36
36
|
"@babel/preset-typescript": "7.29.7",
|
|
37
|
-
"@babel/traverse": "7.29.
|
|
37
|
+
"@babel/traverse": "7.29.10",
|
|
38
38
|
"@babel/types": "7.29.8",
|
|
39
|
-
"@cedarjs/api-server": "7.0.1-next.
|
|
40
|
-
"@cedarjs/babel-config": "7.0.1-next.
|
|
41
|
-
"@cedarjs/cli-helpers": "7.0.1-next.
|
|
42
|
-
"@cedarjs/internal": "7.0.1-next.
|
|
43
|
-
"@cedarjs/prerender": "7.0.1-next.
|
|
44
|
-
"@cedarjs/project-config": "7.0.1-next.
|
|
45
|
-
"@cedarjs/structure": "7.0.1-next.
|
|
46
|
-
"@cedarjs/telemetry": "7.0.1-next.
|
|
47
|
-
"@cedarjs/utils": "7.0.1-next.
|
|
48
|
-
"@cedarjs/vite": "7.0.1-next.
|
|
49
|
-
"@cedarjs/web-server": "7.0.1-next.
|
|
50
|
-
"@listr2/prompt-adapter-enquirer": "4.3.
|
|
39
|
+
"@cedarjs/api-server": "7.0.1-next.467",
|
|
40
|
+
"@cedarjs/babel-config": "7.0.1-next.467",
|
|
41
|
+
"@cedarjs/cli-helpers": "7.0.1-next.467",
|
|
42
|
+
"@cedarjs/internal": "7.0.1-next.467",
|
|
43
|
+
"@cedarjs/prerender": "7.0.1-next.467",
|
|
44
|
+
"@cedarjs/project-config": "7.0.1-next.467",
|
|
45
|
+
"@cedarjs/structure": "7.0.1-next.467",
|
|
46
|
+
"@cedarjs/telemetry": "7.0.1-next.467",
|
|
47
|
+
"@cedarjs/utils": "7.0.1-next.467",
|
|
48
|
+
"@cedarjs/vite": "7.0.1-next.467",
|
|
49
|
+
"@cedarjs/web-server": "7.0.1-next.467",
|
|
50
|
+
"@listr2/prompt-adapter-enquirer": "4.3.3",
|
|
51
51
|
"@opentelemetry/api": "1.9.1",
|
|
52
|
-
"@opentelemetry/core": "2.
|
|
53
|
-
"@opentelemetry/exporter-trace-otlp-http": "0.
|
|
54
|
-
"@opentelemetry/resources": "2.
|
|
55
|
-
"@opentelemetry/sdk-trace-node": "2.
|
|
52
|
+
"@opentelemetry/core": "2.12.0",
|
|
53
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.223.0",
|
|
54
|
+
"@opentelemetry/resources": "2.12.0",
|
|
55
|
+
"@opentelemetry/sdk-trace-node": "2.12.0",
|
|
56
56
|
"@opentelemetry/semantic-conventions": "1.43.0",
|
|
57
57
|
"@prisma/internals": "7.10.0",
|
|
58
58
|
"ansis": "4.4.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"camelcase": "6.3.0",
|
|
63
63
|
"change-case": "4.1.2",
|
|
64
64
|
"ci-info": "4.4.0",
|
|
65
|
-
"concurrently": "9.2.
|
|
65
|
+
"concurrently": "9.2.5",
|
|
66
66
|
"configstore": "7.1.0",
|
|
67
67
|
"decamelize": "6.0.1",
|
|
68
68
|
"dotenv-defaults": "5.0.2",
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
"pascalcase": "1.0.0",
|
|
80
80
|
"pluralize": "8.0.0",
|
|
81
81
|
"portfinder": "1.0.38",
|
|
82
|
-
"prettier": "3.9.
|
|
82
|
+
"prettier": "3.9.10",
|
|
83
83
|
"prisma": "7.10.0",
|
|
84
84
|
"prompts": "2.4.2",
|
|
85
|
-
"smol-toml": "1.9.
|
|
85
|
+
"smol-toml": "1.9.1",
|
|
86
86
|
"srvx": "0.12.8",
|
|
87
87
|
"string-env-interpolation": "1.0.1",
|
|
88
|
-
"systeminformation": "5.33.
|
|
88
|
+
"systeminformation": "5.33.15",
|
|
89
89
|
"termi-link": "1.1.0",
|
|
90
90
|
"title-case": "3.0.3",
|
|
91
91
|
"unionfs": "4.6.0",
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
"yargs": "17.7.3"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@cedarjs/framework-tools": "7.0.1-next.
|
|
97
|
+
"@cedarjs/framework-tools": "7.0.1-next.467",
|
|
98
98
|
"@prisma/dmmf": "7.10.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
|
-
"memfs": "4.
|
|
100
|
+
"memfs": "4.80.0",
|
|
101
101
|
"node-ssh": "13.2.1",
|
|
102
102
|
"ts-dedent": "2.3.0",
|
|
103
103
|
"typescript": "5.9.3",
|