From 9bf870ac61523b487829c3b38b71eea76b088932 Mon Sep 17 00:00:00 2001 From: niltor Date: Wed, 31 Jul 2024 12:18:13 +0800 Subject: [PATCH 1/3] release v1.0.0 --- .github/workflows/static.yml | 6 +++--- src/BuildSite/BuildSite.csproj | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 00890a7..943b761 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -33,14 +33,14 @@ jobs: with: dotnet-version: '8.x' - - run: dotnet tool install -g Ater.EasyBlog --version 1.0.0-beta1 - - run: ezblog build ./Content ./WebApp + - run: dotnet tool install -g Ater.EasyBlog --version 1.0.0 + - run: ezblog build ./Content ./site - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: 'WebApp/' + path: 'site/' - name: Deploy to GitHub Pages id: deployment diff --git a/src/BuildSite/BuildSite.csproj b/src/BuildSite/BuildSite.csproj index c2e99c0..e64c14f 100644 --- a/src/BuildSite/BuildSite.csproj +++ b/src/BuildSite/BuildSite.csproj @@ -9,7 +9,7 @@ ./nupkg 8.0.0 Ater.EasyBlog - 1.0.0-beta1 + 1.0.0 The Static Blog Site Generator! NilTor Atersoft From ff6cc142eb97ce3c5af3e72d899f7b583a2780e0 Mon Sep 17 00:00:00 2001 From: niltor Date: Wed, 31 Jul 2024 14:13:58 +0800 Subject: [PATCH 2/3] add node package commander --- README.md | 2 +- README_cn.md | 2 +- src/NodePackage/.npmignore | 6 ++++ src/NodePackage/README.md | 64 ++++++++++++++++++++++++++++++++++ src/NodePackage/index.js | 34 ++++++++++++++++++ src/NodePackage/package.json | 15 +++++++- src/NodePackage/pnpm-lock.yaml | 31 ++++++++++++++++ 7 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 src/NodePackage/.npmignore create mode 100644 src/NodePackage/README.md create mode 100644 src/NodePackage/pnpm-lock.yaml diff --git a/README.md b/README.md index fbe855d..83c7da6 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ jobs: with: dotnet-version: 8.x - - run: dotnet tool install -g Ater.EasyBlog --version 1.0.0-beta1 + - run: dotnet tool install -g Ater.EasyBlog --version 1.0.0 - run: ezblog build ./Content ./_site - name: Upload artifact diff --git a/README_cn.md b/README_cn.md index ba1468c..f81309e 100644 --- a/README_cn.md +++ b/README_cn.md @@ -142,7 +142,7 @@ jobs: with: dotnet-version: 8.x - - run: dotnet tool install -g Ater.EasyBlog --version 1.0.0-beta1 + - run: dotnet tool install -g Ater.EasyBlog --version 1.0.0 - run: ezblog build ./Content ./_site - name: Upload artifact diff --git a/src/NodePackage/.npmignore b/src/NodePackage/.npmignore new file mode 100644 index 0000000..465395c --- /dev/null +++ b/src/NodePackage/.npmignore @@ -0,0 +1,6 @@ +/bin/*.d.ts +/bin/*.pdb +/bin/*.xml +/obj +*.csproj +*.sln \ No newline at end of file diff --git a/src/NodePackage/README.md b/src/NodePackage/README.md new file mode 100644 index 0000000..f64a4b7 --- /dev/null +++ b/src/NodePackage/README.md @@ -0,0 +1,64 @@ +# Blog + +This tool generates a `pure static` blog website from a `markdown` document through commands. With the help of `GitHub Pages`, you can have a personal blog for free in 5 minutes.It has the following characteristics + +- Provide command line tools to generate static websites +- Generate a pure static website with extremely fast access speed +- Support for content written in markdown format +- Support search, classification, archiving and screening +- Customize website name and description, etc + +**Demo:** NilTor's Blog: [https://blog.dusi.dev/](https://blog.dusi.dev/) + +## 🎖️Features + +- Blog list on the homepage, supporting search, category and archive filtering +- Customize website name and description +- Light and Dark themes that change with the system +- Adaptive display for mobile devices +- TOC support +- mermaid, nomnoml, Math rendering support +- Code highlighting and copy support + +## 🚀Quick Start + +Currently, the tool has been released in the form of 'dotnet tool'.You can easily install and use it. + +### Using tools + +We assume that you already have some markdown documents in the `markdown` directory. + +Now we use the command: + +```pwsh +ezblog init +``` + +Initialize a 'webinfo.json' file to configure the basic information of your blog. This file can be reused during subsequent generation.The document reads as follows: + +```json +{ + "Name": "Niltor Blog", // blog name, displayed at the top of the homepage navigation + "Description": "🗽 for freedom",// description, displayed in the middle of the top of the homepage + "AuthorName": "Ater", // Author name, displayed in the blog list + "BaseHref": "/blazor-blog/", // sub directory + "Domain": "https://aterdev.github.io" // Domain name, used for generating a sitemap. Leave it blank if not needed +} +``` + +> [!IMPORTANT] +Please note that the trailing `/` in `BaseHref` is mandatory. +> +If you have configured a custom domain name and are not using a subdirectory, set BaseHref to '/'. + +Then we use the command + +```pwsh +ezblog build .\markdown .\WebApp +``` + +This command will convert all markdown files in the 'markdown' directory into html files and generate them into the 'WebApp' directory. + +You can use the `http-server` command to start a local server and view the generated content. + +The 'WebApp' directory contains everything you need for a static website, and you can freely deploy it wherever you need. diff --git a/src/NodePackage/index.js b/src/NodePackage/index.js index 908ba84..fc072ca 100644 --- a/src/NodePackage/index.js +++ b/src/NodePackage/index.js @@ -1 +1,35 @@ #!/usr/bin/env node +import dotnet from 'node-api-dotnet'; +import { Command } from "commander"; + + +const program = new Command(); + +program.name('ezblog') + .description('Generates a pure static blog website from a markdown document'); + +program.command('init') + .description('') + .action(() => { + console.log('init'); + }); + + +program.command('build ') + .description('生成静态博客站点') + .argument('', 'markdown文件目录') + .argument('', '站点输出目录') + .action((source, output) => { + + }); + +program + .action(() => { + console.log('No command provided. Use --help to see available commands.'); + }); + +program.on('--help', () => { + console.log('Generates a pure static blog website from a markdown document'); +}); + +program.parse(process.argv); \ No newline at end of file diff --git a/src/NodePackage/package.json b/src/NodePackage/package.json index 8cca0ce..991aa48 100644 --- a/src/NodePackage/package.json +++ b/src/NodePackage/package.json @@ -1,11 +1,24 @@ { "name": "ater.ezblog", "version": "0.1.0", + "bin": { + "ezblog": "./index.js" + }, "description": "Generates a pure static blog website from a markdown document through commands", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "repository": { + "type": "git", + "url": "https://github.com/AterDev/EasyBlog" + }, + "homepage": "https://github.com/AterDev/EasyBlog", + "readme": "README.md", "author": "NilTor", - "license": "MIT" + "license": "MIT", + "dependencies": { + "commander": "^12.1.0", + "node-api-dotnet": "^0.7.34" + } } \ No newline at end of file diff --git a/src/NodePackage/pnpm-lock.yaml b/src/NodePackage/pnpm-lock.yaml new file mode 100644 index 0000000..ef74aa8 --- /dev/null +++ b/src/NodePackage/pnpm-lock.yaml @@ -0,0 +1,31 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + commander: + specifier: ^12.1.0 + version: 12.1.0 + node-api-dotnet: + specifier: ^0.7.34 + version: 0.7.34 + +packages: + + commander@12.1.0: + resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} + engines: {node: '>=18'} + + node-api-dotnet@0.7.34: + resolution: {integrity: sha512-L/BA4CPVtUj2Z0+st7zGUL8x50gk5+40U8BC3c6DFwxQdqAWAM9q0nCeqFlfb2AX7UYN6wzsgwf8f6WcVzma1Q==} + +snapshots: + + commander@12.1.0: {} + + node-api-dotnet@0.7.34: {} From 0fd7d1c80a3a4b621811bacd5b24d4216092d420 Mon Sep 17 00:00:00 2001 From: niltor Date: Wed, 31 Jul 2024 14:15:35 +0800 Subject: [PATCH 3/3] update package --- src/NodePackage/index.js | 15 +++++++++++---- src/NodePackage/package.json | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/NodePackage/index.js b/src/NodePackage/index.js index fc072ca..39c1220 100644 --- a/src/NodePackage/index.js +++ b/src/NodePackage/index.js @@ -1,17 +1,24 @@ #!/usr/bin/env node import dotnet from 'node-api-dotnet'; import { Command } from "commander"; +import "./bin/BuildSite.js"; +const Cmd = dotnet.BuildSite.Command; + const program = new Command(); program.name('ezblog') .description('Generates a pure static blog website from a markdown document'); program.command('init') - .description('') - .action(() => { - console.log('init'); + .description('初始化webinfo.json配置文件') + .argument('[path]', '目录') + .action((path) => { + if (path == null) { + path = '' + } + Cmd.Init(path); }); @@ -20,7 +27,7 @@ program.command('build ') .argument('', 'markdown文件目录') .argument('', '站点输出目录') .action((source, output) => { - + Cmd.Build(source, output); }); program diff --git a/src/NodePackage/package.json b/src/NodePackage/package.json index 991aa48..e1937d1 100644 --- a/src/NodePackage/package.json +++ b/src/NodePackage/package.json @@ -17,6 +17,7 @@ "readme": "README.md", "author": "NilTor", "license": "MIT", + "type": "module", "dependencies": { "commander": "^12.1.0", "node-api-dotnet": "^0.7.34"