onlybuild 1.3.0 → 1.4.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 +8 -0
- package/README.md +25 -8
- package/dist/bin/index.d.ts +1 -0
- package/dist/bin/index.js +10 -11
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v1.4.0](https://github.com/neogeek/onlybuild/tree/v1.4.0) - (2024-05-08)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/neogeek/onlybuild/compare/v1.3.0...v1.4.0)
|
|
6
|
+
|
|
7
|
+
- [feat] Switch typescript work without a flag. [#18](https://github.com/neogeek/onlybuild/pull/18)
|
|
8
|
+
- [feat] TSX/React.js Support [#17](https://github.com/neogeek/onlybuild/pull/17)
|
|
9
|
+
- [hotfix] Fixed TypeScript logic to not override JavaScript functionality. [#16](https://github.com/neogeek/onlybuild/pull/16)
|
|
10
|
+
|
|
3
11
|
## [v1.3.0](https://github.com/neogeek/onlybuild/tree/v1.3.0) - (2024-05-08)
|
|
4
12
|
|
|
5
13
|
[Full Changelog](https://github.com/neogeek/onlybuild/compare/v1.2.1...v1.3.0)
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
- [Getting Started](#getting-started)
|
|
33
33
|
- [File Structure](#file-structure)
|
|
34
34
|
- [Ignore Files](#ignore-files)
|
|
35
|
+
- [React](#react)
|
|
35
36
|
- [TypeScript](#typescript)
|
|
36
37
|
- [Formatting Files](#formatting-files)
|
|
37
38
|
- [Watching For Changes](#watching-for-changes)
|
|
@@ -92,7 +93,6 @@ Usage: onlybuild <path> [options]
|
|
|
92
93
|
-v, --version Display the current installed version.
|
|
93
94
|
-o, --out Sets build directory. Default path is build/
|
|
94
95
|
-i, --ignore Sets ignore file path. Default path is .onlyignore
|
|
95
|
-
-t, --typescript Parse TypeScript files. (experimental)
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
## Quick Start Guide
|
|
@@ -264,18 +264,34 @@ screenshot.png
|
|
|
264
264
|
LICENSE
|
|
265
265
|
```
|
|
266
266
|
|
|
267
|
-
##
|
|
267
|
+
## React
|
|
268
268
|
|
|
269
|
-
|
|
270
|
-
> This feature is experimental.
|
|
269
|
+
If you want to use [React.js](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.
|
|
271
270
|
|
|
272
|
-
|
|
271
|
+
```javascript
|
|
272
|
+
import React from 'react';
|
|
273
|
+
import { renderToString } from 'react-dom/server';
|
|
273
274
|
|
|
274
|
-
|
|
275
|
-
|
|
275
|
+
function Hello() {
|
|
276
|
+
return <h1>Hello, React!</h1>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export default renderToString(<Hello />);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
In order for `.jsx` or `.tsx` files to work property you will need to add `"type": "module"` to your `package.json`.
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
...
|
|
287
|
+
"type": "module",
|
|
288
|
+
...
|
|
289
|
+
}
|
|
276
290
|
```
|
|
277
291
|
|
|
278
|
-
|
|
292
|
+
## TypeScript
|
|
293
|
+
|
|
294
|
+
In order for TypeScript files to work property you will need to add `"type": "module"` to your `package.json`.
|
|
279
295
|
|
|
280
296
|
```json
|
|
281
297
|
{
|
|
@@ -350,6 +366,7 @@ Serving the files once the build is complete is easy using the NPM package [http
|
|
|
350
366
|
1. [External API](./examples/external-api/) - Output data fetched from an external API.
|
|
351
367
|
1. [<code>`html`</code> String Template](./examples/html-string-template/) - Use the <code>`html`</code> string template utility to add syntax highlighting to HTML.
|
|
352
368
|
1. [Includes](./examples/includes/) - An example that uses reusable includes for building multiple pages.
|
|
369
|
+
1. [React.js](./examples/react.js/) - An example using React.js to render HTML.
|
|
353
370
|
|
|
354
371
|
## Benchmark
|
|
355
372
|
|
package/dist/bin/index.d.ts
CHANGED
package/dist/bin/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings
|
|
2
2
|
import 'dotenv/config';
|
|
3
|
-
import
|
|
3
|
+
import 'tsx/esm';
|
|
4
4
|
import { globby } from 'globby';
|
|
5
5
|
import parseCmdArgs from 'parse-cmd-args';
|
|
6
6
|
import { buildFiles, writeFiles } from '../src/build.js';
|
|
@@ -22,7 +22,6 @@ else if (args.flags['--help'] || args.flags['-h']) {
|
|
|
22
22
|
-v, --version Display the current installed version.
|
|
23
23
|
-o, --out Sets build directory. Default path is build/
|
|
24
24
|
-i, --ignore Sets ignore file path. Default path is .onlyignore
|
|
25
|
-
-t, --typescript Parse TypeScript files. (experimental)
|
|
26
25
|
`);
|
|
27
26
|
process.exit();
|
|
28
27
|
}
|
|
@@ -32,25 +31,25 @@ const [buildDir = 'build/'] = [args.flags['--out'], args.flags['-o']]
|
|
|
32
31
|
const [ignoreFile = '.onlyignore'] = [args.flags['--ignore'], args.flags['-i']]
|
|
33
32
|
.filter(flag => typeof flag === 'string')
|
|
34
33
|
.map(String);
|
|
35
|
-
const [typescript = false] = [args.flags['--typescript'], args.flags['-t']]
|
|
36
|
-
.filter(flag => typeof flag === 'boolean')
|
|
37
|
-
.map(Boolean);
|
|
38
|
-
if (typescript) {
|
|
39
|
-
register();
|
|
40
|
-
}
|
|
41
34
|
const filesToBuild = await globby([
|
|
42
|
-
|
|
35
|
+
'**/*.mjs',
|
|
36
|
+
'**/*.jsx',
|
|
37
|
+
'**/*.ts',
|
|
38
|
+
'**/*.tsx',
|
|
43
39
|
'!_*/**/*',
|
|
44
40
|
'!node_modules/',
|
|
45
41
|
`!${buildDir}`
|
|
46
|
-
], {
|
|
42
|
+
].filter(Boolean), {
|
|
47
43
|
gitignore: false,
|
|
48
44
|
ignoreFiles: [ignoreFile],
|
|
49
45
|
cwd: args.inputs[0]
|
|
50
46
|
});
|
|
51
47
|
const filesToCopy = await globby([
|
|
52
48
|
'**/*',
|
|
53
|
-
|
|
49
|
+
'!**/*.mjs',
|
|
50
|
+
'!**/*.jsx',
|
|
51
|
+
'!**/*.ts',
|
|
52
|
+
'!**/*.tsx',
|
|
54
53
|
'!_*/**/*',
|
|
55
54
|
'!package.json',
|
|
56
55
|
'!package-lock.json',
|
package/dist/package.json
CHANGED