create-fuse-app
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -111,11 +111,19 @@ #!/usr/bin/env node | ||
if (isUsingSrc) { | ||
const dir = shouldUseAppDir ? resolve(targetDir, "src", "app", "api", "fuse", "route.ts") : resolve(targetDir, "src", "pages", "api", "fuse.ts"); | ||
const apiRoute = shouldUseAppDir ? resolve(targetDir, "src", "app", "api", "fuse", "route.ts") : resolve(targetDir, "src", "pages", "api", "fuse.ts"); | ||
if (shouldUseAppDir) { | ||
await fs.mkdir(resolve(targetDir, "src", "app", "api")); | ||
await fs.mkdir(resolve(targetDir, "src", "app", "api", "fuse")); | ||
const apiFolder = resolve(targetDir, "src", "app", "api"); | ||
if (!existsSync(apiFolder)) | ||
await fs.mkdir(apiFolder); | ||
const fuseDir = resolve(targetDir, "src", "app", "api", "fuse"); | ||
if (!existsSync(fuseDir)) | ||
await fs.mkdir(fuseDir); | ||
} else { | ||
await fs.mkdir(resolve(targetDir, "src", "pages", "api")); | ||
const apiPagesFolder = resolve(targetDir, "src", "pages", "api"); | ||
if (!existsSync(apiPagesFolder)) | ||
await fs.mkdir(apiPagesFolder); | ||
} | ||
await fs.writeFile(dir, apiRouteSnippet); | ||
await fs.mkdir(resolve(targetDir, "src", "types")); | ||
await fs.writeFile(apiRoute, apiRouteSnippet); | ||
if (!existsSync(resolve(targetDir, "src", "types"))) { | ||
await fs.mkdir(resolve(targetDir, "src", "types")); | ||
} | ||
await fs.writeFile( | ||
@@ -126,11 +134,19 @@ resolve(targetDir, "src", "types", "User.ts"), | ||
} else { | ||
const dir = shouldUseAppDir ? resolve(targetDir, "app", "api", "fuse", "route.ts") : resolve(targetDir, "pages", "api", "fuse.ts"); | ||
const apiRoute = shouldUseAppDir ? resolve(targetDir, "app", "api", "fuse", "route.ts") : resolve(targetDir, "pages", "api", "fuse.ts"); | ||
if (shouldUseAppDir) { | ||
await fs.mkdir(resolve(targetDir, "app", "api")); | ||
await fs.mkdir(resolve(targetDir, "app", "api", "fuse")); | ||
const apiFolder = resolve(targetDir, "app", "api"); | ||
if (!existsSync(apiFolder)) | ||
await fs.mkdir(apiFolder); | ||
const fuseDir = resolve(targetDir, "app", "api", "fuse"); | ||
if (!existsSync(fuseDir)) | ||
await fs.mkdir(fuseDir); | ||
} else { | ||
await fs.mkdir(resolve(targetDir, "pages", "api")); | ||
const apiPagesFolder = resolve(targetDir, "pages", "api"); | ||
if (!existsSync(apiPagesFolder)) | ||
await fs.mkdir(apiPagesFolder); | ||
} | ||
await fs.writeFile(dir, apiRouteSnippet); | ||
await fs.mkdir(resolve(targetDir, "types")); | ||
await fs.writeFile(apiRoute, apiRouteSnippet); | ||
if (!existsSync(resolve(targetDir, "types"))) { | ||
await fs.mkdir(resolve(targetDir, "types")); | ||
} | ||
await fs.writeFile( | ||
@@ -200,3 +216,5 @@ resolve(targetDir, "types", "User.ts"), | ||
} else { | ||
await fs.mkdir(resolve(targetDir, ".vscode")); | ||
if (!existsSync(resolve(targetDir, ".vscode"))) { | ||
await fs.mkdir(resolve(targetDir, ".vscode")); | ||
} | ||
await fs.writeFile( | ||
@@ -208,31 +226,33 @@ resolve(targetDir, ".vscode", "settings.json"), | ||
} | ||
const tsConfigFile = await fs.readFile( | ||
resolve(targetDir, "tsconfig.json"), | ||
"utf-8" | ||
); | ||
const tsConfig = JSON.parse(tsConfigFile); | ||
if (!tsConfig.compilerOptions?.plugins?.find( | ||
(plugin2) => plugin2.name === "@0no-co/graphqlsp" | ||
)) { | ||
const updatedTsConfig = { | ||
...tsConfig, | ||
compilerOptions: { | ||
...tsConfig.compilerOptions, | ||
plugins: [ | ||
...tsConfig.compilerOptions?.plugins || [], | ||
{ | ||
name: "@0no-co/graphqlsp", | ||
schema: "./schema.graphql", | ||
disableTypegen: true, | ||
templateIsCallExpression: true, | ||
template: "graphql" | ||
} | ||
] | ||
} | ||
}; | ||
await fs.writeFile( | ||
if (existsSync(resolve(targetDir, "tsconfig.json"))) { | ||
const tsConfigFile = await fs.readFile( | ||
resolve(targetDir, "tsconfig.json"), | ||
JSON.stringify(updatedTsConfig, void 0, 2), | ||
"utf-8" | ||
); | ||
const tsConfig = JSON.parse(tsConfigFile); | ||
if (!tsConfig.compilerOptions?.plugins?.find( | ||
(plugin2) => plugin2.name === "@0no-co/graphqlsp" | ||
)) { | ||
const updatedTsConfig = { | ||
...tsConfig, | ||
compilerOptions: { | ||
...tsConfig.compilerOptions, | ||
plugins: [ | ||
...tsConfig.compilerOptions?.plugins || [], | ||
{ | ||
name: "@0no-co/graphqlsp", | ||
schema: "./schema.graphql", | ||
disableTypegen: true, | ||
templateIsCallExpression: true, | ||
template: "graphql" | ||
} | ||
] | ||
} | ||
}; | ||
await fs.writeFile( | ||
resolve(targetDir, "tsconfig.json"), | ||
JSON.stringify(updatedTsConfig, void 0, 2), | ||
"utf-8" | ||
); | ||
} | ||
} | ||
@@ -239,0 +259,0 @@ s.stop(kl.green("Added Fuse plugin to next config!")); |
{ | ||
"name": "create-fuse-app", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "The magical GraphQL framework", | ||
@@ -35,3 +35,4 @@ "homepage": "https://github.com/StellateHQ/fuse.js", | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
@@ -38,0 +39,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
12967
4
309
1
17