diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c5186160e0..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,137 +0,0 @@ -version: 2 -vm_settings: &vm_settings - docker: - - image: circleci/node:6.12.3-browsers - -jobs: - install_template_deps: - <<: *vm_settings - working_directory: ~/project/webpack-template - steps: - - checkout - - restore_cache: - key: template-cache-{{ checksum "package.json" }} - - run: - name: Install npm dependencies - command: npm install - - save_cache: - key: template-cache-{{ checksum "package.json" }} - paths: - - node_modules - - run: - name: Rollout minimal scenario - command: VUE_TEMPL_TEST=minimal node_modules/.bin/vue init . test-minimal - - run: - name: Rollout full scenario - command: VUE_TEMPL_TEST=full node_modules/.bin/vue init . test-full - - run: - name: Rollout full-karma-airbnb scenario - command: VUE_TEMPL_TEST=full-karma-airbnb node_modules/.bin/vue init . test-full-karma-airbnb - - persist_to_workspace: - root: ~/project/webpack-template - paths: - - node_modules - - test-* - - scenario_minimal: - <<: *vm_settings - environment: - - VUE_TEMPL_TEST: minimal - working_directory: ~/project/webpack-template/test-minimal - steps: - - attach_workspace: - at: '~/project/webpack-template' - - restore_cache: - key: template-cache-minimal-{{ checksum "package.json" }} - - run: - name: Install npm dependencies - command: npm install - - save_cache: - key: template-cache-minimal-{{ checksum "package.json" }} - paths: - - node_modules - - run: - name: Test build - command: npm run build - - scenario_full: - <<: *vm_settings - working_directory: ~/project/webpack-template/test-full - environment: - - VUE_TEMPL_TEST: full - steps: - - attach_workspace: - at: '~/project/webpack-template' - - restore_cache: - key: template-cache-full-{{ checksum "package.json" }} - - run: - name: Install npm dependencies - command: npm install - - save_cache: - key: template-cache-full-{{ checksum "package.json" }} - paths: - - node_modules - - run: - name: Run Lint - command: npm run lint -- --fix - - run: - name: Run Unit tests - command: npm run unit - when: always - - run: - name: Run e2e tests - command: npm run e2e - when: always - - run: - name: Test build - command: npm run build - when: always - - scenario_full-karma-airbnb: - <<: *vm_settings - working_directory: ~/project/webpack-template/test-full-karma-airbnb - environment: - - VUE_TEMPL_TEST: full-karma-airbnb - steps: - - attach_workspace: - at: '~/project/webpack-template' - - restore_cache: - key: template-cache-full-karma-airbnb-{{ checksum "package.json" }} - - run: - name: Install npm dependencies - command: npm install - - save_cache: - key: template-cache-full-karma-airbnb-{{ checksum "package.json" }} - paths: - - node_modules - - run: - name: Run Lint - command: npm run lint -- --fix - - run: - name: Run Unit tests - command: npm run unit - when: always - - run: - name: Run e2e tests - command: npm run e2e - when: always - - run: - name: Test build - command: npm run build - when: always - - -workflows: - version: 2 - build_and_test: - jobs: - - install_template_deps - - scenario_minimal: - requires: - - install_template_deps - - scenario_full: - requires: - - install_template_deps - - scenario_full-karma-airbnb: - requires: - - install_template_deps \ No newline at end of file diff --git a/deploy-docs.sh b/deploy-docs.sh index a9f76366a4..93c68f3846 100644 --- a/deploy-docs.sh +++ b/deploy-docs.sh @@ -5,4 +5,4 @@ cd _book git init git add -A git commit -m 'update book' -git push -f git@github.com:vuejs-templates/webpack.git master:gh-pages +git push -f git@github.com:vuejs-templates/webpack.git master:gh-pages \ No newline at end of file diff --git a/meta.js b/meta.js index a521f9bdd0..54d65e181a 100644 --- a/meta.js +++ b/meta.js @@ -44,7 +44,7 @@ module.exports = { type: 'string', required: false, message: 'Project description', - default: 'A Vue.js project', + default: 'Projeto padrĂ£o Huddle', }, author: { when: 'isNotTest', diff --git a/scenarios/README.md b/scenarios/README.md deleted file mode 100644 index 2fcacaf077..0000000000 --- a/scenarios/README.md +++ /dev/null @@ -1,27 +0,0 @@ -## What is this folder? - -This folder contains test scenarios for the automated tests of the template on CircleCI. - -Each `.json`file contains an object that represents a set of answers to the questions that vue-cli asks the user when installing the template. - -With the code from `index.js`, we insert those answers into the metalsmith metadata and skip the inquirer questions, thus allowing us to run different test scenarios in CI without having to actually provide any answers to inquirer or to mock it. - -## The scenarios - -We currently have 3 scenarios set up: - -1. 'minimal': it basically answers "no" to ever choice, so no router, no eslint, no tests -2. 'full': It answers "yes" to every choice. With router, with linting (standard), with full tests (jest & e2e) -3. 'full-airbnb-karma': like 'full', but using airbnb eslint config instead of standard and karma instead of jest for unit tests. - -Other permutations might be worth testing to secure against edge cases, but this gives us a decent level of security over common combinations. - -## How to use it? - -Choosing a scenario is done through setting an ENV variable named `VUE_TEMPL_TEST`. - -You can run a scenario yourself by running this in your terminal: - -```` -VUE_TEMPL_TEST=minimal vue init webpack your-directory -``` diff --git a/scenarios/full-karma-airbnb.json b/scenarios/full-karma-airbnb.json deleted file mode 100644 index 4e70e573b2..0000000000 --- a/scenarios/full-karma-airbnb.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "noEscape": true, - "name": "test", - "description": "A Vue.js project", - "author": "CircleCI", - "build": "standalone", - "router": false, - "lint": true, - "lintConfig": "airbnb", - "unit": true, - "runner": "karma", - "e2e": true, - "autoInstall": false -} diff --git a/scenarios/full.json b/scenarios/full.json deleted file mode 100644 index f12d01e828..0000000000 --- a/scenarios/full.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "noEscape": true, - "name": "test", - "description": "A Vue.js project", - "author": "CircleCI", - "build": "runtime", - "router": false, - "lint": true, - "lintConfig": "standard", - "unit": true, - "runner": "jest", - "e2e": true, - "autoInstall": false -} diff --git a/scenarios/index.js b/scenarios/index.js deleted file mode 100644 index 662f16d8a3..0000000000 --- a/scenarios/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const scenarios = [ - 'full', - 'full-karma-airbnb', - 'minimal' -] - -const index = scenarios.indexOf(process.env.VUE_TEMPL_TEST) - -const isTest = exports.isTest = index !== -1 - -const scenario = isTest && require(`./${scenarios[index]}.json`) - -exports.addTestAnswers = (metalsmith, options, helpers) => { - Object.assign( - metalsmith.metadata(), - { isNotTest: !isTest }, - isTest ? scenario : {} - ) -} \ No newline at end of file diff --git a/scenarios/minimal.json b/scenarios/minimal.json deleted file mode 100644 index abf2637541..0000000000 --- a/scenarios/minimal.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "noEscape": true, - "name": "test-minimal", - "description": "Testing the minimal template setup", - "author": "CircleCI", - "build": "standalone", - "router": false, - "lint": false, - "lintConfig": "standard", - "unit": false, - "runner": "jest", - "e2e": false, - "autoInstall": false -} diff --git a/template/package.json b/template/package.json index 207322b98c..a8fa9a634b 100644 --- a/template/package.json +++ b/template/package.json @@ -26,7 +26,9 @@ }, "dependencies": { "vue": "^2.5.2"{{#router}}, - "vue-router": "^3.0.1"{{/router}} + "vue-router": "^3.0.1"{{/router}}, + "vuex": "^2.1.1", + "axios": "^0.19.0", }, "devDependencies": { {{#lint}} @@ -116,7 +118,9 @@ "portfinder": "^1.0.13", "webpack": "^3.6.0", "webpack-dev-server": "^2.9.1", - "webpack-merge": "^4.1.0" + "webpack-merge": "^4.1.0", + "node-sass": "^4.9.0", + "sass-loader": "^7.1.0", }, "engines": { "node": ">= 6.0.0", diff --git a/template/src/containers/Container.vue b/template/src/containers/Container.vue new file mode 100644 index 0000000000..80ca0fc3cd --- /dev/null +++ b/template/src/containers/Container.vue @@ -0,0 +1,13 @@ + + + diff --git a/template/src/event-bus.js b/template/src/event-bus.js new file mode 100644 index 0000000000..4e5a22cf5c --- /dev/null +++ b/template/src/event-bus.js @@ -0,0 +1,2 @@ +import Vue from 'vue'; +export const Bus = new Vue(); diff --git a/template/src/helpers/helper.js b/template/src/helpers/helper.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/template/src/router/index.js b/template/src/router/index.js deleted file mode 100644 index 5fa7f9d319..0000000000 --- a/template/src/router/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import Vue from 'vue' -import Router from 'vue-router' -import HelloWorld from '@/components/HelloWorld' - -Vue.use(Router) - -export default new Router({ - routes: [ - { - path: '/', - name: 'HelloWorld', - component: HelloWorld - } - ] -}) diff --git a/template/src/store/index.js b/template/src/store/index.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/template/src/views/View.vue b/template/src/views/View.vue new file mode 100644 index 0000000000..80ca0fc3cd --- /dev/null +++ b/template/src/views/View.vue @@ -0,0 +1,13 @@ + + + diff --git a/utils/index.js b/utils/index.js deleted file mode 100644 index fa8d8046f0..0000000000 --- a/utils/index.js +++ /dev/null @@ -1,146 +0,0 @@ -const path = require('path') -const fs = require('fs') -const spawn = require('child_process').spawn - -const lintStyles = ['standard', 'airbnb'] - -/** - * Sorts dependencies in package.json alphabetically. - * They are unsorted because they were grouped for the handlebars helpers - * @param {object} data Data from questionnaire - */ -exports.sortDependencies = function sortDependencies(data) { - const packageJsonFile = path.join( - data.inPlace ? '' : data.destDirName, - 'package.json' - ) - const packageJson = JSON.parse(fs.readFileSync(packageJsonFile)) - packageJson.devDependencies = sortObject(packageJson.devDependencies) - packageJson.dependencies = sortObject(packageJson.dependencies) - fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2) + '\n') -} - -/** - * Runs `npm install` in the project directory - * @param {string} cwd Path of the created project directory - * @param {object} data Data from questionnaire - */ -exports.installDependencies = function installDependencies( - cwd, - executable = 'npm', - color -) { - console.log(`\n\n# ${color('Installing project dependencies ...')}`) - console.log('# ========================\n') - return runCommand(executable, ['install'], { - cwd, - }) -} - -/** - * Runs `npm run lint -- --fix` in the project directory - * @param {string} cwd Path of the created project directory - * @param {object} data Data from questionnaire - */ -exports.runLintFix = function runLintFix(cwd, data, color) { - if (data.lint && lintStyles.indexOf(data.lintConfig) !== -1) { - console.log( - `\n\n${color( - 'Running eslint --fix to comply with chosen preset rules...' - )}` - ) - console.log('# ========================\n') - const args = - data.autoInstall === 'npm' - ? ['run', 'lint', '--', '--fix'] - : ['run', 'lint', '--fix'] - return runCommand(data.autoInstall, args, { - cwd, - }) - } - return Promise.resolve() -} - -/** - * Prints the final message with instructions of necessary next steps. - * @param {Object} data Data from questionnaire. - */ -exports.printMessage = function printMessage(data, { green, yellow }) { - const message = ` -# ${green('Project initialization finished!')} -# ======================== - -To get started: - - ${yellow( - `${data.inPlace ? '' : `cd ${data.destDirName}\n `}${installMsg( - data - )}${lintMsg(data)}npm run dev` - )} - -Documentation can be found at https://vuejs-templates.github.io/webpack -` - console.log(message) -} - -/** - * If the user will have to run lint --fix themselves, it returns a string - * containing the instruction for this step. - * @param {Object} data Data from questionnaire. - */ -function lintMsg(data) { - return !data.autoInstall && - data.lint && - lintStyles.indexOf(data.lintConfig) !== -1 - ? 'npm run lint -- --fix (or for yarn: yarn run lint --fix)\n ' - : '' -} - -/** - * If the user will have to run `npm install` or `yarn` themselves, it returns a string - * containing the instruction for this step. - * @param {Object} data Data from the questionnaire - */ -function installMsg(data) { - return !data.autoInstall ? 'npm install (or if using yarn: yarn)\n ' : '' -} - -/** - * Spawns a child process and runs the specified command - * By default, runs in the CWD and inherits stdio - * Options are the same as node's child_process.spawn - * @param {string} cmd - * @param {array} args - * @param {object} options - */ -function runCommand(cmd, args, options) { - return new Promise((resolve, reject) => { - const spwan = spawn( - cmd, - args, - Object.assign( - { - cwd: process.cwd(), - stdio: 'inherit', - shell: true, - }, - options - ) - ) - - spwan.on('exit', () => { - resolve() - }) - }) -} - -function sortObject(object) { - // Based on https://github.com/yarnpkg/yarn/blob/v1.3.2/src/config.js#L79-L85 - const sortedObject = {} - Object.keys(object) - .sort() - .forEach(item => { - sortedObject[item] = object[item] - }) - return sortedObject -}