Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apphosting/create

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apphosting/create - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

47

dist/bin/create.js

@@ -7,9 +7,14 @@ #! /usr/bin/env node

import ora from "ora";
console.log(process);
const contextIsNpmCreate = process.env.npm_command === "init";
// npm/10.1.0 node/v20.9.0 darwin x64 workspaces/false
// pnpm/9.1.0 npm/? node/v20.9.0 darwin x64
// yarn/1.7.0 npm/? node/v8.9.4 darwin x64
const npmUserAgent = process.env.npm_config_user_agent
? Object.fromEntries(process.env.npm_config_user_agent.split(" ").map((s) => s.split("/")))
: {};
program
.option("--framework <string>")
.option("--package-manager <string>")
.option("--skip-install")
.argument("<directory>", "path to the project's root directory")
.action(async (dir, { framework, packageManager, skipInstall, }) => {
.action(async (dir, { framework, packageManager }) => {
// TODO DRY up the validation and error handling, move to commander parse

@@ -31,8 +36,6 @@ if (framework) {

}
const cloneSpinner = ora("Cloning template...").start();
// TODO allow different templates
await downloadTemplate(`gh:FirebaseExtended/firebase-framework-tools/starters/${framework}/basic`, { dir, force: true });
cloneSpinner.succeed();
// TODO DRY up validation and error message, move to commander parse
let packageManagerVersion = "*";
if (packageManager) {
[packageManager, packageManagerVersion = "*"] = packageManager.split("@");
if (!["npm", "yarn", "pnpm"].includes(packageManager)) {

@@ -43,2 +46,13 @@ console.error(`Invalid package manager: ${packageManager}, valid choices are npm, yarn, and pnpm`);

}
else if (contextIsNpmCreate) {
packageManager = "npm";
}
else if (npmUserAgent.yarn) {
packageManager = "yarn";
packageManagerVersion = npmUserAgent.yarn;
}
else if (npmUserAgent.pnpm) {
packageManager = "pnpm";
packageManagerVersion = npmUserAgent.pnpm;
}
else {

@@ -55,4 +69,9 @@ packageManager = await select({

}
if (packageManager !== "npm") {
await spawn("corepack", ["enable"], {
const cloneSpinner = ora("Cloning template...").start();
// TODO allow different templates
await downloadTemplate(`gh:FirebaseExtended/firebase-framework-tools/starters/${framework}/basic`, { dir, force: true });
cloneSpinner.succeed();
if (packageManager === "npm") {
console.log(`> ${packageManager} install`);
await spawn(packageManager, ["install"], {
shell: true,

@@ -62,3 +81,5 @@ stdio: "inherit",

});
await spawn("corepack", ["use", `${packageManager}@*`], {
}
else {
await spawn("corepack", ["enable"], {
shell: true,

@@ -68,6 +89,3 @@ stdio: "inherit",

});
}
if (!skipInstall) {
const installSpinner = ora("Installing dependencies...").start();
await spawn(packageManager, ["install"], {
await spawn("corepack", ["use", `${packageManager}@${packageManagerVersion}`], {
shell: true,

@@ -77,5 +95,4 @@ stdio: "inherit",

});
installSpinner.succeed();
}
});
program.parse();
{
"name": "@apphosting/create",
"version": "0.1.0",
"version": "0.2.0",
"main": "dist/index.js",

@@ -11,3 +11,3 @@ "description": "Experimental addon to the Firebase CLI to add web framework support",

"bin": {
"@apphosting/create": "dist/bin/create.js"
"apphosting-create": "dist/bin/create.js"
},

@@ -14,0 +14,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc