mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-06 04:42:40 +02:00
setup infra
This commit is contained in:
parent
d6ecead327
commit
06faff3474
9 changed files with 1344 additions and 4 deletions
18
.eslintrc.js
Normal file
18
.eslintrc.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const OFF = 0;
|
||||
const WARNING = 1;
|
||||
const ERROR = 2;
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
commonjs: true,
|
||||
jest: true,
|
||||
node: true,
|
||||
},
|
||||
extends: ['airbnb', 'prettier'],
|
||||
rules: {
|
||||
'no-console': OFF,
|
||||
'func-names': OFF,
|
||||
'react/jsx-filename-extension': OFF, // Enable in future when migrating.
|
||||
},
|
||||
};
|
8
.prettierrc
Normal file
8
.prettierrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"bracketSpacing": false,
|
||||
"jsxBracketSameLine": true,
|
||||
"parser": "flow",
|
||||
"printWidth": 80,
|
||||
"proseWrap": "never",
|
||||
"singleQuote": true
|
||||
}
|
58
bin/blogi.js
Normal file
58
bin/blogi.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const chalk = require('chalk');
|
||||
const semver = require('semver');
|
||||
const path = require('path');
|
||||
const program = require('commander');
|
||||
const {dev, build} = require('../lib');
|
||||
const requiredVersion = require('../package.json').engines.node;
|
||||
|
||||
if (!semver.satisfies(process.version, requiredVersion)) {
|
||||
console.log(
|
||||
chalk.red(`\nMinimum node version not met :)`) +
|
||||
chalk.yellow(
|
||||
`\nYou are using Node ${
|
||||
process.version
|
||||
}, but blogi requires Node ${requiredVersion}.\n`
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function wrapCommand(fn) {
|
||||
return (...args) =>
|
||||
fn(...args).catch(err => {
|
||||
console.error(chalk.red(err.stack));
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
|
||||
program
|
||||
.version(require('../package.json').version)
|
||||
.usage('<command> [options]');
|
||||
|
||||
program
|
||||
.command('dev [targetDir]')
|
||||
.description('start development server')
|
||||
.option('-p, --port <port>', 'use specified port (default: 8080)')
|
||||
.action((dir = '.', {port}) => {
|
||||
wrapCommand(dev)(path.resolve(dir), {port});
|
||||
});
|
||||
|
||||
program
|
||||
.command('build [targetDir]')
|
||||
.description('build dir as static site')
|
||||
.option(
|
||||
'-d, --dest <outDir>',
|
||||
'specify build output dir (default: .blogi/dist)'
|
||||
)
|
||||
.action((dir = '.', {dest}) => {
|
||||
const outDir = dest ? path.resolve(dest) : null;
|
||||
wrapCommand(build)(path.resolve(dir), {outDir});
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
program.outputHelp();
|
||||
}
|
12
blog/hello-world.md
Normal file
12
blog/hello-world.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
title: Hello, World !
|
||||
author: Endilie Yacop Sucipto
|
||||
authorURL: http://twitter.com/endiliey
|
||||
authorFBID: 100000251103620
|
||||
---
|
||||
|
||||
Hi, Endilie here.
|
||||
|
||||
<!--truncate-->
|
||||
|
||||
Random thoughts, experiences, write-up of Endilie Yacop Sucipto will be shared here.
|
4
lib/build.js
Normal file
4
lib/build.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = async function build(sourceDir, cliOptions = {}) {
|
||||
process.env.NODE_ENV = 'production';
|
||||
console.log('Build');
|
||||
};
|
3
lib/dev.js
Normal file
3
lib/dev.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = async function dev(sourceDir, cliOptions = {}) {
|
||||
console.log('Development');
|
||||
};
|
2
lib/index.js
Normal file
2
lib/index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
exports.dev = require('./dev');
|
||||
exports.build = require('./build');
|
32
package.json
32
package.json
|
@ -2,8 +2,15 @@
|
|||
"name": "blogi",
|
||||
"version": "1.0.0",
|
||||
"description": "Blog instantly",
|
||||
"main": "index.js",
|
||||
"main": "lib/index.js",
|
||||
"bin": {
|
||||
"blogi": "bin/blogi.js"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "node bin/blogi dev blog",
|
||||
"build": "node bin/blogi build blog",
|
||||
"prettier": "prettier --config .prettierrc --write \"lib/**/*.js\" \"bin/**/*.js\"",
|
||||
"lint": "eslint --cache \"lib/**/*.js\" \"bin/**/*.js\"",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -12,13 +19,30 @@
|
|||
},
|
||||
"keywords": [
|
||||
"blog",
|
||||
"websites",
|
||||
"open source"
|
||||
"generator",
|
||||
"react"
|
||||
],
|
||||
"author": "endiliey",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/endiliey/blogi/issues"
|
||||
},
|
||||
"homepage": "https://github.com/endiliey/blogi#readme"
|
||||
"homepage": "https://github.com/endiliey/blogi#readme",
|
||||
"devDependencies": {
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-airbnb": "17.0.0",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-plugin-import": "^2.12.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.0.3",
|
||||
"eslint-plugin-react": "^7.9.1",
|
||||
"prettier": "^1.13.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^2.4.1",
|
||||
"commander": "^2.16.0",
|
||||
"semver": "^5.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue