⬆️ bump publicodes to beta.3

pull/1056/head
Johan Girod 2020-05-26 14:32:13 +02:00
parent acc3dc1de1
commit e4bcb40aa2
7 changed files with 46 additions and 47 deletions

View File

@ -3,5 +3,6 @@
"spellright.language": ["fr", "en"],
"spellright.documentTypes": ["yaml", "git-commit", "markdown"],
"typescript.tsdk": "node_modules/typescript/lib",
"editor.tabSize": 2
"editor.tabSize": 2,
"eslint.enable": true
}

View File

@ -35,7 +35,7 @@
"js-yaml": "^3.13.1",
"moo": "^0.5.0",
"nearley": "^2.19.0",
"publicodes": "^1.0.0-beta.2",
"publicodes": "^1.0.0-beta.3",
"ramda": "^0.27.0",
"react": "^16.13.1",
"react-color": "^2.14.0",

View File

@ -1,6 +1,6 @@
{
"name": "publicodes",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "A declarative language for encoding public algorithm",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",
@ -40,7 +40,7 @@
"scripts": {
"prepublishOnly": "yarn test && yarn run build",
"clean": "rimraf dist node_modules",
"prepare": "rimraf dist && yarn run build",
"prepare": "yarn run rimraf dist && yarn run build",
"build": "tsc && yarn run webpack --config webpack.config.js",
"test:file": "yarn mocha-webpack --webpack-config ./webpack.test.js --include test/setupIntl.js",
"test": "yarn test:file \"./{,!(node_modules)/**/}!(webpack).test.js\""

View File

@ -14,6 +14,9 @@ export default function Modal({
...otherProps
}: ModalProps) {
useEffect(() => {
if (typeof document === 'undefined') {
return
}
const body = document.getElementsByTagName('body')[0]
body.classList.add('no-scroll')
return () => {

View File

@ -1,24 +1,35 @@
import React from 'react'
import emoji from 'react-easy-emoji'
import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter'
import yaml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml'
import style from 'react-syntax-highlighter/dist/esm/styles/prism/atom-dark'
SyntaxHighlighter.registerLanguage('yaml', yaml)
let Component
if (process.env.NODE_ENV !== 'test') {
const yaml = require('react-syntax-highlighter/dist/esm/languages/prism/yaml')
.default
const style = require('react-syntax-highlighter/dist/esm/styles/prism/atom-dark')
.default
const SyntaxHighlighter = require('react-syntax-highlighter').PrismLight
export default function PublicodeHighlighter({ source }: { source: string }) {
return (
<div css="position: relative; margin-bottom: 1rem">
<SyntaxHighlighter language="yaml" style={style}>
{source}
</SyntaxHighlighter>
<a
href={`https://publi.codes/studio?code=${encodeURIComponent(source)}`}
target="_blank"
css="position: absolute; bottom: 5px; right: 10px; color: white !important;"
>
{emoji('⚡')} Lancer le calcul
</a>
</div>
)
SyntaxHighlighter.registerLanguage('yaml', yaml)
Component = function PublicodeHighlighter({ source }: { source: string }) {
return (
<div css="position: relative; margin-bottom: 1rem">
<SyntaxHighlighter language="yaml" style={style}>
{source}
</SyntaxHighlighter>
<a
href={`https://publi.codes/studio?code=${encodeURIComponent(source)}`}
target="_blank"
css="position: absolute; bottom: 5px; right: 10px; color: white !important;"
>
{emoji('⚡')} Lancer le calcul
</a>
</div>
)
}
}
export default Component ??
function() {
return null
}

View File

@ -1,4 +1,5 @@
const { commonLoaders } = require('../webpack/common')
const { EnvironmentPlugin } = require('webpack')
module.exports = {
resolve: {
@ -17,5 +18,10 @@ module.exports = {
use: ['css-loader', 'postcss-loader']
}
]
}
},
plugins: [
new EnvironmentPlugin({
NODE_ENV: 'test'
})
]
}

View File

@ -4690,11 +4690,6 @@ executable@4.1.1:
dependencies:
pify "^2.2.0"
exenv@^1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/exenv/-/exenv-1.2.2.tgz#2ae78e85d9894158670b03d47bec1f03bd91bb9d"
integrity sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=
exit-hook@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8"
@ -9461,7 +9456,7 @@ react-is@^16.12.0, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-i
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
@ -9487,16 +9482,6 @@ react-markdown@^4.1.0, react-markdown@^4.3.1:
unist-util-visit "^1.3.0"
xtend "^4.0.1"
react-modal@^3.11.2:
version "3.11.2"
resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-3.11.2.tgz#bad911976d4add31aa30dba8a41d11e21c4ac8a4"
integrity sha512-o8gvvCOFaG1T7W6JUvsYjRjMVToLZgLIsi5kdhFIQCtHxDkA47LznX62j+l6YQkpXDbvQegsDyxe/+JJsFQN7w==
dependencies:
exenv "^1.2.0"
prop-types "^15.5.10"
react-lifecycles-compat "^3.0.0"
warning "^4.0.3"
react-monaco-editor@^0.36.0:
version "0.36.0"
resolved "https://registry.yarnpkg.com/react-monaco-editor/-/react-monaco-editor-0.36.0.tgz#ac085c14f25fb072514c925596f6a06a711ee078"
@ -11888,13 +11873,6 @@ walker@^1.0.7, walker@~1.0.5:
dependencies:
makeerror "1.0.x"
warning@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==
dependencies:
loose-envify "^1.0.0"
watchpack@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.1.tgz#280da0a8718592174010c078c7585a74cd8cd0e2"