@cedarjs/cli 6.0.0-canary.2661 → 6.0.0-canary.2663

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.
@@ -16,6 +16,10 @@ import {
16
16
  mysqlDatabaseService
17
17
  } from "../templates/flightcontrol.js";
18
18
  const { getConfig } = prismaInternals;
19
+ const APOLLO_PROVIDER_COMPONENT_NAMES = [
20
+ "CedarApolloProvider",
21
+ "RedwoodApolloProvider"
22
+ ];
19
23
  const getFlightcontrolJson = async (database) => {
20
24
  const flightcontrolConfig = getFlightcontrolConfig();
21
25
  if (database === "none") {
@@ -205,18 +209,26 @@ const updateApp = () => {
205
209
  appContent[authLineIndex] = ` <AuthProvider type="dbAuth" config={{ fetchConfig: { credentials: 'include' } }}>
206
210
  `;
207
211
  }
208
- const gqlLineIndex = appContent.findIndex(
209
- (line) => line.includes("<RedwoodApolloProvider")
210
- );
212
+ let gqlLineIndex = -1;
213
+ let apolloProviderComponentName = "";
214
+ for (const componentName of APOLLO_PROVIDER_COMPONENT_NAMES) {
215
+ gqlLineIndex = appContent.findIndex(
216
+ (line) => line.includes(`<${componentName}`)
217
+ );
218
+ if (gqlLineIndex !== -1) {
219
+ apolloProviderComponentName = componentName;
220
+ break;
221
+ }
222
+ }
211
223
  if (gqlLineIndex === -1) {
212
224
  console.log(`
213
- Couldn't find <RedwoodApolloProvider in web/src/App.js
225
+ Couldn't find <CedarApolloProvider in web/src/App.js
214
226
  If (and when) you use *dbAuth*, you'll have to add the following fetch config manually:
215
227
 
216
228
  graphQLClientConfig={{ httpLinkConfig: { credentials: 'include' }}}
217
229
  `);
218
230
  } else if (appContent.toString().match(/dbAuth/)) {
219
- appContent[gqlLineIndex] = ` <RedwoodApolloProvider graphQLClientConfig={{ httpLinkConfig: { credentials: 'include' }}} >
231
+ appContent[gqlLineIndex] = ` <${apolloProviderComponentName} graphQLClientConfig={{ httpLinkConfig: { credentials: 'include' }}} >
220
232
  `;
221
233
  }
222
234
  fs.writeFileSync(appPath, appContent.join(EOL));
@@ -16,8 +16,11 @@ function isPropertyWithName(node, name) {
16
16
  function transform(file, api) {
17
17
  const j = api.jscodeshift;
18
18
  const root = j(file.source);
19
- const redwoodApolloProvider = root.findJSXElements("RedwoodApolloProvider");
20
- const graphQLClientConfigCollection = redwoodApolloProvider.find(
19
+ let apolloProviderElements = root.findJSXElements("CedarApolloProvider");
20
+ if (apolloProviderElements.length === 0) {
21
+ apolloProviderElements = root.findJSXElements("RedwoodApolloProvider");
22
+ }
23
+ const graphQLClientConfigCollection = apolloProviderElements.find(
21
24
  j.JSXAttribute,
22
25
  {
23
26
  name: { name: "graphQLClientConfig" }
@@ -104,7 +107,7 @@ function transform(file, api) {
104
107
  cacheConfigValue.properties.push(property);
105
108
  }
106
109
  graphQLClientConfigCollection.remove();
107
- redwoodApolloProvider.get(0).node.openingElement.attributes.push(
110
+ apolloProviderElements.get(0).node.openingElement.attributes.push(
108
111
  j.jsxAttribute(
109
112
  j.jsxIdentifier("graphQLClientConfig"),
110
113
  j.jsxExpressionContainer(j.identifier(graphQLClientConfigVariableName))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "6.0.0-canary.2661",
3
+ "version": "6.0.0-canary.2663",
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.7",
35
35
  "@babel/preset-typescript": "7.29.7",
36
- "@cedarjs/api-server": "6.0.0-canary.2661",
37
- "@cedarjs/cli-helpers": "6.0.0-canary.2661",
38
- "@cedarjs/fastify-web": "6.0.0-canary.2661",
39
- "@cedarjs/internal": "6.0.0-canary.2661",
40
- "@cedarjs/prerender": "6.0.0-canary.2661",
41
- "@cedarjs/project-config": "6.0.0-canary.2661",
42
- "@cedarjs/structure": "6.0.0-canary.2661",
43
- "@cedarjs/telemetry": "6.0.0-canary.2661",
44
- "@cedarjs/utils": "6.0.0-canary.2661",
45
- "@cedarjs/vite": "6.0.0-canary.2661",
46
- "@cedarjs/web-server": "6.0.0-canary.2661",
36
+ "@cedarjs/api-server": "6.0.0-canary.2663",
37
+ "@cedarjs/cli-helpers": "6.0.0-canary.2663",
38
+ "@cedarjs/fastify-web": "6.0.0-canary.2663",
39
+ "@cedarjs/internal": "6.0.0-canary.2663",
40
+ "@cedarjs/prerender": "6.0.0-canary.2663",
41
+ "@cedarjs/project-config": "6.0.0-canary.2663",
42
+ "@cedarjs/structure": "6.0.0-canary.2663",
43
+ "@cedarjs/telemetry": "6.0.0-canary.2663",
44
+ "@cedarjs/utils": "6.0.0-canary.2663",
45
+ "@cedarjs/vite": "6.0.0-canary.2663",
46
+ "@cedarjs/web-server": "6.0.0-canary.2663",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.1",
49
49
  "@opentelemetry/core": "1.30.1",