Merge branch 'master' of github.com:facebook/docusaurus

This commit is contained in:
Alexey Pyltsyn 2020-03-24 09:16:50 +03:00
commit c56ec347f2
4 changed files with 7 additions and 16 deletions

View file

@ -0,0 +1 @@
{}

View file

@ -19,8 +19,7 @@ const addAdmonitions = pluginOptions => {
const admonitionsOptions = {
remarkPlugins: (pluginOptions.remarkPlugins || []).concat([
admonitions,
pluginOptions.admonitions || {},
[admonitions, pluginOptions.admonitions || {}],
]),
};

View file

@ -14,6 +14,7 @@
"@docusaurus/preset-classic": "^2.0.0-alpha.48",
"classnames": "^2.2.6",
"color": "^3.1.2",
"npm-to-yarn": "^1.0.0-2",
"react": "^16.8.4",
"react-dom": "^16.8.4"
},

View file

@ -5,20 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
// This is a very naive implementation of converting npm commands to yarn commands
// Works well for our use case since we only use either 'npm install', or 'npm run <something>'
// Its impossible to convert it right since some commands at npm are not available in yarn and vice/versa
const convertNpmToYarn = npmCode => {
// global install: 'npm i' -> 'yarn'
return (
npmCode
.replace(/^npm i$/gm, 'yarn')
// install: 'npm install --save foo' -> 'yarn add foo'
.replace(/npm install --save/gm, 'yarn add')
// run command: 'npm run start' -> 'yarn run start'
.replace(/npm run/gm, 'yarn run')
);
};
const npmToYarn = require('npm-to-yarn');
// E.g. global install: 'npm i' -> 'yarn'
const convertNpmToYarn = npmCode => npmToYarn(npmCode, 'yarn');
const transformNode = node => {
const npmCode = node.value;