Skip to content

Commit d2ca784

Browse files
committed
Initial commit
1 parent 48fee36 commit d2ca784

File tree

8 files changed

+1660
-1
lines changed

8 files changed

+1660
-1
lines changed

.gitignore

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
2+
# Created by https://www.gitignore.io/api/macos,node,visualstudiocode
3+
# Edit at https://www.gitignore.io/?templates=macos,node,visualstudiocode
4+
5+
/dist
6+
/tmp
7+
8+
### macOS ###
9+
# General
10+
.DS_Store
11+
.AppleDouble
12+
.LSOverride
13+
14+
# Icon must end with two \r
15+
Icon
16+
17+
# Thumbnails
18+
._*
19+
20+
# Files that might appear in the root of a volume
21+
.DocumentRevisions-V100
22+
.fseventsd
23+
.Spotlight-V100
24+
.TemporaryItems
25+
.Trashes
26+
.VolumeIcon.icns
27+
.com.apple.timemachine.donotpresent
28+
29+
# Directories potentially created on remote AFP share
30+
.AppleDB
31+
.AppleDesktop
32+
Network Trash Folder
33+
Temporary Items
34+
.apdisk
35+
36+
### Node ###
37+
# Logs
38+
logs
39+
*.log
40+
npm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
lerna-debug.log*
44+
45+
# Diagnostic reports (https://nodejs.org/api/report.html)
46+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
47+
48+
# Runtime data
49+
pids
50+
*.pid
51+
*.seed
52+
*.pid.lock
53+
54+
# Directory for instrumented libs generated by jscoverage/JSCover
55+
lib-cov
56+
57+
# Coverage directory used by tools like istanbul
58+
coverage
59+
*.lcov
60+
61+
# nyc test coverage
62+
.nyc_output
63+
64+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
65+
.grunt
66+
67+
# Bower dependency directory (https://bower.io/)
68+
bower_components
69+
70+
# node-waf configuration
71+
.lock-wscript
72+
73+
# Compiled binary addons (https://nodejs.org/api/addons.html)
74+
build/Release
75+
76+
# Dependency directories
77+
node_modules/
78+
jspm_packages/
79+
80+
# TypeScript v1 declaration files
81+
typings/
82+
83+
# TypeScript cache
84+
*.tsbuildinfo
85+
86+
# Optional npm cache directory
87+
.npm
88+
89+
# Optional eslint cache
90+
.eslintcache
91+
92+
# Optional REPL history
93+
.node_repl_history
94+
95+
# Output of 'npm pack'
96+
*.tgz
97+
98+
# Yarn Integrity file
99+
.yarn-integrity
100+
101+
# dotenv environment variables file
102+
.env
103+
.env.test
104+
105+
# parcel-bundler cache (https://parceljs.org/)
106+
.cache
107+
108+
# next.js build output
109+
.next
110+
111+
# nuxt.js build output
112+
.nuxt
113+
114+
# vuepress build output
115+
.vuepress/dist
116+
117+
# Serverless directories
118+
.serverless/
119+
120+
# FuseBox cache
121+
.fusebox/
122+
123+
# DynamoDB Local files
124+
.dynamodb/
125+
126+
### VisualStudioCode ###
127+
.vscode/*
128+
!.vscode/settings.json
129+
!.vscode/tasks.json
130+
!.vscode/launch.json
131+
!.vscode/extensions.json
132+
133+
### VisualStudioCode Patch ###
134+
# Ignore all local history of files
135+
.history
136+
137+
# End of https://www.gitignore.io/api/macos,node,visualstudiocode

LICENSE.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2019, Jason Lee <[email protected]>
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

README.md

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,103 @@
11
# static-sitemap-cli
2-
CLI to generate static sitemaps in 10 minutes.
2+
3+
Simple CLI to pre-generate XML sitemaps for static sites locally.
4+
5+
Built in 10 minutes. :stuck_out_tongue_winking_eye:
6+
7+
8+
### Install
9+
10+
```
11+
npm i -g static-sitemap-cli
12+
```
13+
14+
15+
### Usage
16+
17+
Syntax: `static-sitemap-cli <BASEURL> <options>`
18+
19+
At its simplest, just go to your `dist` folder and run:
20+
21+
```
22+
static-sitemap-cli https://example.com > sitemap.xml
23+
```
24+
25+
By default outputs to `stdout`. So that you can pipe it to do other stuff.
26+
27+
28+
### Arguments
29+
30+
| Argument | Description |
31+
|----------|-------------|
32+
| BASEURL | Base URL that is prefixed to all location entries. For example: https://example.com/ |
33+
34+
35+
### Options
36+
37+
| Option | Long | Description |
38+
|--------|--------------|-----------------------------------------------------------------|
39+
| -h | --help | show CLI help |
40+
| -v | --version | show CLI version |
41+
| -r | --root | [default: .] root dir to start from |
42+
| -m | --match | [default: .html] comma-separated list of extensions to match |
43+
| -i | --ignore | [default: 404.html] comma-separated list of globs to ignore |
44+
| -p | --priority | comma-separated glob/priority pair; eg: foo/*.html,0.1 |
45+
| -f | --changefreq | comma-separated glob/changefreq pair; eg: foo/*.html,daily |
46+
| -n | --no-clean | disable clean URLs |
47+
| -s | --slash | add trailing slash to all URLs |
48+
49+
**Clean URLs**
50+
51+
Whether or not to include the `.html` extension. By default, something like:
52+
53+
`https://example.com/foo/index.html` becomes `https://example.com/foo`.
54+
55+
Pass `-n` option to disable this behavior.
56+
57+
**Trailing Slashes**
58+
59+
Control whether or not URLs should include trailing slashes. For example:
60+
61+
`https://example.com/bar/index.html` becomes `https://example.com/bar/`.
62+
63+
For obvious reasons, this cannot be used together with `-n`.
64+
65+
66+
### Examples
67+
68+
**Create sitemap for `dist/` folder**
69+
70+
```
71+
static-sitemap-cli https://example.com -r dist/ > dist/sitemap.xml
72+
```
73+
74+
Note: Just put `dist/` for that location, not `dist/.` or `./dist/**`.
75+
76+
**Ignore a bunch of files**
77+
78+
```
79+
static-sitemap-cli https://example.com -i 404.html,foo/*.html > sm.xml
80+
```
81+
82+
**Set priority of certain pages**
83+
84+
By default, the optional `<priority>` label ([protocol reference](https://www.sitemaps.org/protocol.html)) is excluded,
85+
so every pages' default is 0.5. To change the *relative* priority (to 0.1) of certain pages:
86+
87+
```
88+
static-sitemap-cli https://example.com -p **/privacy-policy/**,0.1 **/terms-of-service/**,0.1 > sm.xml
89+
```
90+
91+
92+
### To-do
93+
94+
Add tests! :sweat_smile:
95+
96+
97+
### Changelog
98+
99+
**v0.1.0 - 2019-07-26:**
100+
* Initial release.
101+
102+
103+

bin/run

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
require('..').run()
4+
.catch(require('@oclif/errors/handle'))

bin/run.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\run" %*

0 commit comments

Comments
 (0)