Skip to content

Commit fa1f040

Browse files
authored
cleanup after workspace introduction, fix remark-snackplayer tests (facebook#2331)
1 parent 3648f94 commit fa1f040

10 files changed

Lines changed: 150 additions & 165 deletions

File tree

‎.gitignore‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
node_modules
22
.DS_Store
33
.idea
4-
lib/core/metadata.js
5-
lib/core/MetadataBlog.js
6-
website/build/
7-
website/yarn.lock
8-
website/node_modules
94
.nvmrc
105
.docusaurus
11-
website/scripts/sync-api-docs/generatedComponentApiDocs.js
12-
website/scripts/sync-api-docs/extracted.json
6+
7+
website/build/
8+
9+
sync-api-docs/generatedComponentApiDocs.js
10+
sync-api-docs/extracted.json

‎docs/layoutanimation.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ Schedules an animation to happen on the next layout.
8686
8787
#### Parameters:
8888
89-
| Name | Type | Required | Description |
90-
| ----------------- | -------- | -------- | ----------------------------------- |
91-
| config | object | Yes | See config description below. |
92-
| onAnimationDidEnd | function | No | Called when the animation finished. |
93-
| onAnimationDidFail| function | No | Called when the animation failed. |
89+
| Name | Type | Required | Description |
90+
| ------------------ | -------- | -------- | ----------------------------------- |
91+
| config | object | Yes | See config description below. |
92+
| onAnimationDidEnd | function | No | Called when the animation finished. |
93+
| onAnimationDidFail | function | No | Called when the animation failed. |
9494
9595
The `config` parameter is an object with the keys below. [`create`](layoutanimation.md#create) returns a valid object for `config`, and the [`Presets`](layoutanimation.md#presets) objects can also all be passed as the `config`.
9696

‎package.json‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
{
22
"private": true,
3+
"workspaces": [
4+
"website",
5+
"plugins/*",
6+
"sync-api-docs"
7+
],
38
"scripts": {
9+
"postinstall": "yarn update-lock",
410
"update-lock": "npx yarn-deduplicate"
511
},
6-
"workspaces": ["website", "plugins/*", "sync-api-docs"]
12+
"husky": {
13+
"hooks": {
14+
"pre-commit": "pretty-quick --staged"
15+
}
16+
},
17+
"devDependencies": {
18+
"husky": "^4.2.5",
19+
"prettier": "1.16.4",
20+
"pretty-quick": "^1.11.1"
21+
}
722
}
Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
<h1 align="center"> Remark SnackPlayer </h1>
1+
<h1 align="center">Remark SnackPlayer</h1>
22

3-
<p align="center">
4-
Remark plugin to embed <a href="https://snack.expo.io/">Expo Snack's</a> using Code Blocks
5-
</p>
6-
7-
## Installation
8-
9-
```shell
10-
yarn add remark-snackplayer
11-
```
12-
13-
Add Snack Player embedded script to your website:
14-
15-
```html
16-
<script async src="https://snack.expo.io/embed.js"></script>
17-
```
3+
<p align="center">Remark plugin to embed <a href="https://snack.expo.io/">Expo Snack's</a> using Code Blocks</p>
184

195
## Usage
206

@@ -28,20 +14,18 @@ import React from 'react';
2814
import { Text, View } from 'react-native';
2915
3016
const YourApp = () => {
31-
return (
17+
return (
3218
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
33-
<Text>
34-
Try editing me! 🎉
35-
</Text>
19+
<Text>Try editing me! 🎉</Text>
3620
</View>
37-
);
21+
);
3822
}
3923
4024
export default YourApp;
4125
```
4226
````
4327

44-
The above code snippet would look like this on your page
28+
The above code snippet would look like this:
4529

4630
<img width="783" alt="Screenshot 2020-10-03 at 1 11 19 AM" src="https://user-images.githubusercontent.com/11258286/94963203-67de3500-0515-11eb-974a-a2289c0bfdc8.png">
4731

@@ -59,8 +43,3 @@ The above code snippet would look like this on your page
5943
## Styling
6044

6145
To style the Snack Player wrapper you can use `.snack-player` class.
62-
63-
## To Do
64-
65-
- Support Passing Configuration Parameters
66-
- Write Comprehensive tests

‎plugins/remark-snackplayer/package.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "remark-snackplayer",
2+
"name": "@react-native-website/remark-snackplayer",
33
"version": "0.0.5",
4+
"private": true,
45
"description": "Remark SnackPlayer Plugin",
56
"main": "src/index.js",
6-
"author": "Darsh <darshkpatel@gmail.com>",
77
"keywords": [
88
"remark",
99
"react-native",
@@ -15,7 +15,8 @@
1515
"src"
1616
],
1717
"scripts": {
18-
"test": "node_modules/.bin/tape tests/index.js"
18+
"prettier": "prettier --write \"{src/**/*.js,tests/**/*.js}\"",
19+
"test": "yarn tape tests/index.js"
1920
},
2021
"dependencies": {
2122
"dedent": "^0.7.0",

‎plugins/remark-snackplayer/tests/index.js‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,27 @@ const test = require('tape');
44
const remark = require('remark');
55
const snackplayer = require('../');
66

7-
function read(name) {
8-
return fs.readFileSync(path.join(__dirname, name), 'utf8');
9-
}
7+
const read = name => fs.readFileSync(path.join(__dirname, name), 'utf8');
8+
const normalizeLineEndings = str => str.replace(/\r\n/g, '\n');
109

1110
test('remark-snackplayer', async t => {
1211
const processor = remark().use(snackplayer);
1312

1413
processor.process(read('markdown/test1.md'), (err, file) => {
1514
if (err) t.fail('Failed to process markdown/test1.md');
16-
t.equal(String(file), read('output/output1.html'), 'With 1 Code Block');
15+
t.equal(
16+
normalizeLineEndings(String(file)),
17+
normalizeLineEndings(read('output/output1.html')),
18+
'With 1 Code Block'
19+
);
1720
});
1821

1922
processor.process(read('markdown/test2.md'), (err, file) => {
2023
if (err) t.fail('Failed to process markdown/test2.md');
21-
t.equal(String(file), read('output/output2.html'), 'With 2 Code Blocks');
24+
t.equal(
25+
normalizeLineEndings(String(file)),
26+
normalizeLineEndings(read('output/output2.html')),
27+
'With 2 Code Blocks'
28+
);
2229
});
2330
});

‎sync-api-docs/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6+
"prettier": "prettier --write \"**/*.js\"",
67
"sync": "node sync-api-docs ../../react-native"
78
},
89
"devDependencies": {

‎website/docusaurus.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = {
3434
'https://github.com/facebook/react-native-website/blob/master/website/',
3535
path: '../docs',
3636
sidebarPath: require.resolve('./sidebars.json'),
37-
remarkPlugins: [require('../plugins/remark-snackplayer')],
37+
remarkPlugins: [require('@react-native-website/remark-snackplayer')],
3838
},
3939
blog: {
4040
path: 'blog',

‎website/package.json‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"swizzle": "docusaurus swizzle",
1616
"deploy": "docusaurus deploy",
1717
"serve": "docusaurus serve",
18+
"clean": "docusaurus clean",
1819
"publish-gh-pages": "yarn deploy",
1920
"ci-check": "yarn prettier:diff && node image-check.js",
2021
"format:source": "prettier --write \"{core/**/*.js,src/**/*.js,static/js/**/*.js}\"",
@@ -27,28 +28,19 @@
2728
"lint": "cd ../ && alex .",
2829
"lintv": "cd ../ && alex"
2930
},
30-
"husky": {
31-
"hooks": {
32-
"pre-commit": "pretty-quick --staged"
33-
}
34-
},
3531
"dependencies": {
3632
"@docusaurus/core": "2.0.0-alpha.66",
3733
"@docusaurus/preset-classic": "2.0.0-alpha.66",
3834
"docusaurus-plugin-sass": "^0.1.11",
3935
"react": "^16.10.2",
4036
"react-dom": "^16.10.2",
41-
"react-github-btn": "^1.2.0",
42-
"remark-snackplayer": "./plugins/remark-snackplayer"
37+
"react-github-btn": "^1.2.0"
4338
},
4439
"devDependencies": {
4540
"alex": "^9.0.1",
4641
"fs-extra": "^9.0.1",
4742
"glob": "^7.1.6",
4843
"glob-promise": "^3.4.0",
49-
"husky": "^4.2.5",
50-
"path": "^0.12.7",
51-
"prettier": "1.16.4",
52-
"pretty-quick": "^1.11.1"
44+
"path": "^0.12.7"
5345
}
5446
}

0 commit comments

Comments
 (0)