@cnamts/vue-cli-plugin-vue-dash
Advanced tools
Comparing version 2.3.0 to 2.4.0
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 2018 | ||
}, | ||
env: { | ||
node: true, | ||
es6: true, | ||
jest: true | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:jsdoc/recommended' | ||
], | ||
rules: { | ||
'indent': ['error', 'tab'], | ||
// Force semi | ||
'semi': ['error', 'always'], | ||
// Remove space in functions, eg. function() | ||
'space-before-function-paren': ['error', 'never'], | ||
// Remove trailing coma | ||
'comma-dangle': ['error', 'never'], | ||
'space-before-blocks': ['error', 'always'], | ||
'keyword-spacing': ['error', { | ||
before: true | ||
}], | ||
// Single quotes | ||
'quotes': ['error', 'single'], | ||
// No trailing spaces | ||
'no-trailing-spaces': 'error', | ||
// Enforces one true brace style, eg. | ||
// if () { | ||
// } | ||
'brace-style': ['error', '1tbs'], | ||
// Limit .vue files to 350 lines | ||
'max-lines': ['error', { | ||
max: 350, | ||
skipBlankLines: true, | ||
skipComments: true | ||
}], | ||
// Prefer const | ||
'prefer-const': 'error', | ||
// No var | ||
'no-var': 'error' | ||
}, | ||
extends: '@cnamts/eslint-config', | ||
ignorePatterns: [ | ||
'generator/template/' | ||
], | ||
plugins: [ | ||
'jsdoc' | ||
] | ||
}; |
const fs = require('fs'); | ||
const consola = require('consola'); | ||
const { log, warn, getPath } = require('@cnamts/cli-helpers'); | ||
const { fileExists } = require('./utils'); | ||
const ENV_DIST_PATH = 'public/js/config.js.dist'; | ||
const ENV_PATH = 'public/js/config.js'; | ||
const { getPath } = require('./utils'); | ||
/** | ||
@@ -19,11 +18,10 @@ * Copy env file if missing to save debugging time | ||
const shouldCopyFile = !fileExists(envFilePath) && fileExists(envFilePathDist); | ||
const shouldCopyFile = !fs.existsSync(envFilePath) && fs.existsSync(envFilePathDist); | ||
if (shouldCopyFile) { | ||
warn('Fix missing config.js file'); | ||
consola.warn('Fix missing config.js file'); | ||
fs.copyFileSync(envFilePathDist, envFilePath); | ||
log(`Copied ${ENV_DIST_PATH} to ${ENV_PATH}`); | ||
log(); | ||
consola.info(`Copied ${ENV_DIST_PATH} to ${ENV_PATH}`); | ||
} | ||
@@ -30,0 +28,0 @@ } |
@@ -9,11 +9,5 @@ /** | ||
function deleteOldResources(resources, resourcesToDelete) { | ||
for (const resource of resourcesToDelete) { | ||
let shouldDeleteFile; | ||
resourcesToDelete.forEach((resource) => { | ||
const shouldDeleteFile = typeof resource.condition === 'undefined' ? true : resource.condition; | ||
if (typeof resource.condition === 'undefined') { | ||
shouldDeleteFile = true; | ||
} else { | ||
shouldDeleteFile = resource.condition; | ||
} | ||
if (resource.type === 'file' && shouldDeleteFile) { | ||
@@ -31,5 +25,5 @@ delete resources[resource.path]; | ||
} | ||
} | ||
}); | ||
} | ||
module.exports = { deleteOldResources }; |
@@ -25,2 +25,3 @@ const { devDependencies } = require('../../package.json'); | ||
const FormBuilderVersion = normalizeVersion(devDependencies['@cnamts/form-builder']); | ||
const EslintConfigVueVersion = normalizeVersion(devDependencies['@cnamts/eslint-config-vue']); | ||
@@ -44,46 +45,51 @@ /** | ||
dependencies: { | ||
'@cnamts/eslint-config-vue': EslintConfigVueVersion, | ||
'@cnamts/design-tokens': DesignTokensVersion, | ||
'@cnamts/form-builder': FormBuilderVersion, | ||
'@cnamts/vue-dot': VueDotVersion, | ||
'axios': '^0.26.1', | ||
'core-js': '^3.21.1', | ||
'axios': '0.26.1', /** @see https://github.com/axios/axios/issues/4716 */ | ||
'core-js': '^3.22.5', | ||
'custom-event-polyfill': '^1.0.7', | ||
'dayjs': '^1.11.0', | ||
'dayjs': '^1.11.2', | ||
'languages': '^0.1.3', | ||
'vue': '^2.6.14', | ||
'vue-input-facade': '^2.0.0', | ||
'vue-input-facade': '^2.0.1', | ||
'vue-meta': '^2.4.0', | ||
'vue-router': '^3.5.3', | ||
'vuetify': '^2.6.4', | ||
'vuetify': '^2.6.5', | ||
'vuex': '^3.6.2' | ||
}, | ||
devDependencies: { | ||
'@babel/core': '^7.17.8', | ||
'@mdi/js': '^6.6.95', | ||
'@rushstack/eslint-patch': '^1.1.1', | ||
'@types/jest': '^26.0.24', | ||
'@babel/core': '^7.17.10', | ||
'@mdi/js': '^6.6.96', | ||
'@rushstack/eslint-patch': '^1.1.3', | ||
'@types/jest': '^27.5.1', | ||
'@types/webfontloader': '^1.6.34', | ||
'@typescript-eslint/eslint-plugin': '^5.16.0', | ||
'@typescript-eslint/parser': '^5.16.0', | ||
'@vue/cli-plugin-babel': '~4.5.17', | ||
'@vue/cli-plugin-eslint': '~4.5.17', | ||
'@vue/cli-plugin-router': '~4.5.17', | ||
'@vue/cli-plugin-typescript': '~4.5.17', | ||
'@vue/cli-plugin-unit-jest': '~4.5.17', | ||
'@vue/cli-plugin-vuex': '~4.5.17', | ||
'@vue/cli-service': '~4.5.17', | ||
'@vue/eslint-config-standard': '^6.1.0', | ||
'@typescript-eslint/eslint-plugin': '^5.23.0', | ||
'@typescript-eslint/parser': '^5.23.0', | ||
'@vue/cli-plugin-babel': '~5.0.4', | ||
'@vue/cli-plugin-eslint': '~5.0.4', | ||
'@vue/cli-plugin-router': '~5.0.4', | ||
'@vue/cli-plugin-typescript': '~5.0.4', | ||
'@vue/cli-plugin-unit-jest': '~5.0.4', | ||
'@vue/cli-plugin-vuex': '~5.0.4', | ||
'@vue/cli-service': '~5.0.4', | ||
'@vue/eslint-config-standard': '^7.0.0', | ||
'@vue/eslint-config-typescript': '^10.0.0', | ||
'@vue/test-utils': '^1.3.0', | ||
'eslint': '^7.32.0', | ||
'eslint-plugin-import': '^2.25.4', | ||
'@vue/vue2-jest': '^27.0.0', | ||
'babel-jest': '^27.5.1', | ||
'eslint': '^8.15.0', | ||
'eslint-plugin-import': '^2.26.0', | ||
'eslint-plugin-node': '^11.1.0', | ||
'eslint-plugin-promise': '^6.0.0', | ||
'eslint-plugin-vue': '^8.5.0', | ||
'eslint-plugin-vue': '^8.7.1', | ||
'jest': '^27.5.1', | ||
'jest-serializer-vue': '^2.0.2', | ||
'lint-staged': '^12.3.7', | ||
'lint-staged': '^12.4.1', | ||
'sass': '~1.32.13', /** @see https://github.com/vuetifyjs/vuetify/issues/13694 */ | ||
'sass-loader': '^10.2.1', | ||
'sass-loader': '^12.6.0', | ||
'ts-jest': '^27.1.4', | ||
'ts-node': '^10.7.0', | ||
'typescript': '~4.6.3', | ||
'typescript': '~4.6.4', | ||
'vue-class-component': '^7.2.6', | ||
@@ -94,20 +100,9 @@ 'vue-cli-plugin-vuetify': '^2.4.8', | ||
'webfontloader': '^1.6.28', | ||
'webpack': '^4.46.0' | ||
'webpack': '^5.72.1' | ||
}, | ||
resolutions: { | ||
'jest': '^26.6.3', | ||
'ts-jest': '^26.5.6', | ||
'babel-jest': '^26.6.3' | ||
}, | ||
engines: { | ||
'node': '^12 || ^14' | ||
'node': '^14 || ^16' | ||
}, | ||
gitHooks: { | ||
'pre-commit': 'lint-staged' | ||
}, | ||
'lint-staged': { | ||
'*.{ts,vue}': [ | ||
'vue-cli-service lint', | ||
'git add' | ||
] | ||
} | ||
@@ -124,3 +119,3 @@ }; | ||
if (options.i18n) { | ||
newPackageProperties.dependencies['vue-i18n'] = '^8.27.0'; | ||
newPackageProperties.dependencies['vue-i18n'] = '^8.27.1'; | ||
} | ||
@@ -135,8 +130,7 @@ | ||
if (options.cypress) { | ||
newPackageProperties.devDependencies['@vue/cli-plugin-e2e-cypress'] = '~4.5.17'; | ||
newPackageProperties.devDependencies['@vue/cli-plugin-e2e-cypress'] = '~5.0.4'; | ||
newPackageProperties.devDependencies['cypress'] = '^9.6.1'; | ||
newPackageProperties.scripts['test:e2e'] = 'vue-cli-service test:e2e --headless'; | ||
newPackageProperties.scripts['test:e2e:gui'] = 'vue-cli-service test:e2e'; | ||
newPackageProperties.resolutions['cypress'] = '^9.5.2'; | ||
} | ||
@@ -143,0 +137,0 @@ |
const fs = require('fs-extra'); | ||
const { getPath } = require('@cnamts/cli-helpers'); | ||
const { getPath } = require('../../utils'); | ||
@@ -16,10 +16,4 @@ const TAB_CHARACTER = ' '; | ||
function fixPackageIndentation(invoking, projectName) { | ||
let packagePath; | ||
const packagePath = getPath(invoking ? 'package.json' : projectName + '/package.json'); | ||
if (invoking) { | ||
packagePath = getPath('package.json'); | ||
} else { | ||
packagePath = getPath(projectName + '/package.json'); | ||
} | ||
const package = fs.readFileSync(packagePath).toString(); | ||
@@ -26,0 +20,0 @@ |
@@ -11,2 +11,6 @@ /** | ||
type: 'file', | ||
path: 'jsconfig.json' | ||
}, | ||
{ | ||
type: 'file', | ||
path: 'src/assets/logo.png' | ||
@@ -24,6 +28,2 @@ }, | ||
type: 'file', | ||
path: 'src/main.js' | ||
}, | ||
{ | ||
type: 'file', | ||
path: 'src/components/HelloWorld.vue' | ||
@@ -30,0 +30,0 @@ }, |
@@ -0,1 +1,2 @@ | ||
const fs = require('fs'); | ||
const { extendPackage } = require('./functions/extendPackage'); | ||
@@ -22,3 +23,3 @@ const { fixPackageIndentation } = require('./functions/fixPackageIndentation'); | ||
// Custom options | ||
name: projectName, | ||
projectName, | ||
pm, | ||
@@ -34,4 +35,3 @@ // Functions | ||
api.postProcessFiles((resources) => { | ||
const resourcesToDelete = getResourcesToDelete(options); | ||
deleteOldResources(resources, resourcesToDelete); | ||
deleteOldResources(resources, getResourcesToDelete(options)); | ||
@@ -43,7 +43,8 @@ const indexPath = 'public/index.html'; | ||
// Fix package indentation after writing files to the disk | ||
// Even if no template is rendered the indentation is modified | ||
// Do these operations after writing files to the disk | ||
// to be sure they are effective | ||
api.onCreateComplete(() => { | ||
fixPackageIndentation(api.invoking, projectName); | ||
fs.unlinkSync(api.resolve('src/main.js')); | ||
}); | ||
}; |
module.exports = { | ||
root: true, | ||
env: { | ||
node: true | ||
}, | ||
parser: 'vue-eslint-parser', | ||
extends: [ | ||
'plugin:vue/recommended', | ||
'eslint:recommended', | ||
'@vue/typescript/recommended' | ||
], | ||
rules: { | ||
// Allow logs in development but not in production | ||
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn', | ||
// Tab indent in templates | ||
'vue/html-indent': ['error', 'tab'], | ||
'indent': 'off', | ||
// Disallow spaces around equal in HTML attributes | ||
// eg. attr= "value" is invalid | ||
'vue/no-spaces-around-equal-signs-in-attribute': ['error'], | ||
// Force semi-colons | ||
'semi': 'off', | ||
'@typescript-eslint/semi': ['error'], | ||
// Remove space in functions, eg. function() | ||
'space-before-function-paren': ['error', 'never'], | ||
// .vue <script> indent | ||
'vue/script-indent': ['error', 'tab', { | ||
baseIndent: 1, | ||
switchCase: 1, | ||
ignores: [] | ||
}], | ||
// Allow modifiers in slot names | ||
// eg. <template v-slot.foo> | ||
'vue/valid-v-slot': ['error', { | ||
allowModifiers: true | ||
}], | ||
// Allow event names like click:row | ||
'vue/custom-event-name-casing': ['error', { | ||
ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'] | ||
}], | ||
// Maximum 1 empty line | ||
'no-multiple-empty-lines': ['error', { | ||
max: 1 | ||
}], | ||
// Remove trailing coma | ||
'comma-dangle': ['error', 'never'], | ||
// Force PascalCase for component names | ||
'vue/component-name-in-template-casing': [ | ||
'error', | ||
'PascalCase', | ||
{ | ||
ignores: [ | ||
'keep-alive', | ||
'component', | ||
'transition', | ||
'transition-group' | ||
] | ||
} | ||
], | ||
// Force single quotes | ||
'quotes': ['error', 'single'], | ||
// No trailing spaces | ||
'no-trailing-spaces': 'error', | ||
// Enforces one true brace style, eg. | ||
// if () { | ||
// } | ||
'brace-style': ['error', '1tbs'], | ||
// Allow v-html | ||
'vue/no-v-html': ['off'], | ||
// Limit .vue files to 350 lines | ||
'max-lines': ['error', { | ||
max: 350, | ||
skipBlankLines: true, | ||
skipComments: true | ||
}], | ||
'object-curly-spacing': ['error', 'always'], | ||
// Force arrow functions | ||
'prefer-arrow-callback': 'error', | ||
'no-prototype-builtins': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': [ | ||
'error', | ||
{ | ||
allowedNames: [ | ||
'beforeCreate', | ||
'created', | ||
'beforeMount', | ||
'mounted', | ||
'beforeUpdate', | ||
'updated', | ||
'beforeDestroy', | ||
'destroyed' | ||
] | ||
} | ||
] | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.js'], | ||
rules: { | ||
// Allow require() in JS files | ||
'@typescript-eslint/no-var-requires': 'off' | ||
} | ||
}, | ||
{ | ||
files: ['*.spec.ts'], | ||
rules: { | ||
// Sometimes in tests we mock more than one component | ||
'vue/one-component-per-file': 'off' | ||
} | ||
} | ||
], | ||
ignorePatterns: [ | ||
'tests/unit/coverage', | ||
'dist/' | ||
], | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser' | ||
} | ||
'@cnamts/eslint-config-vue' | ||
] | ||
}; |
@@ -1,4 +0,4 @@ | ||
# <%= name %> | ||
# <%= projectName %> | ||
> <%= description %> | ||
> <%= projectDescription %> | ||
@@ -5,0 +5,0 @@ ## Configure config.js |
@@ -15,2 +15,3 @@ import Vue from 'vue'; | ||
mocks: { | ||
$maintenanceEnabled: false, | ||
$t: (key: string) => { | ||
@@ -17,0 +18,0 @@ return key === 'components.layout.appHeader.navigationItems' ? [] : key; |
export default { | ||
meta: { | ||
title: '<%= capitalizeFirstLetter(name) %>', | ||
title: '<%= capitalizeFirstLetter(projectName) %>', | ||
titleTemplate: '%s | CNAM', | ||
description: '<%= description %>.' | ||
description: '<%= projectDescription %>.' | ||
}, | ||
defaultErrorMessage: 'Une erreur inconnue est survenue' | ||
}; |
export default { | ||
title: 'Projet <%= name %>', | ||
title: 'Projet <%= projectName %>', | ||
navigationItems: [ | ||
@@ -18,11 +18,3 @@ { | ||
user: 'Utilisateur', | ||
role: 'Développeur', | ||
userMenuLinks: [ | ||
{ | ||
title: 'Accueil', | ||
to: { | ||
name: 'home' | ||
} | ||
} | ||
], | ||
role: 'Développeur' | ||
}; |
@@ -14,3 +14,6 @@ import Vue from 'vue'; | ||
wrapper = mountComponent(App, { | ||
router | ||
router, | ||
mocks: { | ||
$maintenanceEnabled: false | ||
} | ||
}); | ||
@@ -20,2 +23,13 @@ | ||
}); | ||
it('renders correctly when maintenance is enabled', () => { | ||
wrapper = mountComponent(App, { | ||
router, | ||
mocks: { | ||
$maintenanceEnabled: true | ||
} | ||
}); | ||
expect(html(wrapper)).toMatchSnapshot(); | ||
}); | ||
}); |
@@ -6,5 +6,6 @@ // Vue CLI configuration | ||
const { defineConfig } = require('@vue/cli-service'); | ||
const { vueDotLoader } = require('@cnamts/vue-cli-plugin-vue-dash/vueDotLoader'); | ||
module.exports = { | ||
const config = defineConfig({ | ||
chainWebpack: config => { | ||
@@ -36,2 +37,4 @@ // Auto-load VueDot components | ||
parallel: process.env.NODE_ENV !== 'production' | ||
}; | ||
}); | ||
module.exports = config; |
{ | ||
"name": "@cnamts/vue-cli-plugin-vue-dash", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Vue CLI plugin to scaffold front-end projects", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@cnamts/cli-helpers": "^2.1.0", | ||
"consola": "^2.15.3", | ||
"dayjs": "^1.8.34", | ||
@@ -33,5 +33,7 @@ "fs-extra": "^10.0.0", | ||
"devDependencies": { | ||
"@cnamts/design-tokens": "^2.3.0", | ||
"@cnamts/form-builder": "^2.3.0", | ||
"@cnamts/vue-dot": "^2.3.0" | ||
"@cnamts/design-tokens": "^2.4.0", | ||
"@cnamts/eslint-config": "^2.4.0", | ||
"@cnamts/eslint-config-vue": "^2.4.0", | ||
"@cnamts/form-builder": "^2.4.0", | ||
"@cnamts/vue-dot": "^2.4.0" | ||
}, | ||
@@ -41,3 +43,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "2f1aad0becee1fed5dd3d836755794c0ce9d43df" | ||
"gitHead": "1e4d86bb298920cd901e754d5db3cf193b004506" | ||
} |
@@ -9,3 +9,3 @@ const shouldRenderTemplate = require('./shouldRenderTemplate'); | ||
{ | ||
name: 'description', | ||
name: 'projectDescription', | ||
type: 'text', | ||
@@ -12,0 +12,0 @@ message: 'Description du projet', |
14
utils.js
@@ -1,2 +0,2 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
@@ -14,9 +14,9 @@ /** | ||
/** | ||
* Checks if the file exists (sync) | ||
* Get path relative to current working directory | ||
* | ||
* @param {string} path The path of the file | ||
* @returns {boolean} If the file exists | ||
* @param {string} value The path to join | ||
* @returns {string} The normalized path | ||
*/ | ||
function fileExists(path) { | ||
return fs.existsSync(path); | ||
function getPath(value) { | ||
return path.join(process.cwd(), value); | ||
} | ||
@@ -26,3 +26,3 @@ | ||
capitalizeFirstLetter, | ||
fileExists | ||
getPath | ||
}; |
@@ -14,2 +14,3 @@ const componentMap = { | ||
// Patterns | ||
CookieBanner: 'patterns', | ||
DataListGroup: 'patterns', | ||
@@ -29,2 +30,3 @@ DatePicker: 'patterns', | ||
// Templates | ||
CookiesPage: 'templates', | ||
ErrorPage: 'templates' | ||
@@ -31,0 +33,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
111
158685
5
1668
+ Addedconsola@^2.15.3
+ Addedconsola@2.15.3(transitive)
- Removed@cnamts/cli-helpers@^2.1.0
- Removed@cnamts/cli-helpers@2.1.0(transitive)
- Removed@types/figlet@1.5.4(transitive)
- Removedfiglet@1.8.0(transitive)