create-fuse-app
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -7,3 +7,2 @@ #!/usr/bin/env node | ||
import * as prompts from "@clack/prompts"; | ||
import { install } from "pkg-install"; | ||
import babel from "@babel/core"; | ||
@@ -75,6 +74,63 @@ import * as kl from "kolorist"; | ||
// src/get-package-manager.ts | ||
function getPkgManager() { | ||
const userAgent = process.env.npm_config_user_agent || ""; | ||
if (userAgent.startsWith("yarn")) { | ||
return "yarn"; | ||
} | ||
if (userAgent.startsWith("pnpm")) { | ||
return "pnpm"; | ||
} | ||
if (userAgent.startsWith("bun")) { | ||
return "bun"; | ||
} | ||
return "npm"; | ||
} | ||
// src/install-package.ts | ||
import { execa } from "execa"; | ||
async function install(packageManager, env, packages) { | ||
let args = []; | ||
switch (packageManager) { | ||
case "npm": { | ||
args.push("install"); | ||
if (env === "dev") { | ||
args.push("--save-dev"); | ||
} else { | ||
args.push("--save"); | ||
} | ||
} | ||
case "yarn": { | ||
args.push("add"); | ||
if (env === "dev") { | ||
args.push("-D"); | ||
} | ||
} | ||
case "pnpm": { | ||
args.push("add"); | ||
if (env === "dev") { | ||
args.push("-D"); | ||
} | ||
} | ||
case "bun": { | ||
args.push("add"); | ||
if (env === "dev") { | ||
args.push("-D"); | ||
} | ||
} | ||
} | ||
args.push(...packages); | ||
await execa(packageManager, args, { | ||
stdio: "inherit", | ||
env: { | ||
...process.env, | ||
NODE_ENV: "development" | ||
} | ||
}); | ||
} | ||
// src/index.ts | ||
var s = prompts.spinner(); | ||
async function createFuseApp() { | ||
const packageManager = /yarn/.test(process.env.npm_execpath || "") ? "yarn" : "npm"; | ||
const packageManager = getPkgManager(); | ||
prompts.intro(kl.trueColor(219, 254, 1)("Fuse - Your new datalayer")); | ||
@@ -97,12 +153,7 @@ const targetDir = resolve(process.cwd()); | ||
s.start("Installing fuse..."); | ||
await install(["fuse"], { | ||
prefer: packageManager, | ||
cwd: targetDir, | ||
dev: false | ||
}); | ||
await install(["@0no-co/graphqlsp", "@graphql-typed-document-node/core"], { | ||
prefer: packageManager, | ||
cwd: targetDir, | ||
dev: true | ||
}); | ||
await install(packageManager, "prod", ["fuse"]); | ||
await install(packageManager, "dev", [ | ||
"@0no-co/graphqlsp", | ||
"@graphql-typed-document-node/core" | ||
]); | ||
s.stop(kl.green("Installed fuse!")); | ||
@@ -109,0 +160,0 @@ s.start("Creating API Route..."); |
{ | ||
"name": "create-fuse-app", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "The magical GraphQL framework", | ||
@@ -25,4 +25,4 @@ "homepage": "https://github.com/StellateHQ/fuse.js", | ||
"@clack/prompts": "^0.7.0", | ||
"kolorist": "^1.8.0", | ||
"pkg-install": "^1.0.0" | ||
"execa": "^8.0.1", | ||
"kolorist": "^1.8.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "devDependencies": { |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
13931
358
2
+ Addedexeca@^8.0.1
+ Addedcross-spawn@7.0.6(transitive)
+ Addedexeca@8.0.1(transitive)
+ Addedget-stream@8.0.1(transitive)
+ Addedhuman-signals@5.0.0(transitive)
+ Addedis-stream@3.0.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@4.0.0(transitive)
+ Addednpm-run-path@5.3.0(transitive)
+ Addedonetime@6.0.0(transitive)
+ Addedpath-key@3.1.14.0.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstrip-final-newline@3.0.0(transitive)
+ Addedwhich@2.0.2(transitive)
- Removedpkg-install@^1.0.0
- Removed@types/execa@0.9.0(transitive)
- Removed@types/node@11.15.54(transitive)
- Removedcross-spawn@6.0.6(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedexeca@1.0.0(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removednice-try@1.0.5(transitive)
- Removednpm-run-path@2.0.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpkg-install@1.0.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedsemver@5.7.2(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstrip-eof@1.0.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwrappy@1.0.2(transitive)