├── .github └── workflows │ └── update.yml ├── .gitignore ├── .gitmodules ├── LICENSE.txt ├── README.md ├── lib ├── zengin-code.js └── zengin-data.js ├── package.json └── scripts ├── build └── ci /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: update 2 | 3 | on: 4 | push: 5 | 6 | schedule: 7 | # Run at 12:00 JST 8 | - cron: '0 3 * * *' 9 | 10 | jobs: 11 | update: 12 | runs-on: ubuntu-latest 13 | 14 | permissions: 15 | contents: write 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | with: 20 | submodules: 'recursive' 21 | 22 | - uses: ruby/setup-ruby@v1 23 | with: 24 | ruby-version: '3.3' 25 | 26 | - uses: actions/setup-node@v4 27 | with: 28 | node-version: 'latest' 29 | 30 | - name: npm install 31 | run: npm install 32 | 33 | - name: update 34 | if: github.ref == 'refs/heads/master' 35 | run: | 36 | git submodule update --remote 37 | ./scripts/build 38 | ./scripts/ci 39 | env: 40 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "source-data"] 2 | path = source-data 3 | url = https://github.com/zengin-code/source-data.git 4 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Sho Kusano 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZenginCode 2 | 3 | [![update](https://github.com/zengin-code/zengin-js/actions/workflows/update.yml/badge.svg)](https://github.com/zengin-code/zengin-js/actions/workflows/update.yml) 4 | [![npm version](https://badge.fury.io/js/zengin-code.svg)](http://badge.fury.io/js/zengin-code) 5 | 6 | The javascript implementation of ZenginCode. 7 | 8 | ZenginCode is datasets of bank codes and branch codes for japanese. 9 | 10 | ## Installation 11 | 12 | Install via [npm](https://www.npmjs.com/). 13 | 14 | ```shell 15 | npm install --save zengin-code 16 | ``` 17 | 18 | ## Usage 19 | 20 | ```js 21 | var zenginCode = require('zengin-code'); 22 | 23 | zenginCode; // => { '0001': { 'name': ..., 'kana': ..., 'branches': [ ... ] } } 24 | ``` 25 | 26 | ## Contributing 27 | 28 | Bug reports and pull requests are welcome on GitHub at https://github.com/zengin-code/zengin-js 29 | 30 | ## License 31 | 32 | The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 33 | 34 | -------------------------------------------------------------------------------- /lib/zengin-code.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ZenginCode 3 | * Copyright(c) 2015 Sho Kusano <@rosylilly> 4 | * MIT Licensed 5 | */ 6 | (function() { 7 | 'use strict'; 8 | 9 | var zenginCode = require('./zengin-data'); 10 | 11 | if (typeof define === 'function' && define.amd) { 12 | define(function() { return zenginCode; }); 13 | } else if (typeof module !== 'undefined' && module.exports) { 14 | module.exports = zenginCode; 15 | } else { 16 | window.zenginCode = zenginCode; 17 | } 18 | })(); 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zengin-code", 3 | "version": "1.0.0-p20250603", 4 | "main": "lib/zengin-code.js", 5 | "description": "bank codes and branch codes for japanese", 6 | "files": [ 7 | "LICENSE.txt", 8 | "README.md", 9 | "lib/" 10 | ], 11 | "repository": "zengin-code/zengin-js", 12 | "author": { 13 | "name": "Sho Kusano", 14 | "email": "rosylilly@aduca.org" 15 | }, 16 | "license": "MIT", 17 | "ignore": [ 18 | ".*", 19 | "**/*.rb" 20 | ], 21 | "scripts": { 22 | "build": "scripts/build", 23 | "ci": "scripts/ci" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /scripts/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'json' 3 | require 'rake' 4 | 5 | ROOT = File.expand_path('../..', __FILE__) 6 | 7 | # Checkout submodule first 8 | # sh('git submodule update --init') 9 | # sh("git submodule foreach 'git pull origin master'") 10 | 11 | LATEST_UPDATED_AT = File.read(File.join(ROOT, 'source-data', 'data', 'updated_at')).strip 12 | 13 | # Update package.json 14 | package_json = JSON.load(File.read(File.join(ROOT, 'package.json'))) 15 | 16 | package_json['version'] = package_json['version'].sub(/-p\d+$/, "-p#{LATEST_UPDATED_AT}") 17 | 18 | open(File.join(ROOT, 'package.json'), 'w') do |f| 19 | f.puts(JSON.pretty_generate(package_json)) 20 | end 21 | 22 | # Update lib/zengin-data.js 23 | banks = JSON.load(File.read(File.join(ROOT, 'source-data', 'data', 'banks.json'))) 24 | 25 | banks.each_pair do |code, bank| 26 | branches = JSON.load(File.read(File.join(ROOT, 'source-data', 'data', 'branches', "#{code}.json"))) 27 | bank['branches'] = branches 28 | end 29 | 30 | open(File.join(ROOT, 'lib', 'zengin-data.js'), 'w') do |f| 31 | f.write('module.exports = ') 32 | f.write(JSON.pretty_generate(banks)) 33 | f.write(";\n") 34 | end 35 | -------------------------------------------------------------------------------- /scripts/ci: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | git config user.name "github-actions[bot]" 6 | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" 7 | 8 | CI_RELEASE_VERSION=`date +"v%Y-%m-%d"` 9 | 10 | cat > $HOME/.npmrc << EOF 11 | --- 12 | //registry.npmjs.org/:_authToken=${NPM_TOKEN} 13 | EOF 14 | chmod 600 $HOME/.npmrc 15 | 16 | if [ -z "$(git status -s)" ]; then 17 | echo "No changes to commit" 18 | exit 0 19 | fi 20 | 21 | git commit -a -m "Update: ${CI_RELEASE_VERSION}" 22 | git push --all 23 | 24 | npm publish 25 | --------------------------------------------------------------------------------