docs-test
Just a simple site that renders a template around some markdown files. It is compiled to a static site for deployment.
Last updated 2 years ago by jeffesp_today .
MIT · Original npm · Tarball · package.json
$ cnpm install docs-test 
SYNC missed versions from official npm registry.

Public API Documentation Site

Just a simple site that renders a template around some markdown files. It is compiled to a static site for deployment.

Running

yarn to install all the deps. There are no global packages needed.

yarn dev, and then open a browser to http://localhost:3000

Deploying

yarn bulid && yarn export - the resulting site will be in the out directory.

You can run yarn serve to host the exported site on http://localhost:3000.

To build the docker container, docker build . -t aie-docs:latest

To run the container on your local machine, docker run -d aie-docs:latest -p 3000 --net="host"

Other tips

Yarn commands

yarn flow will check the whole project for Flow type errors. If you mess around with anything in .flowconfig, or the flow-typed folder which is where the dependency types are defined, you will need to run this command in order for the changes to be picked up. You can also run ./node_modules/.bin/flow stop to stop the flow service if it hangs or anything.

yarn flow:update will run flow-typed which is a commandline tool to download type defs for dendencies. It will also automatically create a stub file if it cannot find something to download. You can then fill in the stub with a real type def. I would recommend searching for the same lib on DefinitelyTyped, and then translate the TypeScript to Flow.

yarn lint and yarn lint:fix will run the linter, and auto fix things.

yarn test runs the Jest unit tests. yarn test --watch will watch files for changes and re-run them.

yarn e2e runs the end to end tests. yarn e2e:dev is what you want when writing tests. It starts both the app and the tests in a watch mode, so you can update both things and have them rebuild on save.

yarn size shows you the size of the exported out directory. Take this with a grain of salt. Next.js does some pretty fancy things with code splitting, so not all of that code is going to be loaded when a page is vistied. _app.js and one of the main.[hash].js files are served, as well as the content for the specific page. I see about 3 other versions of main.[hash].js in the out folder that looks similar, but not all of them are downloaded by the user. I think we can trust that Next.js is going to serve the smallest possible thing, and we should just keep in mind that the out folder size is just a rough gague.

yarn analyze shows the breakdown of what gets included in the bundles. Again, export isn't really taken into account, this is the build size as seen by Webpack. It opens a page for the server and client build output. These are then merged into one when export is run.

yarn why lodash or other names of libraries that you find in the analyze output can tell you why that dependency is in the output. It checks which library is requiring it, or if it is directly referenced in package.json.

yarn searchIndex will update the search index on Algolia. You probably never need to do this. It is run when the application is deployed.

Editor plugins

You don't have to use VS Code, but here are the plugins that I have used which work well for this project.

  • ESLint
  • Flow Lanaguge Support
  • Prettier - Code formatter
  • vscode-styled-components

Browser plugins

There are dev tool plugins for browsers, to help debug what is going on behind the scenes.

Mobx dev tools to look at state. React dev tools - Chrome React dev tools - Firefox

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (35)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |