Skip to content

Commit

Permalink
feat(cli): add chalk
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Jan 20, 2021
1 parent 0ac0aa1 commit 223c673
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 82 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
*.ejs
coverage
dist
CHANGELOG.md
9 changes: 2 additions & 7 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

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


### Bug Fixes

* **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))
* **client:** update screenfull ([74b6326](https://github.com/hiroppy/fusuma/commit/74b6326fad5232893d0a98ae85074af5b1755aa3))




- **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))
- **client:** update screenfull ([74b6326](https://github.com/hiroppy/fusuma/commit/74b6326fad5232893d0a98ae85074af5b1755aa3))

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

Expand Down
21 changes: 3 additions & 18 deletions packages/fusuma/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

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


### Bug Fixes

* **build:** add publicPath to fileServer ([b75d44d](https://github.com/hiroppy/fusuma/commit/b75d44d2013e0279fc65a154c5dc765e1f30841c))




- **build:** add publicPath to fileServer ([b75d44d](https://github.com/hiroppy/fusuma/commit/b75d44d2013e0279fc65a154c5dc765e1f30841c))

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


### Features

* **config:** add publicPath field ([52a2ddd](https://github.com/hiroppy/fusuma/commit/52a2ddd141df880153fe3071ab756a102471a729))




- **config:** add publicPath field ([52a2ddd](https://github.com/hiroppy/fusuma/commit/52a2ddd141df880153fe3071ab756a102471a729))

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


### Bug Fixes

* **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))




- **client:** fix sidebar param ([ffbca40](https://github.com/hiroppy/fusuma/commit/ffbca408a19fb82b99b7f4c53c7692546bb63bd2))

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

Expand Down
15 changes: 15 additions & 0 deletions packages/fusuma/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
## fusuma

<div align="center">
<strong>📝 Makes slides with Markdown easily.</strong>
</div>

This repository uses a monorepo.
Please see https://github.com/hiroppy/fusuma.

```sh
$ npm i -D fusuma
$ mkdir slides && echo '# Hello😄' > slides/title.md

# --- executable tasks---
$ npx fusuma init # customize fusuma configuration
$ npx fusuma start # development
$ npx fusuma build # build as NODE_ENV=production
$ npx fusuma live # start live mode
$ npx fusuma deploy # deploy to github pages
$ npx fusuma pdf # export as PDF from HTML
```
164 changes: 135 additions & 29 deletions packages/fusuma/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/fusuma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"babel-loader": "^8.2.2",
"babel-plugin-prismjs": "^2.0.1",
"caporal": "^1.4.0",
"chalk": "^4.1.0",
"child-process-promise": "^2.2.1",
"core-js": "^3.8.3",
"css-loader": "^5.0.1",
Expand Down
21 changes: 21 additions & 0 deletions packages/fusuma/src/cli/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

const chalk = require('chalk');

function info(type, text) {
console.info(chalk.black.bgCyan(type), chalk.cyan(text));
}

function warn(type, text) {
console.warn(chalk.black.bgYellow(type), chalk.yellow(text));
}

function error(type, text) {
console.error(chalk.black.bgRed(type), chalk.red(text));
}

module.exports = {
info,
warn,
error,
};
2 changes: 1 addition & 1 deletion packages/fusuma/src/configs/fusumarc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const config = {
build: {
ssr: true,
useCache: true,
publicPath: '/'
publicPath: '/',
},
};

Expand Down
5 changes: 3 additions & 2 deletions packages/fusuma/src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const express = require('express');
const webpack = require('webpack');
const webpackHotMiddleware = require('webpack-hot-middleware');
const webpackDevMiddleware = require('webpack-dev-middleware');
const { info, error } = require('../cli/log')

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

server.on('error', (err) => {
console.error(err);
error('start', err.message);
process.exit(1);
});

compiler.hooks.done.tap('fusuma-server', () => {
if (!initialFlag) {
console.info(`Listening on ${url}`);
info('start', `Serving on ${url}`);
initialFlag = true;
}

Expand Down
Loading

0 comments on commit 223c673

Please sign in to comment.