Compare commits
2 Commits
feature/cl
...
main
Author | SHA1 | Date | |
---|---|---|---|
772e50b92b | |||
3dd73a05a7 |
1
LICENSE
1
LICENSE
@ -230,3 +230,4 @@ The hypothetical commands `show w' and `show c' should show the appropriate part
|
|||||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# webby
|
# webby
|
||||||
|
|
||||||
A small static website builder written in javascript for learning purposes.
|
A small static website builder written in typescript for learning purposes.
|
1964
package-lock.json
generated
1964
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
73
src/bin.mts
73
src/bin.mts
@ -1,73 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
import type { WebbyAsyncOptions } from './index.js'
|
|
||||||
import { loadPackageJson } from 'package-json-from-dist'
|
|
||||||
|
|
||||||
const { version } = loadPackageJson(import.meta.url)
|
|
||||||
|
|
||||||
const runHelpForUsage = () => console.error('run `webby --help` for usage information')
|
|
||||||
|
|
||||||
export const help = `webby version ${version}
|
|
||||||
|
|
||||||
Usage: webby <path to webby.conf.js file>
|
|
||||||
Builds your website with the information from the webby.conf.js file.
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-h --help Display this usage info
|
|
||||||
--version Display version
|
|
||||||
`
|
|
||||||
|
|
||||||
import { parse, relative, resolve } from 'path'
|
|
||||||
const cwd = process.cwd()
|
|
||||||
|
|
||||||
const main = async (...args: string[]) => {
|
|
||||||
if (process.env.__WEBBY_TESTING_BIN_FAIL__ === '1') {
|
|
||||||
throw new Error('simulated Webby failure')
|
|
||||||
}
|
|
||||||
|
|
||||||
const opt: WebbyAsyncOptions = {}
|
|
||||||
const paths: string[] = []
|
|
||||||
/*
|
|
||||||
let impl: (
|
|
||||||
path: string | string[],
|
|
||||||
opt?: WebbyAsyncOptions,
|
|
||||||
) => Promise<boolean> = webby
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (const arg of args) {
|
|
||||||
if (arg === '-h' || arg === '--help') {
|
|
||||||
console.log(help)
|
|
||||||
return 0
|
|
||||||
} else if (arg === '--version') {
|
|
||||||
console.log(version)
|
|
||||||
return 0
|
|
||||||
} else {
|
|
||||||
console.error(`unknown option: ${arg}`)
|
|
||||||
runHelpForUsage()
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!paths.length) {
|
|
||||||
console.error('webby: must provide a path to build')
|
|
||||||
runHelpForUsage()
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
main.help = help
|
|
||||||
main.version = version
|
|
||||||
|
|
||||||
export default main
|
|
||||||
|
|
||||||
if (process.env.__TESTING_WEBBY_BIN__ !== '1') {
|
|
||||||
const args = process.argv.slice(2)
|
|
||||||
main(...args).then(
|
|
||||||
code => process.exit(code),
|
|
||||||
er => {
|
|
||||||
console.error(er)
|
|
||||||
process.exit(1)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
19
src/index.ts
19
src/index.ts
@ -1,18 +1 @@
|
|||||||
import { Dirent, Stats } from 'fs'
|
console.log("This is Webby - A small static website builder written in TypeScript for learning purposes.")
|
||||||
import { GlobOptions } from 'glob'
|
|
||||||
|
|
||||||
export interface WebbyAsyncOptions {
|
|
||||||
preserveRoot?: boolean
|
|
||||||
tmp?: string
|
|
||||||
maxRetries?: number
|
|
||||||
retryDelay?: number
|
|
||||||
backoff?: number
|
|
||||||
maxBackoff?: number
|
|
||||||
signal?: AbortSignal
|
|
||||||
glob?: boolean | GlobOptions
|
|
||||||
filter?:
|
|
||||||
| ((path: string, ent: Dirent | Stats) => boolean)
|
|
||||||
| ((path: string, ent: Dirent | Stats) => Promise<boolean>)
|
|
||||||
}
|
|
||||||
|
|
||||||
//console.log("This is Webby - A small static website builder written in TypeScript for learning purposes.")
|
|
Loading…
x
Reference in New Issue
Block a user