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

Commit 161281a

Browse files
committed
feat(init): create fusumarc.yml
1 parent 2b3008d commit 161281a

File tree

8 files changed

+38
-19
lines changed

8 files changed

+38
-19
lines changed

packages/client/src/components/ContentView/Base.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import { useMermaid } from '../../hooks/useMermaid';
77

88
const articleClass = process.env.IS_VERTICAL ? 'vertical' : undefined;
99

10+
// don't move to useEffect
11+
if (!getSearchParams().get('ssr')) {
12+
// don't run when creating html
13+
import(/* webpackPreload: true */ '../../setup/prism');
14+
}
15+
1016
export const Base = memo(
1117
({ slides, onChangeSlideIndex, hash, showIndex }) => {
1218
const [mermaid] = useMermaid();
@@ -27,10 +33,6 @@ export const Base = memo(
2733
useEffect(() => {
2834
setupSlides();
2935

30-
if (!getSearchParams().get('ssr')) {
31-
// don't run when creating html
32-
import(/* webpackPreload: true */ '../../setup/prism');
33-
}
3436
if (slides.some(({ fusumaProps }) => !!fusumaProps.hasExecutableCode)) {
3537
createVMEnv();
3638
}

packages/client/src/setup/prism.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Prism from 'prismjs';
22
import '../../assets/style/code.css';
33

4+
// check https://github.com/PrismJS/prism/issues/1487
45
Prism.highlightAll();
56

67
export { Prism };

packages/fusuma/src/configs/babelrc.js

-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ function babelrc({ languages = [], plugins = [], theme = 'default' } = {}) {
2525
],
2626
],
2727
plugins: [
28-
'@babel/plugin-syntax-dynamic-import',
29-
'@babel/plugin-proposal-class-properties',
30-
'@babel/plugin-proposal-object-rest-spread',
3128
[
3229
'prismjs',
3330
{

packages/fusuma/src/configs/fusumarc.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const { promisify } = require('util');
66
const yaml = require('js-yaml');
77
const pSearch = require('preferred-search');
88
const { all: mergeAll } = require('deepmerge');
9+
const { info } = require('../cli/log');
910

1011
const mkdirAsync = promisify(mkdir);
1112
const readFileAsync = promisify(readFile);
@@ -60,25 +61,29 @@ function getConfigYaml() {
6061
}
6162

6263
async function init(baseDir) {
63-
await writeFileAsync(join(baseDir, '.fusumarc.yml'), getConfigYaml());
64-
console.info('Created .fusumarc.yml');
64+
{
65+
const data = await readFileAsync(join(__dirname, 'templates', 'fusumarc.yml'), 'utf8');
66+
67+
await writeFileAsync(join(baseDir, '.fusumarc.yml'), data);
68+
info('init', 'Created .fusumarc.yml');
69+
}
6570

6671
// scaffold
6772
await mkdirAsync(join(baseDir, 'slides'));
68-
console.info('Created slides directory');
73+
info('init', 'Created slides directory');
6974

7075
{
7176
const data = await readFileAsync(join(__dirname, 'templates', '0-title.md'), 'utf8');
7277

7378
await writeFileAsync(join(baseDir, 'slides', '0-title.md'), data);
74-
console.info('Created slides/0-title.md');
79+
info('init', 'Created slides/0-title.md');
7580
}
7681

7782
{
7883
const data = await readFileAsync(join(__dirname, 'templates', 'style.css'), 'utf8');
7984

8085
await writeFileAsync(join(baseDir, 'style.css'), data);
81-
console.info('Created style.css');
86+
info('init', 'Created style.css');
8287
}
8388
}
8489

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
meta:
2+
url:
3+
title:
4+
description:
5+
siteName:
6+
sns: ['twitter']
7+
slide:
8+
loop: true
9+
sidebar: true
10+
targetBlank: true
11+
showIndex: true
12+
code:
13+
languages:
14+
- json
15+
- markdown
16+
- javascript
17+
- css
18+
plugins: []
19+
theme: default

samples/debug/.fusumarc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ meta:
22
url: https://hiroppy.github.io/fusuma/debug
33
title: debug
44
description: A place which produces to resolve issues
5-
# thumbnail: https://avatars0.githubusercontent.com/u/3367801?s=400&v=4
65
siteName: hiroppy.me
76
sns: ['twitter']
87
slide:
@@ -18,4 +17,5 @@ slide:
1817
- python
1918
extends:
2019
js: main.js
21-
css: style.css
20+
build:
21+
useCache: false

samples/debug/style.css

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
__body {
2-
background: #666;
3-
}
4-
51
@font-face {
62
font-family: Stratum;
73
src: url('./assets/StratumNo1.ttf');

samples/intro/.fusumarc.yml

-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ slide:
1515
- css
1616
extends:
1717
js: index.js
18-
css: style.css

0 commit comments

Comments
 (0)