npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pzl-spfx-tasks

v0.5.10-2

Published

One shared place for node tasks used by our SPFx solutions.

Downloads

377

Readme

SPFx tasks

One shared place for node tasks used by our SPFx solutions.

createEnviromentFile.js

Creates a .env file in the current folder (process.cwd()). This is ran as a part of the pre-watch.js task.

createServeConfig.js

Creates a config/serve.json file from the template config/serve.sample.json for the current folder.

post-watch.js

Runs modifyConfig.js.

pre-watch.js

Runs createEnviromentFile.js. Also generates a config/.generated-solution-config.json if the channel environment variable SERVE_CHANNEL is set and not main. Also runs ./modifyConfig.js to modifiy the included bundles.

modifyConfig.js

Updates config/config.json for the solution based on the environment variable SERVE_BUNDLE_REGEX.

generateComponentOverview.js

This script generates an overview of components by loading configuration files and writing the result to an output file.

Dependencies

  • path: Provides utilities for working with file and directory paths.
  • glob: Matches file paths using patterns.
  • fs: Provides file system-related functionality.
  • util: Custom utility functions for logging and file operations.
  • colors: Provides color formatting for console output.

Constants

  • ROOT_PATH: The root directory of the project.
  • CONFIG_FILES_PATTERN: Pattern to match configuration files.
  • OUTPUT_FILE: Path to the output file where the overview will be written.

Functions

loadJsonFile(file)

  • Description: Loads and parses a JSON file.
  • Parameters:
    • file: Path to the JSON file.
  • Returns: Parsed JSON object or null on failure.

loadManifestFile(configFile, bundle)

  • Description: Loads the manifest file for a given configuration file and bundle.
  • Parameters:
    • configFile: Path to the configuration file.
    • bundle: Bundle object containing information about the components.
  • Returns: Manifest object containing component details or null on failure.

loadConfigFile(configFile)

  • Description: Loads the configuration file and returns the application name and an array of manifests.
  • Parameters:
    • configFile: Path to the configuration file.
  • Returns: An array containing the application name and an array of manifest objects.

generateComponentOverview()

  • Description: Generates an overview of components by loading configuration files and writing the result to an output file.
  • Process:
    1. Glob matches configuration files.
    2. Loads configuration files and extracts component manifests.
    3. Writes the overview to the output file.

generateComponentsClass.js

This script generates C# classes based on JSON data. It is designed to work with a specific JSON file structure containing information about SPFx components.

Dependencies

  • path: Provides utilities for working with file and directory paths.
  • glob: Matches file paths using patterns.
  • fs: Provides file system-related functionality.
  • util: Custom utility functions for logging and file operations.
  • lodash: Provides utility functions for working with arrays, objects, and other data types.
  • package.json: Contains metadata about the project.

Constants

  • ROOT_PATH: The root directory of the project.
  • INPUT_JSON_FILE: Path to the input JSON file containing component data.
  • NAMESPACE: Namespace for the generated C# classes.
  • DIRNAME: Path to the directory where the generated C# files will be saved.
  • FILE_NAME: Name of the generated C# file.
  • MAIN_CLASS_NAME: Name of the main static class containing all components.
  • COMPONENT_CLASS_NAME: Name of the C# class representing SPFx components.

Functions

generateClasses(jsonFile)

  • Description: Generates C# classes for a JSON file.
  • Parameters:
    • jsonFile: Path to the JSON file containing component data.

generateComponentClass(component, classType = 'public readonly')

  • Description: Generates a C# class for a component.
  • Parameters:
    • component: Component object containing information about the component.
    • classType: Type of the class to generate (default is 'public readonly').

generateAppClassName(app)

  • Description: Generates the class name for the given SPFx app.
  • Parameters:
    • app: Name of the SPFx app.
  • Returns: The generated class name.

generateAppClass(app, components, classType = 'public class', classMemberType = 'public static readonly')

  • Description: Generates a C# class for the SPFx app with the provided app name and components.
  • Parameters:
    • app: Name of the SPFx app.
    • components: Array of component objects belonging to the app.
    • classType: Type of the class to generate (default is 'public class').
    • classMemberType: Type of the class members to generate (default is 'public static readonly').

generateCSharpCode(jsonContent)

  • Description: Generates C# code based on the provided JSON content.
  • Parameters:
    • jsonContent: JSON content used to generate the C# code.
  • Returns: Generated C# code as a string.