create-fuse-app
Advanced tools
Comparing version 0.6.0 to 0.7.0
# create-fuse-app | ||
## 0.7.0 | ||
### Minor Changes | ||
- db8b67d: Support creating a fuse app in an empty directory | ||
## 0.6.0 | ||
@@ -4,0 +10,0 @@ |
@@ -136,14 +136,37 @@ #!/usr/bin/env node | ||
import { parse, stringify } from "comment-json"; | ||
import { execa as execa2 } from "execa"; | ||
var s = prompts.spinner(); | ||
var ensurePackageJson = async (targetDir) => { | ||
if (!existsSync(resolve(targetDir, "package.json"))) { | ||
await execa2("npm", ["init", "-y", "--silent"], { | ||
stdio: "inherit", | ||
env: process.env | ||
}); | ||
} | ||
}; | ||
var ensureTsConfig = async (targetDir) => { | ||
if (!existsSync(resolve(targetDir, "tsconfig.json"))) { | ||
await fs.writeFile(resolve(targetDir, "tsconfig.json"), defaultTsConfig); | ||
return false; | ||
} | ||
return true; | ||
}; | ||
async function createFuseApp() { | ||
const packageManager = getPkgManager(); | ||
prompts.intro(kl.trueColor(219, 254, 1)("Fuse - Your new API")); | ||
const targetDir = resolve(process.cwd()); | ||
await ensurePackageJson(targetDir); | ||
const hasTsConfig = await ensureTsConfig(targetDir); | ||
s.start("Installing fuse..."); | ||
await install(packageManager, "prod", ["fuse", "gql.tada", "graphql"]); | ||
await install(packageManager, "dev", [ | ||
"@0no-co/graphqlsp", | ||
"@graphql-typed-document-node/core" | ||
]); | ||
await install( | ||
packageManager, | ||
"dev", | ||
[ | ||
"@0no-co/graphqlsp", | ||
"@graphql-typed-document-node/core", | ||
hasTsConfig ? "" : "typescript" | ||
].filter(Boolean) | ||
); | ||
s.stop(kl.green("Installed fuse!")); | ||
const targetDir = resolve(process.cwd()); | ||
const packageJson = await fs.readFile( | ||
@@ -162,9 +185,9 @@ resolve(targetDir, "package.json"), | ||
export const getContext = ( | ||
ctx: InitialContext, | ||
): GetContext<{ ua: string | null }> => { | ||
return { | ||
ua: ctx.request.headers.get('user-agent'), | ||
} | ||
} | ||
export const getContext = ( | ||
ctx: InitialContext, | ||
): GetContext<{ ua: string | null }> => { | ||
return { | ||
ua: ctx.request.headers.get('user-agent'), | ||
} | ||
} | ||
`; | ||
@@ -401,1 +424,31 @@ await fs.writeFile(resolve(targetDir, "_context.ts"), contextCopy); | ||
} | ||
var defaultTsConfig = `{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
"paths": { | ||
"@/*": ["./*"] | ||
}, | ||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["./**/*.ts"], | ||
"exclude": [ | ||
"node_modules/**/*" | ||
] | ||
}`; |
{ | ||
"name": "create-fuse-app", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "The magical GraphQL framework", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/StellateHQ/fuse", |
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
17226
438
3