create-sprint 0.0.80 → 0.0.82

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,24 @@ export default defineConfig({
53
53
  }
54
54
  ;
55
55
  export function getSprintConfigFile(language, telemetry, swagger, graphql) {
56
+ const swaggerEnabled = swagger ? "true" : "false";
57
+ const graphqlEnabled = graphql ? "true" : "false";
58
+ const graphiqlEnabled = graphql ? '["development"]' : "false";
56
59
  if (language === "typescript") {
57
60
  let config = `import type { SprintOptions } from "sprint-es";
58
61
 
59
62
  export const config: SprintOptions = {
60
63
  openapi: {
61
- enabled: ${swagger},
62
- generateOnBuild: ${swagger},
64
+ enabled: ${swaggerEnabled},
65
+ generateOnBuild: ${swaggerEnabled},
63
66
  swaggerUi: {
64
- enabled: ${swagger}
67
+ enabled: ${swaggerEnabled}
65
68
  }
66
69
  },
67
70
  graphql: {
68
- enabled: ${graphql},
71
+ enabled: ${graphqlEnabled},
69
72
  graphiql: {
70
- enabled: ${graphql}
73
+ enabled: ${graphiqlEnabled}
71
74
  }
72
75
  }
73
76
  };
@@ -99,16 +102,16 @@ initTelemetry({
99
102
  }
100
103
  let config = `export const config = {
101
104
  openapi: {
102
- enabled: ${swagger},
103
- generateOnBuild: ${swagger},
105
+ enabled: ${swaggerEnabled},
106
+ generateOnBuild: ${swaggerEnabled},
104
107
  swaggerUi: {
105
- enabled: ${swagger}
108
+ enabled: ${swaggerEnabled}
106
109
  }
107
110
  },
108
111
  graphql: {
109
- enabled: ${graphql},
112
+ enabled: ${graphqlEnabled},
110
113
  graphiql: {
111
- enabled: ${graphql}
114
+ enabled: ${graphiqlEnabled}
112
115
  }
113
116
  }
114
117
  };
@@ -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.84"
14
14
  };
15
15
  const devDeps = {
16
16
  "@types/node": "^22.0.0",
@@ -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.84"
53
53
  };
54
54
  if (telemetry === "sentry" || telemetry === "glitchtip")
55
55
  deps["@sentry/node"] = "^8.0.0";
@@ -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.82",
4
4
  "description": "Create a new Sprint API project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -53,21 +53,25 @@ 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 graphqlEnabled = graphql ? "true" : "false";
58
+ const graphiqlEnabled = graphql ? '["development"]' : "false";
59
+
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: ${swaggerEnabled}
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
  };
@@ -101,16 +105,16 @@ initTelemetry({
101
105
 
102
106
  let config = `export const config = {
103
107
  openapi: {
104
- enabled: ${swagger},
105
- generateOnBuild: ${swagger},
108
+ enabled: ${swaggerEnabled},
109
+ generateOnBuild: ${swaggerEnabled},
106
110
  swaggerUi: {
107
- enabled: ${swagger}
111
+ enabled: ${swaggerEnabled}
108
112
  }
109
113
  },
110
114
  graphql: {
111
- enabled: ${graphql},
115
+ enabled: ${graphqlEnabled},
112
116
  graphiql: {
113
- enabled: ${graphql}
117
+ enabled: ${graphiqlEnabled}
114
118
  }
115
119
  }
116
120
  };
@@ -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.84"
20
20
  };
21
21
 
22
22
  const devDeps: Record<string, string> = {
@@ -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.84"
60
60
  };
61
61
 
62
62
  if (telemetry === "sentry" || telemetry === "glitchtip") deps["@sentry/node"] = "^8.0.0";
@@ -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);