Skip to content

Commit 13823f2

Browse files
committed
initial commit
0 parents  commit 13823f2

Some content is hidden

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

58 files changed

+18969
-0
lines changed

.babelrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['@vue/app'],
3+
}

.browserslistrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
> 1%
2+
last 2 versions

.env

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VUE_APP_I18N_LOCALE=ru
2+
VUE_APP_I18N_FALLBACK_LOCALE=en

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist/
2+
/tests/unit/coverage/

.eslintrc.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
module.exports = {
2+
root: true,
3+
parserOptions: {
4+
sourceType: 'script',
5+
},
6+
extends: [
7+
// https://github.com/vuejs/eslint-plugin-vue#bulb-rules
8+
'plugin:vue/recommended',
9+
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
10+
'standard',
11+
// https://github.com/prettier/eslint-config-prettier
12+
'prettier',
13+
'prettier/standard',
14+
'prettier/vue',
15+
],
16+
rules: {
17+
// Only allow debugger in development
18+
'no-debugger': process.env.PRE_COMMIT ? 'error' : 'off',
19+
// Only allow `console.log` in development
20+
'no-console': process.env.PRE_COMMIT
21+
? ['error', { allow: ['warn', 'error'] }]
22+
: 'off',
23+
'vue/array-bracket-spacing': 'error',
24+
'vue/arrow-spacing': 'error',
25+
'vue/block-spacing': 'error',
26+
'vue/brace-style': 'error',
27+
'vue/camelcase': 'error',
28+
'vue/comma-dangle': ['error', 'always-multiline'],
29+
'vue/component-name-in-template-casing': 'error',
30+
'vue/dot-location': ['error', 'property'],
31+
'vue/eqeqeq': 'error',
32+
'vue/key-spacing': 'error',
33+
'vue/keyword-spacing': 'error',
34+
'vue/no-boolean-default': ['error', 'default-false'],
35+
'vue/no-deprecated-scope-attribute': 'error',
36+
'vue/no-empty-pattern': 'error',
37+
'vue/object-curly-spacing': ['error', 'always'],
38+
'vue/space-infix-ops': 'error',
39+
'vue/space-unary-ops': 'error',
40+
'vue/v-on-function-call': 'error',
41+
'vue/v-slot-style': [
42+
'error',
43+
{
44+
atComponent: 'v-slot',
45+
default: 'v-slot',
46+
named: 'longform',
47+
},
48+
],
49+
'vue/valid-v-slot': 'error',
50+
},
51+
overrides: [
52+
{
53+
files: ['src/**/*', 'tests/unit/**/*', 'tests/e2e/**/*'],
54+
parserOptions: {
55+
parser: 'babel-eslint',
56+
sourceType: 'module',
57+
},
58+
env: {
59+
browser: true,
60+
},
61+
},
62+
{
63+
files: ['**/*.unit.js'],
64+
parserOptions: {
65+
parser: 'babel-eslint',
66+
sourceType: 'module',
67+
},
68+
env: { jest: true },
69+
globals: {
70+
mount: false,
71+
shallowMount: false,
72+
shallowMountView: false,
73+
createComponentMocks: false,
74+
createModuleStore: false,
75+
},
76+
},
77+
],
78+
}

.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# OS Files
2+
.DS_Store
3+
Thumbs.db
4+
5+
# Dependencies
6+
node_modules/
7+
8+
# Dev/Build Artifacts
9+
/dist/
10+
/tests/e2e/videos/
11+
/tests/e2e/screenshots/
12+
/tests/unit/coverage/
13+
jsconfig.json
14+
15+
# Local Env Files
16+
.env.local
17+
.env.*.local
18+
19+
# Log Files
20+
*.log
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# Unconfigured Editors
26+
.idea
27+
*.suo
28+
*.ntvs*
29+
*.njsproj
30+
*.sln
31+
*.sw*

.postcssrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: {
3+
autoprefixer: {}
4+
}
5+
}

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/node_modules/**
2+
/dist/**
3+
/tests/unit/coverage/**

.prettierrc.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
printWidth: 80,
3+
tabWidth: 2,
4+
useTabs: false,
5+
semi: false,
6+
singleQuote: true,
7+
trailingComma: 'es5',
8+
bracketSpacing: true,
9+
jsxBracketSameLine: false,
10+
arrowParens: 'always',
11+
proseWrap: 'never',
12+
htmlWhitespaceSensitivity: 'strict',
13+
endOfLine: 'lf',
14+
}

.vscode/extensions.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
// Syntax highlighting and more for .vue files
6+
// https://github.com/vuejs/vetur
7+
"octref.vetur",
8+
9+
// Peek and go-to-definition for .vue files
10+
// https://github.com/fuzinato/vscode-vue-peek
11+
"dariofuzinato.vue-peek",
12+
13+
// Lint-on-save with ESLint
14+
// https://github.com/Microsoft/vscode-eslint
15+
"dbaeumer.vscode-eslint",
16+
17+
// Lint-on-save with Stylelint
18+
// https://github.com/shinnn/vscode-stylelint
19+
"shinnn.stylelint",
20+
21+
// Format-on-save with Prettier
22+
// https://github.com/prettier/prettier-vscode
23+
"esbenp.prettier-vscode",
24+
25+
// SCSS intellisense
26+
// https://github.com/mrmlnc/vscode-scss
27+
"mrmlnc.vscode-scss",
28+
29+
// Test `.unit.js` files on save with Jest
30+
// https://github.com/jest-community/vscode-jest
31+
"Orta.vscode-jest",
32+
33+
// Lint markdown in README files
34+
// https://github.com/DavidAnson/vscode-markdownlint
35+
"DavidAnson.vscode-markdownlint"
36+
]
37+
}

.vscode/settings.json

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
// ===
3+
// Spacing
4+
// ===
5+
6+
"editor.insertSpaces": true,
7+
"editor.tabSize": 2,
8+
"editor.trimAutoWhitespace": true,
9+
"files.trimTrailingWhitespace": true,
10+
"files.eol": "\n",
11+
"files.insertFinalNewline": true,
12+
"files.trimFinalNewlines": true,
13+
14+
// ===
15+
// Files
16+
// ===
17+
18+
"files.exclude": {
19+
"**/*.log": true,
20+
"**/*.log*": true,
21+
"**/dist": true,
22+
"**/coverage": true
23+
},
24+
"files.associations": {
25+
".markdownlintrc": "jsonc"
26+
},
27+
28+
// ===
29+
// Event Triggers
30+
// ===
31+
32+
"editor.formatOnSave": true,
33+
"eslint.autoFixOnSave": true,
34+
"eslint.run": "onSave",
35+
"eslint.validate": [
36+
{ "language": "javascript", "autoFix": true },
37+
{ "language": "javascriptreact", "autoFix": true },
38+
{ "language": "vue", "autoFix": true },
39+
{ "language": "vue-html", "autoFix": true },
40+
{ "language": "html", "autoFix": true }
41+
],
42+
"vetur.format.enable": false,
43+
"vetur.completion.scaffoldSnippetSources": {
44+
"user": "🗒️",
45+
"workspace": "💼",
46+
"vetur": ""
47+
},
48+
"prettier.disableLanguages": [],
49+
50+
// ===
51+
// HTML
52+
// ===
53+
54+
"html.format.enable": false,
55+
"vetur.validation.template": false,
56+
"emmet.triggerExpansionOnTab": true,
57+
"emmet.includeLanguages": {
58+
"vue-html": "html"
59+
},
60+
"vetur.completion.tagCasing": "initial",
61+
62+
// ===
63+
// JS(ON)
64+
// ===
65+
66+
"jest.autoEnable": false,
67+
"jest.enableCodeLens": false,
68+
"javascript.format.enable": false,
69+
"json.format.enable": false,
70+
"vetur.validation.script": false,
71+
72+
// ===
73+
// CSS
74+
// ===
75+
76+
"stylelint.enable": true,
77+
"css.validate": false,
78+
"scss.validate": false,
79+
"vetur.validation.style": false,
80+
81+
// ===
82+
// MARKDOWN
83+
// ===
84+
85+
"[markdown]": {
86+
"editor.wordWrap": "wordWrapColumn",
87+
"editor.wordWrapColumn": 80
88+
}
89+
}

.vuepress/config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const appConfig = require('../src/app.config')
2+
3+
module.exports = {
4+
title: appConfig.title + ' Docs',
5+
description: appConfig.description,
6+
themeConfig: {
7+
sidebar: [
8+
['/', 'Introduction'],
9+
'/docs/state',
10+
'/docs/editors',
11+
'/docs/linting',
12+
'/docs/styles',
13+
],
14+
},
15+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 mavajee
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

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Vue-cli 3 and multiple entry points (pages)
2+
3+
> UPD.1: I found reference for multiple pages in the vue-cli source code. I think it's not yet documented. UPD.2: See config [documentation](https://cli.vuejs.org/config/#pages) for create multiple pages.
4+
5+
---
6+
7+
For example we need build two different app instances:
8+
9+
- index - `/`;
10+
- dashboard - `/manage`.
11+
12+
Simple way add **pages** config reference to **vue.config.js**.
13+
14+
Full config you can see [here](vue.config.js).
15+
16+
> Old example using [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain) is [here](https://github.com/mavajee/guide__vue-cli-3-multiple-entry-points/tree/chain-usage).
17+
18+
## Configure **vue.config.js**
19+
20+
With **pages** api you don't need manually edit entry points. You just define each your page like this:
21+
22+
```js
23+
module.exports = {
24+
pages: {
25+
manage: {
26+
entry: 'src/dashboard/main.js',
27+
template: 'public/index.html',
28+
filename: 'dashboard/index.html',
29+
title: 'Dashboard Page',
30+
chunks: ['chunk-vendors', 'chunk-common', 'dashboard']
31+
}
32+
}
33+
```
34+
35+
### Vue router
36+
37+
Using vue router you will see error, for fix configure [historyApiFallback](https://webpack.js.org/configuration/dev-server/#devserver-historyapifallback) for **webpack-dev-server**:
38+
39+
```js
40+
devServer: {
41+
historyApiFallback: {
42+
rewrites: [
43+
{ from: /^\/manage\/?.*/, to: path.posix.join('/', 'manage/index.html') },
44+
{ from: /./, to: path.posix.join('/', 'index.html') }
45+
]
46+
},
47+
}
48+
```
49+
50+
## Configure Nginx
51+
52+
For more, if you need configure nginx you can make something like this:
53+
54+
```js
55+
server {
56+
listen 80;
57+
58+
location ~ ^/manage(.*)$ {
59+
proxy_pass http://127.0.0.1:8550/manage/$1;
60+
}
61+
}
62+
```
63+
64+
Best way if on a each entry point configure own location. See full config [here](configs/nginx.dev.conf).
65+
66+
Using non "localhost" host HMR can not be working. And for it add [allowedHosts](https://webpack.js.org/configuration/dev-server/#devserver-allowedhosts) to `webpack-dev-server` or edit server headers.

0 commit comments

Comments
 (0)