Skip to content

Commit c186272

Browse files
committed
[2025-11-19] release: 0.3.0-alpha.9
1 parent 0e85c3d commit c186272

File tree

373 files changed

+3287
-2723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

373 files changed

+3287
-2723
lines changed

.scripts/build.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616

1717
import { Build } from './classes/Build.js';
1818
import { Compile } from './classes/Compile.js';
19+
import { Test } from './classes/Test.js';
1920

2021
const _defaults = {
2122
build: Build.prototype.ARGS_DEFAULT,
@@ -77,7 +78,7 @@ const config: Config = {
7778
},
7879
} ],
7980

80-
test: true,
81+
test: Test,
8182

8283
document: {
8384

.scripts/classes/Build.ts

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,40 @@ export class Build extends BuildStage {
3434
'readme' as Stage.SubStage.Build,
3535
'prettify',
3636
'minimize',
37+
'demos' as Stage.SubStage.Build,
3738
'test',
3839
'document',
39-
'demos' as Stage.SubStage.Build,
40+
'tidy' as Stage.SubStage.Build,
4041
];
4142

42-
protected async demos() {
43-
this.console.progress( 'updating demo files...', 1 );
43+
protected demo_deleteGlobs() {
4444

45+
const deleteGlobs = [
46+
'demos/*/.snapshots/',
47+
'demos/*/@releases/',
48+
'demos/*/dist/',
49+
'demos/*/node_modules/',
50+
'demos/*/src/',
51+
'demos/*/.releasenotes.md',
52+
'demos/*/package-lock.json',
53+
54+
'**/demos/no-config/.scripts/',
55+
'**/demos/no-config/build-utils.config.js',
56+
'**/demos/no-config/CHANGELOG.md',
57+
'**/demos/no-config/jest.config.js',
58+
'**/demos/no-config/tsconfig.json',
59+
];
4560

46-
this.console.verbose( 'deleting compiled files...', 2 );
61+
return deleteGlobs;
62+
}
4763

48-
const deleteGlobs = [
64+
protected async demos() {
65+
this.console.progress( 'updating demo files...', 1 );
4966

50-
'demos/complete/.snapshots',
51-
'demos/complete/@releases',
52-
'demos/complete/dist',
53-
54-
'demos/no-config/.scripts',
55-
'demos/no-config/.snapshots',
56-
'demos/no-config/@releases',
57-
'demos/no-config/dist',
58-
'demos/no-config/src',
59-
'demos/no-config/.releasenotes.md',
60-
'demos/no-config/build-utils.config.js',
61-
'demos/no-config/CHANGELOG.md',
62-
'demos/no-config/tsconfig.json',
63-
];
6467

65-
if ( this.params.releasing ) {
66-
deleteGlobs.push( 'demos/complete/node_modules' );
67-
deleteGlobs.push( 'demos/no-config/node_modules' );
68-
deleteGlobs.push( 'demos/complete/package-lock.json' );
69-
deleteGlobs.push( 'demos/no-config/package-lock.json' );
70-
}
68+
this.console.verbose( 'deleting existing compiled demo files...', 2 );
69+
70+
const deleteGlobs = this.demo_deleteGlobs();
7171

7272
this.fs.delete( deleteGlobs, this.params.verbose ? 3 : 2 );
7373

@@ -111,13 +111,20 @@ export class Build extends BuildStage {
111111
'demos/no-config',
112112
'src/demos',
113113
);
114+
}
115+
116+
protected async tidy() {
117+
this.console.progress( 'tidying built files...', 1 );
118+
114119

120+
this.console.verbose( 'deleting existing compiled demo files...', 2 );
115121

116-
this.console.verbose( 'updating version numbers...', 2 );
117-
for ( const _path of [
118-
'demos/complete/package.json',
119-
'demos/no-config/package.json',
120-
] ) {
122+
this.fs.delete( this.demo_deleteGlobs(), this.params.verbose ? 3 : 2 );
123+
124+
125+
this.console.verbose( 'updating demo version numbers...', 2 );
126+
127+
for ( const _path of this.fs.glob( 'demos/*/package.json' ) ) {
121128
const _currentPkgJson = this.fs.readFile( _path );
122129

123130
let _replaced = _currentPkgJson;
@@ -127,30 +134,23 @@ export class Build extends BuildStage {
127134
escRegExpReplace( `"version": "${ this.version.toString( false ) }"` )
128135
);
129136

130-
if ( this.params.releasing ) {
137+
if ( this.params.releasing && !this.params.dryrun ) {
131138

132-
if ( this.version.prerelease ) {
139+
// update to the version being release for testing
140+
_replaced = _replaced.replace(
141+
/"@maddimathon\/build-utilities":\s*"[^"]*"/gi,
142+
escRegExpReplace( `"@maddimathon/build-utilities": "${ this.version.toString( false ) }"` ),
143+
);
144+
} else {
133145

134-
// update to the version being release for testing
135-
_replaced = _replaced.replace(
136-
/"@maddimathon\/build-utilities":\s*"[^"]*"/gi,
137-
escRegExpReplace( `"@maddimathon/build-utilities": "${ this.version.toString( false ) }"` ),
138-
);
139-
} else {
140-
141-
// update to be a file path for development
142-
_replaced = _replaced.replace(
143-
/"@maddimathon\/build-utilities":\s*"[^"]*"/gi,
144-
escRegExpReplace( `"@maddimathon/build-utilities": "file:../.."` ),
145-
);
146-
}
146+
// update to be a file path for development
147+
_replaced = _replaced.replace(
148+
/"@maddimathon\/build-utilities":\s*"[^"]*"/gi,
149+
escRegExpReplace( `"@maddimathon/build-utilities": "file:../.."` ),
150+
);
147151
}
148152

149-
this.fs.write(
150-
_path,
151-
_replaced,
152-
{ force: true },
153-
);
153+
this.fs.write( _path, _replaced, { force: true } );
154154
}
155155
}
156156

.scripts/classes/Compile.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ import type { Stage } from '../../src/ts/index.js';
1313

1414
import { CompileStage, FileSystem } from '../../src/ts/index.js';
1515

16-
// import type {
17-
// } from "../../src/ts/lib/@internal.js";
18-
19-
// import {
20-
// } from '../../src/ts/lib/@internal.js';
21-
2216
/**
2317
* Extension of the built-in one.
2418
*/
@@ -66,12 +60,3 @@ export class Compile extends CompileStage {
6660
);
6761
}
6862
}
69-
70-
export namespace Compile {
71-
72-
export type SubStage =
73-
| Stage.SubStage.Compile
74-
| 'demos'
75-
| 'readme'
76-
| 'tscheck';
77-
}

.scripts/classes/Test.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
/*
4+
* @package @maddimathon/build-utilities
5+
* @author Maddi Mathon (www.maddimathon.com)
6+
*
7+
* @license MIT
8+
*/
9+
10+
import type { Stage } from '../../src/ts/index.js';
11+
12+
import { TestStage } from '../../src/ts/index.js';
13+
14+
/**
15+
* Extension of the built-in one.
16+
*/
17+
export class Test extends TestStage {
18+
19+
public override readonly subStages: Stage.SubStage.Test[] = [
20+
'js',
21+
'demos' as Stage.SubStage.Test,
22+
];
23+
24+
/**
25+
* Prompts the user to test build the demo dirs.
26+
*/
27+
protected async demos() {
28+
// returns
29+
if ( !this.params.packaging && !this.params.dryrun ) {
30+
return;
31+
}
32+
33+
this.console.log( [
34+
[ 'testing built package in demo directories...' ],
35+
[ 'to test, run `npm i && npm run --silent dryrun` in each directory', {
36+
bold: false,
37+
clr: 'grey',
38+
italic: true,
39+
} ],
40+
], 1, {
41+
linesOut: 1,
42+
joiner: '\n',
43+
} );
44+
45+
const demos = this.fs.glob( 'demos/*' );
46+
47+
for ( const path of demos ) {
48+
// continues
49+
if ( !this.fs.isDirectory( path ) ) {
50+
continue;
51+
}
52+
53+
const demoName = this.fs.pathRelative( path ).replace( /^demos\//i, '' );
54+
55+
// exits on false
56+
if ( !( await this.console.prompt.bool(
57+
`Does the ${ demoName } demo compile as expected and without error?`,
58+
2,
59+
{
60+
default: false,
61+
62+
msgArgs: {
63+
bold: false,
64+
linesIn: 0,
65+
linesOut: 0,
66+
},
67+
68+
timeout: 300000,
69+
},
70+
) ) ) {
71+
this.console.log( [
72+
[ `ⅹ ` ],
73+
[ `${ demoName } demo failed - exiting...`, { italic: true } ],
74+
], 3, {
75+
bold: false,
76+
italic: false,
77+
joiner: '',
78+
linesIn: 0,
79+
linesOut: 1,
80+
} );
81+
process.exit( 0 );
82+
}
83+
}
84+
}
85+
}
246 KB
Binary file not shown.

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ and this project adheres to
1919
<!--CHANGELOG_NEW-->
2020

2121

22+
## **0.3.0-alpha.9** — 2025-11-19
23+
24+
Some small fixes to improve default js testing.
25+
26+
### Breaking
27+
- Updated dependencies (including glob to new major version)
28+
29+
### Added
30+
- Added option to TestStage args to use a custom jest cli command
31+
- Added local prompt methods to Stage_Console for easier output styling
32+
(including log-base-level)
33+
34+
### Changed
35+
- Removed prettier and typedoc-plugin-inline-sources from peerDependencies
36+
37+
2238
## **0.3.0-alpha.8** — 2025-11-09
2339

2440
Quick fix to replacements in sass error handling of multi-line messages.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ children:
77
---
88

99
<!--README_HEADER-->
10-
# NPM Build Utilities @ 0.3.0-alpha.8
10+
# NPM Build Utilities @ 0.3.0-alpha.9
1111
<!--/README_HEADER-->
1212

1313
<!--README_DESC-->
@@ -36,8 +36,8 @@ or
3636

3737
<!--README_INSTALL-->
3838
```bash
39-
npm i -D @maddimathon/build-utilities@0.3.0-alpha.8
40-
npm i -D github:maddimathon/build-utilities#0.3.0-alpha.8
39+
npm i -D @maddimathon/build-utilities@0.3.0-alpha.9
40+
npm i -D github:maddimathon/build-utilities#0.3.0-alpha.9
4141
```
4242
<!--/README_INSTALL-->
4343

demos/complete/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@maddimathon/build-utilities--demos--complete",
3-
"version": "0.3.0-alpha.8",
3+
"version": "0.3.0-alpha.9",
44

55
"files": [
66
"./dist/**/*",
@@ -33,14 +33,19 @@
3333
"release": "build-utils release",
3434

3535
"dryrun": "build-utils release --dryrun",
36+
37+
"rm": "rm -f @releases/* .snapshots/* dist/* || echo ''",
3638

37-
"reset": "rm -f @releases/* .snapshots/* dist/*"
39+
"reset": "run-s --silent rm reset:*",
40+
"reset:uninstall": "rm -r package-lock.json node_modules",
41+
"reset:install": "npm i"
3842
},
3943

4044
"dependencies": {
4145
},
4246
"devDependencies": {
43-
"@maddimathon/build-utilities": "0.3.0-alpha.8"
47+
"@maddimathon/build-utilities": "0.3.0-alpha.9",
48+
"npm-run-all": "4.1.5"
4449
},
4550

4651
"browserslist": [

demos/complete/src/files/demo-file-1.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

demos/complete/src/files/demo-file-2.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)