diff --git a/build/config/rollup-options-test.js b/build/config/rollup-options-test.js deleted file mode 100644 index b19b113e1..000000000 --- a/build/config/rollup-options-test.js +++ /dev/null @@ -1,9 +0,0 @@ -const resolve = require('path').resolve - -module.exports = [ - { - dest: resolve('dist/vue-test-utils.js'), - format: 'cjs', - sourceMap: 'inline' - } -] diff --git a/build/git-hooks/commit-msg b/build/git-hooks/commit-msg deleted file mode 100755 index 6453512c9..000000000 --- a/build/git-hooks/commit-msg +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -# Validate commit log -commit_regex='^Merge.+|(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .{1,50}' - -if ! grep -iqE "$commit_regex" "$1"; then - echo - echo " Error: proper commit message format is required for automated changelog generation." - echo - echo " - Use \`npm run commit\` to interactively generate a commit message." - echo " - See .github/COMMIT_CONVENTION.md for more details." - echo - exit 1 -fi \ No newline at end of file diff --git a/build/git-hooks/pre-commit b/build/git-hooks/pre-commit deleted file mode 100755 index df3f1a71b..000000000 --- a/build/git-hooks/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -npm run lint -npm run lint:docs \ No newline at end of file diff --git a/build/install-hooks.js b/build/install-hooks.js deleted file mode 100644 index e5f8ad84f..000000000 --- a/build/install-hooks.js +++ /dev/null @@ -1,8 +0,0 @@ -const { test, ln, chmod } = require('shelljs') - -if (test('-e', '.git/hooks')) { - ln('-sf', '../../build/git-hooks/pre-commit', '.git/hooks/pre-commit') - chmod('+x', '.git/hooks/pre-commit') - ln('-sf', '../../build/git-hooks/commit-msg', '.git/hooks/commit-msg') - chmod('+x', '.git/hooks/commit-msg') -} diff --git a/package.json b/package.json index e6b3994c6..a6f4c0c4a 100644 --- a/package.json +++ b/package.json @@ -9,24 +9,23 @@ "types/index.d.ts" ], "scripts": { - "build": "node build/build.js", - "build:test": "cross-env NODE_ENV=test node build/build.js", + "build": "node scripts/build.js", + "build:test": "cross-env NODE_ENV=test node scripts/build.js", "coverage": "cross-env NODE_ENV=coverage nyc --reporter=lcov --reporter=text npm run test:unit", "docs": "cd docs && gitbook install && gitbook serve", - "docs:deploy": "build/update-docs.sh", + "docs:deploy": "scripts/update-docs.sh", "docs:serve": "cd docs && gitbook serve", "flow": "flow check", "lint": "eslint --ext js,vue src test flow build --ignore-path .gitignore", "lint:docs": "eslint --ext js,vue,md docs --ignore-path .gitignore", "lint:fix": "npm run lint -- --fix", - "setup": "node build/install-hooks.js", "test": "npm run lint && npm run lint:docs && npm run flow && npm run test:types && npm run test:unit && npm run test:unit:karma", - "test:compat": "test/test.sh", - "test:unit": "npm run build:test && cross-env BABEL_ENV=test && mocha-webpack --webpack-config build/webpack.test.config.js test/specs --recursive --require test/setup/mocha.setup.js", + "test:compat": "scripts/test-compat.sh", + "test:unit": "npm run build:test && cross-env BABEL_ENV=test && mocha-webpack --webpack-config test/setup/webpack.test.config.js test/specs --recursive --require test/setup/mocha.setup.js", "test:unit:karma": "npm run build:test && cross-env BABEL_ENV=test TARGET=browser karma start test/setup/karma.conf.js --single-run", "test:types": "tsc -p types", - "release": "bash build/release.sh", - "release:note": "node build/gen-release-note.js" + "release": "bash scripts/release.sh", + "release:note": "node scripts/gen-release-note.js" }, "repository": { "type": "git", diff --git a/build/build.js b/scripts/build.js similarity index 59% rename from build/build.js rename to scripts/build.js index 3119cb130..ccdafef11 100644 --- a/build/build.js +++ b/scripts/build.js @@ -5,8 +5,6 @@ const buble = require('rollup-plugin-buble') const nodeResolve = require('rollup-plugin-node-resolve') const commonjs = require('rollup-plugin-commonjs') const chalk = require('chalk') -const rollupOptionsBuild = require('./config/rollup-options-build') -const rollupOptionsTest = require('./config/rollup-options-test') function success (text) { console.log(chalk.green(`${text} ✔`)) @@ -16,6 +14,40 @@ function error (text) { console.log(chalk.red(`${text} ✘`)) } +const rollupOptionsBuild = [ + { + dest: resolve('dist/vue-test-utils.js'), + format: 'cjs' + }, + { + name: 'globals', + dest: resolve('dist/vue-test-utils.iife.js'), + moduleName: 'vueTestUtils', + format: 'iife', + globals: { + 'vue': 'Vue', + 'vue-template-compiler': 'VueTemplateCompiler' + } + }, + { + dest: resolve('dist/vue-test-utils.umd.js'), + format: 'umd', + globals: { + 'vue': 'Vue', + 'vue-template-compiler': 'VueTemplateCompiler' + }, + moduleName: 'vueTestUtils' + } +] + +const rollupOptionsTest = [ + { + dest: resolve('dist/vue-test-utils.js'), + format: 'cjs', + sourceMap: 'inline' + } +] + const rollupOptions = process.env.NODE_ENV === 'test' ? rollupOptionsTest : rollupOptionsBuild rollupOptions.forEach(options => { diff --git a/build/gen-release-note.js b/scripts/gen-release-note.js similarity index 100% rename from build/gen-release-note.js rename to scripts/gen-release-note.js diff --git a/build/release.sh b/scripts/release.sh similarity index 100% rename from build/release.sh rename to scripts/release.sh diff --git a/build/config/rollup-options-build.js b/scripts/rollup-options-build.js similarity index 100% rename from build/config/rollup-options-build.js rename to scripts/rollup-options-build.js diff --git a/test/test.sh b/scripts/test-compat.sh similarity index 100% rename from test/test.sh rename to scripts/test-compat.sh diff --git a/build/update-docs.sh b/scripts/update-docs.sh similarity index 100% rename from build/update-docs.sh rename to scripts/update-docs.sh diff --git a/test/setup/karma.conf.js b/test/setup/karma.conf.js index 52b8754f5..7777394a2 100644 --- a/test/setup/karma.conf.js +++ b/test/setup/karma.conf.js @@ -1,4 +1,4 @@ -const webpackConfig = require('../../build/webpack.test.config.js') +const webpackConfig = require('./webpack.test.config.js') module.exports = function (config) { config.set({ diff --git a/build/webpack.test.config.js b/test/setup/webpack.test.config.js similarity index 94% rename from build/webpack.test.config.js rename to test/setup/webpack.test.config.js index 72e3a872a..74f710f71 100644 --- a/build/webpack.test.config.js +++ b/test/setup/webpack.test.config.js @@ -2,7 +2,7 @@ const nodeExternals = require('webpack-node-externals') const browser = process.env.TARGET === 'browser' const path = require('path') -const projectRoot = path.resolve(__dirname, '../') +const projectRoot = path.resolve(__dirname, '../../') const isCoverage = process.env.NODE_ENV === 'coverage' const rules = [].concat( isCoverage ? {