Skip to content

Commit

Permalink
cidr minify
Browse files Browse the repository at this point in the history
  • Loading branch information
NavyStack committed Feb 3, 2024
1 parent eb9b7a4 commit d0f0a2c
Show file tree
Hide file tree
Showing 7 changed files with 934 additions and 178 deletions.
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
overrides: [
{
env: {
node: true
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
}
}
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {}
}
55 changes: 47 additions & 8 deletions .github/workflows/Update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
workflow_dispatch:
schedule:
- cron: "53 */3 * * *" # I'm on a prime schedule - every 3 hours at 53 minutes, because ordinary schedules are just too divisible! :)
- cron: '53 */3 * * *' # I'm on a prime schedule - every 3 hours at 53 minutes, because ordinary schedules are just too divisible! :)

jobs:
run-script:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Git Auto Commit (Googlebot)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[BOT] [Googlebot] changes - ${{ steps.googlebot-extract-timestamp.outputs.googlebot_utc }}"
commit_message: '[BOT] [Googlebot] changes - ${{ steps.googlebot-extract-timestamp.outputs.googlebot_utc }}'
push_options: '--force'

- name: Run OCI Script
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Git Auto Commit (OCI)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[BOT] [OCI] changes - ${{ steps.oracle-extract-timestamp.outputs.oracle_utc }}"
commit_message: '[BOT] [OCI] changes - ${{ steps.oracle-extract-timestamp.outputs.oracle_utc }}'
push_options: '--force'

- name: Run Azure Script
Expand All @@ -60,7 +60,7 @@ jobs:
- name: Git Auto Commit (Azure)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[BOT] [Azure] changes - ${{ steps.azure-extract-timestamp.outputs.azure_utc }}"
commit_message: '[BOT] [Azure] changes - ${{ steps.azure-extract-timestamp.outputs.azure_utc }}'
push_options: '--force'

- name: Run Github Script
Expand All @@ -75,7 +75,7 @@ jobs:
- name: Git Auto Commit (Github)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[BOT] [Github] changes - ${{ steps.github-extract-timestamp.outputs.github_utc }}"
commit_message: '[BOT] [Github] changes - ${{ steps.github-extract-timestamp.outputs.github_utc }}'
push_options: '--force'

- name: Run Cloudflare Script
Expand All @@ -90,7 +90,7 @@ jobs:
- name: Git Auto Commit (Cloudflare)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[BOT] [Cloudflare] changes - ${{ steps.cloudflare-extract-timestamp.outputs.cloudflare_utc }}"
commit_message: '[BOT] [Cloudflare] changes - ${{ steps.cloudflare-extract-timestamp.outputs.cloudflare_utc }}'
push_options: '--force'

- name: Run AWS Script
Expand All @@ -105,7 +105,7 @@ jobs:
- name: Git Auto Commit (AWS)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[BOT] [AWS] changes - ${{ steps.amazon-extract-timestamp.outputs.amazon_utc }}"
commit_message: '[BOT] [AWS] changes - ${{ steps.amazon-extract-timestamp.outputs.amazon_utc }}'
push_options: '--force'

- name: Run Bing Script
Expand All @@ -120,5 +120,44 @@ jobs:
- name: Git Auto Commit (Bing)
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[BOT] [Bing] changes - ${{ steps.bingbot-extract-timestamp.outputs.bingbot_utc }}"
commit_message: '[BOT] [Bing] changes - ${{ steps.bingbot-extract-timestamp.outputs.bingbot_utc }}'
push_options: '--force'

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: build
run: pnpm build

- name: set env
run: echo "NOW=$(TZ=Asia/Seoul date +'%Y.%m.%d')" >> $GITHUB_ENV

- name: Mini Commit And Push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: '[BOT] [MINI] changes - ${{ env.NOW }}'
push_options: '--force'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt
5 changes: 3 additions & 2 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import merge from 'cidr-tools/merge'
import { merge } from 'cidr-tools'
import fs from 'fs'
import readline from 'readline'
import path from 'path'
Expand Down Expand Up @@ -32,7 +32,8 @@ const processFiles = async (filesToProcess, outputSuffix) => {
try {
const readInterface = readline.createInterface({
input: fs.createReadStream(sourceFilePath),
output: process.env.DEBUG === 'true' ? process.stdout : null
output: process.env.DEBUG === 'true' ? process.stdout : null,
console: false
})

const addresses = []
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"cidr-tools": "^7.0.4",
"eslint": "^8.56.0",
"prettier": "^3.2.4"
Expand Down
Loading

0 comments on commit d0f0a2c

Please sign in to comment.