grunt-swapi2json
This download swapi data available at http://swapi.co/ and store them in json files. Useful when one wanted to create a generated site or want to store those data locally
Last updated 16 days ago by franckldx .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install grunt-swapi2json 
SYNC missed versions from official npm registry.

grunt-swapi2json

This download swapi data and store them in json files. Useful when one wanted to create a generated site or one want to store those data locally.

**This version require

Getting Started

This plugin requires Grunt ~0.4.5 and Node v8.x or later. For older Node, you can use grunt-swapi2json 1.x

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-swapi2json --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-swapi2json');

The "swapi2json" task

Overview

In your project's Gruntfile, add a section named swapi2json to the data object passed into grunt.initConfig(). You can either download all swapi resources, or download only some of them.

Download all resources:

grunt.initConfig({
  swapi2json: {
    all: {
      dir: './json'
    },
  },
});

Download some resources:

Use the swapi resource(s) name as a target:

grunt.initConfig({
  swapi2json: {
    options: {
	  dir: './json'
    },
    films: {},
    people: {},
  },
});

Options

dir

Type: String Default value: .

The directory where files are be saved.

Usage Examples

All resources

In this example, all resources are downloaded and saved.

grunt.initConfig({
  swapi2json: {
    all: {
      dir: './json'
    },
  },
});

When all target is used, a task for each resources are dynamically created:

screenshot

Save some resources in a single directory

Use swapi resource(s) as target name.

grunt.initConfig({
  swapi2json: {
    options: {
	  dir: './json'
    },
    films: {},
    people: {},
  },
});

Save some resources in directories

Use swapi resource(s) as target name.

grunt.initConfig({
  swapi2json: {
    films: {
      dir: './starwars/movies'
    },
    people: {
      dir: './starwars/characters'
    },
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • v1.0.0   First release.
  • v1.0.1   Fix packaging.
  • v1.0.2   Code refactoring.
  • v1.0.3   Update dependencies.
  • v2.0.0   Use swapi-promise instead of swapi-node.
  • v2.0.1   Use new swapi-promise version.
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 34
Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |