Skip to content

Commit

Permalink
dev: add js watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Lhcfl committed Sep 9, 2024
1 parent 11b3025 commit b62ecfa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions includes/tasks/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ module.exports = function (hexo) {
if (hexo.env?.cmd?.startsWith('n')) {
return;
}
hexo.log.info('building js');
cp.execSync('pnpm build', { cwd: './themes/Anatolo', stdio: 'inherit' });
hexo.log.info('build successful!');
if (hexo.env?.cmd === 's' || hexo.env?.cmd === 'server') {
hexo.log.info('Starting js watch changer...');
cp.exec('pnpm watch', { cwd: './themes/Anatolo', stdio: 'inherit' });
} else {
hexo.log.info('Building js...');
cp.execSync('pnpm build', { cwd: './themes/Anatolo', stdio: 'inherit' });
hexo.log.info('Build successful!');
}
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"format:biome": "biome format --write includes languages scripts source src",
"lint": "eslint . --fix",
"format": "pnpm format:stylus && pnpm format:biome && pnpm format:pretty",
"watch": "rollup -w -c ./rollup.config.mjs",
"build": "rollup -c ./rollup.config.mjs"
},
"dependencies": {
Expand Down

0 comments on commit b62ecfa

Please sign in to comment.