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

skeleton-code-generator

v1.1.3

Published

The most powerfull node-based code generator! Automate the process of generating multiple code files and folder structures fast, efficient and easy. You can use a pre-defined folder structure as parameter for code generation

Downloads

3

Readme

Installation

$ npm install skeleton-code-generator -D

or

$ yarn add skeleton-code-generator -D

generate

  • Generates all the files, folders and subfolders defined at bonesPath. If bonesPath is a string, a new folder named "dist_FOLDERNAME" will be created at the same height of "FOLDERNAME". If bonesPath is an object {bonesPath: "..." , distPath: "..."} all the files in bonesPath will be generated in distPath
  • The word SKELETON in folders and files names will be replaced by bone parameter.
  • Files inside bonesPath that match the extension *SKL.JS will be generated, replacing the content inside.
  • All generated files will preserve the original structure.

| Parameter | Type | Description | | --------------- | --------------- | --------------- | | bonesPath | string or {bonesPath: string , distPath: string} | Path of folder to be generated and dist folder | | bone | string | Word that will replace SKELETON matches | | params | any | Optional parameters that can be referenced inside .skl.js files |

Implementation Example:

var path = require("path");
var Skeleton = require("skeleton-code-generator");

//You can use this, if you want to generate files at dist_FOLDERNAME
const bonesPath = path.join(__dirname, "bonesFolder");
Skeleton.generate(bonesPath, boneWord);

//You can use this if you want to specify the dist path.
const sklPaths = {
  bonesPath: path.join(__dirname, "bonesFolder"), //This can be the path for a folder with Skeleton structure, or a skl.js file
  distPath: path.join(__dirname, "generatedFolder"),
};
//Skeleton.generate(sklPaths, boneWord);

//Add this parameter if you want to reference any extra param in the skl.js file. 
const extraParams = {signature: "YourName", date: "01/01/2023"}
//Skeleton.generate(sklPaths, boneWord, extraParams);

.skl.js file example

({ Bone, signature, date }) => `
//File created by ${signature} at ${date}
import { Router } from "express";

import {
  create${Bone},
  read${Bone},
  delete${Bone},
  update${Bone},
} from "../../../controllers/${Bone}";

export const ${Bone}Routes = {
  create${Bone}: "/create${Bone}",
  read${Bone}: "/read${Bone}",
  update${Bone}: "/update${Bone}",
  delete${Bone}: "/delete${Bone}",
};

const router: Router = Router();

router.post(${Bone}Routes.create${Bone}, create${Bone});
router.get(${Bone}Routes.read${Bone}+"/:id", read${Bone});
router.put(${Bone}Routes.update${Bone}+"/:id", update${Bone});
router.delete(${Bone}Routes.delete${Bone}+"/:id", delete${Bone});

export default router;
`;

"Bone" is not the only parameter you can reference. By default you can use the following ones: | Parameter | Description | | --------------- | --------------- | | bone | Word that will replace SKELETON matches | | Bone | Word that will replace SKELETON matches with first letter in Uppercase | | boneFilePath | bone file path | | boneFileName | bone file name | | tempFilePath | temp bone file path | | tempFileName | temp bone file name | | generatedFilePath | generated file path | | generatedFileName | generated file name | | extension | generated file extension |

You can also use ANY parameter defined in "params".