-
-
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.
- Loading branch information
0 parents
commit 5df45b3
Showing
22 changed files
with
5,822 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
github: razonyang | ||
custom: | ||
- https://paypal.me/razonyang |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: lint | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
- run: npm ci | ||
- run: npm run lint |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
command: manifest | ||
- uses: actions/checkout@v4 | ||
if: ${{ steps.release.outputs.release_created }} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
registry-url: 'https://registry.npmjs.org' | ||
if: ${{ steps.release.outputs.release_created }} | ||
- run: npm ci | ||
if: ${{ steps.release.outputs.release_created }} | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: ${{ steps.release.outputs.release_created }} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public/ | ||
resources/ | ||
.hugo_build.lock | ||
node_modules/ |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pull_request_rules: | ||
- name: Automatic merge for Renovate pull requests | ||
conditions: | ||
- author=renovate[bot] | ||
actions: | ||
merge: | ||
method: rebase | ||
|
||
- name: Automatic merge on approval | ||
conditions: | ||
- "#approved-reviews-by>=1" | ||
actions: | ||
merge: | ||
method: rebase |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
".": "0.0.1" | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.tmpl.scss |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "stylelint-config-standard-scss", | ||
"rules": { | ||
"at-rule-no-unknown": null, | ||
"color-function-notation": null, | ||
"scss/at-rule-no-unknown": true, | ||
"scss/at-extend-no-missing-placeholder": null | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 HugoMods Authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Hugo Lorem Ipsum Content Generator | ||
|
||
[![License](https://flat.badgen.net/github/license/hugomods/lorem-ipsum-content-generator)](https://github.com/hugomods/lorem-ipsum-content-generator/blob/main/LICENSE) | ||
[![Version](https://flat.badgen.net/github/tag/hugomods/lorem-ipsum-content-generator)](https://github.com/hugomods/lorem-ipsum-content-generator/tags) |
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/usr/bin/env node | ||
const path = require('path') | ||
const fs = require('fs') | ||
const { program } = require('commander') | ||
const LoremIpsum = require('lorem-ipsum').LoremIpsum | ||
const randomstring = require('randomstring') | ||
const Mustache = require('mustache') | ||
|
||
function getRandomInt (min = 1) { | ||
return Math.floor(Math.random() * 10) + min | ||
} | ||
|
||
const template = `--- | ||
date: {{date}} | ||
title: "{{title}}" | ||
description: "{{description}}" | ||
categories: | ||
{{#categories}} | ||
- "{{.}}" | ||
{{/categories}} | ||
tags: | ||
{{#tags}} | ||
- "{{.}}" | ||
{{/tags}} | ||
series: | ||
{{#series}} | ||
- "{{.}}" | ||
{{/series}} | ||
--- | ||
{{body}} | ||
` | ||
|
||
const lorem = new LoremIpsum({ | ||
sentencesPerParagraph: { | ||
max: 8, | ||
min: 4 | ||
}, | ||
wordsPerSentence: { | ||
max: 16, | ||
min: 4 | ||
} | ||
}) | ||
|
||
program | ||
.name('lorem-ipsum-content-generator') | ||
.requiredOption('-n, --number <number>', 'number of content', parseInt) | ||
.option('--paginate <number>', 'how many content per folder', parseInt, 1000) | ||
.option('-o, --output <char>', 'output folder', 'content') | ||
.option('--tag-count <number>', '', parseInt, 5) | ||
.option('--category-count <number>', '', parseInt, 3) | ||
.option('--series-count <number>', '', parseInt, 1) | ||
|
||
program.parse() | ||
|
||
const options = program.opts() | ||
const number = options.number | ||
const paginate = options.paginate | ||
const tagCount = options.tagCount | ||
const categoryCount = options.categoryCount | ||
const seriesCount = options.seriesCount | ||
for (let i = 1; i <= number; i++) { | ||
const date = (new Date()).toISOString() | ||
const title = lorem.generateSentences(1) | ||
const description = lorem.generateSentences(2) | ||
const tags = [] | ||
for (let ti = 0; ti < tagCount; ti++) { | ||
tags.push(randomstring.generate(getRandomInt(3))) | ||
} | ||
const categories = [] | ||
for (let ci = 0; ci < categoryCount; ci++) { | ||
categories.push(randomstring.generate(getRandomInt(3))) | ||
} | ||
const series = [] | ||
for (let si = 0; si < seriesCount; si++) { | ||
series.push(randomstring.generate(getRandomInt(3))) | ||
} | ||
let body = '' | ||
for (let bi = 0; bi < getRandomInt(5); bi++) { | ||
body += ` | ||
## ${lorem.generateWords(3)} | ||
${lorem.generateParagraphs(3)} | ||
` | ||
} | ||
const content = Mustache.render(template, { | ||
date, | ||
title, | ||
description, | ||
body, | ||
tags, | ||
categories, | ||
series | ||
}) | ||
const page = Math.ceil(i / paginate) | ||
const subfolder = `${(page - 1) * paginate + 1}-${page * paginate}` | ||
const file = path.join(options.output, subfolder, `${(i - 1) % paginate + 1}.md`) | ||
const dir = path.dirname(file) | ||
if (!fs.existsSync(dir)) { | ||
fs.mkdirSync(dir, { | ||
recursive: true, | ||
mode: 0o744 | ||
}) | ||
} | ||
fs.writeFile(file, content, err => { | ||
if (err) { | ||
console.error(err) | ||
} | ||
}) | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Oops, something went wrong.