onlybuild 2.0.0 → 2.1.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [v2.1.0](https://github.com/neogeek/onlybuild/tree/v2.1.0) - (2026-04-02)
4
+
5
+ [Full Changelog](https://github.com/neogeek/onlybuild/compare/v2.0.1...v2.1.0)
6
+
7
+ - [feat] Added file utils. [#42](https://github.com/neogeek/onlybuild/pull/42)
8
+
9
+ ## [v2.0.1](https://github.com/neogeek/onlybuild/tree/v2.0.1) - (2026-02-23)
10
+
11
+ [Full Changelog](https://github.com/neogeek/onlybuild/compare/v2.0.0...v2.0.1)
12
+
13
+ - [hotfix] Fixed issue with ignorefile not working. [#41](https://github.com/neogeek/onlybuild/pull/41)
14
+
3
15
  ## [v2.0.0](https://github.com/neogeek/onlybuild/tree/v2.0.0) - (2026-02-21)
4
16
 
5
17
  [Full Changelog](https://github.com/neogeek/onlybuild/compare/v1.6.6...v2.0.0)
package/dist/bin/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
2
  import 'tsx/esm';
3
- import { glob } from 'node:fs/promises';
3
+ import { glob, readFile } from 'node:fs/promises';
4
+ import { existsSync } from 'node:fs';
4
5
  import { parseArgs } from 'node:util';
5
6
  import chalk from 'chalk';
6
7
  import '../src/env.js';
@@ -39,6 +40,9 @@ const [buildDir = 'build/'] = [args.values.out].filter(Boolean).map(String);
39
40
  const [ignoreFile = '.onlyignore'] = [args.values.ignore]
40
41
  .filter(Boolean)
41
42
  .map(String);
43
+ const filesToIgnore = existsSync(ignoreFile)
44
+ ? (await readFile(ignoreFile, 'utf8')).split(/\n+/g).filter(Boolean)
45
+ : [];
42
46
  const filesToBuild = (await Array.fromAsync(glob(['**/*.mjs', '**/*.jsx', '**/*.ts', '**/*.tsx'].filter(Boolean), {
43
47
  exclude: ['node_modules/', '_*/**/*', buildDir, ignoreFile],
44
48
  cwd: args.positionals[0]
@@ -54,7 +58,8 @@ const filesToCopy = (await Array.fromAsync(glob(['**/*'], {
54
58
  'package-lock.json',
55
59
  'node_modules/',
56
60
  buildDir,
57
- ignoreFile
61
+ ignoreFile,
62
+ ...filesToIgnore
58
63
  ],
59
64
  cwd: args.positionals[0]
60
65
  }))).filter(path => path.includes('.'));
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": "2.0.0",
4
+ "version": "2.1.0",
5
5
  "engines": {
6
6
  "node": ">=22.22"
7
7
  },
@@ -21,13 +21,12 @@
21
21
  "tsx": "4.21.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/node": "25.3.0",
25
- "typescript": "5.9.3"
24
+ "@types/node": "25.5.0",
25
+ "typescript": "6.0.2"
26
26
  },
27
27
  "scripts": {
28
28
  "test": "node --import tsx --test --experimental-test-coverage ./src/*.test.ts",
29
- "build": "rm -rf dist/ && tsc && chmod +x ./dist/bin/index.js",
30
- "prepare": "npm run build"
29
+ "build": "rm -rf dist/ && tsc --project tsconfig.build.json && chmod +x ./dist/bin/index.js"
31
30
  },
32
31
  "keywords": [
33
32
  "javascript",
@@ -0,0 +1,2 @@
1
+ export declare const findFiles: (pattern: string | readonly string[], excludePattern?: ((fileName: string) => boolean) | readonly string[] | undefined, cwd?: string) => Promise<string[]>;
2
+ export declare const getPatternsFromGitIgnore: (cwd?: string, filename?: string) => Promise<string[]>;
@@ -0,0 +1,16 @@
1
+ import { EOL } from 'node:os';
2
+ import { join } from 'node:path';
3
+ import { glob, readFile } from 'node:fs/promises';
4
+ export const findFiles = async (pattern, excludePattern, cwd) => {
5
+ return await Array.fromAsync(glob(Array.isArray(pattern) ? pattern.filter(Boolean) : pattern, {
6
+ exclude: Array.isArray(excludePattern)
7
+ ? excludePattern.filter(Boolean)
8
+ : excludePattern,
9
+ cwd
10
+ }));
11
+ };
12
+ export const getPatternsFromGitIgnore = async (cwd, filename = '.gitignore') => {
13
+ return (await readFile(cwd ? join(cwd, filename) : filename, 'utf8'))
14
+ .split(EOL)
15
+ .filter(Boolean);
16
+ };
@@ -1,2 +1,3 @@
1
1
  export { css } from './css.js';
2
2
  export { html } from './html.js';
3
+ export { findFiles, getPatternsFromGitIgnore } from './files.js';
package/dist/src/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { css } from './css.js';
2
2
  export { html } from './html.js';
3
+ export { findFiles, getPatternsFromGitIgnore } from './files.js';
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": "2.0.0",
4
+ "version": "2.1.0",
5
5
  "engines": {
6
6
  "node": ">=22.22"
7
7
  },
@@ -21,13 +21,12 @@
21
21
  "tsx": "4.21.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/node": "25.3.0",
25
- "typescript": "5.9.3"
24
+ "@types/node": "25.5.0",
25
+ "typescript": "6.0.2"
26
26
  },
27
27
  "scripts": {
28
28
  "test": "node --import tsx --test --experimental-test-coverage ./src/*.test.ts",
29
- "build": "rm -rf dist/ && tsc && chmod +x ./dist/bin/index.js",
30
- "prepare": "npm run build"
29
+ "build": "rm -rf dist/ && tsc --project tsconfig.build.json && chmod +x ./dist/bin/index.js"
31
30
  },
32
31
  "keywords": [
33
32
  "javascript",
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["./dist", "**/*.test.ts"]
4
+ }