Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit abe5a9d

Browse files
initial commit
1 parent 1a91b28 commit abe5a9d

File tree

88 files changed

+7263
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+7263
-0
lines changed

‎cli.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
3+
const path = require('path')
4+
const sao = require('sao')
5+
6+
const generator = path.resolve(__dirname, './')
7+
// In a custom directory or current directory
8+
const outDir = path.resolve(process.argv[2] || '.')
9+
10+
console.log(`> Generating VueFront app in ${outDir}`)
11+
12+
// See https://sao.js.org/#/advanced/standalone-cli
13+
sao({ generator, outDir, logLevel: 2 })
14+
.run()
15+
.catch((err) => {
16+
console.trace(err)
17+
process.exit(1)
18+
})

‎package-lock.json‎

Lines changed: 2950 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "create-vuefront-app",
3+
"version": "0.1.0",
4+
"description": "Create a VueFront App in seconds.",
5+
"bin": "cli.js",
6+
"files": [
7+
"cli.js",
8+
"saofile.js",
9+
"template/"
10+
],
11+
"scripts": {
12+
"test": "ava --verbose"
13+
},
14+
"repository": {
15+
"type": "git",
16+
"url": "git+https://dmitriyzhuk@github.com/vuefront/create-vuefront-app.git"
17+
},
18+
"dependencies": {
19+
"cross-spawn": "^6.0.5",
20+
"glob": "^7.1.3",
21+
"lodash": "^4.17.11",
22+
"sao": "^1.6.1",
23+
"superb": "^2.0.0",
24+
"validate-npm-package-name": "^3.0.0"
25+
},
26+
"keywords": [
27+
"vuefront"
28+
],
29+
"author": "Dreamvention",
30+
"license": "MIT",
31+
"bugs": {
32+
"url": "https://github.com/vuefront/create-vuefront-app/issues"
33+
},
34+
"homepage": "https://github.com/vuefront/create-vuefront-app#readme"
35+
}

‎saofile.js‎

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
const { join } = require('path')
2+
const superb = require('superb')
3+
const glob = require('glob')
4+
const spawn = require('cross-spawn')
5+
const validate = require('validate-npm-package-name')
6+
7+
const rootDir = __dirname
8+
9+
module.exports = {
10+
prompts: [{
11+
name: 'name',
12+
message: 'Project name',
13+
default: '{outFolder}'
14+
},
15+
{
16+
name: 'description',
17+
message: 'Project description',
18+
default: `My ${superb()} Nuxt.js project`
19+
},
20+
{
21+
name: 'author',
22+
type: 'string',
23+
message: 'Author name',
24+
default: '{gitUser.name}',
25+
store: true
26+
},
27+
{
28+
name: 'url',
29+
message: 'Your Site Url',
30+
default: 'http://localhost:3000'
31+
},
32+
{
33+
name: 'api',
34+
message: 'Your API URL, provided by the CMS Connect',
35+
default: ''
36+
},
37+
{
38+
name: 'pm',
39+
message: 'Choose a package manager',
40+
choices: ['yarn', 'npm'],
41+
type: 'list',
42+
default: 'yarn'
43+
}
44+
],
45+
templateData() {
46+
const edge = process.argv.includes('--edge')
47+
const pwa = true
48+
const linter = false
49+
const prettier = false
50+
const axios = false
51+
const esm = true
52+
53+
return {
54+
edge,
55+
pwa: pwa ? 'yes' : 'no',
56+
eslint: linter ? 'yes' : 'no',
57+
prettier: prettier ? 'yes' : 'no',
58+
axios: axios ? 'yes' : 'no',
59+
esm
60+
}
61+
},
62+
actions() {
63+
64+
this.answers.ui = 'none';
65+
this.answers.server = 'none';
66+
this.answers.test = 'none';
67+
this.answers.mode = 'universal';
68+
this.answers.features = [
69+
'pwa', 'linter'
70+
]
71+
const validation = validate(this.answers.name)
72+
validation.warnings && validation.warnings.forEach((warn) => {
73+
console.warn('Warning:', warn)
74+
})
75+
validation.errors && validation.errors.forEach((err) => {
76+
console.error('Error:', err)
77+
})
78+
validation.errors && validation.errors.length && process.exit(1)
79+
80+
const actions = [{
81+
type: 'add',
82+
files: '**',
83+
templateDir: 'template/nuxt',
84+
filters: {
85+
'static/icon.png': 'features.includes("pwa")'
86+
}
87+
}]
88+
89+
actions.push({
90+
type: 'add',
91+
files: '**',
92+
templateDir: `template/frameworks/vuefront`
93+
})
94+
95+
actions.push({
96+
type: 'add',
97+
files: '*',
98+
filters: {
99+
'_.eslintrc.js': 'features.includes("linter")',
100+
'.prettierrc': 'features.includes("prettier")'
101+
}
102+
})
103+
104+
actions.push({
105+
type: 'move',
106+
patterns: {
107+
gitignore: '.gitignore',
108+
'_package.json': 'package.json',
109+
'_.eslintrc.js': '.eslintrc.js',
110+
'_.env': '.env'
111+
}
112+
})
113+
114+
return actions
115+
},
116+
async completed() {
117+
this.gitInit()
118+
119+
120+
await this.npmInstall({ npmClient: this.answers.pm })
121+
122+
const isNewFolder = this.outDir !== process.cwd()
123+
const cd = () => {
124+
if (isNewFolder) {
125+
console.log(`\t${this.chalk.cyan('cd')} ${this.outFolder}`)
126+
}
127+
}
128+
129+
130+
if (this.answers.features.includes('linter')) {
131+
const options = ['run', 'lint', '--', '--fix']
132+
if (this.answers.pm === 'yarn') {
133+
options.splice(2, 1)
134+
}
135+
spawn.sync(this.answers.pm, options, {
136+
cwd: this.outDir,
137+
stdio: 'inherit'
138+
})
139+
}
140+
141+
console.log()
142+
console.log(this.chalk.bold(` To get started:\n`))
143+
cd()
144+
console.log(`\t${this.answers.pm} run dev\n`)
145+
console.log(this.chalk.bold(` To build & start for production:\n`))
146+
cd()
147+
console.log(`\t${this.answers.pm} run build`)
148+
console.log(`\t${this.answers.pm} start`)
149+
150+
if (this.answers.test !== 'none') {
151+
console.log(this.chalk.bold(`\n To test:\n`))
152+
cd()
153+
console.log(`\t${this.answers.pm} run test`)
154+
}
155+
console.log()
156+
}
157+
}

‎template/README.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# <%= name %>
2+
3+
> <%= description %>
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
$ <%= pm %> install
10+
11+
# serve with hot reload at localhost:3000
12+
$ <%= pm %> run dev
13+
14+
# build for production and launch server
15+
$ <%= pm %> run build
16+
$ <%= pm %> start
17+
18+
# generate static project
19+
$ <%= pm %> run generate
20+
```
21+
22+
For detailed explanation on how things work, checkout [Nuxt.js docs](https://nuxtjs.org).

‎template/_.env‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
API=<%= api %>
2+
HTTP_ENDPOINT=<%= url %>
3+
NODE_TLS_REJECT_UNAUTHORIZED=0

‎template/_.eslintrc.js‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true
6+
},<% if (server === 'adonis') { %>
7+
globals: {
8+
use: true
9+
},<% } %>
10+
parserOptions: {
11+
parser: 'babel-eslint'
12+
},
13+
extends: [
14+
'@nuxtjs',
15+
'plugin:nuxt/recommended'<% if (prettier === 'yes'){ %>,
16+
'plugin:prettier/recommended',
17+
'prettier',
18+
'prettier/vue'<% } %>
19+
],<% if (prettier === 'yes'){ %>
20+
plugins: [
21+
'prettier'
22+
],<% } %>
23+
// add your custom rules here
24+
rules: {
25+
<% if (!esm){ -%>
26+
'nuxt/no-cjs-in-config': 'off'
27+
<% } -%>
28+
}
29+
}

‎template/_package.json‎

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"name": "<%= name %>",
3+
"version": "1.0.0",
4+
"description": "<%= description %>",
5+
"author": "<%= author %>",
6+
"private": true,
7+
"scripts": {<% if (server === 'adonis') { %>
8+
"serve:dev": "<%= pm %> run dev",
9+
"dev": "nodemon --watch app --watch bootstrap --watch config --watch .env -x node server.js",
10+
"build": "cross-env NODE_ENV=production node ./ace nuxtbuild",
11+
"start": "cross-env NODE_ENV=production node server.js"<% } else { %>
12+
"dev": "<% if (server === 'none') { %>nuxt<% } else { %>cross-env NODE_ENV=development nodemon server/index.js --watch server<% } %>",
13+
"build": "nuxt build",
14+
"start": "<% if (server === 'none') { %>nuxt start<% } else { %>cross-env NODE_ENV=production node server/index.js<% } %>",
15+
"generate": "nuxt generate"<% } %><% if (eslint === 'yes') { %>,
16+
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
17+
"precommit": "<%= pm %> run lint"<% } %><% if (test !== 'none') { %>,
18+
"test": "<%= test %>"<% } %>
19+
},
20+
"dependencies": {
21+
"vuefront": "vuefront/vuefront",
22+
"vuefront-nuxt": "vuefront/vuefront-nuxt",
23+
"cross-env": "^5.2.0"<% if (edge) { %>,
24+
"nuxt-edge": "latest"<% } else { %>,
25+
"nuxt": "^2.4.0"<% } %><% if (server === 'express') { %>,
26+
"express": "^4.16.4"<% } else if (server === 'koa') { %>,
27+
"koa": "^2.6.2"<% } else if (server === 'hapi') { %>,
28+
"hapi-nuxt": "^1.0.1"<% } else if (server === 'micro') { %>,
29+
"micro": "^9.3.3",
30+
"micro-route": "^2.5.0"<% } else if (server === 'fastify') { %>,
31+
"fastify": "^1.13.3"<% } else if (server === 'feathers') { %>,
32+
"@feathersjs/feathers": "^3.3.1",
33+
"@feathersjs/express": "^1.3.1",
34+
"@feathersjs/configuration": "^2.0.6"<% } else if (server === 'adonis') { %>,
35+
"@adonisjs/ace": "^4.0.7",
36+
"@adonisjs/auth": "^2.0.10",
37+
"@adonisjs/bodyparser": "^1.0.8",
38+
"@adonisjs/cors": "^1.0.2",
39+
"@adonisjs/fold": "^4.0.5",
40+
"@adonisjs/framework": "^4.0.27",
41+
"@adonisjs/ignitor": "^1.0.14",
42+
"@adonisjs/lucid": "^4.0.22",
43+
"@adonisjs/session": "^1.0.19",
44+
"@adonisjs/shield": "^1.0.4"<% } %><% if (ui === 'bootstrap') { %>,
45+
"bootstrap-vue": "^2.0.0-rc.11",
46+
"bootstrap": "^4.1.3"<% } else if (ui === 'vuetify') { %>,
47+
"vuetify": "^1.5.5",
48+
"vuetify-loader": "^1.2.1"<% } else if (ui === 'bulma') { %>,
49+
"@nuxtjs/bulma": "^1.2.1"<% } else if (ui === 'element-ui') { %>,
50+
"element-ui": "^2.4.11"<% } else if (ui === 'ant-design-vue') { %>,
51+
"ant-design-vue": "^1.1.10"<% } else if (ui === 'buefy') { %>,
52+
"nuxt-buefy": "^0.3.2"<% } else if (ui === 'iview') { %>,
53+
"iview": "3.1.5"<% } %><% if (axios === 'yes') { %>,
54+
"@nuxtjs/axios": "^5.3.6"<% } %><% if (pwa === 'yes') { %>,
55+
"@nuxtjs/pwa": "^2.6.0"<% } %><% if (ui === 'tachyons') { %>,
56+
"tachyons": "^4.11.1"<% } %>
57+
},
58+
"devDependencies": {
59+
"nodemon": "^1.18.9"<% if (eslint === 'yes') { %>,
60+
"@nuxtjs/eslint-config": "^0.0.1",
61+
"babel-eslint": "^10.0.1",
62+
"eslint": "^5.15.1",
63+
"eslint-config-standard": ">=12.0.0",
64+
"eslint-plugin-import": ">=2.16.0",
65+
"eslint-plugin-jest": ">=22.3.0",
66+
"eslint-plugin-node": ">=8.0.1",
67+
"eslint-plugin-nuxt": ">=0.4.2",
68+
"eslint-plugin-promise": ">=4.0.1",
69+
"eslint-plugin-standard": ">=4.0.0",
70+
"eslint-loader": "^2.1.2",
71+
"eslint-plugin-vue": "^5.2.2"<% } %><% if (prettier === 'yes') { %>,
72+
"eslint-config-prettier": "^4.1.0",
73+
"eslint-plugin-prettier": "^3.0.1",
74+
"prettier": "^1.16.4"<% } %><% if (ui === 'tailwind') { %>,
75+
"autoprefixer": "^8.6.4",
76+
"tailwindcss": "^0.7.0"<% } else if (ui === 'vuetify') { %>,
77+
"stylus": "^0.54.5",
78+
"stylus-loader": "^3.0.2"<% } %><% if (test !== 'none') { %>,
79+
"@vue/test-utils": "^1.0.0-beta.27"<% } %><% if (test === 'jest') { %>,
80+
"babel-core": "7.0.0-bridge.0",
81+
"babel-jest": "^24.1.0",
82+
"jest": "^24.1.0",
83+
"vue-jest": "^3.0.3"<% } %><% if (test === 'ava') { %>,
84+
"ava": "^1.0.1",
85+
"browser-env": "^3.2.5",
86+
"require-extension-hooks": "^0.3.3",
87+
"require-extension-hooks-babel": "^0.1.1",
88+
"require-extension-hooks-vue": "^2.0.0"<% } %>
89+
}
90+
}

‎template/frameworks/adonis/.env‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
HOST=127.0.0.1
2+
PORT=3000
3+
NODE_ENV=development
4+
APP_URL=http://${HOST}:${PORT}
5+
6+
CACHE_VIEWS=false
7+
8+
APP_KEY=2wsjLSopTjD6WQEztTYIZgCFou8wpLJn
9+
10+
DB_CONNECTION=sqlite
11+
DB_HOST=127.0.0.1
12+
DB_PORT=3306
13+
DB_USER=root
14+
DB_PASSWORD=
15+
DB_DATABASE=adonis
16+
17+
SESSION_DRIVER=cookie

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /