diff --git a/version.js b/bump-version.js similarity index 66% rename from version.js rename to bump-version.js index 004c2a2..7243887 100644 --- a/version.js +++ b/bump-version.js @@ -1,10 +1,8 @@ -// Example usage: npm --newVersion=3.0.2 run version - const fs = require('fs'); const path = require('path'); const config = { - files: ['package.json', 'public/index.html', 'version.js'], + files: ['public/index.html'], }; /** @@ -37,21 +35,20 @@ const argvToObject = () => { */ const updateVersion = ({ files }) => { const args = argvToObject(); - const currentVersion = args.current; - const newVersion = args.new || currentVersion; + const version = args.current; - console.log(`Updating version from ${currentVersion} to ${newVersion}`); + console.log(`Updating version to ${version}`); files.forEach(file => { const filePath = path.join(__dirname, file); - const regex = new RegExp(currentVersion, 'g'); + const regex = new RegExp(/\?version=(.*?)\"/, 'g'); let contents = fs.readFileSync(filePath, 'utf-8'); - contents = contents.replace(regex, newVersion); + contents = contents.replace(regex, `?version=${version}"`); fs.writeFileSync(filePath, contents); }); - console.log(`Updated version to ${newVersion}`); + console.log(`Updated version to ${version}`); }; updateVersion(config); diff --git a/config/test.js b/config/jsdom.js similarity index 100% rename from config/test.js rename to config/jsdom.js diff --git a/cypress.json b/cypress.json index 4fd2057..e8c9304 100644 --- a/cypress.json +++ b/cypress.json @@ -1,3 +1,4 @@ { - "baseUrl": "http://localhost:3001/test" + "baseUrl": "http://localhost:3001/test", + "video": false } \ No newline at end of file diff --git a/package.json b/package.json index d3fb9fb..574fd2f 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "coverage": "nyc npm run test:unit", "cypress:run": "$(npm bin)/cypress run", "cypress:open": "$(npm bin)/cypress open", - "test:unit": "mocha --require ./config/test.js --compilers js:babel-core/register \"./src/**/**/**/**/*.test.js\" --exit", + "test:unit": "mocha --require ./config/jsdom.js --compilers js:babel-core/register \"./src/**/**/**/**/*.test.js\" --exit", "test:unit:watch": "npm run test:unit -- --watch --inspect=5556", "test:e2e": "run-p --race start cypress:run", "test": "run-p test:unit test:e2e", @@ -24,7 +24,7 @@ "css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css", "css:prefix": "postcss --use autoprefixer -b 'last 2 versions' public/assets/styles/*.css -d public/assets/styles", "css:min": "csso public/assets/styles/base.css public/assets/styles/base.min.css && csso public/assets/styles/choices.css public/assets/styles/choices.min.css", - "version": "node version.js --current $npm_package_version", + "bump-version": "node bump-version.js --current $npm_package_version", "gh-pages": "git subtree push --prefix public origin gh-pages", "postversion": "npm run js:build", "prepush": "run-p lint test:unit"