Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 223c673

Browse files
committed
feat(cli): add chalk
1 parent 0ac0aa1 commit 223c673

18 files changed

+212
-82
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
*.ejs
33
coverage
44
dist
5+
CHANGELOG.md

packages/client/CHANGELOG.md

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
55

66
# [2.0.0-alpha.7](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.6...v2.0.0-alpha.7) (2021-01-19)
77

8-
98
### Bug Fixes
109

11-
* **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))
12-
* **client:** update screenfull ([74b6326](https://github.com/hiroppy/fusuma/commit/74b6326fad5232893d0a98ae85074af5b1755aa3))
13-
14-
15-
16-
10+
- **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))
11+
- **client:** update screenfull ([74b6326](https://github.com/hiroppy/fusuma/commit/74b6326fad5232893d0a98ae85074af5b1755aa3))
1712

1813
# [2.0.0-alpha.4](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2021-01-19)
1914

packages/fusuma/CHANGELOG.md

+3-18
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
55

66
# [2.0.0-alpha.9](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2021-01-20)
77

8-
98
### Bug Fixes
109

11-
* **build:** add publicPath to fileServer ([b75d44d](https://github.com/hiroppy/fusuma/commit/b75d44d2013e0279fc65a154c5dc765e1f30841c))
12-
13-
14-
15-
10+
- **build:** add publicPath to fileServer ([b75d44d](https://github.com/hiroppy/fusuma/commit/b75d44d2013e0279fc65a154c5dc765e1f30841c))
1611

1712
# [2.0.0-alpha.8](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2021-01-20)
1813

19-
2014
### Features
2115

22-
* **config:** add publicPath field ([52a2ddd](https://github.com/hiroppy/fusuma/commit/52a2ddd141df880153fe3071ab756a102471a729))
23-
24-
25-
26-
16+
- **config:** add publicPath field ([52a2ddd](https://github.com/hiroppy/fusuma/commit/52a2ddd141df880153fe3071ab756a102471a729))
2717

2818
# [2.0.0-alpha.7](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.6...v2.0.0-alpha.7) (2021-01-19)
2919

30-
3120
### Bug Fixes
3221

33-
* **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))
34-
35-
36-
37-
22+
- **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))
3823

3924
# [2.0.0-alpha.6](https://github.com/hiroppy/fusuma/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2021-01-19)
4025

packages/fusuma/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
## fusuma
2+
3+
<div align="center">
4+
<strong>📝 Makes slides with Markdown easily.</strong>
5+
</div>
6+
17
This repository uses a monorepo.
28
Please see https://github.com/hiroppy/fusuma.
39

410
```sh
511
$ npm i -D fusuma
12+
$ mkdir slides && echo '# Hello😄' > slides/title.md
13+
14+
# --- executable tasks---
15+
$ npx fusuma init # customize fusuma configuration
16+
$ npx fusuma start # development
17+
$ npx fusuma build # build as NODE_ENV=production
18+
$ npx fusuma live # start live mode
19+
$ npx fusuma deploy # deploy to github pages
20+
$ npx fusuma pdf # export as PDF from HTML
621
```

packages/fusuma/package-lock.json

+135-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fusuma/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"babel-loader": "^8.2.2",
4141
"babel-plugin-prismjs": "^2.0.1",
4242
"caporal": "^1.4.0",
43+
"chalk": "^4.1.0",
4344
"child-process-promise": "^2.2.1",
4445
"core-js": "^3.8.3",
4546
"css-loader": "^5.0.1",

packages/fusuma/src/cli/log.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const chalk = require('chalk');
4+
5+
function info(type, text) {
6+
console.info(chalk.black.bgCyan(type), chalk.cyan(text));
7+
}
8+
9+
function warn(type, text) {
10+
console.warn(chalk.black.bgYellow(type), chalk.yellow(text));
11+
}
12+
13+
function error(type, text) {
14+
console.error(chalk.black.bgRed(type), chalk.red(text));
15+
}
16+
17+
module.exports = {
18+
info,
19+
warn,
20+
error,
21+
};

packages/fusuma/src/configs/fusumarc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const config = {
4242
build: {
4343
ssr: true,
4444
useCache: true,
45-
publicPath: '/'
45+
publicPath: '/',
4646
},
4747
};
4848

packages/fusuma/src/server/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const express = require('express');
77
const webpack = require('webpack');
88
const webpackHotMiddleware = require('webpack-hot-middleware');
99
const webpackDevMiddleware = require('webpack-dev-middleware');
10+
const { info, error } = require('../cli/log')
1011

1112
async function server(config, options = {}) {
1213
return new Promise((resolve) => {
@@ -32,13 +33,13 @@ async function server(config, options = {}) {
3233
const server = createServer(app);
3334

3435
server.on('error', (err) => {
35-
console.error(err);
36+
error('start', err.message);
3637
process.exit(1);
3738
});
3839

3940
compiler.hooks.done.tap('fusuma-server', () => {
4041
if (!initialFlag) {
41-
console.info(`Listening on ${url}`);
42+
info('start', `Serving on ${url}`);
4243
initialFlag = true;
4344
}
4445

0 commit comments

Comments
 (0)