Skip to content

Commit b62ecfa

Browse files
committed
dev: add js watcher
1 parent 11b3025 commit b62ecfa

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

includes/tasks/rollup.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ module.exports = function (hexo) {
55
if (hexo.env?.cmd?.startsWith('n')) {
66
return;
77
}
8-
hexo.log.info('building js');
9-
cp.execSync('pnpm build', { cwd: './themes/Anatolo', stdio: 'inherit' });
10-
hexo.log.info('build successful!');
8+
if (hexo.env?.cmd === 's' || hexo.env?.cmd === 'server') {
9+
hexo.log.info('Starting js watch changer...');
10+
cp.exec('pnpm watch', { cwd: './themes/Anatolo', stdio: 'inherit' });
11+
} else {
12+
hexo.log.info('Building js...');
13+
cp.execSync('pnpm build', { cwd: './themes/Anatolo', stdio: 'inherit' });
14+
hexo.log.info('Build successful!');
15+
}
1116
};

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"format:biome": "biome format --write includes languages scripts source src",
99
"lint": "eslint . --fix",
1010
"format": "pnpm format:stylus && pnpm format:biome && pnpm format:pretty",
11+
"watch": "rollup -w -c ./rollup.config.mjs",
1112
"build": "rollup -c ./rollup.config.mjs"
1213
},
1314
"dependencies": {

0 commit comments

Comments
 (0)