create-sprint 0.0.80 → 0.0.84

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.
@@ -53,21 +53,25 @@ export default defineConfig({
53
53
  }
54
54
  ;
55
55
  export function getSprintConfigFile(language, telemetry, swagger, graphql) {
56
+ const swaggerEnabled = swagger ? "true" : "false";
57
+ const swaggerUiEnabled = swagger ? '["development"]' : "false";
58
+ const graphqlEnabled = graphql ? "true" : "false";
59
+ const graphiqlEnabled = graphql ? '["development"]' : "false";
56
60
  if (language === "typescript") {
57
61
  let config = `import type { SprintOptions } from "sprint-es";
58
62
 
59
63
  export const config: SprintOptions = {
60
64
  openapi: {
61
- enabled: ${swagger},
62
- generateOnBuild: ${swagger},
65
+ enabled: ${swaggerEnabled},
66
+ generateOnBuild: ${swaggerEnabled},
63
67
  swaggerUi: {
64
- enabled: ${swagger}
68
+ enabled: ${swaggerUiEnabled}
65
69
  }
66
70
  },
67
71
  graphql: {
68
- enabled: ${graphql},
72
+ enabled: ${graphqlEnabled},
69
73
  graphiql: {
70
- enabled: ${graphql}
74
+ enabled: ${graphiqlEnabled}
71
75
  }
72
76
  }
73
77
  };
@@ -99,16 +103,16 @@ initTelemetry({
99
103
  }
100
104
  let config = `export const config = {
101
105
  openapi: {
102
- enabled: ${swagger},
103
- generateOnBuild: ${swagger},
106
+ enabled: ${swaggerEnabled},
107
+ generateOnBuild: ${swaggerEnabled},
104
108
  swaggerUi: {
105
- enabled: ${swagger}
109
+ enabled: ${swaggerUiEnabled}
106
110
  }
107
111
  },
108
112
  graphql: {
109
- enabled: ${graphql},
113
+ enabled: ${graphqlEnabled},
110
114
  graphiql: {
111
- enabled: ${graphql}
115
+ enabled: ${graphiqlEnabled}
112
116
  }
113
117
  }
114
118
  };
@@ -1,5 +1,6 @@
1
1
  export function getGraphQLFiles(language) {
2
- const ext = language === "typescript" ? "ts" : "js";
2
+ const isTs = language === "typescript";
3
+ const ext = isTs ? "" : ".js";
3
4
  return {
4
5
  "types.ts": `import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLNonNull } from "graphql";
5
6
 
@@ -13,7 +14,7 @@ export const UserType = new GraphQLObjectType({
13
14
  });
14
15
  `,
15
16
  "resolvers.ts": `import { GraphQLString, GraphQLList, GraphQLNonNull } from "graphql";
16
- import { UserType } from "./types.js";
17
+ import { UserType } from "./types${ext}";
17
18
 
18
19
  export const users = [
19
20
  { id: "1", name: "John Doe", email: "john@example.com" },
@@ -54,8 +55,7 @@ export const mutations = {
54
55
  };
55
56
  `,
56
57
  "schema.ts": `import { GraphQLSchema, GraphQLObjectType } from "graphql";
57
- import { queries } from "./resolvers.js";
58
- import { mutations } from "./resolvers.js";
58
+ import { queries, mutations } from "./resolvers${ext}";
59
59
 
60
60
  const Query = new GraphQLObjectType({
61
61
  name: "Query",
@@ -10,7 +10,7 @@ export function generateJWTKeys() {
10
10
  ;
11
11
  export function getTypeScriptPackageJson(name, telemetry, swagger, graphql) {
12
12
  const deps = {
13
- "sprint-es": "^0.0.83"
13
+ "sprint-es": "^0.0.85"
14
14
  };
15
15
  const devDeps = {
16
16
  "@types/node": "^22.0.0",
@@ -26,9 +26,9 @@ export function getTypeScriptPackageJson(name, telemetry, swagger, graphql) {
26
26
  if (swagger)
27
27
  devDeps["@types/swagger-ui-express"] = "^4.1.8";
28
28
  if (graphql) {
29
- deps["graphql"] = "^16.9.0";
30
- deps["graphql-http"] = "^1.22.0";
31
- deps["ruru"] = "^1.1.0";
29
+ deps["graphql"] = "^16.13.0";
30
+ deps["graphql-http"] = "^1.22.4";
31
+ deps["ruru"] = "^2.0.0-rc.6";
32
32
  }
33
33
  return {
34
34
  name: name === "." ? "sprint-app" : name,
@@ -49,7 +49,7 @@ export function getTypeScriptPackageJson(name, telemetry, swagger, graphql) {
49
49
  ;
50
50
  export function getJavaScriptPackageJson(name, telemetry, swagger, graphql) {
51
51
  const deps = {
52
- "sprint-es": "^0.0.83"
52
+ "sprint-es": "^0.0.85"
53
53
  };
54
54
  if (telemetry === "sentry" || telemetry === "glitchtip")
55
55
  deps["@sentry/node"] = "^8.0.0";
@@ -58,9 +58,9 @@ export function getJavaScriptPackageJson(name, telemetry, swagger, graphql) {
58
58
  if (swagger)
59
59
  deps["swagger-ui-express"] = "^5.0.0";
60
60
  if (graphql) {
61
- deps["graphql"] = "^16.9.0";
62
- deps["graphql-http"] = "^1.22.0";
63
- deps["ruru"] = "^1.1.0";
61
+ deps["graphql"] = "^16.13.0";
62
+ deps["graphql-http"] = "^1.22.4";
63
+ deps["ruru"] = "^2.0.0-rc.6";
64
64
  }
65
65
  return {
66
66
  name: name === "." ? "sprint-app" : name,
@@ -1,9 +1,10 @@
1
1
  export function getMainFile(language, graphql = false) {
2
- const ext = language === "typescript" ? "ts" : "js";
3
- if (language === "typescript") {
2
+ const isTs = language === "typescript";
3
+ const ext = isTs ? "" : ".js";
4
+ if (isTs) {
4
5
  if (graphql) {
5
6
  return `import Sprint from "sprint-es";
6
- import { graphqlSchema } from "./graphql/schema.js";
7
+ import { graphqlSchema } from "./graphql/schema";
7
8
 
8
9
  const app = new Sprint();
9
10
  app.setGraphQLSchema(graphqlSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sprint",
3
- "version": "0.0.80",
3
+ "version": "0.0.84",
4
4
  "description": "Create a new Sprint API project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -53,21 +53,26 @@ export default defineConfig({
53
53
  };
54
54
 
55
55
  export function getSprintConfigFile(language: string, telemetry: string, swagger: boolean, graphql: boolean) {
56
+ const swaggerEnabled = swagger ? "true" : "false";
57
+ const swaggerUiEnabled = swagger ? '["development"]' : "false";
58
+ const graphqlEnabled = graphql ? "true" : "false";
59
+ const graphiqlEnabled = graphql ? '["development"]' : "false";
60
+
56
61
  if (language === "typescript") {
57
62
  let config = `import type { SprintOptions } from "sprint-es";
58
63
 
59
64
  export const config: SprintOptions = {
60
65
  openapi: {
61
- enabled: ${swagger},
62
- generateOnBuild: ${swagger},
66
+ enabled: ${swaggerEnabled},
67
+ generateOnBuild: ${swaggerEnabled},
63
68
  swaggerUi: {
64
- enabled: ${swagger}
69
+ enabled: ${swaggerUiEnabled}
65
70
  }
66
71
  },
67
72
  graphql: {
68
- enabled: ${graphql},
73
+ enabled: ${graphqlEnabled},
69
74
  graphiql: {
70
- enabled: ${graphql}
75
+ enabled: ${graphiqlEnabled}
71
76
  }
72
77
  }
73
78
  };
@@ -101,16 +106,16 @@ initTelemetry({
101
106
 
102
107
  let config = `export const config = {
103
108
  openapi: {
104
- enabled: ${swagger},
105
- generateOnBuild: ${swagger},
109
+ enabled: ${swaggerEnabled},
110
+ generateOnBuild: ${swaggerEnabled},
106
111
  swaggerUi: {
107
- enabled: ${swagger}
112
+ enabled: ${swaggerUiEnabled}
108
113
  }
109
114
  },
110
115
  graphql: {
111
- enabled: ${graphql},
116
+ enabled: ${graphqlEnabled},
112
117
  graphiql: {
113
- enabled: ${graphql}
118
+ enabled: ${graphiqlEnabled}
114
119
  }
115
120
  }
116
121
  };
@@ -1,5 +1,6 @@
1
1
  export function getGraphQLFiles(language: string) {
2
- const ext = language === "typescript" ? "ts" : "js";
2
+ const isTs = language === "typescript";
3
+ const ext = isTs ? "" : ".js";
3
4
 
4
5
  return {
5
6
  "types.ts": `import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLNonNull } from "graphql";
@@ -14,7 +15,7 @@ export const UserType = new GraphQLObjectType({
14
15
  });
15
16
  `,
16
17
  "resolvers.ts": `import { GraphQLString, GraphQLList, GraphQLNonNull } from "graphql";
17
- import { UserType } from "./types.js";
18
+ import { UserType } from "./types${ext}";
18
19
 
19
20
  export const users = [
20
21
  { id: "1", name: "John Doe", email: "john@example.com" },
@@ -55,8 +56,7 @@ export const mutations = {
55
56
  };
56
57
  `,
57
58
  "schema.ts": `import { GraphQLSchema, GraphQLObjectType } from "graphql";
58
- import { queries } from "./resolvers.js";
59
- import { mutations } from "./resolvers.js";
59
+ import { queries, mutations } from "./resolvers${ext}";
60
60
 
61
61
  const Query = new GraphQLObjectType({
62
62
  name: "Query",
@@ -16,7 +16,7 @@ export function generateJWTKeys(): JWTKeys {
16
16
 
17
17
  export function getTypeScriptPackageJson(name: string, telemetry: string, swagger: boolean, graphql: boolean) {
18
18
  const deps: Record<string, string> = {
19
- "sprint-es": "^0.0.83"
19
+ "sprint-es": "^0.0.85"
20
20
  };
21
21
 
22
22
  const devDeps: Record<string, string> = {
@@ -32,9 +32,9 @@ export function getTypeScriptPackageJson(name: string, telemetry: string, swagge
32
32
  if (swagger) devDeps["@types/swagger-ui-express"] = "^4.1.8";
33
33
 
34
34
  if (graphql) {
35
- deps["graphql"] = "^16.9.0";
36
- deps["graphql-http"] = "^1.22.0";
37
- deps["ruru"] = "^1.1.0";
35
+ deps["graphql"] = "^16.13.0";
36
+ deps["graphql-http"] = "^1.22.4";
37
+ deps["ruru"] = "^2.0.0-rc.6";
38
38
  }
39
39
 
40
40
  return {
@@ -56,7 +56,7 @@ export function getTypeScriptPackageJson(name: string, telemetry: string, swagge
56
56
 
57
57
  export function getJavaScriptPackageJson(name: string, telemetry: string, swagger: boolean, graphql: boolean) {
58
58
  const deps: Record<string, string> = {
59
- "sprint-es": "^0.0.83"
59
+ "sprint-es": "^0.0.85"
60
60
  };
61
61
 
62
62
  if (telemetry === "sentry" || telemetry === "glitchtip") deps["@sentry/node"] = "^8.0.0";
@@ -65,9 +65,9 @@ export function getJavaScriptPackageJson(name: string, telemetry: string, swagge
65
65
  if (swagger) deps["swagger-ui-express"] = "^5.0.0";
66
66
 
67
67
  if (graphql) {
68
- deps["graphql"] = "^16.9.0";
69
- deps["graphql-http"] = "^1.22.0";
70
- deps["ruru"] = "^1.1.0";
68
+ deps["graphql"] = "^16.13.0";
69
+ deps["graphql-http"] = "^1.22.4";
70
+ deps["ruru"] = "^2.0.0-rc.6";
71
71
  }
72
72
 
73
73
  return {
@@ -1,10 +1,11 @@
1
1
  export function getMainFile(language: string, graphql: boolean = false) {
2
- const ext = language === "typescript" ? "ts" : "js";
2
+ const isTs = language === "typescript";
3
+ const ext = isTs ? "" : ".js";
3
4
 
4
- if (language === "typescript") {
5
+ if (isTs) {
5
6
  if (graphql) {
6
7
  return `import Sprint from "sprint-es";
7
- import { graphqlSchema } from "./graphql/schema.js";
8
+ import { graphqlSchema } from "./graphql/schema";
8
9
 
9
10
  const app = new Sprint();
10
11
  app.setGraphQLSchema(graphqlSchema);