├── .fake ├── companyList.json ├── personList.json ├── productList.json └── userList.json ├── .gitignore ├── .vscode └── settings.json ├── README.md ├── deno.jsonc ├── deno.lock └── main.ts /.fake/companyList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "companyId": "97fa505c-46a5-4efa-bb6b-5731a6587361", 4 | "companyName": "Nitzsche, Fisher and Stamm", 5 | "catchPhrase": "Optional bandwidth-monitored frame", 6 | "buzzPhrase": "strategize e-business markets", 7 | "established": "1994-05-05T07:22:25.976Z", 8 | "registeredAt": "2023-06-26T07:14:13.838Z" 9 | }, 10 | { 11 | "companyId": "d357b404-f858-42b2-b1f4-c5a7fdea2202", 12 | "companyName": "Fahey, Parisian and Wyman", 13 | "catchPhrase": "Reactive logistical focus group", 14 | "buzzPhrase": "mesh distributed systems", 15 | "established": "1987-11-11T08:08:37.669Z", 16 | "registeredAt": "2023-11-09T09:22:18.025Z" 17 | }, 18 | { 19 | "companyId": "5e0477ca-455a-42d9-8362-442be29e4bbe", 20 | "companyName": "Armstrong - Morissette", 21 | "catchPhrase": "Robust reciprocal infrastructure", 22 | "buzzPhrase": "target robust paradigms", 23 | "established": "1976-07-18T16:27:35.800Z", 24 | "registeredAt": "2024-01-26T04:50:24.444Z" 25 | }, 26 | { 27 | "companyId": "91f043a4-7f21-4ebf-86b4-db131483cf3b", 28 | "companyName": "Block - Maggio", 29 | "catchPhrase": "De-engineered intangible knowledge user", 30 | "buzzPhrase": "matrix viral supply-chains", 31 | "established": "1938-12-17T10:36:49.050Z", 32 | "registeredAt": "2023-06-11T06:20:39.718Z" 33 | }, 34 | { 35 | "companyId": "6d3fe45a-4a93-47d5-853c-f5d4e6531c79", 36 | "companyName": "Cummerata Group", 37 | "catchPhrase": "Upgradable radical protocol", 38 | "buzzPhrase": "brand wireless mindshare", 39 | "established": "1943-11-15T15:36:32.571Z", 40 | "registeredAt": "2023-09-19T21:37:18.258Z" 41 | }, 42 | { 43 | "companyId": "e1cfa7b4-06f7-4090-93ad-c9f997a23b00", 44 | "companyName": "Daniel Inc", 45 | "catchPhrase": "Polarised value-added functionalities", 46 | "buzzPhrase": "e-enable cross-platform initiatives", 47 | "established": "2005-03-30T02:06:41.028Z", 48 | "registeredAt": "2024-02-29T18:24:17.242Z" 49 | }, 50 | { 51 | "companyId": "e74b20fd-35c7-402c-9cb4-4890f0200db7", 52 | "companyName": "Gerhold LLC", 53 | "catchPhrase": "Switchable zero tolerance contingency", 54 | "buzzPhrase": "whiteboard synergistic content", 55 | "established": "2024-02-18T08:52:10.382Z", 56 | "registeredAt": "2023-11-12T11:16:58.137Z" 57 | }, 58 | { 59 | "companyId": "f47c5728-97b8-4ab0-94ac-1016afe80f31", 60 | "companyName": "Willms - Schiller", 61 | "catchPhrase": "Persevering tangible functionalities", 62 | "buzzPhrase": "enhance leading-edge ROI", 63 | "established": "1937-07-27T19:58:09.564Z", 64 | "registeredAt": "2024-02-08T16:23:30.143Z" 65 | }, 66 | { 67 | "companyId": "a9825686-cbbb-423b-a0b7-29a704646f8d", 68 | "companyName": "Lubowitz - Langosh", 69 | "catchPhrase": "Secured 6th generation circuit", 70 | "buzzPhrase": "productize plug-and-play lifetime value", 71 | "established": "1931-05-04T09:23:27.687Z", 72 | "registeredAt": "2024-02-27T03:20:44.370Z" 73 | }, 74 | { 75 | "companyId": "60b3fa41-9042-452b-967b-3482ae3767c4", 76 | "companyName": "Orn - Rowe", 77 | "catchPhrase": "Decentralized discrete solution", 78 | "buzzPhrase": "evolve rich infrastructures", 79 | "established": "1945-06-24T05:30:02.790Z", 80 | "registeredAt": "2023-09-23T14:49:07.999Z" 81 | }, 82 | { 83 | "companyId": "84119d3f-d87c-491c-99bb-9fa50e1cad10", 84 | "companyName": "Orn and Sons", 85 | "catchPhrase": "Face to face solution-oriented website", 86 | "buzzPhrase": "utilize bleeding-edge experiences", 87 | "established": "1977-11-02T03:25:18.233Z", 88 | "registeredAt": "2024-02-15T08:44:32.285Z" 89 | }, 90 | { 91 | "companyId": "78a05688-97ec-441c-9670-754bdf2efa8c", 92 | "companyName": "Feeney Group", 93 | "catchPhrase": "Virtual content-based database", 94 | "buzzPhrase": "target customized platforms", 95 | "established": "2023-07-04T00:24:21.703Z", 96 | "registeredAt": "2023-10-16T15:22:41.315Z" 97 | }, 98 | { 99 | "companyId": "a190742b-5bc0-4a1e-a4a2-e5ddcb638ba4", 100 | "companyName": "Brekke, O'Reilly and Ratke", 101 | "catchPhrase": "Exclusive reciprocal core", 102 | "buzzPhrase": "productize sticky initiatives", 103 | "established": "1925-09-21T17:39:40.798Z", 104 | "registeredAt": "2023-09-07T02:29:00.253Z" 105 | }, 106 | { 107 | "companyId": "f6f1a2c6-d9ff-4d6b-a65e-70fdefc58576", 108 | "companyName": "Kautzer, Cummerata and Wehner", 109 | "catchPhrase": "Persevering context-sensitive access", 110 | "buzzPhrase": "seize value-added functionalities", 111 | "established": "1925-06-12T03:06:16.367Z", 112 | "registeredAt": "2023-05-14T22:43:57.632Z" 113 | }, 114 | { 115 | "companyId": "6d72294b-d335-4283-8fae-87bf0666fe66", 116 | "companyName": "Medhurst Inc", 117 | "catchPhrase": "Ergonomic bottom-line model", 118 | "buzzPhrase": "syndicate dynamic synergies", 119 | "established": "1967-01-07T11:54:43.890Z", 120 | "registeredAt": "2023-12-03T06:29:37.872Z" 121 | }, 122 | { 123 | "companyId": "abae36f0-aa57-494e-b116-853ae3cc839f", 124 | "companyName": "Leuschke, Cormier and Padberg", 125 | "catchPhrase": "Sharable 24/7 portal", 126 | "buzzPhrase": "drive plug-and-play eyeballs", 127 | "established": "1933-02-27T22:49:40.260Z", 128 | "registeredAt": "2023-06-28T20:09:19.445Z" 129 | } 130 | ] -------------------------------------------------------------------------------- /.fake/personList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "userId": "5db9aaa6-7bba-4fb1-ad1a-5d1668888349", 4 | "fullName": "Tina Ritchie", 5 | "bio": "friend, photographer, designer", 6 | "gender": "Transmasculine", 7 | "birthdate": "1950-05-02T16:46:45.173Z", 8 | "registeredAt": "2023-11-07T00:03:13.218Z" 9 | }, 10 | { 11 | "userId": "066b90a9-91ed-4462-bbd9-7f399ef02c58", 12 | "fullName": "Dr. Johnathan Dare-West MD", 13 | "bio": "friend, blogger, musician 👇", 14 | "gender": "Pangender", 15 | "birthdate": "1966-04-07T08:51:48.832Z", 16 | "registeredAt": "2023-11-11T00:44:51.577Z" 17 | } 18 | ] -------------------------------------------------------------------------------- /.fake/productList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "productId": "35c9fd74-dc33-4a7a-97e2-a7fd87e9693b", 4 | "productName": "Practical Metal Table", 5 | "price": "635.00", 6 | "productDescription": "Andy shoes are designed to keeping in mind durability as well as trends, the most stylish range of shoes & sandals", 7 | "registeredAt": "2023-09-01T15:22:29.155Z" 8 | }, 9 | { 10 | "productId": "0b1c1330-6360-4d65-b0c9-3d2f243cb05a", 11 | "productName": "Luxurious Wooden Car", 12 | "price": "768.00", 13 | "productDescription": "New ABC 13 9370, 13.3, 5th Gen CoreA5-8250U, 8GB RAM, 256GB SSD, power UHD Graphics, OS 10 Home, OS Office A & J 2016", 14 | "registeredAt": "2023-10-14T13:38:45.270Z" 15 | }, 16 | { 17 | "productId": "13ee1e14-930d-43dc-8985-bca2bd670a2f", 18 | "productName": "Rustic Rubber Chicken", 19 | "price": "786.00", 20 | "productDescription": "The automobile layout consists of a front-engine design, with transaxle-type transmissions mounted at the rear of the engine and four wheel drive", 21 | "registeredAt": "2023-10-20T00:50:32.524Z" 22 | }, 23 | { 24 | "productId": "4f219145-ec42-4d89-8b17-c934087acc3c", 25 | "productName": "Practical Rubber Shoes", 26 | "price": "283.00", 27 | "productDescription": "The Football Is Good For Training And Recreational Purposes", 28 | "registeredAt": "2023-11-06T02:37:51.446Z" 29 | }, 30 | { 31 | "productId": "d868b8dd-cc7c-45c6-af79-49907068bb11", 32 | "productName": "Refined Granite Tuna", 33 | "price": "267.00", 34 | "productDescription": "The automobile layout consists of a front-engine design, with transaxle-type transmissions mounted at the rear of the engine and four wheel drive", 35 | "registeredAt": "2023-12-18T08:44:13.522Z" 36 | } 37 | ] -------------------------------------------------------------------------------- /.fake/userList.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/ef033de91f04e2f9df8dbbd2d459c4be59bae507/Node.gitignore 2 | 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # node-waf configuration 27 | .lock-wscript 28 | 29 | # Compiled binary addons (http://nodejs.org/api/addons.html) 30 | build/Release 31 | 32 | # Dependency directories 33 | node_modules 34 | jspm_packages 35 | 36 | # Optional npm cache directory 37 | .npm 38 | 39 | # Optional eslint cache 40 | .eslintcache 41 | 42 | # Optional REPL history 43 | .node_repl_history 44 | 45 | # Output of 'npm pack' 46 | *.tgz 47 | 48 | # Yarn Integrity file 49 | .yarn-integrity 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[typescript]": { 3 | "editor.defaultFormatter": "denoland.vscode-deno" 4 | }, 5 | "cSpell.words": ["Denomander", "jinko", "kusa", "shiba"] 6 | } 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kusa 2 | 3 | GitHub の草をただ生やし続けるためのリポジトリ 4 | 5 | ## Install 6 | 7 | ``` 8 | deno install --allow-run=git --allow-env --allow-write -n kusa app.ts 9 | ``` 10 | 11 | ## Usage 12 | 13 | ``` 14 | $ kusa generate --from 20220101 --to 20220131 15 | $ git push -u origin main 16 | ``` 17 | 18 | 平日の昼間に草が集中するように、コミットを行います。 19 | 20 | ``` 21 | GIT_AUTHOR_DATE= 22 | GIT_COMMITTER_DATE= 23 | git commit -am 'kusa' 24 | ``` 25 | 26 | `GIT_AUTHOR_DATE`と`GIT_COMMITTER_DATE`で時間を操作し、あたかも過去や未来にコミットしたかのように見せかけています。 27 | -------------------------------------------------------------------------------- /deno.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "fmt": { 3 | "include": ["./"] 4 | }, 5 | "lint": { 6 | "include": ["./"], 7 | "rules": { 8 | "tags": ["recommended"] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /deno.lock: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2", 3 | "remote": { 4 | "https://deno.land/std@0.138.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", 5 | "https://deno.land/std@0.138.0/flags/mod.ts": "019df8a63ed24df2d10be22e8983aa9253623e871228a2f8f328ff2d0404f7ef", 6 | "https://deno.land/std@0.138.0/fmt/colors.ts": "30455035d6d728394781c10755351742dd731e3db6771b1843f9b9e490104d37", 7 | "https://deno.land/std@0.138.0/testing/_diff.ts": "029a00560b0d534bc0046f1bce4bd36b3b41ada3f2a3178c85686eb2ff5f1413", 8 | "https://deno.land/std@0.138.0/testing/_format.ts": "0d8dc79eab15b67cdc532826213bbe05bccfd276ca473a50a3fc7bbfb7260642", 9 | "https://deno.land/std@0.138.0/testing/asserts.ts": "dc7ab67b635063989b4aec8620dbcc6fa7c2465f2d9c856bddf8c0e7b45b4481", 10 | "https://deno.land/std@0.166.0/_util/asserts.ts": "d0844e9b62510f89ce1f9878b046f6a57bf88f208a10304aab50efcb48365272", 11 | "https://deno.land/std@0.166.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", 12 | "https://deno.land/std@0.166.0/bytes/equals.ts": "3c3558c3ae85526f84510aa2b48ab2ad7bdd899e2e0f5b7a8ffc85acb3a6043a", 13 | "https://deno.land/std@0.166.0/bytes/mod.ts": "b2e342fd3669176a27a4e15061e9d588b89c1aaf5008ab71766e23669565d179", 14 | "https://deno.land/std@0.166.0/fmt/colors.ts": "9e36a716611dcd2e4865adea9c4bec916b5c60caad4cdcdc630d4974e6bb8bd4", 15 | "https://deno.land/std@0.166.0/fs/exists.ts": "6a447912e49eb79cc640adacfbf4b0baf8e17ede6d5bed057062ce33c4fa0d68", 16 | "https://deno.land/std@0.166.0/io/buffer.ts": "245f1762a949082ddc0a6e9b15589d0be2d29c150266decd04320b8a8318f9f6", 17 | "https://deno.land/std@0.166.0/io/types.d.ts": "107e1e64834c5ba917c783f446b407d33432c5d612c4b3430df64fc2b4ecf091", 18 | "https://deno.land/std@0.166.0/log/handlers.ts": "61ab932822ba268ad42b25de6f0014892fe469df7627b14245ad32db6fd8b54d", 19 | "https://deno.land/std@0.166.0/log/levels.ts": "82c965b90f763b5313e7595d4ba78d5095a13646d18430ebaf547526131604d1", 20 | "https://deno.land/std@0.166.0/log/logger.ts": "b545159727b023825ee6814d9178fb2a7472f8d95d704c253b771b95c658cf8c", 21 | "https://deno.land/std@0.166.0/log/mod.ts": "90618a3fdbb4520ed4e7d960665322a3dbfc107eebb3345fe0f36c8c8a7b7962", 22 | "https://deno.land/std@0.167.0/_util/asserts.ts": "d0844e9b62510f89ce1f9878b046f6a57bf88f208a10304aab50efcb48365272", 23 | "https://deno.land/std@0.167.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", 24 | "https://deno.land/std@0.167.0/bytes/concat.ts": "97a1274e117510ffffc9499c4debb9541e408732bab2e0ca624869ae13103c10", 25 | "https://deno.land/std@0.167.0/bytes/copy.ts": "d14a58f188a997ee0d2ba696d0c82a42f4fb4b6705e90a4238b77d7644dae24c", 26 | "https://deno.land/std@0.167.0/fmt/colors.ts": "03ad95e543d2808bc43c17a3dd29d25b43d0f16287fe562a0be89bf632454a12", 27 | "https://deno.land/std@0.167.0/fs/exists.ts": "6a447912e49eb79cc640adacfbf4b0baf8e17ede6d5bed057062ce33c4fa0d68", 28 | "https://deno.land/std@0.167.0/io/buffer.ts": "9d6f555ded12960bd5a44f57291a82270cca0a77bde6cadd1384a03a86bf876a", 29 | "https://deno.land/std@0.167.0/io/types.d.ts": "790d3a3fa6b7f298d4cfbcf8bfd9d4be595c1b1acaa3eebb3009177df98bf93c", 30 | "https://deno.land/std@0.167.0/log/handlers.ts": "f0a9ac3892d46381982db388b8bde4e487eca290be04ec77321edf0ada8575d3", 31 | "https://deno.land/std@0.167.0/log/levels.ts": "3043c0bf69b1de718488feb6e0ded2d64f6aef362fe73f762b506f32b1029ea2", 32 | "https://deno.land/std@0.167.0/log/logger.ts": "83fb231064a38736fbfd078fe6624e21ed2537733de7baa1cdd749b8c3c9d991", 33 | "https://deno.land/std@0.167.0/log/mod.ts": "6ff372a706ecef125a9fd455931ae00741d6408562c84cf2fbdc35a2c2a840af", 34 | "https://deno.land/x/denomander@0.9.3/deps.ts": "ee3eaf845a9837e38bfd660fd3521c85b3decc5f264b7c6e474627a46f87e9bf", 35 | "https://deno.land/x/denomander@0.9.3/mod.ts": "eb4b69cb286079982ac85c30591a2311047441f2bc2c9ad137f738843933965a", 36 | "https://deno.land/x/denomander@0.9.3/src/Arguments.ts": "597037e58244baa1d9acb216da77913d3a4e9885fafadc76929155a4f0a74298", 37 | "https://deno.land/x/denomander@0.9.3/src/Command.ts": "f27085b553809674dec027ffd5b8f4470730af8186856850ee9689c48cd0c095", 38 | "https://deno.land/x/denomander@0.9.3/src/CustomOption.ts": "22316399f71ce584d36e242643113456cf7d93b195b4667a3cf4c1e20c8847ae", 39 | "https://deno.land/x/denomander@0.9.3/src/Denomander.ts": "597491b5bfbb653ae5e05d0307cfb0c733615e7dbc3322b7da36523dd306ebd6", 40 | "https://deno.land/x/denomander@0.9.3/src/Executor.ts": "fa3a1132981369a97636af17139a316885e05810806498daf15a8197b0f032eb", 41 | "https://deno.land/x/denomander@0.9.3/src/Kernel.ts": "7800e95588c341ee46019991453f60e54e850a2d6293dbd81dfca3b212d2db47", 42 | "https://deno.land/x/denomander@0.9.3/src/Option.ts": "a272450bb3e814ee2ef1776f75c595e50230c3f56fd16c85809c122979dbf492", 43 | "https://deno.land/x/denomander@0.9.3/src/Validator.ts": "b7f56a2bd773ab52394bf0d7d8b47379331eead2dcd1282062c045bec215a020", 44 | "https://deno.land/x/denomander@0.9.3/src/printer/Printer.ts": "ff4b25a2c734322ea60ce43a7c66f39e28bb0b32ca105bcdf78e5741d0ecab60", 45 | "https://deno.land/x/denomander@0.9.3/src/printer/colors.ts": "ba785bf6a5975200e29fd120e34a78cf192b43fd25deed3b2516c05f833fc941", 46 | "https://deno.land/x/denomander@0.9.3/src/types/interfaces.ts": "1a64640a774f6a6a0c4f23aa3886b5e19acd07da7b72fa5365e3cd208457c704", 47 | "https://deno.land/x/denomander@0.9.3/src/types/types.ts": "8c575c785e522269e454f6130aea764d829d581566b06fc1fc87e3fce3779856", 48 | "https://deno.land/x/denomander@0.9.3/src/utils/detect.ts": "e20b93554e8d87126a0a813c247a53b8781c6a65bbd1ca0cd6526567e84f878a", 49 | "https://deno.land/x/denomander@0.9.3/src/utils/find.ts": "0a74d7a081a0c97ded180e5ce728bd1b156e7aaf67116713ddc4abe545e44ded", 50 | "https://deno.land/x/denomander@0.9.3/src/utils/print.ts": "6d6a6d86f14ced800bb1c49eed2d2ea20f5f33a922aba60659e221b4a7e942ff", 51 | "https://deno.land/x/denomander@0.9.3/src/utils/remove.ts": "e80f1d257f76cbcafafc855debe7274c59db319639b51aca63a63003e8cf1118", 52 | "https://deno.land/x/denomander@0.9.3/src/utils/set.ts": "a89fe0f27575cecd5f5fdaa6907f13a387a03c83b3ef66fd317d114f4dc0fe3e", 53 | "https://deno.land/x/denomander@0.9.3/src/utils/utils.ts": "fc29c3b267065685c45d24b3e597e67bee94b2b9d68b5739625051358fef541e", 54 | "https://raw.githubusercontent.com/YuG1224/kusa/main/app.ts": "44b8b04f28153f1b5a7f84fa826decb1c048bcf91b162a0214bb9f164f3d2cd1" 55 | }, 56 | "npm": { 57 | "specifiers": { 58 | "@faker-js/faker": "@faker-js/faker@8.0.2", 59 | "dayjs": "dayjs@1.11.9", 60 | "dayjs@^1.11.6": "dayjs@1.11.6" 61 | }, 62 | "packages": { 63 | "@faker-js/faker@8.0.2": { 64 | "integrity": "sha512-Uo3pGspElQW91PCvKSIAXoEgAUlRnH29sX2/p89kg7sP1m2PzCufHINd0FhTXQf6DYGiUlVncdSPa2F9wxed2A==", 65 | "dependencies": {} 66 | }, 67 | "dayjs@1.11.6": { 68 | "integrity": "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ==", 69 | "dependencies": {} 70 | }, 71 | "dayjs@1.11.9": { 72 | "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==", 73 | "dependencies": {} 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /main.ts: -------------------------------------------------------------------------------- 1 | import { faker } from "npm:@faker-js/faker"; 2 | import * as log from "https://deno.land/std@0.167.0/log/mod.ts"; 3 | import dayjs from "npm:dayjs"; 4 | import Denomander from "https://deno.land/x/denomander@0.9.3/mod.ts"; 5 | 6 | // deno-lint-ignore no-explicit-any 7 | function validateDate(value: any): string { 8 | if (dayjs(String(value), "YYYYMMDD").format("YYYYMMDD") !== String(value)) { 9 | throw `${program.errors.INVALID_RULE}: ${value}`; 10 | } 11 | return String(value); 12 | } 13 | 14 | // deno-lint-ignore no-explicit-any 15 | function validateNumber(value: any): number { 16 | if (Number.isNaN(parseInt(value, 10))) { 17 | throw `${program.errors.INVALID_RULE}: ${value}`; 18 | } 19 | return parseInt(value, 10); 20 | } 21 | 22 | const program = new Denomander({ 23 | app_name: "kusa", 24 | app_description: "jinko shiba generator", 25 | app_version: "2.0.0", 26 | }); 27 | 28 | // コマンド定義 29 | program 30 | .command("generate") 31 | .requiredOption( 32 | "--from", 33 | "(required) This flag specifies the start date. [YYYYMMDD]", 34 | validateDate, 35 | ) 36 | .requiredOption( 37 | "--to", 38 | "(required) This flag specifies the end date. [YYYYMMDD]", 39 | validateDate, 40 | ) 41 | .option( 42 | "--weekday", 43 | "This argument is the percentage to run during the daytime on weekdays. [number]", 44 | validateNumber, 45 | ) 46 | .option( 47 | "--holiday", 48 | "This argument is the percentage to run on holidays and at night. [number]", 49 | validateNumber, 50 | ) 51 | .parse(Deno.args); 52 | 53 | // 変数の定義 54 | const { from, to, weekday: wd = 5, holiday: hd = 50 } = program; 55 | 56 | // 開始の日時をセット 57 | let date = dayjs(`${from}`, "YYYYMMDD"); 58 | 59 | // 終了の日時をセット 60 | const end = dayjs(`${to}`, "YYYYMMDD"); 61 | 62 | // dateとendのdiffを取る 63 | const diff = () => { 64 | return date.diff(end) < 0; 65 | }; 66 | 67 | // dateがendの日時を過ぎるまで続ける 68 | while (diff()) { 69 | // // 月-金判定 70 | // const isWeekday = +date.format("d") > 0 && +date.format("d") < 6; 71 | 72 | // 21-3時判定 73 | const isWorkTime = +date.format("h") >= 21 && +date.format("h") <= 3; 74 | 75 | // 1/n判定 76 | const n = isWorkTime ? wd : hd; 77 | 78 | // 月-金で21-4時の間で1/5の確率でgit commitを行う 79 | // 土日もしくは日中帯の間で1/50の確率でgit commitを行う 80 | const canCommit = Math.floor(Math.random() * n) === 0; 81 | 82 | if (canCommit) { 83 | await commit(); 84 | } 85 | 86 | // 時間を進める 87 | date = date.add(15, "minute"); 88 | } 89 | 90 | // commitする 91 | async function commit() { 92 | Deno.env.set("GIT_AUTHOR_DATE", date.format()); 93 | Deno.env.set("GIT_COMMITTER_DATE", date.format()); 94 | 95 | // フェイクユーザーリストを作成 96 | if (faker.datatype.boolean()) { 97 | const fakePersonList = [...Array(faker.number.int(20))].map(() => { 98 | return { 99 | userId: faker.string.uuid(), 100 | fullName: faker.person.fullName(), 101 | bio: faker.person.bio(), 102 | gender: faker.person.gender(), 103 | birthdate: faker.date.birthdate(), 104 | registeredAt: faker.date.past(), 105 | }; 106 | }); 107 | await Deno.writeTextFile( 108 | ".fake/personList.json", 109 | JSON.stringify(fakePersonList, null, 2), 110 | ); 111 | } 112 | // フェイク会社リストを作成 113 | if (faker.datatype.boolean()) { 114 | const fakeCompanyList = [...Array(faker.number.int(20))].map(() => { 115 | return { 116 | companyId: faker.string.uuid(), 117 | companyName: faker.company.name(), 118 | catchPhrase: faker.company.catchPhrase(), 119 | buzzPhrase: faker.company.buzzPhrase(), 120 | established: faker.date.birthdate({ min: 0, max: 100, mode: "age" }), 121 | registeredAt: faker.date.past(), 122 | }; 123 | }); 124 | await Deno.writeTextFile( 125 | ".fake/companyList.json", 126 | JSON.stringify(fakeCompanyList, null, 2), 127 | ); 128 | } 129 | 130 | // フェイク商品リストを作成 131 | if (faker.datatype.boolean()) { 132 | const fakeProductList = [...Array(faker.number.int(20))].map(() => { 133 | return { 134 | productId: faker.string.uuid(), 135 | productName: faker.commerce.productName(), 136 | price: faker.commerce.price(), 137 | productDescription: faker.commerce.productDescription(), 138 | registeredAt: faker.date.past(), 139 | }; 140 | }); 141 | await Deno.writeTextFile( 142 | ".fake/productList.json", 143 | JSON.stringify(fakeProductList, null, 2), 144 | ); 145 | } 146 | 147 | const c = new Deno.Command("git", { 148 | args: [ 149 | "commit", 150 | "--allow-empty", 151 | "-am", 152 | faker.lorem.sentence({ max: 5, min: 3 }), 153 | ], 154 | }); 155 | 156 | const { stdout, stderr } = await c.outputSync(); 157 | 158 | log.info(new TextDecoder().decode(stdout || stderr)); 159 | } 160 | --------------------------------------------------------------------------------