1.0.7 • Published 6 years ago

grunt-swapi2json v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

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.
  • v2.0.2   Migrate to yarn & Use new swapi-promise version.
  • v2.0.3   Use new swapi-promise version.
1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago