forked from madefor/postal-code-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tokyootakumode/update-gulp4.0.2
update gulp@4.0.2
- Loading branch information
Showing
3 changed files
with
1,535 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,54 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
var gulp = require( 'gulp' ); | ||
var download = require( 'gulp-download' ); | ||
var decompress = require( 'gulp-decompress' ); | ||
var convertEncoding = require( 'gulp-convert-encoding' ); | ||
var chmod = require( 'gulp-chmod' ); | ||
var postal2json = require( './lib/postal2json.js' ); | ||
var jigyosyo2json = require( './lib/jigyosyo2json.js' ); | ||
var v1 = require( './lib/v1.js' ); | ||
const gulp = require("gulp"); | ||
const download = require("gulp-download"); | ||
const decompress = require("gulp-decompress"); | ||
const convertEncoding = require("gulp-convert-encoding"); | ||
const chmod = require("gulp-chmod"); | ||
const postal2json = require("./lib/postal2json.js"); | ||
const jigyosyo2json = require("./lib/jigyosyo2json.js"); | ||
const v1 = require("./lib/v1.js"); | ||
|
||
gulp.task( 'download', function () { | ||
var urls = [ | ||
'http://www.post.japanpost.jp/zipcode/dl/roman/ken_all_rome.zip', | ||
'http://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip' | ||
gulp.task("download", () => { | ||
const urls = [ | ||
"http://www.post.japanpost.jp/zipcode/dl/roman/ken_all_rome.zip", | ||
"http://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip", | ||
]; | ||
return download( urls ) | ||
.pipe( decompress() ) | ||
.pipe( convertEncoding( { from: "shift_jis", to: "utf-8" } ) ) | ||
.pipe( chmod( 644 ) ) | ||
.pipe( gulp.dest( 'api' ) ); | ||
} ); | ||
return download(urls) | ||
.pipe(decompress()) | ||
.pipe(convertEncoding({ from: "shift_jis", to: "utf-8" })) | ||
.pipe(chmod(644)) | ||
.pipe(gulp.dest("api")); | ||
}); | ||
|
||
/** | ||
* Create an API of the postal code. | ||
*/ | ||
gulp.task( 'v1', [ 'download' ], function () { | ||
gulp.src( 'api/KEN_ALL_ROME.CSV' ) | ||
.pipe( postal2json() ) | ||
.pipe( v1() ) | ||
.pipe( chmod( 644 ) ) | ||
.pipe( gulp.dest( 'api/v1' ) ); | ||
} ); | ||
gulp.task( | ||
"v1", | ||
gulp.series("download", () => { | ||
return gulp | ||
.src("api/KEN_ALL_ROME.CSV") | ||
.pipe(postal2json()) | ||
.pipe(v1()) | ||
.pipe(chmod(644)) | ||
.pipe(gulp.dest("api/v1")); | ||
}) | ||
); | ||
|
||
/** | ||
* Create an API of the Jigyosyo postal code. | ||
*/ | ||
gulp.task( 'v1-jigyosyo', ['download'], function () { | ||
gulp.src( 'api/JIGYOSYO.CSV' ) | ||
.pipe( jigyosyo2json() ) | ||
.pipe( v1() ) | ||
.pipe( chmod( 644 ) ) | ||
.pipe( gulp.dest( 'api/v1' ) ); | ||
} ); | ||
gulp.task( | ||
"v1-jigyosyo", | ||
gulp.series("download", () => { | ||
return gulp | ||
.src("api/JIGYOSYO.CSV") | ||
.pipe(jigyosyo2json()) | ||
.pipe(v1()) | ||
.pipe(chmod(644)) | ||
.pipe(gulp.dest("api/v1")); | ||
}) | ||
); | ||
|
||
gulp.task( 'default', [ 'v1', 'v1-jigyosyo' ] ); | ||
gulp.task("default", gulp.series(["v1", "v1-jigyosyo"])); |
Oops, something went wrong.