Skip to content

Commit ce69707

Browse files
:sparles: Create nuxt netlify cms docs
0 parents  commit ce69707

31 files changed

+2959
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 RoboMx
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# @nuxt/netlify-cms-docs
2+
3+
[![npm version][npm-version-src]][npm-version-href]
4+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
5+
[![License][license-src]][license-href]
6+
7+
> Create a documentation with @nuxt/netlify-cms-docs
8+
9+
- [📖  Read the @nuxt/content-theme-docs documentation](https://content.nuxtjs.org/themes/docs)
10+
11+
## Usage
12+
13+
With [yarn](https://yarnpkg.com/en/):
14+
15+
```bash
16+
yarn create nuxt-content-docs <project-name>
17+
```
18+
19+
Or with [npx](https://www.npmjs.com/package/npx) (`npx` is shipped by default since [npm](https://www.npmjs.com/get-npm) `5.2.0`)
20+
21+
```bash
22+
npx create-nuxt-content-docs <project-name>
23+
```
24+
25+
Or starting with npm v6.1 you can do:
26+
27+
```bash
28+
npm init nuxt-content-docs <project-name>
29+
```
30+
31+
## References
32+
33+
1. [Create Nuxt Content doc](https://github.com/nuxt/content/blob/dev/packages/create-nuxt-content-docs)
34+
35+
## License
36+
37+
[MIT License](LICENSE)
38+
39+
<!-- Badges -->
40+
[npm-version-src]: https://img.shields.io/npm/v/create-nuxt-content-docs/latest.svg
41+
[npm-version-href]: https://npmjs.com/package/create-nuxt-content-docs
42+
43+
[npm-downloads-src]: https://img.shields.io/npm/dt/create-nuxt-content-docs.svg
44+
[npm-downloads-href]: https://npmjs.com/package/create-nuxt-content-docs
45+
46+
[license-src]: https://img.shields.io/npm/l/@nuxt/content.svg
47+
[license-href]: https://npmjs.com/package/@nuxt/content
48+
49+
[lerna-src]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
50+
[lerna-href]: https://lerna.js.org/

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "create-nuxt-netlify-cms-docs-",
3+
"version": "0.2020.0",
4+
"files": [
5+
"src",
6+
"template"
7+
],
8+
"author": "RoboMx",
9+
"description": "Write your documentation with Nuxt content module and Netlify CMS panel.",
10+
"license": "MIT",
11+
"contributors": [{
12+
"name": "RoboMx Team"
13+
}],
14+
"bin": "src/cli.js",
15+
"dependencies": {
16+
"cac": "^6.6.1",
17+
"sao": "^1.7.1"
18+
},
19+
"publishConfig": {
20+
"access": "public"
21+
}
22+
}

src/cli.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env node
2+
const path = require('path')
3+
const fs = require('fs')
4+
const sao = require('sao')
5+
const cac = require('cac')
6+
const chalk = require('chalk')
7+
const { version } = require('../package.json')
8+
9+
const generator = path.resolve(__dirname, './')
10+
11+
const cli = cac('create-nuxt-content-docs')
12+
13+
cli
14+
.command('[out-dir]', 'Generate in a custom directory or current directory')
15+
.option('--verbose', 'Show debug logs')
16+
// eslint-disable-next-line default-param-last
17+
.action((outDir = '.', cliOptions) => {
18+
const files = fs.existsSync(outDir) ? fs.readdirSync(outDir) : []
19+
// eslint-disable-next-line no-console
20+
console.log(chalk`{cyan create-nuxt-content-docs v${version}}`)
21+
if (files.length) {
22+
// eslint-disable-next-line no-console
23+
return console.log(chalk.red(`Can't create ${outDir} because there's already a non-empty directory ${outDir} existing in path.`))
24+
}
25+
// eslint-disable-next-line no-console
26+
console.log(chalk`✨ Generating @nuxt/content documentation in {cyan ${outDir}}`)
27+
28+
const { verbose, answers } = cliOptions
29+
const logLevel = verbose ? 4 : 2
30+
// See https://saojs.org/api.html#standalone-cli
31+
sao({ generator, outDir, logLevel, answers, cliOptions })
32+
.run()
33+
.catch((err) => {
34+
// eslint-disable-next-line no-console
35+
console.trace(err)
36+
process.exit(1)
37+
})
38+
})
39+
40+
cli.help()
41+
42+
cli.version(version)
43+
44+
cli.parse()

src/saofile.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
module.exports = {
2+
prompts () {
3+
return [
4+
{
5+
name: 'name',
6+
message: 'Project name:',
7+
default: this.outFolder,
8+
filter: val => val.toLowerCase()
9+
},
10+
{
11+
name: 'title',
12+
message: 'Project title:',
13+
default: 'Nuxt Netlify CMS Doc'
14+
},
15+
{
16+
name: 'url',
17+
message: 'Documentation url:',
18+
url: 'https://content.nuxtjs.org'
19+
},
20+
{
21+
name: 'github',
22+
message: 'GitHub repository (owner/name):',
23+
default: 'nuxt/content'
24+
},
25+
{
26+
name: 'twitter',
27+
message: 'Twitter username (@username):',
28+
default: '@robomxHQ'
29+
},
30+
{
31+
name: 'pm',
32+
message: 'Package manager:',
33+
choices: [
34+
{ name: 'Yarn', value: 'yarn' },
35+
{ name: 'Npm', value: 'npm' }
36+
],
37+
type: 'list',
38+
default: 'yarn'
39+
}
40+
]
41+
},
42+
templateData () {
43+
const pm = this.answers.pm === 'yarn' ? 'yarn' : 'npm'
44+
const pmRun = this.answers.pm === 'yarn' ? 'yarn' : 'npm run'
45+
46+
return {
47+
pm,
48+
pmRun
49+
}
50+
},
51+
actions: [
52+
{
53+
type: 'add',
54+
files: '**',
55+
templateDir: '../template'
56+
},
57+
{
58+
type: 'move',
59+
patterns: {
60+
gitignore: '.gitignore',
61+
'_package.json': 'package.json'
62+
}
63+
}
64+
],
65+
async completed () {
66+
this.gitInit()
67+
await this.npmInstall()
68+
this.showProjectTips()
69+
}
70+
}

template/.gitignore

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Node template
3+
# Logs
4+
/logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
22+
# nyc test coverage
23+
.nyc_output
24+
25+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26+
.grunt
27+
28+
# Bower dependency directory (https://bower.io/)
29+
bower_components
30+
31+
# node-waf configuration
32+
.lock-wscript
33+
34+
# Compiled binary addons (https://nodejs.org/api/addons.html)
35+
build/Release
36+
37+
# Dependency directories
38+
node_modules/
39+
jspm_packages/
40+
41+
# TypeScript v1 declaration files
42+
typings/
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Optional REPL history
51+
.node_repl_history
52+
53+
# Output of 'npm pack'
54+
*.tgz
55+
56+
# Yarn Integrity file
57+
.yarn-integrity
58+
59+
# dotenv environment variables file
60+
.env
61+
62+
# parcel-bundler cache (https://parceljs.org/)
63+
.cache
64+
65+
# next.js build output
66+
.next
67+
68+
# nuxt.js build output
69+
.nuxt
70+
71+
# Nuxt generate
72+
dist
73+
74+
# vuepress build output
75+
.vuepress/dist
76+
77+
# Serverless directories
78+
.serverless
79+
80+
# IDE / Editor
81+
.idea
82+
83+
# Service worker
84+
sw.*
85+
86+
# macOS
87+
.DS_Store
88+
89+
# Vim swap files
90+
*.swp

template/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Create Nuxt Netlify Docs
2+
3+
[![Netlify Status](https://api.netlify.com/api/v1/badges/12de0f2a-d4d6-4d93-a949-d1e2b5328289/deploy-status)](https://app.netlify.com/sites/nuxt-cms-content-doc/deploys)
4+
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FMexsonFernandes%2Fnuxt-netlify-doc&count_bg=%231F83DB&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=visitor+count&edge_flat=false)](https://hits.seeyoufarm.com)
5+
6+
A base template to create a documentation website using Nuxt.js framework with Netlify CMS support.
7+
8+
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/MexsonFernandes/nuxt-netlify-doc)
9+
10+
## Screenshot
11+
12+
<img src="static/screenshot.jpeg" alt="Screenshot 1" />
13+
14+
## References
15+
16+
* [Netlify CMS documentation](https://www.netlifycms.org/docs/nuxt/)
17+
* [Jamstack documentation sites](https://www.stackbit.com/blog/jamstack-documentation-sites/)
18+
* [Nuxtjs/content Example](https://github.com/nuxt/content/blob/dev/example)

template/content/en/hello.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Getting started
3+
description: Get started with Nuxt module inspired documentation platform
4+
developed using Netlify CMS. It supports i18n, files like Markdown, JSON, YAML
5+
and CSV files. It acts as a Git-based Headless CMS.
6+
position: 2
7+
category: Basic
8+
---
9+
10+
Get started with Nuxt module inspired documentation platform developed using Netlify CMS. It supports i18n, files like Markdown, JSON, YAML and CSV files. It acts as a **Git-based Headless CMS**.
11+
12+
## Start collaboration
13+
14+
Its easy to start writing your project documentation. Just deploy this to `Netlify` with one click.
15+
16+
## Writing articles
17+
18+
Once successfully deployed, head over to `/admin` route. Enable Git-Gateway on Netlify to start logging onto the platform.
19+
20+
## Edit icon
21+
22+
Upload images with names `logo-dark.png` and `logo-light.png`.
23+
24+
Note: You can edit the settings file to use different name.
25+
26+
```js[content/settings.json]
27+
{
28+
...
29+
"logo": {
30+
"light": "/images/<light-mode-name>.png",
31+
"dark": "/images/<dark-mode-name>.png"
32+
},
33+
...
34+
}
35+
```

template/content/en/index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Introduction
3+
description: ""
4+
position: 1
5+
category: " "
6+
features:
7+
- Git based
8+
- Admin Panel
9+
- i18n support
10+
- Article workflow
11+
- Team collaboration
12+
---
13+
14+
<img src="/images/logo-light.png" class="light-img" width="1280" height="640" alt=""/>
15+
<img src="/images/logo-dark.png" class="dark-img" width="1280" height="640" alt=""/>
16+
17+
Template for [NuxtJS/NetlifyCMS Doc](https://github.com/MexsonFernandes/nuxt-netlify-doc).
18+
19+
<alert type="success">
20+
21+
Your documentation has been created successfully!
22+
23+
</alert>
24+
25+
## Features
26+
27+
<list :items="features"></list>
28+
29+
<p class="flex items-center">Enjoy light and dark mode:&nbsp;<app-color-switcher class="inline-flex ml-2"></app-color-switcher></p>

0 commit comments

Comments
 (0)