@cedarjs/cli 5.0.0-canary.2384 → 5.0.0-canary.2386
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/destroy/scaffold/scaffoldHandler.js +3 -3
- package/dist/commands/generate/realtime/realtimeHandler.js +6 -6
- package/dist/commands/generate/scaffold/scaffoldHandler.js +3 -3
- package/dist/commands/setup/realtime/realtimeHandler.js +12 -12
- package/dist/lib/index.js +8 -8
- package/dist/lib/packages.js +3 -3
- package/dist/telemetry/resource.js +1 -1
- package/package.json +12 -12
|
@@ -28,12 +28,12 @@ const removeSetImport = () => {
|
|
|
28
28
|
if (routesContent.match("<Set")) {
|
|
29
29
|
return "Skipping removal of Set import in Routes.{jsx,tsx}";
|
|
30
30
|
}
|
|
31
|
-
const [
|
|
31
|
+
const [cedarRouterImport] = routesContent.match(
|
|
32
32
|
/import {[^]*} from '@cedarjs\/router'/
|
|
33
33
|
);
|
|
34
|
-
const removedSetImport =
|
|
34
|
+
const removedSetImport = cedarRouterImport.replace(/,*\s*Set,*/, "");
|
|
35
35
|
const newRoutesContent = routesContent.replace(
|
|
36
|
-
|
|
36
|
+
cedarRouterImport,
|
|
37
37
|
removedSetImport
|
|
38
38
|
);
|
|
39
39
|
writeFile(routesPath, newRoutesContent, { overwriteExisting: true });
|
|
@@ -36,7 +36,7 @@ const templateVariables = (name) => {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
async function handler({ name, type, force, verbose, silent }) {
|
|
39
|
-
const
|
|
39
|
+
const cedarPaths = getPaths();
|
|
40
40
|
const ts = isTypeScriptProject();
|
|
41
41
|
name = pluralize.singular(name.toLowerCase());
|
|
42
42
|
let functionType = type;
|
|
@@ -80,7 +80,7 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
80
80
|
`blank.sdl.ts.template`
|
|
81
81
|
);
|
|
82
82
|
const sdlFile = path.join(
|
|
83
|
-
|
|
83
|
+
cedarPaths.api.graphql,
|
|
84
84
|
`${name}.sdl.${isTypeScriptProject() ? "ts" : "js"}`
|
|
85
85
|
);
|
|
86
86
|
const sdlContent = ts ? exampleSdlTemplateContent : await transformTSToJS(sdlFile, exampleSdlTemplateContent);
|
|
@@ -92,7 +92,7 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
92
92
|
`blank.service.ts.template`
|
|
93
93
|
);
|
|
94
94
|
const serviceFile = path.join(
|
|
95
|
-
|
|
95
|
+
cedarPaths.api.services,
|
|
96
96
|
`${name}`,
|
|
97
97
|
`${name}.${isTypeScriptProject() ? "ts" : "js"}`
|
|
98
98
|
);
|
|
@@ -105,7 +105,7 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
105
105
|
`blank.ts.template`
|
|
106
106
|
);
|
|
107
107
|
const exampleFile = path.join(
|
|
108
|
-
|
|
108
|
+
cedarPaths.api.subscriptions,
|
|
109
109
|
`${name}`,
|
|
110
110
|
`${name}.${isTypeScriptProject() ? "ts" : "js"}`
|
|
111
111
|
);
|
|
@@ -156,7 +156,7 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
156
156
|
`blank.sdl.ts.template`
|
|
157
157
|
);
|
|
158
158
|
const sdlFile = path.join(
|
|
159
|
-
|
|
159
|
+
cedarPaths.api.graphql,
|
|
160
160
|
`${name}.sdl.${isTypeScriptProject() ? "ts" : "js"}`
|
|
161
161
|
);
|
|
162
162
|
const sdlContent = ts ? exampleSdlTemplateContent : await transformTSToJS(sdlFile, exampleSdlTemplateContent);
|
|
@@ -168,7 +168,7 @@ async function handler({ name, type, force, verbose, silent }) {
|
|
|
168
168
|
"blank.service.ts.template"
|
|
169
169
|
);
|
|
170
170
|
const serviceFile = path.join(
|
|
171
|
-
|
|
171
|
+
cedarPaths.api.services,
|
|
172
172
|
`${name}`,
|
|
173
173
|
`${name}.${isTypeScriptProject() ? "ts" : "js"}`
|
|
174
174
|
);
|
|
@@ -508,10 +508,10 @@ const addHelperPackages = async (task) => {
|
|
|
508
508
|
const addSetImport = (task) => {
|
|
509
509
|
const routesPath = getPaths().web.routes;
|
|
510
510
|
const routesContent = readFile(routesPath).toString();
|
|
511
|
-
const [
|
|
511
|
+
const [cedarRouterImport, importStart, spacing, importContent, importEnd] = routesContent.match(
|
|
512
512
|
/(import {)(\s*)([^]*)(} from ['"]@cedarjs\/router['"])/
|
|
513
513
|
) || [];
|
|
514
|
-
if (!
|
|
514
|
+
if (!cedarRouterImport) {
|
|
515
515
|
task.skip(
|
|
516
516
|
"Couldn't add Set import from @cedarjs/router to Routes.{jsx,tsx}"
|
|
517
517
|
);
|
|
@@ -522,7 +522,7 @@ const addSetImport = (task) => {
|
|
|
522
522
|
return "Skipping Set import";
|
|
523
523
|
}
|
|
524
524
|
const newRoutesContent = routesContent.replace(
|
|
525
|
-
|
|
525
|
+
cedarRouterImport,
|
|
526
526
|
importStart + spacing + PACKAGE_SET + `,` + spacing + importContent + importEnd
|
|
527
527
|
);
|
|
528
528
|
writeFile(routesPath, newRoutesContent, { overwriteExisting: true });
|
|
@@ -33,10 +33,10 @@ async function handleExamplesPreference(includeExamples) {
|
|
|
33
33
|
return incl;
|
|
34
34
|
}
|
|
35
35
|
async function handler(args) {
|
|
36
|
-
const
|
|
36
|
+
const cedarPaths = getPaths();
|
|
37
37
|
const ts = isTypeScriptProject();
|
|
38
38
|
const realtimeLibFilePath = path.join(
|
|
39
|
-
|
|
39
|
+
cedarPaths.api.lib,
|
|
40
40
|
`realtime.${isTypeScriptProject() ? "ts" : "js"}`
|
|
41
41
|
);
|
|
42
42
|
const force = args.force || false;
|
|
@@ -94,7 +94,7 @@ async function handler(args) {
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
const exampleFile = path.join(
|
|
97
|
-
|
|
97
|
+
cedarPaths.api.subscriptions,
|
|
98
98
|
"countdown",
|
|
99
99
|
`countdown.${isTypeScriptProject() ? "ts" : "js"}`
|
|
100
100
|
);
|
|
@@ -124,7 +124,7 @@ async function handler(args) {
|
|
|
124
124
|
"utf-8"
|
|
125
125
|
);
|
|
126
126
|
const sdlFile = path.join(
|
|
127
|
-
|
|
127
|
+
cedarPaths.api.graphql,
|
|
128
128
|
`rooms.sdl.${isTypeScriptProject() ? "ts" : "js"}`
|
|
129
129
|
);
|
|
130
130
|
const sdlContent = ts ? exampleSdlTemplateContent : await transformTSToJS(sdlFile, exampleSdlTemplateContent);
|
|
@@ -139,7 +139,7 @@ async function handler(args) {
|
|
|
139
139
|
"utf-8"
|
|
140
140
|
);
|
|
141
141
|
const serviceFile = path.join(
|
|
142
|
-
|
|
142
|
+
cedarPaths.api.services,
|
|
143
143
|
"rooms",
|
|
144
144
|
`rooms.${isTypeScriptProject() ? "ts" : "js"}`
|
|
145
145
|
);
|
|
@@ -161,7 +161,7 @@ async function handler(args) {
|
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
const exampleFile = path.join(
|
|
164
|
-
|
|
164
|
+
cedarPaths.api.subscriptions,
|
|
165
165
|
"newMessage",
|
|
166
166
|
`newMessage.${isTypeScriptProject() ? "ts" : "js"}`
|
|
167
167
|
);
|
|
@@ -197,7 +197,7 @@ async function handler(args) {
|
|
|
197
197
|
"utf-8"
|
|
198
198
|
);
|
|
199
199
|
const sdlFile = path.join(
|
|
200
|
-
|
|
200
|
+
cedarPaths.api.graphql,
|
|
201
201
|
`auctions.sdl.${isTypeScriptProject() ? "ts" : "js"}`
|
|
202
202
|
);
|
|
203
203
|
const sdlContent = ts ? exampleSdlTemplateContent : await transformTSToJS(sdlFile, exampleSdlTemplateContent);
|
|
@@ -212,7 +212,7 @@ async function handler(args) {
|
|
|
212
212
|
"utf-8"
|
|
213
213
|
);
|
|
214
214
|
const serviceFile = path.join(
|
|
215
|
-
|
|
215
|
+
cedarPaths.api.services,
|
|
216
216
|
"auctions",
|
|
217
217
|
`auctions.${isTypeScriptProject() ? "ts" : "js"}`
|
|
218
218
|
);
|
|
@@ -242,7 +242,7 @@ async function handler(args) {
|
|
|
242
242
|
"utf-8"
|
|
243
243
|
);
|
|
244
244
|
const sdlFile = path.join(
|
|
245
|
-
|
|
245
|
+
cedarPaths.api.graphql,
|
|
246
246
|
`fastAndSlowFields.sdl.${isTypeScriptProject() ? "ts" : "js"}`
|
|
247
247
|
);
|
|
248
248
|
const sdlContent = ts ? exampleSdlTemplateContent : await transformTSToJS(sdlFile, exampleSdlTemplateContent);
|
|
@@ -257,7 +257,7 @@ async function handler(args) {
|
|
|
257
257
|
"utf-8"
|
|
258
258
|
);
|
|
259
259
|
const serviceFile = path.join(
|
|
260
|
-
|
|
260
|
+
cedarPaths.api.services,
|
|
261
261
|
"fastAndSlowFields",
|
|
262
262
|
`fastAndSlowFields.${isTypeScriptProject() ? "ts" : "js"}`
|
|
263
263
|
);
|
|
@@ -287,7 +287,7 @@ async function handler(args) {
|
|
|
287
287
|
"utf-8"
|
|
288
288
|
);
|
|
289
289
|
const sdlFile = path.join(
|
|
290
|
-
|
|
290
|
+
cedarPaths.api.graphql,
|
|
291
291
|
`alphabet.sdl.${isTypeScriptProject() ? "ts" : "js"}`
|
|
292
292
|
);
|
|
293
293
|
const sdlContent = ts ? exampleSdlTemplateContent : await transformTSToJS(sdlFile, exampleSdlTemplateContent);
|
|
@@ -302,7 +302,7 @@ async function handler(args) {
|
|
|
302
302
|
"utf-8"
|
|
303
303
|
);
|
|
304
304
|
const serviceFile = path.join(
|
|
305
|
-
|
|
305
|
+
cedarPaths.api.services,
|
|
306
306
|
"alphabet",
|
|
307
307
|
`alphabet.${isTypeScriptProject() ? "ts" : "js"}`
|
|
308
308
|
);
|
package/dist/lib/index.js
CHANGED
|
@@ -280,8 +280,8 @@ const wrapWithSet = (routesContent, layout, routes, newLineAndIndent, props = {}
|
|
|
280
280
|
].join(newLineAndIndent);
|
|
281
281
|
};
|
|
282
282
|
const addRoutesToRouterTask = (routes, layout, setProps = {}) => {
|
|
283
|
-
const
|
|
284
|
-
const routesContent = readFile(
|
|
283
|
+
const cedarPaths = getPaths();
|
|
284
|
+
const routesContent = readFile(cedarPaths.web.routes).toString();
|
|
285
285
|
let newRoutes = routes.filter((route) => !routesContent.match(route));
|
|
286
286
|
if (newRoutes.length) {
|
|
287
287
|
const [routerStart, routerParams, newLineAndIndent] = routesContent.match(
|
|
@@ -307,7 +307,7 @@ ${route}`);
|
|
|
307
307
|
routerStart,
|
|
308
308
|
`${routerStart + routesBatch + newLineAndIndent}`
|
|
309
309
|
);
|
|
310
|
-
writeFile(
|
|
310
|
+
writeFile(cedarPaths.web.routes, newRoutesContent, {
|
|
311
311
|
overwriteExisting: true
|
|
312
312
|
});
|
|
313
313
|
}
|
|
@@ -340,14 +340,14 @@ const removeEmtpySet = (routesContent, layout) => {
|
|
|
340
340
|
return routesContent.replace(setWithLayoutReg, "");
|
|
341
341
|
};
|
|
342
342
|
const removeRoutesFromRouterTask = (routes, layout) => {
|
|
343
|
-
const
|
|
344
|
-
const routesContent = readFile(
|
|
343
|
+
const cedarPaths = getPaths();
|
|
344
|
+
const routesContent = readFile(cedarPaths.web.routes).toString();
|
|
345
345
|
const newRoutesContent = routes.reduce((content, route) => {
|
|
346
346
|
const matchRouteByName = new RegExp(`\\s*<Route[^>]*name="${route}"[^>]*/>`);
|
|
347
347
|
return content.replace(matchRouteByName, "");
|
|
348
348
|
}, routesContent);
|
|
349
349
|
const routesWithoutEmptySet = layout ? removeEmtpySet(newRoutesContent, layout) : newRoutesContent;
|
|
350
|
-
writeFile(
|
|
350
|
+
writeFile(cedarPaths.web.routes, routesWithoutEmptySet, {
|
|
351
351
|
overwriteExisting: true
|
|
352
352
|
});
|
|
353
353
|
};
|
|
@@ -428,8 +428,8 @@ const getDefaultArgs = (builder) => {
|
|
|
428
428
|
);
|
|
429
429
|
};
|
|
430
430
|
const usingVSCode = () => {
|
|
431
|
-
const
|
|
432
|
-
const VS_CODE_PATH = path.join(
|
|
431
|
+
const cedarPaths = getPaths();
|
|
432
|
+
const VS_CODE_PATH = path.join(cedarPaths.base, ".vscode");
|
|
433
433
|
return fs.existsSync(VS_CODE_PATH);
|
|
434
434
|
};
|
|
435
435
|
const printSetupNotes = (notes) => {
|
package/dist/lib/packages.js
CHANGED
|
@@ -8,7 +8,7 @@ async function installModule(name, version = void 0) {
|
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
10
|
if (version === void 0) {
|
|
11
|
-
return
|
|
11
|
+
return installCedarModule(name);
|
|
12
12
|
} else {
|
|
13
13
|
await execa.command(`yarn add -D ${name}@${version}`, {
|
|
14
14
|
stdio: "inherit",
|
|
@@ -17,7 +17,7 @@ async function installModule(name, version = void 0) {
|
|
|
17
17
|
}
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
20
|
+
async function installCedarModule(module) {
|
|
21
21
|
const packageJson = await import("@cedarjs/cli/package.json", { with: { type: "json" } });
|
|
22
22
|
let version = packageJson.default.version;
|
|
23
23
|
if (!isModuleInstalled(module)) {
|
|
@@ -73,7 +73,7 @@ function isModuleInstalled(module) {
|
|
|
73
73
|
}) ?? false;
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
|
+
installCedarModule,
|
|
76
77
|
installModule,
|
|
77
|
-
installRedwoodModule,
|
|
78
78
|
isModuleInstalled
|
|
79
79
|
};
|
|
@@ -83,7 +83,7 @@ async function getResources() {
|
|
|
83
83
|
"cpu.count": cpu.physicalCores,
|
|
84
84
|
"memory.gb": Math.round(mem.total / 1073741824),
|
|
85
85
|
"env.node_env": process.env.NODE_ENV || null,
|
|
86
|
-
"ci.redwood": !!process.env.
|
|
86
|
+
"ci.redwood": !!process.env.CEDAR_CI,
|
|
87
87
|
"ci.isci": ci.isCI,
|
|
88
88
|
"dev.environment": developmentEnvironment,
|
|
89
89
|
complexity,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2386",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/parser": "7.29.3",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
|
-
"@cedarjs/api-server": "5.0.0-canary.
|
|
37
|
-
"@cedarjs/cli-helpers": "5.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "5.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "5.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "5.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "5.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "5.0.0-canary.
|
|
45
|
-
"@cedarjs/vite": "5.0.0-canary.
|
|
46
|
-
"@cedarjs/web-server": "5.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "5.0.0-canary.2386",
|
|
37
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2386",
|
|
38
|
+
"@cedarjs/fastify-web": "5.0.0-canary.2386",
|
|
39
|
+
"@cedarjs/internal": "5.0.0-canary.2386",
|
|
40
|
+
"@cedarjs/prerender": "5.0.0-canary.2386",
|
|
41
|
+
"@cedarjs/project-config": "5.0.0-canary.2386",
|
|
42
|
+
"@cedarjs/structure": "5.0.0-canary.2386",
|
|
43
|
+
"@cedarjs/telemetry": "5.0.0-canary.2386",
|
|
44
|
+
"@cedarjs/utils": "5.0.0-canary.2386",
|
|
45
|
+
"@cedarjs/vite": "5.0.0-canary.2386",
|
|
46
|
+
"@cedarjs/web-server": "5.0.0-canary.2386",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
48
48
|
"@opentelemetry/api": "1.9.0",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|