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

@apphosting/discover

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apphosting/discover - npm Package Compare versions

Comparing version 0.1.0-canary.a076bd8 to 0.1.0-canary.a4c33c9

2

dist/index.d.ts

@@ -9,3 +9,3 @@ export declare const PLATFORMS: readonly [readonly ["nodejs", readonly ["package.json"], "npm", readonly [readonly ["npm", readonly ["npm-shrinkwrap.json", "package-lock.json"]], readonly ["yarn", readonly ["yarn.lock"]], readonly ["pnpm", readonly ["pnpm-lock.yaml"]]], readonly [readonly ["nextjs", readonly ["next"], readonly [], readonly ["react"]], readonly ["angular", readonly ["@angular/core"], readonly ["angular.json"], readonly ["vite"]], readonly ["astro", readonly ["astro"], readonly ["astro.config.js", "astro.config.mjs", "astro.config.cjs", "astro.config.ts"], readonly ["lit", "react", "preact", "svelte", "vue", "vite"]], readonly ["nuxt", readonly ["nuxt"], readonly ["nuxt.config.js"], readonly ["vue"]], readonly ["lit", readonly ["lit", "lit-element"], readonly [], readonly []], readonly ["vue", readonly ["vue"], readonly [], readonly []], readonly ["vite", readonly ["vite"], readonly [], readonly ["vue", "react", "preact", "lit", "svelte"]], readonly ["preact", readonly ["preact"], readonly [], readonly []], readonly ["react", readonly ["react", "react-dom"], readonly [], readonly []], readonly ["svelte", readonly ["svelte"], readonly [], readonly []], readonly ["sveltekit", readonly ["@sveltejs/kit"], readonly [], readonly ["svelte", "vite"]]]], readonly ["python", readonly [], "pip", readonly [readonly ["pip", readonly []], readonly ["pipenv", readonly ["Pipfile.lock"]], readonly ["poetry", readonly ["poetry.lock"]]], readonly [readonly ["flask", readonly ["flask"], readonly [], readonly []], readonly ["django", readonly ["django"], readonly [], readonly []]]]];

};
export declare function discover(path: string, githubRepo?: string, githubToken?: string): Promise<DiscoveredFramework[]>;
export declare function discover(directory: string, githubRepo?: string, githubToken?: string): Promise<DiscoveredFramework[]>;
export {};

@@ -54,6 +54,6 @@ import fsExtra from "fs-extra";

];
export async function discover(path, githubRepo, githubToken) {
export async function discover(directory, githubRepo, githubToken) {
if (githubRepo && !githubToken)
throw new Error("needs token");
const { join } = await (githubRepo ? import("node:path") : import("node:path/posix"));
const path = await (githubRepo ? import("node:path") : import("node:path/posix"));
const { readFile, pathExists, readJson } = githubRepo

@@ -97,3 +97,3 @@ ? {

await Promise.all(PLATFORMS.map(async ([platform, files, defaultPackageManager, packageManagers, frameworkDefinitions]) => {
const filesExist = await Promise.all(files.map((it) => pathExists(join(path, it))));
const filesExist = await Promise.all(files.map((it) => pathExists(path.join(directory, it))));
if (files.length && !filesExist.some((it) => it))

@@ -103,3 +103,3 @@ return;

return async ([packageManager, possibleLockfiles]) => {
const possibleLockfilesExist = await Promise.all(possibleLockfiles.map((it) => pathExists(join(path, it))));
const possibleLockfilesExist = await Promise.all(possibleLockfiles.map((it) => pathExists(path.join(directory, it))));
const [lockfile] = possibleLockfilesExist

@@ -114,3 +114,3 @@ .map((exists, index) => (exists ? possibleLockfiles[index] : undefined))

if (lockfile === "package-lock.json" || lockfile === "npm-shrinkwrap.json") {
const packageJSON = await readJson(join(path, lockfile));
const packageJSON = await readJson(path.join(directory, lockfile));
packages = new Map(Object.keys(packageJSON.packages).map((pkg) => {

@@ -123,3 +123,3 @@ const name = pkg.replace(/^node_modules\//, "");

else if (lockfile === "yarn.lock") {
const file = await readFile(join(path, lockfile));
const file = await readFile(path.join(directory, lockfile));
const yarnLock = YarnLockfile.parse(file.toString());

@@ -135,3 +135,3 @@ if (yarnLock.type !== "success")

else if (lockfile === "pnpm-lock.yaml") {
const file = await readFile(join(path, lockfile));
const file = await readFile(path.join(directory, lockfile));
const pnpmLock = parseYaml(file.toString());

@@ -148,6 +148,6 @@ packages = new Map(Object.keys(pnpmLock.packages).map((pkg) => {

const requirementsFile = "requirements.txt";
const requirementsFileExists = await pathExists(join(path, requirementsFile));
const requirementsFileExists = await pathExists(path.join(directory, requirementsFile));
if (!requirementsFileExists)
return false;
const file = await readFile(join(path, requirementsFile));
const file = await readFile(path.join(directory, requirementsFile));
packages = new Map(file

@@ -161,3 +161,3 @@ .toString()

else if (lockfile === "Pipfile.lock") {
const pipfileLock = await readJson(join(path, lockfile));
const pipfileLock = await readJson(path.join(directory, lockfile));
// TODO include develop too?

@@ -171,3 +171,3 @@ packages = new Map(Object.keys(pipfileLock.default).map((name) => {

else if (lockfile === "poetry.lock") {
const poetryLock = await readFile(join(path, lockfile));
const poetryLock = await readFile(path.join(directory, lockfile));
packages = new Map(toml

@@ -183,3 +183,3 @@ .parse(poetryLock.toString())

const requiredFileExist = requiredFiles.length === 0 ||
(await Promise.all(requiredFiles.map((it) => pathExists(join(path, it))))).some((it) => it);
(await Promise.all(requiredFiles.map((it) => pathExists(path.join(directory, it))))).some((it) => it);
if (!requiredFileExist)

@@ -186,0 +186,0 @@ continue;

{
"name": "@apphosting/discover",
"version": "0.1.0-canary.a076bd8",
"version": "0.1.0-canary.a4c33c9",
"main": "dist/index.js",

@@ -42,4 +42,5 @@ "description": "Experimental addon to the Firebase CLI to add web framework support",

"npm-pick-manifest": "^9.0.0",
"toml": "^3.0.0",
"ts-node": "^10.9.1",
"toml": "^3.0.0"
"yaml": "^2.3.4"
},

@@ -50,3 +51,9 @@ "devDependencies": {

"@types/yarnpkg__lockfile": "*"
},
"publishConfig": {
"tag": "canary",
"registry": "https://registry.npmjs.org",
"provenance": true,
"access": "public"
}
}
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