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

granturismo

v1.14.0

Published

generator tool

Downloads

58

Readme

Granturismo

GT

Build Status NPM Version NPM Downloads MIT License Conventional Commits Codecov

Generator Tool.

Workflow tool for scaffolding projects.

The streaming scaffold system.

It is easy to learn and easy to use, more efficient.

If you want to use a scaffold, the scaffold should be adapted to gt, but it is much more simpler than yeoman.

Scaffolds

Installation

Make sure your git version >= 2.7.0

Make sure you have installed nodejs

npm i -g granturismo

Usage

gt

gt help

gt init

gt config list

gt config add scaffold-name git-repo

gt config remove scaffold-name

How to Scaffold Using GT?

Implement scripts/gt.js, adding project info into user config.

If scripts/gt.js, all files will be copied by default.

See Scaffolds for examples.

gt.js

If you want to use es6 in gt.js, please use babel-register or babel-built js.

// using `babel-register`
if (!global._babelPolyfill) {
    require('babel-polyfill');
}
require('babel-register');
module.exports = require('./gt/index');

GT cli invokes methods in scaffold/scripts/gt.js, and passing options into init.

// gt.js
/**
 * `ask` will be invoked first
 * prompt questions
 * `config` returned will be passed into `init` and `after` by `options.config`
 */, 
export const ask = async(options) => {
    return config;
};
export const init = async(options) => {
    
};
export const after = async(options) => {
    
};
// options
{
    project: {
        folder: '/absolute/path/to/project/folder',
        name: 'project-name', // same as project folder name
        git: {
            repositoryURL: 'git://git-url', // mainly used for package.json repository.url
            username: 'vivaxy', // git configured username
        },
    },
    scaffold: {
        folder: '/absolute/path/to/scaffold/folder', // mostly ~/.gt/scaffold-name
        name: 'scaffold-name',
        git: {
            headHash: '23c5742ac306e561554d1cfa56b1618d30d16157',
        },
    },
    presets: {
        copyFiles: async() => {},
        writeFile: async() => {},
        updateFile: async() => {},
        writeJson: async() => {},
        updateJson: async() => {},
        removeFiles: async() => {},
        addScaffoldInfo: async() => {},
    },
}
/**
 * listr context
 * do not modify existing attributes
 * if you want to passing variables in listr context, add a new attribute
 */
{
    selectedScaffoldName,
    selectedScaffoldRepo,
    selectedScaffoldFolder,
    projectGT: {}, // js object required from `./scripts/gt.js`
    GTInfo: {}, // options
}

Presets

copyFiles(fileList)
  • fileList Array[String] is an array containing filename your want to copy.

eg.

const copyFiles = async() => {
    const { presets } = options;

    const files = [
        `docs`,
        `mock-server`,
        `source`,
        `.babelrc`,
        `.editorconfig`,
        `.gitignore`,
        `LICENSE`,
        `webpack.config.js`,
    ];

    await presets.copyFiles(files);
};
writeFile(file, content)
  • file {String}
  • content {String}

Write string into file under project folder.

updateFile(file, filter)
  • file {String}
  • filter {Function} filter(input) => output
    • input {String}
    • output {String}

Read file from scaffold, passing into filter, write filter result into file under project folder.

updateFiles(files, filter)
  • files {Array[String]}
  • filter {Function} filter(input) => output
    • input {String}
    • output {String}

Read file from scaffold, passing into filter, write filter result into file under project folder.

writeJson(file, json)
  • file {String}
  • json {Object}

Same as writeFile, but passing json object into second parameter.

updateJson(file, filter)
  • file {String}
  • filter {Function} filter(input) => output
    • input {Object}
    • output {Object}

Same as updateFile, but passing json object into filter.

removeFiles(fileList)
  • fileList Array[String] is an array containing filename your want to copy.

Same as copyFiles, but remove files in project folder.

addScaffoldInfo({ scaffoldCommitHash, scaffoldVersion })
  • scaffoldCommitHash {String} default: 'scaffoldCommitHash'
  • scaffoldVersion {String} default: 'scaffoldVersion'

Update the project package.json file, add scaffoldCommitHash and scaffoldVersion. Use scaffoldCommitHash and scaffoldVersion as package.json key. If scaffoldCommitHash or scaffoldVersion is falsy`, it will not add this key.

How to test a scaffold project?

  • Checkout a new branch, update your gt.js.
  • Use gt config add test-scaffold-name git-repo#new-branch-name to set a test registry.
  • gt init and select test-scaffold-name to run gt.js in your new branch to test.

Change Log

Change Log

Contributing

Contributing

Prior Art