chore: 🧹 fix tools
This commit is contained in:
parent
405d6a5855
commit
3bd9cbda12
12
README.md
12
README.md
@ -41,4 +41,16 @@ DEFAULT_THEME=dark # optional
|
|||||||
```bash
|
```bash
|
||||||
$ npm install
|
$ npm install
|
||||||
$ npm run build
|
$ npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### serve
|
||||||
|
```bash
|
||||||
|
$ npm run serve -- --server path/to/gitea/custom
|
||||||
|
|
||||||
|
# e.g.
|
||||||
|
|
||||||
|
# on linux
|
||||||
|
$ npm run serve -- --server ~/gitea/custom
|
||||||
|
# on windows
|
||||||
|
$ npm run serve -- -- --server c:/gitea/custom
|
||||||
```
|
```
|
@ -13,7 +13,7 @@ const srcPath = resolve(cwd(), src);
|
|||||||
const distPath = resolve(cwd(), dist);
|
const distPath = resolve(cwd(), dist);
|
||||||
const serverPath = resolve(
|
const serverPath = resolve(
|
||||||
cwd(),
|
cwd(),
|
||||||
getArg('--sever', 'D:/users/lucas/Desktop/dev/server/gitea')
|
getArg('--server', 'd:/gitea')
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.info('Deploy started!');
|
logger.info('Deploy started!');
|
||||||
|
@ -13,7 +13,7 @@ const srcPath = resolve(cwd(), src);
|
|||||||
const distPath = resolve(cwd(), dist);
|
const distPath = resolve(cwd(), dist);
|
||||||
const serverPath = resolve(
|
const serverPath = resolve(
|
||||||
cwd(),
|
cwd(),
|
||||||
getArg('--sever', 'd:/gitea')
|
getArg('--server', 'd:/gitea')
|
||||||
);
|
);
|
||||||
const debouncer = new TaskDebouncer(300);
|
const debouncer = new TaskDebouncer(300);
|
||||||
const logger = new Logger('serve', 'info', 'brightMagenta');
|
const logger = new Logger('serve', 'info', 'brightMagenta');
|
||||||
@ -37,4 +37,5 @@ watcher.on('change', (file) => debouncer.add(
|
|||||||
serverPath,
|
serverPath,
|
||||||
serviceName,
|
serviceName,
|
||||||
file,
|
file,
|
||||||
|
true
|
||||||
));
|
));
|
||||||
|
@ -11,15 +11,16 @@ const logger = new Logger('deploy', 'info', 'brightMagenta');
|
|||||||
|
|
||||||
const sync = browsersync.create('lugit')
|
const sync = browsersync.create('lugit')
|
||||||
|
|
||||||
sync.init({
|
export async function deploy(srcPath, distPath, serverPath, serviceName, file = null, live = false) {
|
||||||
proxy: 'http://lugit.local',
|
|
||||||
port: 8080,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
export async function deploy(srcPath, distPath, serverPath, serviceName, file = null) {
|
|
||||||
logger.info('Deploying...');
|
logger.info('Deploying...');
|
||||||
|
|
||||||
|
if(live && !sync.active) {
|
||||||
|
sync.init({
|
||||||
|
proxy: 'http://lugit.local',
|
||||||
|
port: 8080,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let shouldRestart = true;
|
let shouldRestart = true;
|
||||||
|
|
||||||
// check if it's an scss
|
// check if it's an scss
|
||||||
@ -34,7 +35,7 @@ export async function deploy(srcPath, distPath, serverPath, serviceName, file =
|
|||||||
await copyTo(distPath, serverPath);
|
await copyTo(distPath, serverPath);
|
||||||
shouldRestart && await restartService(serviceName);
|
shouldRestart && await restartService(serviceName);
|
||||||
|
|
||||||
if(!shouldRestart) {
|
if(!shouldRestart && live) {
|
||||||
sync.reload();
|
sync.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user