New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shenanigans-manager

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shenanigans-manager - npm Package Compare versions

Comparing version 0.2.10 to 0.2.11

2

package.json
{
"name": "shenanigans-manager",
"version": "0.2.10",
"version": "0.2.11",
"description": "Manages large-scale operations on FullScreenShenanigans project.",

@@ -5,0 +5,0 @@ "bin": {

@@ -10,3 +10,3 @@ const glob = require("glob");

{
entry: `./src/${package.shenanigans.name}.js`,
entry: `./src/index.js`,
name: package.shenanigans.name,

@@ -45,5 +45,4 @@ sources: [

// multiple entries?
module.exports = {
entry, // IDictionary<string>
entry,
externals,

@@ -50,0 +49,0 @@ output: {

@@ -18,23 +18,2 @@ "use strict";

/**
* Recursively gets the names of all a package's dependencies.
*
* @param basePackageLocation Locatino of a package's package.json.
* @returns Promise for the names of all the package's dependencies.
*/
const getDependencyNamesOfPackage = (basePackageLocation) => __awaiter(this, void 0, void 0, function* () {
const { dependencies, shenanigans } = yield utils_1.parseFileJson(basePackageLocation);
// Packages that have no dependencies or are not from FullScreenShenanigans can be ignored
if (dependencies === undefined || shenanigans === undefined) {
return [];
}
const dependencyNames = Object.keys(dependencies);
for (const localDependency of Object.keys(dependencies)) {
const modulePackageLocation = path.normalize(basePackageLocation.replace("package.json", `node_modules/${localDependency}/package.json`));
if (yield fs.exists(modulePackageLocation)) {
dependencyNames.push(...(yield getDependencyNamesOfPackage(modulePackageLocation)));
}
}
return Array.from(new Set(dependencyNames));
});
/**
* Generates the HTML page for a repository's tests.

@@ -52,12 +31,7 @@ */

.replace(/\\/g, "/"));
const externalsRaw = basePackageContents.shenanigans.externals === undefined
? []
: basePackageContents.shenanigans.externals;
const externals = externalsRaw
.map((external) => `"${external.name}": "${external.js.dev}"`);
const newTestContents = mustache.render(testTemplate, Object.assign({}, basePackageContents, { dependencyNames: (yield getDependencyNamesOfPackage(basePackageLocation))
.filter((dependencyName) => dependencyName !== "requirejs")
.filter((dependencyName) => !externalsRaw.some((externalRaw) => externalRaw.name === dependencyName.toLowerCase())), externals,
const { dependencyNames, externals } = yield utils_1.getDependencyNamesAndExternalsOfPackage(basePackageLocation);
const newTestContents = mustache.render(testTemplate, Object.assign({}, basePackageContents, { dependencyNames,
externals,
testPaths }));
yield fs.writeFile(path.join(args.directory, args.repository, "test/index.html"), newTestContents);
});

@@ -7,36 +7,6 @@ import * as mustache from "mustache";

import { IRuntime } from "../runtime";
import { globAsync, parseFileJson } from "../utils";
import { getDependencyNamesAndExternalsOfPackage, globAsync, parseFileJson } from "../utils";
import { EnsureRepositoryExists } from "./ensureRepositoryExists";
/**
* Recursively gets the names of all a package's dependencies.
*
* @param basePackageLocation Locatino of a package's package.json.
* @returns Promise for the names of all the package's dependencies.
*/
const getDependencyNamesOfPackage = async (basePackageLocation: string): Promise<string[]> => {
const { dependencies, shenanigans } = await parseFileJson<Partial<IShenanigansPackage>>(basePackageLocation);
// Packages that have no dependencies or are not from FullScreenShenanigans can be ignored
if (dependencies === undefined || shenanigans === undefined) {
return [];
}
const dependencyNames = Object.keys(dependencies);
for (const localDependency of Object.keys(dependencies)) {
const modulePackageLocation = path.normalize(
basePackageLocation.replace(
"package.json",
`node_modules/${localDependency}/package.json`));
if (await fs.exists(modulePackageLocation)) {
dependencyNames.push(...(await getDependencyNamesOfPackage(modulePackageLocation)));
}
}
return Array.from(new Set(dependencyNames));
};
/**
* Generates the HTML page for a repository's tests.

@@ -58,10 +28,4 @@ */

const externalsRaw = basePackageContents.shenanigans.externals === undefined
? []
: basePackageContents.shenanigans.externals;
const { dependencyNames, externals } = await getDependencyNamesAndExternalsOfPackage(basePackageLocation);
const externals = externalsRaw
.map((external: IExternal): string =>
`"${external.name}": "${external.js.dev}"`);
const newTestContents = mustache.render(

@@ -71,5 +35,3 @@ testTemplate,

...basePackageContents,
dependencyNames: (await getDependencyNamesOfPackage(basePackageLocation))
.filter((dependencyName) => dependencyName !== "requirejs")
.filter((dependencyName) => !externalsRaw.some((externalRaw) => externalRaw.name === dependencyName.toLowerCase())),
dependencyNames,
externals,

@@ -76,0 +38,0 @@ testPaths,

@@ -15,2 +15,3 @@ "use strict";

const command_1 = require("../command");
const utils_1 = require("../utils");
/**

@@ -26,3 +27,4 @@ * Copies a file with mustache logic from a repository's package.json.

const outputPath = path.join(args.directory, args.repository, args.output);
const view = Object.assign({}, basePackageJson, { dependencyNames: Object.keys(basePackageJson.dependencies || {}), devDependencyNames: Object.keys(basePackageJson.devDependencies || {}), externalsRaw: (basePackageJson.shenanigans.externals || [])
const { dependencyNames } = yield utils_1.getDependencyNamesAndExternalsOfPackage(basePackagePath);
const view = Object.assign({}, basePackageJson, { dependencyNames, devDependencyNames: Object.keys(basePackageJson.devDependencies || {}), externalsRaw: (basePackageJson.shenanigans.externals || [])
.map((external) => JSON.stringify(external)) });

@@ -29,0 +31,0 @@ const inputContents = (yield fs.readFile(inputPath)).toString();

@@ -7,2 +7,3 @@ import * as mustache from "mustache";

import { IRuntime } from "../runtime";
import { getDependencyNamesAndExternalsOfPackage } from "../utils";

@@ -37,5 +38,7 @@ /**

const { dependencyNames } = await getDependencyNamesAndExternalsOfPackage(basePackagePath);
const view = {
...basePackageJson,
dependencyNames: Object.keys(basePackageJson.dependencies || {}),
dependencyNames,
devDependencyNames: Object.keys(basePackageJson.devDependencies || {}),

@@ -42,0 +45,0 @@ externalsRaw: (basePackageJson.shenanigans.externals || [])

@@ -23,1 +23,12 @@ import { IPackagePaths } from "package-build-order";

export declare const resolvePackagePaths: (directory: string, repositoryNames: string[]) => IPackagePaths;
export interface IDependencyNamesAndExternals {
dependencyNames: string[];
externals: string[];
}
/**
* Recursively gets the names of all a package's dependencies.
*
* @param basePackageLocation Locatino of a package's package.json.
* @returns Promise for the names of all the package's dependencies.
*/
export declare const getDependencyNamesAndExternalsOfPackage: (basePackageLocation: string) => Promise<IDependencyNamesAndExternals>;

@@ -67,1 +67,33 @@ "use strict";

};
/**
* Recursively gets the names of all a package's dependencies.
*
* @param basePackageLocation Locatino of a package's package.json.
* @returns Promise for the names of all the package's dependencies.
*/
exports.getDependencyNamesAndExternalsOfPackage = (basePackageLocation) => __awaiter(this, void 0, void 0, function* () {
const { dependencies, shenanigans } = yield exports.parseFileJson(basePackageLocation);
// Packages that have no dependencies or are not from FullScreenShenanigans can be ignored
if (dependencies === undefined || shenanigans === undefined) {
return {
dependencyNames: [],
externals: [],
};
}
const externalsRaw = shenanigans.externals === undefined
? []
: shenanigans.externals;
const externals = externalsRaw
.map((external) => `"${external.name}": "${external.js.dev}"`);
const allDependencyNames = Object.keys(dependencies);
for (const localDependency of Object.keys(dependencies)) {
const modulePackageLocation = path.normalize(basePackageLocation.replace("package.json", `node_modules/${localDependency}/package.json`));
if (yield fs.exists(modulePackageLocation)) {
allDependencyNames.push(...(yield exports.getDependencyNamesAndExternalsOfPackage(modulePackageLocation)).dependencyNames);
}
}
const dependencyNames = Array.from(new Set(allDependencyNames))
.filter((dependencyName) => dependencyName !== "requirejs")
.filter((dependencyName) => !externalsRaw.some((externalRaw) => externalRaw.name === dependencyName.toLowerCase()));
return { dependencyNames, externals };
});

@@ -71,1 +71,51 @@ import chalk from "chalk";

};
export interface IDependencyNamesAndExternals {
dependencyNames: string[];
externals: string[];
}
/**
* Recursively gets the names of all a package's dependencies.
*
* @param basePackageLocation Locatino of a package's package.json.
* @returns Promise for the names of all the package's dependencies.
*/
export const getDependencyNamesAndExternalsOfPackage = async (basePackageLocation: string): Promise<IDependencyNamesAndExternals> => {
const { dependencies, shenanigans } = await parseFileJson<Partial<IShenanigansPackage>>(basePackageLocation);
// Packages that have no dependencies or are not from FullScreenShenanigans can be ignored
if (dependencies === undefined || shenanigans === undefined) {
return {
dependencyNames: [],
externals: [],
};
}
const externalsRaw = shenanigans.externals === undefined
? []
: shenanigans.externals;
const externals = externalsRaw
.map((external: IExternal): string =>
`"${external.name}": "${external.js.dev}"`);
const allDependencyNames = Object.keys(dependencies);
for (const localDependency of Object.keys(dependencies)) {
const modulePackageLocation = path.normalize(
basePackageLocation.replace(
"package.json",
`node_modules/${localDependency}/package.json`));
if (await fs.exists(modulePackageLocation)) {
allDependencyNames.push(...(await getDependencyNamesAndExternalsOfPackage(modulePackageLocation)).dependencyNames);
}
}
const dependencyNames = Array.from(new Set(allDependencyNames))
.filter((dependencyName) => dependencyName !== "requirejs")
.filter((dependencyName) => !externalsRaw.some((externalRaw) => externalRaw.name === dependencyName.toLowerCase()));
return { dependencyNames, externals };
};
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