vue-cli
Advanced tools
Comparing version 2.6.0 to 2.7.0
@@ -6,3 +6,3 @@ var Metalsmith = require('metalsmith') | ||
var path = require('path') | ||
var match = require('minimatch') | ||
var multimatch = require('multimatch') | ||
var getOptions = require('./options') | ||
@@ -95,2 +95,5 @@ var ask = require('./ask') | ||
function renderTemplateFiles (skipInterpolation) { | ||
skipInterpolation = typeof skipInterpolation === 'string' | ||
? [skipInterpolation] | ||
: skipInterpolation | ||
return function (files, metalsmith, done) { | ||
@@ -101,3 +104,3 @@ var keys = Object.keys(files) | ||
// skipping files with skipInterpolation option | ||
if (skipInterpolation && match(file, skipInterpolation, { dot: true })) { | ||
if (skipInterpolation && multimatch([file], skipInterpolation, { dot: true }).length) { | ||
return next() | ||
@@ -104,0 +107,0 @@ } |
@@ -78,3 +78,5 @@ var path = require('path') | ||
function setValidateName (opts) { | ||
opts.prompts.name.validate = function (name) { | ||
var name = opts.prompts.name | ||
var customValidate = name.validate | ||
name.validate = function (name) { | ||
var its = validateName(name) | ||
@@ -85,4 +87,5 @@ if (!its.validForNewPackages) { | ||
} | ||
if (typeof customValidate === 'function') return customValidate(name) | ||
return true | ||
} | ||
} |
{ | ||
"name": "vue-cli", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "A simple CLI for scaffolding Vue.js projects.", | ||
@@ -42,2 +42,3 @@ "preferGlobal": true, | ||
"minimatch": "^3.0.0", | ||
"multimatch": "^2.1.0", | ||
"ora": "^0.2.1", | ||
@@ -44,0 +45,0 @@ "read-metadata": "^1.0.0", |
@@ -7,2 +7,10 @@ module.exports = { | ||
message: 'Project description' | ||
}, | ||
name: { | ||
type: 'string', | ||
required: true, | ||
label: 'Project name', | ||
validate: function (input) { | ||
return input === 'custom' ? 'can not input `custom`' : true | ||
} | ||
} | ||
@@ -9,0 +17,0 @@ }, |
@@ -18,2 +18,3 @@ const { expect } = require('chai') | ||
const MOCK_METADATA_REPO_JS_PATH = './test/e2e/mock-metadata-repo-js' | ||
const MOCK_SKIP_GLOB = './test/e2e/mock-skip-glob' | ||
@@ -159,5 +160,30 @@ function monkeyPatchInquirer (answers) { | ||
it('support multiple globs in skipInterpolation', done => { | ||
monkeyPatchInquirer(answers) | ||
const binFilePath = `${MOCK_SKIP_GLOB}/template/bin.file` | ||
const wstream = fs.createWriteStream(binFilePath) | ||
wstream.write(crypto.randomBytes(100)) | ||
wstream.end() | ||
generate('test', MOCK_SKIP_GLOB, MOCK_TEMPLATE_BUILD_PATH, err => { | ||
if (err) done(err) | ||
const originalVueFileOne = fs.readFileSync(`${MOCK_SKIP_GLOB}/template/src/no.vue`, 'utf8') | ||
const originalVueFileTwo = fs.readFileSync(`${MOCK_SKIP_GLOB}/template/src/no.js`, 'utf8') | ||
const generatedVueFileOne = fs.readFileSync(`${MOCK_TEMPLATE_BUILD_PATH}/src/no.vue`, 'utf8') | ||
const generatedVueFileTwo = fs.readFileSync(`${MOCK_TEMPLATE_BUILD_PATH}/src/no.js`, 'utf8') | ||
expect(originalVueFileOne).to.equal(generatedVueFileOne) | ||
expect(originalVueFileTwo).to.equal(generatedVueFileTwo) | ||
expect(exists(binFilePath)).to.equal(true) | ||
expect(exists(`${MOCK_TEMPLATE_BUILD_PATH}/bin.file`)).to.equal(true) | ||
rm(binFilePath) | ||
done() | ||
}) | ||
}) | ||
it('validate input value', done => { | ||
// deep copy | ||
var invalidName = extend({}, answers, {name: 'INVALID-NAME'}) | ||
var invalidName = extend({}, answers, { name: 'INVALID-NAME' }) | ||
monkeyPatchInquirer(invalidName) | ||
@@ -169,2 +195,11 @@ generate('INVALID-NAME', MOCK_TEMPLATE_REPO_PATH, MOCK_TEMPLATE_BUILD_PATH, err => { | ||
}) | ||
it('custom validate', done => { | ||
var invalidName = extend({}, answers, { name: 'custom' }) | ||
monkeyPatchInquirer(invalidName) | ||
generate('test', MOCK_METADATA_REPO_JS_PATH, MOCK_TEMPLATE_BUILD_PATH, err => { | ||
expect(err).to.be.an('error') | ||
done() | ||
}) | ||
}) | ||
}) |
Nonpermissive License
License(Experimental) A package's licensing information has fine-grained problems
Found 1 instance in 1 package
37379
37
657
17
2
+ Addedmultimatch@^2.1.0
+ Addedarray-union@1.0.2(transitive)
+ Addedarrify@1.0.1(transitive)
+ Addedmultimatch@2.1.0(transitive)