Skip to content

Commit 0238225

Browse files
authored
Merge pull request #85 from NarraLeaf/dev_nomen
narraleaf-react-0.7.0
2 parents 9d01e1c + 84a9b24 commit 0238225

36 files changed

Lines changed: 2913 additions & 289 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ yarn.lock
3434
Thumbs.db
3535

3636
# Project specific
37-
test/
37+
./test/
3838
dev.json
3939

40+
*-example.test.tsx
41+
*-ignore.test.js

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## [0.7.0]
4+
5+
### _Feature_
6+
7+
- `LayoutRouter` creates a new way to manage complex page structures and transitions
8+
- Use `Layout` to create a layout group
9+
- Use Player prop `onError` to handle errors
10+
- `game.keyMap` allows you to manage key bindings and announce key changes across the player
11+
12+
### _Incompatible Changes_
13+
14+
- `Router` is deprecated, use `LayoutRouter` as a more powerful router
15+
- `Page` is refactored
16+
- `game.config.skipKey` and `game.config.nextKey` are deprecated, use `game.keyMap` instead
17+
318
## [0.6.0]
419

520
### _Feature_

esbuild.config.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,18 @@ esbuild.build({
5050
".png": "file",
5151
".svg": "file",
5252
},
53-
external: ["react", "react-dom"],
53+
external: [
54+
// React and React DOM
55+
"react",
56+
"react-dom",
57+
// Dependencies
58+
"client-only",
59+
"clsx",
60+
"howler",
61+
"html-to-image",
62+
"prop-types",
63+
// Peer Dependencies
64+
"@emotion/is-prop-valid",
65+
"motion"
66+
],
5467
}).catch(() => process.exit(1));

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "narraleaf-react",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"description": "A React visual novel player framework",
55
"main": "./dist/main.js",
66
"types": "./dist/index.d.ts",
@@ -20,7 +20,8 @@
2020
"lint:fix": "eslint --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
2121
"prepublishOnly": "npm run lint && rimraf dist && cross-env NODE_ENV=production node esbuild.config.js && tsc --emitDeclarationOnly && tsc-alias -p tsconfig.json",
2222
"typedoc": "typedoc src/index.ts --out doc",
23-
"prepare": "husky"
23+
"prepare": "husky",
24+
"test": "vitest"
2425
},
2526
"devDependencies": {
2627
"@eslint/eslintrc": "^3.1.0",
@@ -48,7 +49,6 @@
4849
"fs-extra": "^11.3.0",
4950
"globals": "^15.9.0",
5051
"husky": "^9.1.6",
51-
"jest": "^27.0.6",
5252
"motion": "^11.15.0",
5353
"postcss": "^8.5.3",
5454
"postcss-cli": "^11.0.1",
@@ -61,7 +61,8 @@
6161
"tailwindcss": "^4.1.5",
6262
"tsc-alias": "^1.8.10",
6363
"typedoc": "^0.26.7",
64-
"typescript": "5.7.2"
64+
"typescript": "5.7.2",
65+
"vitest": "^3.2.4"
6566
},
6667
"peerDependencies": {
6768
"@emotion/is-prop-valid": "*",

project/postbuild.js

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,57 @@ const process = require("process");
44
const fs = require("fs-extra");
55
const path = require("path");
66

7-
// Read target directory from dev config
7+
// Read target directories from dev config
88
const devConfigPath = path.resolve(__dirname, "../dev.json");
9-
let targetRoot;
9+
let targetDirs = [];
1010
try {
1111
const devConfig = JSON.parse(fs.readFileSync(devConfigPath, "utf8"));
12-
targetRoot = devConfig.targetDir;
13-
if (!targetRoot) {
14-
throw new Error("targetDir not found in dev.json");
12+
13+
// Support both single targetDir and multiple targetDirs
14+
if (devConfig.targetDirs && Array.isArray(devConfig.targetDirs)) {
15+
targetDirs = devConfig.targetDirs;
16+
} else if (devConfig.targetDir) {
17+
targetDirs = [devConfig.targetDir];
18+
} else {
19+
throw new Error("Neither targetDir nor targetDirs found in dev.json");
20+
}
21+
22+
if (targetDirs.length === 0) {
23+
throw new Error("No target directories specified in dev.json");
1524
}
1625
} catch (err) {
1726
console.error(`Error reading dev.json: ${err}`);
1827
process.exit(1);
1928
}
2029

2130
const sourceDir = path.resolve(__dirname, "../dist");
22-
const targetDir = path.join(targetRoot, "dist");
2331

24-
// Ensure target directory exists
25-
fs.ensureDirSync(targetDir);
32+
// Copy files to all target directories
33+
let successCount = 0;
34+
let errorCount = 0;
2635

27-
// Copy files from source to target, overwriting if exists
28-
try {
29-
fs.copySync(sourceDir, targetDir, { overwrite: true });
30-
console.log(`Successfully copied build files from ${sourceDir} to ${targetDir}`);
31-
} catch (err) {
32-
console.error(`Error copying build files: ${err}`);
36+
for (const targetDir of targetDirs) {
37+
const fullTargetDir = path.join(targetDir, "dist");
38+
39+
// Ensure target directory exists
40+
fs.ensureDirSync(fullTargetDir);
41+
42+
// Copy files from source to target, overwriting if exists
43+
try {
44+
fs.copySync(sourceDir, fullTargetDir, { overwrite: true });
45+
console.log(`✓ Successfully copied build files to ${fullTargetDir}`);
46+
successCount++;
47+
} catch (err) {
48+
console.error(`✗ Error copying build files to ${fullTargetDir}: ${err}`);
49+
errorCount++;
50+
}
51+
}
52+
53+
// Summary
54+
console.log(`\nCopy operation completed:`);
55+
console.log(` Success: ${successCount} directories`);
56+
if (errorCount > 0) {
57+
console.log(` Errors: ${errorCount} directories`);
3358
process.exit(1);
3459
}
3560

0 commit comments

Comments
 (0)