Skip to content

Commit

Permalink
chore(ts): the example folder was renamed to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
wang1212 committed Jul 29, 2023
1 parent 35aca76 commit bad1e2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
12 changes: 7 additions & 5 deletions templates/typescript/scripts/serve.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ const WORKING_DIRECTORY = path.resolve(__dirname, '..');

// ! 脚本必须在项目根目录执行,防止脚本执行错误
if (!fse.pathExistsSync(path.join(WORKING_DIRECTORY, 'package.json'))) {
throw new Error('The package.json file does not exist in the current working directory.\n');
throw new Error(
'The package.json file does not exist in the current working directory.\n',
);
}

const PUBLIC_DIR = 'example/';
const PUBLIC_DIR = 'examples/';

browserSync.watch(
[`${PUBLIC_DIR}**/*`],
{
ignoreInitial: true
ignoreInitial: true,
},
async (event, file) => {
if (!['add', 'change'].includes(event)) return;

browserSync.reload();
}
},
);

browserSync.init({
Expand All @@ -34,7 +36,7 @@ browserSync.init({
startPath: PUBLIC_DIR,
// reloadThrottle: 1e3,
open: true,
notify: false
notify: false,
});

exports.browserSync = browserSync;

0 comments on commit bad1e2c

Please sign in to comment.