onlybuild 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +34 -5
- package/dist/bin/index.js +9 -1
- package/dist/package.json +3 -2
- package/dist/src/build.d.ts +1 -1
- package/dist/src/build.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v1.5.0](https://github.com/neogeek/onlybuild/tree/v1.5.0) - (2024-05-13)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/neogeek/onlybuild/compare/v1.4.1...v1.5.0)
|
|
6
|
+
|
|
7
|
+
- [feat] Added logging of files build and copied as well as the duration. [#21](https://github.com/neogeek/onlybuild/pull/21)
|
|
8
|
+
- [hotfix] Updated packages. [#20](https://github.com/neogeek/onlybuild/pull/20)
|
|
9
|
+
|
|
3
10
|
## [v1.4.1](https://github.com/neogeek/onlybuild/tree/v1.4.1) - (2024-05-09)
|
|
4
11
|
|
|
5
12
|
[Full Changelog](https://github.com/neogeek/onlybuild/compare/v1.4.0...v1.4.1)
|
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
## Table of Contents
|
|
28
28
|
|
|
29
|
+
- [Automatic Installation](#automatic-installation)
|
|
29
30
|
- [Install](#install)
|
|
30
31
|
- [Usage](#usage)
|
|
31
32
|
- [Quick Start Guide](#quick-start-guide)
|
|
@@ -44,6 +45,33 @@
|
|
|
44
45
|
- [Community Roadmap](#community-roadmap)
|
|
45
46
|
- [License](#license)
|
|
46
47
|
|
|
48
|
+
## Automatic Installation
|
|
49
|
+
|
|
50
|
+
If this is your first time using `onlybuild`, it is recommended that you use `create-onlybuild-app`, which will walk you through setting up a project and automatically create the files needed to get started.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
$ npx create-onlybuild-app@latest
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
After you run the above command, you'll see the following prompts:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
What is your project named?
|
|
60
|
+
Would you like to use TypeScript?
|
|
61
|
+
How would you like to create pages?
|
|
62
|
+
Include prettier config?
|
|
63
|
+
Do you want to watch for changes?
|
|
64
|
+
Do you want to serve files locally?
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
And once you answer these questions, `create-onlybuild-app` will automatically create the files needed to get started based on your answers.
|
|
68
|
+
|
|
69
|
+
It will also show the commands needed to enter the folder and build, watch (if enabled) or serve (if enabled) your static website.
|
|
70
|
+
|
|
71
|
+
### Demo
|
|
72
|
+
|
|
73
|
+
https://github.com/neogeek/onlybuild/assets/6753/e64f0d09-44a9-41b6-9c4d-d004138e9f89
|
|
74
|
+
|
|
47
75
|
## Install
|
|
48
76
|
|
|
49
77
|
### Globally
|
|
@@ -266,7 +294,7 @@ LICENSE
|
|
|
266
294
|
|
|
267
295
|
## React
|
|
268
296
|
|
|
269
|
-
If you want to use [React
|
|
297
|
+
If you want to use [React](https://react.dev/), instead of <code>`html`</code> string templates, you can do that by using `react-dom/server` in a `.jsx` or `.tsx` file.
|
|
270
298
|
|
|
271
299
|
```javascript
|
|
272
300
|
import React from 'react';
|
|
@@ -279,7 +307,7 @@ function Hello() {
|
|
|
279
307
|
export default renderToString(<Hello />);
|
|
280
308
|
```
|
|
281
309
|
|
|
282
|
-
In order for `.jsx` or `.tsx` files to work
|
|
310
|
+
In order for `.jsx` or `.tsx` files to work properly you will need to add `"type": "module"` to your `package.json`.
|
|
283
311
|
|
|
284
312
|
```json
|
|
285
313
|
{
|
|
@@ -291,7 +319,7 @@ In order for `.jsx` or `.tsx` files to work property you will need to add `"type
|
|
|
291
319
|
|
|
292
320
|
## TypeScript
|
|
293
321
|
|
|
294
|
-
In order for TypeScript files to work
|
|
322
|
+
In order for TypeScript files to work properly you will need to add `"type": "module"` to your `package.json`.
|
|
295
323
|
|
|
296
324
|
```json
|
|
297
325
|
{
|
|
@@ -366,7 +394,8 @@ Serving the files once the build is complete is easy using the NPM package [http
|
|
|
366
394
|
1. [External API](./examples/external-api/) - Output data fetched from an external API.
|
|
367
395
|
1. [<code>`html`</code> String Template](./examples/html-string-template/) - Use the <code>`html`</code> string template utility to add syntax highlighting to HTML.
|
|
368
396
|
1. [Includes](./examples/includes/) - An example that uses reusable includes for building multiple pages.
|
|
369
|
-
1. [React
|
|
397
|
+
1. [React](./examples/react/) - An example using React to render HTML.
|
|
398
|
+
1. [TypeScript](./examples/typescript/) - A simple example using TypeScript.
|
|
370
399
|
|
|
371
400
|
## Benchmark
|
|
372
401
|
|
|
@@ -377,7 +406,7 @@ Times shown are in seconds. Lower is better.
|
|
|
377
406
|
|
|
378
407
|
| Markdown Files | 250 | 500 | 1000 | 2000 | 4000 |
|
|
379
408
|
| ---------------------------------------------- | -------: | -------: | -------: | -------: | -------: |
|
|
380
|
-
| onlybuild | `0.
|
|
409
|
+
| onlybuild | `0.349` | `0.455` | `0.626` | `0.980` | `1.661` |
|
|
381
410
|
| [Hugo](https://gohugo.io/) v0.101.0 | `0.071` | `0.110` | `0.171` | `0.352` | `0.684` |
|
|
382
411
|
| [Eleventy](https://www.11ty.dev/) 1.0.1 | `0.584` | `0.683` | `0.914` | `1.250` | `1.938` |
|
|
383
412
|
| [Astro](https://astro.build/) 1.0.1 | `2.270` | `3.172` | `5.098` | `9.791` | `22.907` |
|
package/dist/bin/index.js
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import 'dotenv/config';
|
|
3
3
|
import 'tsx/esm';
|
|
4
4
|
import { globby } from 'globby';
|
|
5
|
+
import chalk from 'chalk';
|
|
5
6
|
import parseCmdArgs from 'parse-cmd-args';
|
|
6
7
|
import { buildFiles, writeFiles } from '../src/build.js';
|
|
7
8
|
import { copyFiles } from '../src/copy.js';
|
|
8
9
|
import pkg from '../package.json' assert { type: 'json' };
|
|
10
|
+
const elapsedTimeLabel = 'Elapsed time:';
|
|
11
|
+
console.time(elapsedTimeLabel);
|
|
9
12
|
const args = parseCmdArgs(null, {
|
|
10
13
|
requireUserInput: false
|
|
11
14
|
});
|
|
@@ -60,5 +63,10 @@ const filesToCopy = await globby([
|
|
|
60
63
|
ignoreFiles: [ignoreFile],
|
|
61
64
|
cwd: args.inputs[0]
|
|
62
65
|
});
|
|
63
|
-
|
|
66
|
+
const filesToWrite = await buildFiles(filesToBuild);
|
|
67
|
+
await writeFiles(filesToWrite, buildDir);
|
|
64
68
|
await copyFiles(filesToCopy, buildDir);
|
|
69
|
+
console.log(`Wrote ${chalk.green(filesToWrite.length)} file(s).`);
|
|
70
|
+
console.log(`Copied ${chalk.green(filesToCopy.length)} file(s).`);
|
|
71
|
+
console.log('');
|
|
72
|
+
console.timeEnd(elapsedTimeLabel);
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onlybuild",
|
|
3
3
|
"description": "A zero-config cli for building static websites.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.x"
|
|
7
7
|
},
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
"types": "./dist/src/index.d.ts",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"chalk": "5.3.0",
|
|
20
21
|
"dotenv": "16.4.5",
|
|
21
22
|
"globby": "14.0.1",
|
|
22
23
|
"parse-cmd-args": "5.0.2",
|
|
23
|
-
"tsx": "4.
|
|
24
|
+
"tsx": "4.10.2"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@types/node": "20.12.11",
|
package/dist/src/build.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const writeFileAndMakeDir: (path: string, contents: string) => Pr
|
|
|
34
34
|
/**
|
|
35
35
|
* Write files to the build directory.
|
|
36
36
|
*
|
|
37
|
-
* @param {{ path: string; contents: string }[]} files
|
|
37
|
+
* @param {{ path: string; contents: string }[]} files
|
|
38
38
|
* @param {string} buildDir
|
|
39
39
|
*/
|
|
40
40
|
export declare const writeFiles: (files: {
|
package/dist/src/build.js
CHANGED
|
@@ -42,7 +42,7 @@ export const writeFileAndMakeDir = async (path, contents) => {
|
|
|
42
42
|
/**
|
|
43
43
|
* Write files to the build directory.
|
|
44
44
|
*
|
|
45
|
-
* @param {{ path: string; contents: string }[]} files
|
|
45
|
+
* @param {{ path: string; contents: string }[]} files
|
|
46
46
|
* @param {string} buildDir
|
|
47
47
|
*/
|
|
48
48
|
export const writeFiles = async (files, buildDir) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onlybuild",
|
|
3
3
|
"description": "A zero-config cli for building static websites.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.x"
|
|
7
7
|
},
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
"types": "./dist/src/index.d.ts",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"chalk": "5.3.0",
|
|
20
21
|
"dotenv": "16.4.5",
|
|
21
22
|
"globby": "14.0.1",
|
|
22
23
|
"parse-cmd-args": "5.0.2",
|
|
23
|
-
"tsx": "4.
|
|
24
|
+
"tsx": "4.10.2"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@types/node": "20.12.11",
|