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

fs-json-to-files

v1.0.5

Published

fs-extra jsonfile fs-json-to-files Generate the corresponding file directory and file content based on the JSON configuration、 根据配置json生成对应的文件目录以及文件内容,

Downloads

16

Readme

fs-json-to-files

use it, you can create you project folders by folder json data, width any you template content;

v

Installation

npm install fs-json-to-files

import it to your work root, if you create a project,if you need to create many files or folders, it can help you,
at least, i think it

More specifically,this is a tool, generate your project folders,keep you folder structure, fill template content your configured;

i search in the web,many content about folders generate text tree, like:

tree;

then it give me a snippet

every time i build a new project, many folders、files require to create, need to fill content,
if tree has reverse operation,it will be great;
i search in the web, Almost no discovery of this feature;npm 、github 、or Blog、Forum;

so i did it , It took half a day , then It took another half day to publish。

usage:

// example.js

import { genFilesByJsonData } from "fs-json-to-files";
import { temps } from "./tmpData.js";
import { fileJsonData } from "./fileJsonData.js";

//  options?{ basePath}, default is your current folder,if need,you can config it with options.basePath
genFilesByJsonData(temps, fileJsonData,options?);
// You can use it when creating projects, updating requirements,
// and planning to create multiple file structures,
// instead of manually generating them one by one


his directory will be the current directory where your node command is executed

  node example.js

the fileJsonData example:

// fileJsonData.js
// I prefer to use this data structure here,
// which is a one-to-one mapping of file structures without sub arrays such as children
// each Object will renerate one folder, the inner Object is also,done and done,
// if the value of key is type of string, it will be defined as a file,it can be followed a '-' ,
// the later is content template type that will fill.if no,the file will a empty file, no bad impact.

export const fileJsonData = {
  src: {
    views: {
      app: "app.vue-tempVue",
    },
    config: "config.js-tempA",
    common: {
      util: "util.js-tempA",
      data: {
        a: "a.js-tempA",
        b: {
          bb: "bb.js-tempB",
          cc: "cc.js-tempB",
        },
      },
    },
  },
};

the temps example:

// tmpData.js
// I have chosen to put the template type in a separate file, corresponding to the template in the JSON data file just now
export const temps = {
  tempVue: `
    <template>
      <div></div>
    </template>
    
    <script setup>
    
    </script>
    <style lang="less">
    
    </style>
  `,
  tempA: `
    export const A = ()=>{
      console.log('23333')
    }
  `,

  tempB: `
  export const B = ()=>{
    console.log('b3333')
  }
`,
};