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

app-file-create

v1.0.11

Published

A package to create files and directory for WeChat and Alipay miniProgram, and also support for other programs to use

Downloads

31

Readme

app-file-create

NPM

Build Status Dependencies Language License

创建微信小程序和支付宝小程序的目录页面,还适合其它非小程序的项目使用,简单易用,功能强大,English

安装

npm install app-file-create --save-dev

参数

名称 | 类型 | 默认 | 描述 --- | --- | --- | --- root | String | process.cwd() | 创建的文件位置目录 env | String | wechat | 环境类型,alipaywechat,默认wechat debug | Boolean | false | 是否开启调试模式,默认false,如果为true,则会显示log信息 replace | Boolean | false | 是否替换原来的文件,默认false dirname | String | index | 文件夹名称,默认index filename | String | -- | 子文件名称,默认就是上面的dirname(与文件夹名称相同) files | Array | [ fileOption] | 子文件配置,fileOption 是个对象参数,或者文件扩展名字符串 fileOption.ext | String | -- | 子文件扩展名 fileOption.filename | String | -- | 子文件名称,默认是optionsfilename,或者optionsdirname(与文件夹名称相同) fileOption.template | String | Function | -- | 子文件模板内容,如果是函数,那么函数第一个参数就是下面的args参数 fileOption.args | Object | {} | 子文件模板渲染的参数,如果template参数是函数,此参数生效

方法

  • config - 配置默认参数,注意:调用 AppFileCreate([options]) 的参数会覆盖默认的配置
const AppFileCreate = require('app-file-create');

const pageRoot = __dirname + '/pages';

AppFileCreate.config({
    root: pageRoot,
    debug: true
});

使用

  • 创建微信小程序页面
AppFileCreate({
    dirname: 'wx_page',
    files: ['js', 'json', 'wxml', 'wxss']
});
  • 创建支付宝小程序页面
AppFileCreate({
    env: 'alipay',
    dirname: 'ali_page',
    files: [
        'js',
        'axml',
        'acss',
        {
            ext: 'json',
            args: {
                title: '个人信息'
            }
        }
    ]
});
  • 创建其它类型项目文件
AppFileCreate({
    env: '',
    dirname: 'web_page',
    files: [
        'js',
        {
            ext: 'html',
            template: 
`<!DOCTYPE html>
<html>
    <head>
        <title></title>
    </head>
    <body>

    </body>
</html>`
        }
    ]
});
  • 创建其它类型项目文件,子文件名称与文件夹不同
AppFileCreate({
    env: '',
    dirname: 'diff_dir_page',
    filename: 'child',
    files: ['js', 'css']
});
  • 创建其它类型项目文件,子文件名称自定义
AppFileCreate({
    env: '',
    dirname: 'diff_filename_page',
    files: [{
        ext: 'js',
        filename: 'a'
    },{
        ext: 'css',
        filename: 'b'
    }]
});

License

license