Skip to content

Commit

Permalink
Merge pull request #1 from tokyootakumode/update-gulp4.0.2
Browse files Browse the repository at this point in the history
update gulp@4.0.2
  • Loading branch information
hassy55 authored Dec 10, 2021
2 parents b4292fe + 3694d69 commit 045f306
Show file tree
Hide file tree
Showing 3 changed files with 1,535 additions and 308 deletions.
76 changes: 42 additions & 34 deletions gulpfile.js
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"]));
Loading

0 comments on commit 045f306

Please sign in to comment.