Skip to content

Commit

Permalink
cleanup after workspace introduction, fix remark-snackplayer tests (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
Simek authored Nov 17, 2020
1 parent 3648f94 commit fa1f040
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 165 deletions.
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
node_modules
.DS_Store
.idea
lib/core/metadata.js
lib/core/MetadataBlog.js
website/build/
website/yarn.lock
website/node_modules
.nvmrc
.docusaurus
website/scripts/sync-api-docs/generatedComponentApiDocs.js
website/scripts/sync-api-docs/extracted.json

website/build/

sync-api-docs/generatedComponentApiDocs.js
sync-api-docs/extracted.json
10 changes: 5 additions & 5 deletions docs/layoutanimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ Schedules an animation to happen on the next layout.
#### Parameters:
| Name | Type | Required | Description |
| ----------------- | -------- | -------- | ----------------------------------- |
| config | object | Yes | See config description below. |
| onAnimationDidEnd | function | No | Called when the animation finished. |
| onAnimationDidFail| function | No | Called when the animation failed. |
| Name | Type | Required | Description |
| ------------------ | -------- | -------- | ----------------------------------- |
| config | object | Yes | See config description below. |
| onAnimationDidEnd | function | No | Called when the animation finished. |
| onAnimationDidFail | function | No | Called when the animation failed. |
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`.
Expand Down
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{
"private": true,
"workspaces": [
"website",
"plugins/*",
"sync-api-docs"
],
"scripts": {
"postinstall": "yarn update-lock",
"update-lock": "npx yarn-deduplicate"
},
"workspaces": ["website", "plugins/*", "sync-api-docs"]
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"devDependencies": {
"husky": "^4.2.5",
"prettier": "1.16.4",
"pretty-quick": "^1.11.1"
}
}
33 changes: 6 additions & 27 deletions plugins/remark-snackplayer/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
<h1 align="center"> Remark SnackPlayer </h1>
<h1 align="center">Remark SnackPlayer</h1>

<p align="center">
Remark plugin to embed <a href="https://snack.expo.io/">Expo Snack's</a> using Code Blocks
</p>

## Installation

```shell
yarn add remark-snackplayer
```

Add Snack Player embedded script to your website:

```html
<script async src="https://snack.expo.io/embed.js"></script>
```
<p align="center">Remark plugin to embed <a href="https://snack.expo.io/">Expo Snack's</a> using Code Blocks</p>

## Usage

Expand All @@ -28,20 +14,18 @@ import React from 'react';
import { Text, View } from 'react-native';
const YourApp = () => {
return (
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>
Try editing me! 🎉
</Text>
<Text>Try editing me! 🎉</Text>
</View>
);
);
}
export default YourApp;
```
````

The above code snippet would look like this on your page
The above code snippet would look like this:

<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">

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

To style the Snack Player wrapper you can use `.snack-player` class.

## To Do

- Support Passing Configuration Parameters
- Write Comprehensive tests
7 changes: 4 additions & 3 deletions plugins/remark-snackplayer/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "remark-snackplayer",
"name": "@react-native-website/remark-snackplayer",
"version": "0.0.5",
"private": true,
"description": "Remark SnackPlayer Plugin",
"main": "src/index.js",
"author": "Darsh <[email protected]>",
"keywords": [
"remark",
"react-native",
Expand All @@ -15,7 +15,8 @@
"src"
],
"scripts": {
"test": "node_modules/.bin/tape tests/index.js"
"prettier": "prettier --write \"{src/**/*.js,tests/**/*.js}\"",
"test": "yarn tape tests/index.js"
},
"dependencies": {
"dedent": "^0.7.0",
Expand Down
17 changes: 12 additions & 5 deletions plugins/remark-snackplayer/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@ const test = require('tape');
const remark = require('remark');
const snackplayer = require('../');

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

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

processor.process(read('markdown/test1.md'), (err, file) => {
if (err) t.fail('Failed to process markdown/test1.md');
t.equal(String(file), read('output/output1.html'), 'With 1 Code Block');
t.equal(
normalizeLineEndings(String(file)),
normalizeLineEndings(read('output/output1.html')),
'With 1 Code Block'
);
});

processor.process(read('markdown/test2.md'), (err, file) => {
if (err) t.fail('Failed to process markdown/test2.md');
t.equal(String(file), read('output/output2.html'), 'With 2 Code Blocks');
t.equal(
normalizeLineEndings(String(file)),
normalizeLineEndings(read('output/output2.html')),
'With 2 Code Blocks'
);
});
});
1 change: 1 addition & 0 deletions sync-api-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"prettier": "prettier --write \"**/*.js\"",
"sync": "node sync-api-docs ../../react-native"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
'https://github.com/facebook/react-native-website/blob/master/website/',
path: '../docs',
sidebarPath: require.resolve('./sidebars.json'),
remarkPlugins: [require('../plugins/remark-snackplayer')],
remarkPlugins: [require('@react-native-website/remark-snackplayer')],
},
blog: {
path: 'blog',
Expand Down
14 changes: 3 additions & 11 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"serve": "docusaurus serve",
"clean": "docusaurus clean",
"publish-gh-pages": "yarn deploy",
"ci-check": "yarn prettier:diff && node image-check.js",
"format:source": "prettier --write \"{core/**/*.js,src/**/*.js,static/js/**/*.js}\"",
Expand All @@ -27,28 +28,19 @@
"lint": "cd ../ && alex .",
"lintv": "cd ../ && alex"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"dependencies": {
"@docusaurus/core": "2.0.0-alpha.66",
"@docusaurus/preset-classic": "2.0.0-alpha.66",
"docusaurus-plugin-sass": "^0.1.11",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-github-btn": "^1.2.0",
"remark-snackplayer": "./plugins/remark-snackplayer"
"react-github-btn": "^1.2.0"
},
"devDependencies": {
"alex": "^9.0.1",
"fs-extra": "^9.0.1",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"husky": "^4.2.5",
"path": "^0.12.7",
"prettier": "1.16.4",
"pretty-quick": "^1.11.1"
"path": "^0.12.7"
}
}
Loading

0 comments on commit fa1f040

Please sign in to comment.