diff --git a/lerna.json b/lerna.json index f35a63c6d..1fa9d3dd1 100644 --- a/lerna.json +++ b/lerna.json @@ -17,7 +17,7 @@ "npmClient": "npm", "allowBranch": [ "master", - "canary" + "next" ], "registry": "https://registry.npmjs.org/" } @@ -34,5 +34,5 @@ }, "cacheDir": ".changelog" }, - "version": "3.1.0-canary.6" + "version": "3.1.0-canary.9" } diff --git a/package.json b/package.json index 18638e353..8851e0031 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "devDependencies": { "eslint": "^6.8.0", + "got": "^11.0.2", "husky": "^4.2.3", "jest": "^25.1.0", "lerna": "^3.20.2", diff --git a/packages/babel-preset-razzle/package.json b/packages/babel-preset-razzle/package.json index 81f4c2235..dee3c6522 100644 --- a/packages/babel-preset-razzle/package.json +++ b/packages/babel-preset-razzle/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-razzle", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "description": "Babel presets for Razzle", "main": "index.js", "author": "jaredpalmer", diff --git a/packages/create-razzle-app/package.json b/packages/create-razzle-app/package.json index d114b588f..e53cfa0c6 100644 --- a/packages/create-razzle-app/package.json +++ b/packages/create-razzle-app/package.json @@ -1,6 +1,6 @@ { "name": "create-razzle-app", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "description": "CLI tool to bootstrap Razzle applications with no configuration", "main": "index.js", "license": "MIT", diff --git a/packages/razzle-dev-utils/package.json b/packages/razzle-dev-utils/package.json index 40c4d3b68..0a46a7d11 100644 --- a/packages/razzle-dev-utils/package.json +++ b/packages/razzle-dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "razzle-dev-utils", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "description": "Utilities and helpers for Razzle", "author": "Jared Palmer ", "repository": "git@github.com:jaredpalmer/razzle.git", diff --git a/packages/razzle-dev-utils/printErrors.js b/packages/razzle-dev-utils/printErrors.js index e63df66dd..7bbd3d607 100644 --- a/packages/razzle-dev-utils/printErrors.js +++ b/packages/razzle-dev-utils/printErrors.js @@ -8,11 +8,16 @@ const chalk = require('chalk'); * @param {string} summary Summary of error * @param {Array} errors Array of Errors */ -function printErrors(summary, errors) { +function printErrors(summary, errors, verbose) { console.log(chalk.red(summary)); console.log(); errors.forEach(err => { - console.log(err.message || err); + if (verbose) { + console.log(err); + } + else { + console.log(err.message || err); + } console.log(); }); } diff --git a/packages/razzle-plugin-css/package.json b/packages/razzle-plugin-css/package.json index fa57cb45c..3bb264a1d 100644 --- a/packages/razzle-plugin-css/package.json +++ b/packages/razzle-plugin-css/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-css", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT" } diff --git a/packages/razzle-plugin-elm/package.json b/packages/razzle-plugin-elm/package.json index c54034873..912917430 100644 --- a/packages/razzle-plugin-elm/package.json +++ b/packages/razzle-plugin-elm/package.json @@ -1,11 +1,11 @@ { "name": "razzle-plugin-elm", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT", "dependencies": { "elm-hot-loader": "^0.5.4", "elm-webpack-loader": "4.5.0", - "razzle-dev-utils": "^3.1.0-canary.1" + "razzle-dev-utils": "^3.1.0-canary.9" } } diff --git a/packages/razzle-plugin-eslint/package.json b/packages/razzle-plugin-eslint/package.json index 0ed4988a3..f94f4be78 100644 --- a/packages/razzle-plugin-eslint/package.json +++ b/packages/razzle-plugin-eslint/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-eslint", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT", "dependencies": { diff --git a/packages/razzle-plugin-inferno/package.json b/packages/razzle-plugin-inferno/package.json index a6bec7ebd..948e0e84a 100644 --- a/packages/razzle-plugin-inferno/package.json +++ b/packages/razzle-plugin-inferno/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-inferno", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT" } diff --git a/packages/razzle-plugin-less/package.json b/packages/razzle-plugin-less/package.json index af5210ecb..ca1a78d78 100644 --- a/packages/razzle-plugin-less/package.json +++ b/packages/razzle-plugin-less/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-less", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT" } diff --git a/packages/razzle-plugin-mdx/package.json b/packages/razzle-plugin-mdx/package.json index 1c64215c0..6fadf7328 100644 --- a/packages/razzle-plugin-mdx/package.json +++ b/packages/razzle-plugin-mdx/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-mdx", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "description": "Use mdx with Razzle", "main": "index.js", "repository": "git@github.com:jaredpalmer/razzle.git", @@ -14,6 +14,6 @@ "@mdx-js/mdx": "^0.15.0-0" }, "devDependencies": { - "razzle": "^3.1.0-canary.1" + "razzle": "^3.1.0-canary.9" } } diff --git a/packages/razzle-plugin-php/package.json b/packages/razzle-plugin-php/package.json index a67bd3042..b7e9f7da9 100644 --- a/packages/razzle-plugin-php/package.json +++ b/packages/razzle-plugin-php/package.json @@ -1,10 +1,10 @@ { "name": "razzle-plugin-php", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT", "dependencies": { "babel-preset-php": "^1.2.0", - "razzle-dev-utils": "^3.1.0-canary.1" + "razzle-dev-utils": "^3.1.0-canary.9" } } diff --git a/packages/razzle-plugin-preact/package.json b/packages/razzle-plugin-preact/package.json index 05e09c3d1..5ab8d19f0 100644 --- a/packages/razzle-plugin-preact/package.json +++ b/packages/razzle-plugin-preact/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-preact", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT" } diff --git a/packages/razzle-plugin-react/package.json b/packages/razzle-plugin-react/package.json index c4df8ad0b..e608ab250 100644 --- a/packages/razzle-plugin-react/package.json +++ b/packages/razzle-plugin-react/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-react", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT" } diff --git a/packages/razzle-plugin-scss/index.js b/packages/razzle-plugin-scss/index.js index 52e93fbef..128dfae14 100644 --- a/packages/razzle-plugin-scss/index.js +++ b/packages/razzle-plugin-scss/index.js @@ -126,8 +126,9 @@ module.exports = ( use: isServer ? [ { - loader: require.resolve('css-loader/locals'), + loader: require.resolve('css-loader'), options: Object.assign({}, options.css[constantEnv], { + onlyLocals: true, modules: true, localIdentName: '[name]__[local]___[hash:base64:5]', }), diff --git a/packages/razzle-plugin-scss/package.json b/packages/razzle-plugin-scss/package.json index de86097b1..c900081c2 100644 --- a/packages/razzle-plugin-scss/package.json +++ b/packages/razzle-plugin-scss/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-scss", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "description": "Use SCSS/SASS with Razzle", "main": "index.js", "repository": "git@github.com:jaredpalmer/razzle.git", @@ -20,6 +20,6 @@ }, "devDependencies": { "jest": "^23.1.0", - "razzle": "^3.1.0-canary.1" + "razzle": "^3.1.0-canary.9" } } diff --git a/packages/razzle-plugin-typescript/package.json b/packages/razzle-plugin-typescript/package.json index a13c50313..af138dfea 100644 --- a/packages/razzle-plugin-typescript/package.json +++ b/packages/razzle-plugin-typescript/package.json @@ -1,6 +1,6 @@ { "name": "razzle-plugin-typescript", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "description": "Use TypeScript with Razzle", "main": "index.js", "repository": "git@github.com:jaredpalmer/razzle.git", @@ -14,7 +14,7 @@ "ts-loader": "^5.2.1" }, "devDependencies": { - "razzle": "^3.1.0-canary.1" + "razzle": "^3.1.0-canary.9" }, "peerDependencies": { "typescript": ">=2.4.1" diff --git a/packages/razzle-plugin-vue/package.json b/packages/razzle-plugin-vue/package.json index 7a6bcd06a..e0308e311 100644 --- a/packages/razzle-plugin-vue/package.json +++ b/packages/razzle-plugin-vue/package.json @@ -1,11 +1,11 @@ { "name": "razzle-plugin-vue", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "main": "index.js", "license": "MIT", "dependencies": { "css-loader": "^0.28.11", - "razzle-dev-utils": "^3.1.0-canary.1", + "razzle-dev-utils": "^3.1.0-canary.9", "vue": "^2.5.16", "vue-loader": "^15.2.4", "vue-style-loader": "^4.1.0", diff --git a/packages/razzle/config/razzleDevServer.js b/packages/razzle/config/razzleDevServer.js new file mode 100644 index 000000000..33d5619b1 --- /dev/null +++ b/packages/razzle/config/razzleDevServer.js @@ -0,0 +1,23 @@ +#! /usr/bin/env node +'use strict'; + +const devServer = require('webpack-dev-server'); + +class razzleDevServer extends devServer { + + constructor(compiler, options = {}, _log) { + const verbose = options.verbose || false; + delete options['verbose']; + super(compiler, options, _log); + this.verbose = verbose; + } + + showStatus() { + if (this.verbose) { + super.showStatus(); + } + } + +} + +module.exports = razzleDevServer; diff --git a/packages/razzle/package.json b/packages/razzle/package.json index 5546c3766..b6c463dff 100644 --- a/packages/razzle/package.json +++ b/packages/razzle/package.json @@ -1,6 +1,6 @@ { "name": "razzle", - "version": "3.1.0-canary.1", + "version": "3.1.0-canary.9", "description": "Create server-rendered universal JavaScript applications with no configuration", "repository": "git@github.com:jaredpalmer/razzle.git", "author": "Jared Palmer ", @@ -33,7 +33,7 @@ "babel-core": "^7.0.0-bridge.0", "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", - "babel-preset-razzle": "^3.1.0-canary.1", + "babel-preset-razzle": "^3.1.0-canary.9", "chalk": "^3.0.0", "css-loader": "^3.4.2", "dotenv": "8.2.0", @@ -49,7 +49,7 @@ "postcss-loader": "^3.0.0", "postcss-preset-env": "^6.7.0", "postcss-safe-parser": "^4.0.2", - "razzle-dev-utils": "^3.1.0-canary.1", + "razzle-dev-utils": "^3.1.0-canary.9", "react-dev-utils": "^10.2.0", "react-error-overlay": "^6.0.6", "sade": "^1.4.2", diff --git a/packages/razzle/scripts/start.js b/packages/razzle/scripts/start.js index d4ecd6d9f..0283dc639 100755 --- a/packages/razzle/scripts/start.js +++ b/packages/razzle/scripts/start.js @@ -7,7 +7,7 @@ const mri = require('mri'); const webpack = require('webpack'); const paths = require('../config/paths'); const createConfig = require('../config/createConfig'); -const devServer = require('webpack-dev-server'); +const devServer = require('../config/razzleDevServer'); const printErrors = require('razzle-dev-utils/printErrors'); const clearConsole = require('react-dev-utils/clearConsole'); const logger = require('razzle-dev-utils/logger'); @@ -29,6 +29,8 @@ process.env.INSPECT = cliArgs.inspect || ''; // Capture the type (isomorphic or single-page) as an environment variable process.env.BUILD_TYPE = cliArgs.type; +const verbose = cliArgs.verbose || false; + const clientOnly = cliArgs.type === 'spa'; function main() { @@ -116,7 +118,9 @@ function main() { // Create a new instance of Webpack-dev-server for our client assets. // This will actually run on a different port than the users app. - const clientDevServer = new devServer(clientCompiler, clientConfig.devServer); + const clientDevServer = new devServer(clientCompiler, + Object.assign(clientConfig.devServer, { verbose: verbose })); + // Start Webpack-dev-server clientDevServer.listen(port, err => { if (err) { @@ -131,7 +135,7 @@ function compile(config) { try { compiler = webpack(config); } catch (e) { - printErrors('Failed to compile.', [e]); + printErrors('Failed to compile.', [e], verbose); process.exit(1); } return compiler; diff --git a/scripts/release-notes.js b/scripts/release-notes.js new file mode 100644 index 000000000..bd72d7900 --- /dev/null +++ b/scripts/release-notes.js @@ -0,0 +1,119 @@ +const got = require('got'); + +async function main() { + const res = await got( + 'https://api.github.com/repos/jaredpalmer/razzle/releases', + { + responseType: 'json', + } + ); + + const allReleases = res.body + .map(({ id, tag_name, created_at, body }) => ({ + id, + tag_name, + created_at, + body: body + .replace(/\r\n/g, '\n') + .split('\n') + .map(e => e.trim()), + })) + .sort((a, b) => a.created_at.localeCompare(b.created_at)); + + const targetVersion = /v(.*?-)/ + .exec(allReleases.filter(e => /v.*?-/.exec(e.tag_name)).pop().tag_name) + .pop(); + + const releases = allReleases.filter(v => v.tag_name.includes(targetVersion)); + + const lineItems = { + '### Minor Changes': [], + '### Patches': [], + '### Credits': [], + }; + + Object.keys(lineItems).forEach(header => { + releases.forEach(release => { + const headerIndex = release.body.indexOf(header); + if (!~headerIndex) return; + + let headerLastIndex = release.body + .slice(headerIndex + 1) + .findIndex(v => v.startsWith('###')); + + if (~headerLastIndex) { + headerLastIndex = headerLastIndex + headerIndex; + } else { + headerLastIndex = release.body.length - 1; + } + + if (header === '### Credits') { + release.body.slice(headerIndex, headerLastIndex + 1).forEach(e => { + const re = /@[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}/gi; + let m; + do { + m = re.exec(e); + if (m) { + lineItems[header].push(m.pop()); + } + } while (m); + }); + } else { + release.body.slice(headerIndex, headerLastIndex + 1).forEach(e => { + if (!e.startsWith('-')) { + return; + } + + lineItems[header].push(e); + }); + } + }); + }); + + let finalMessage = []; + Object.keys(lineItems).forEach(header => { + let items = lineItems[header]; + if (!items.length) { + return; + } + + finalMessage.push(header); + finalMessage.push(''); + + if (header === '### Credits') { + items = [...new Set(items)]; + let creditsMessage = `Huge thanks to `; + if (items.length > 1) { + creditsMessage += items.slice(0, items.length - 1).join(`, `); + creditsMessage += `, and `; + } + + creditsMessage += items[items.length - 1]; + creditsMessage += ` for helping!`; + + finalMessage.push(creditsMessage); + } else { + items.forEach(e => finalMessage.push(e)); + } + + finalMessage.push(''); + }); + + const firstVersion = releases[0].tag_name; + const lastVersion = releases[releases.length - 1].tag_name; + + // Add compare link + finalMessage.push( + `https://github.com/jaredpalmer/razzle/compare/${firstVersion}...${lastVersion}` + ); + + return { + version: targetVersion.slice(0, -1), + firstVersion, + lastVersion, + content: finalMessage.join('\n'), + }; +} +Promise.resolve() + .then(main) + .then(notes => console.log(String(notes.content))); diff --git a/test/fixtures/util.js b/test/fixtures/util.js index 740717542..84d04844c 100644 --- a/test/fixtures/util.js +++ b/test/fixtures/util.js @@ -39,6 +39,18 @@ module.exports = { shell.cd(stagePath); }, + setupStageWithExample: (stageName, exampleName) => { + const stagePath = path.join(rootDir, stageName); + shell.mkdir(stagePath); + shell.exec(`cp -a ${rootDir}/examples/${exampleName}/. ${stagePath}/`); + shell.ln( + '-s', + path.join(rootDir, 'packages/razzle/node_modules'), + path.join(stagePath, 'node_modules') + ); + shell.cd(stagePath); + }, + teardownStage: stageName => { shell.cd(rootDir); fs.removeSync(path.join(rootDir, stageName)); diff --git a/test/tests/razzle-start-spa.test.js b/test/tests/razzle-start-spa.test.js index af24885da..5d0a36b08 100644 --- a/test/tests/razzle-start-spa.test.js +++ b/test/tests/razzle-start-spa.test.js @@ -1,78 +1,73 @@ /** * @jest-environment node */ -'use strict'; +"use strict"; -const shell = require('shelljs'); -const util = require('../fixtures/util'); -const kill = require('../utils/psKill'); -const path = require('path'); -const fs = require('fs'); +const shell = require("shelljs"); +const util = require("../fixtures/util"); +const kill = require("../utils/psKill"); +const path = require("path"); +const fs = require("fs"); shell.config.silent = true; +const stageName = "stage-start-spa"; -const stageName = 'stage-start-spa'; - -describe('razzle start', () => { - describe('razzle basic example', () => { - +describe("razzle start", () => { + describe("razzle basic example", () => { beforeAll(() => { util.teardownStage(stageName); }); jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; // eslint-disable-line no-undef - it('should start a dev server for spa mode', () => { - util.setupStageWithExample(stageName, 'basic-spa'); + it("should start a dev server for spa mode", () => { + util.setupStageWithExample(stageName, "basic-spa"); let outputTest; - const run = new Promise(resolve => { - const child = shell.exec( - `${path.join('./node_modules/.bin/razzle')} start --type=spa`, - () => { - resolve(outputTest); - } - ); - child.stdout.on('data', data => { + const run = new Promise((resolve) => { + const child = shell.exec("razzle start --type=spa --verbose", () => { + resolve(outputTest); + }); + child.stdout.on("data", (data) => { console.log(data); - if (data.includes('> SPA Started on port 3000')) { - shell.exec('sleep 5'); + if (data.includes("> SPA Started on port 3000")) { + shell.exec("sleep 5"); const devServerOutput = shell.exec( 'curl -sb -o "" localhost:3000/static/js/bundle.js' ); - outputTest = devServerOutput.stdout.includes('React'); + outputTest = devServerOutput.stdout.includes("React"); kill(child.pid); } }); }); - return run.then(test => expect(test).toBeTruthy()); + return run.then((test) => expect(test).toBeTruthy()); }); jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; // eslint-disable-line no-undef - it('should build and run in spa mode', () => { - util.setupStageWithExample(stageName, 'basic-spa'); + it("should build and run in spa mode", () => { + util.setupStageWithExample(stageName, "basic-spa"); let outputTest; - shell.exec(`${path.join('./node_modules/.bin/razzle')} build --type=spa`); - const run = new Promise(resolve => { - const child = shell.exec( - `${path.join('./node_modules/.bin/serve')} -s ${path.join('build/public')}`, - () => { - resolve(outputTest); - } - ); - child.stdout.on('data', data => { + shell.exec("razzle build --type=spa"); + const run = new Promise((resolve) => { + const child = shell.exec("serve -s build/public", () => { + resolve(outputTest); + }); + child.stdout.on("data", (data) => { console.log(data); - if (data.includes('http://localhost:5000')) { - shell.exec('sleep 5'); + if (data.includes("http://localhost:5000")) { + shell.exec("sleep 5"); // we use serve package and it will run in prot 5000 - const output = shell.exec('curl -I localhost:5000'); - outputTest = output.stdout.includes('200'); + const output = shell.exec("curl -I localhost:5000"); + outputTest = output.stdout.includes("200"); kill(child.pid); } }); }); - return run.then(test => expect(test).toBeTruthy()); + return run.then((test) => expect(test).toBeTruthy()); }); + afterEach(() => { + util.teardownStage(stageName); + }); }); }); diff --git a/test/tests/razzle-start.test.js b/test/tests/razzle-start.test.js index b91141b55..08c8acc64 100644 --- a/test/tests/razzle-start.test.js +++ b/test/tests/razzle-start.test.js @@ -1,91 +1,91 @@ /** * @jest-environment node */ -'use strict'; +"use strict"; -const shell = require('shelljs'); -const util = require('../fixtures/util'); -const kill = require('../utils/psKill'); -const path = require('path'); +const shell = require("shelljs"); +const util = require("../fixtures/util"); +const kill = require("../utils/psKill"); +const path = require("path"); shell.config.silent = true; -const stageName = 'stage-start'; +const stageName = "stage-start"; -describe('razzle start', () => { - describe('razzle basic example', () => { +describe("razzle start", () => { + describe("razzle basic example", () => { beforeAll(() => { util.teardownStage(stageName); }); jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; // eslint-disable-line no-undef - it('should start a dev server', () => { - util.setupStageWithExample(stageName, 'basic'); + it("should start a dev server", () => { + util.setupStageWithExample(stageName, "basic"); let outputTest; - const run = new Promise(resolve => { - const child = shell.exec(`${path.join('./node_modules/.bin/razzle')} start`, () => { + const run = new Promise((resolve) => { + const child = shell.exec("razzle start --verbose", () => { resolve(outputTest); }); - child.stdout.on('data', data => { - if (data.includes('Server-side HMR Enabled!')) { - shell.exec('sleep 5'); + child.stdout.on("data", (data) => { + if (data.includes("Server-side HMR Enabled!")) { + shell.exec("sleep 5"); const devServerOutput = shell.exec( 'curl -sb -o "" localhost:3001/static/js/bundle.js' ); - outputTest = devServerOutput.stdout.includes('React'); + outputTest = devServerOutput.stdout.includes("React"); kill(child.pid); } }); }); - return run.then(test => expect(test).toBeTruthy()); + return run.then((test) => expect(test).toBeTruthy()); }); jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; // eslint-disable-line no-undef - it('should start a dev server on different port', () => { - util.setupStageWithExample(stageName, 'with-custom-devserver-options'); + it("should start a dev server on different port", () => { + util.setupStageWithExample(stageName, "with-custom-devserver-options"); let outputTest; - const run = new Promise(resolve => { - const child = shell.exec(`${path.join('./node_modules/.bin/razzle')} start`, () => { + const run = new Promise((resolve) => { + const child = shell.exec("razzle start --verbose", () => { resolve(outputTest); }); - child.stdout.on('data', data => { - if (data.includes('Server-side HMR Enabled!')) { - shell.exec('sleep 5'); + child.stdout.on("data", (data) => { + if (data.includes("Server-side HMR Enabled!")) { + shell.exec("sleep 5"); const devServerOutput = shell.exec( 'curl -sb -o "" localhost:3002/static/js/bundle.js' ); outputTest = devServerOutput.stdout.includes( - 'index.js?http://localhost:3002' + "index.js?http://localhost:3002" ); kill(child.pid); } }); }); - return run.then(test => expect(test).toBeTruthy()); + return run.then((test) => expect(test).toBeTruthy()); }); jasmine.DEFAULT_TIMEOUT_INTERVAL = 400000; // eslint-disable-line no-undef - it('should build and run', () => { - util.setupStageWithExample(stageName, 'basic'); + it("should build and run", () => { + util.setupStageWithExample(stageName, "basic"); let outputTest; - shell.exec(`${path.join('./node_modules/.bin/razzle')} build`); - const run = new Promise(resolve => { - const child = shell.exec(`node ${path.join('build/server.js')}`, () => { + shell.exec("razzle build"); + const run = new Promise((resolve) => { + const child = shell.exec(`node ${path.join("build/server.js")}`, () => { resolve(outputTest); }); - child.stdout.on('data', data => { - if (data.includes('> Started on port 3000')) { - shell.exec('sleep 5'); - const output = shell.exec('curl -I localhost:3000'); - outputTest = output.stdout.includes('200'); + child.stdout.on("data", (data) => { + if (data.includes("> Started on port 3000")) { + shell.exec("sleep 5"); + const output = shell.exec("curl -I localhost:3000"); + outputTest = output.stdout.includes("200"); kill(child.pid); } }); }); - return run.then(test => expect(test).toBeTruthy()); + return run.then((test) => expect(test).toBeTruthy()); }); afterEach(() => { diff --git a/yarn.lock b/yarn.lock index 8aa716348..4a6bbcf40 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2418,6 +2418,11 @@ dependencies: any-observable "^0.3.0" +"@sindresorhus/is@^2.1.0": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-2.1.1.tgz#ceff6a28a5b4867c2dd4a1ba513de278ccbe8bb1" + integrity sha512-/aPsuoj/1Dw/kzhkgz+ES6TxG0zfTMGLwuK2ZG00k/iJzYHTLCE8mVU8EPqEOp/lmxPoq1C1C9RYToRKb2KEfg== + "@sinonjs/commons@^1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.1.tgz#da5fd19a5f71177a53778073978873964f49acf1" @@ -2425,6 +2430,13 @@ dependencies: type-detect "4.0.8" +"@szmarczak/http-timer@^4.0.0": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.5.tgz#bfbd50211e9dfa51ba07da58a14cdfd333205152" + integrity sha512-PyRA9sm1Yayuj5OIoJ1hGt2YISX45w9WcFbh6ddT0Z/0yaFxOtGLInr4jUfU1EAFVs0Yfyfev4RNwBlUaHdlDQ== + dependencies: + defer-to-connect "^2.0.0" + "@types/anymatch@*": version "1.3.1" resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" @@ -2463,6 +2475,16 @@ dependencies: "@babel/types" "^7.3.0" +"@types/cacheable-request@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.1.tgz#5d22f3dded1fd3a84c0bbeb5039a7419c2c91976" + integrity sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ== + dependencies: + "@types/http-cache-semantics" "*" + "@types/keyv" "*" + "@types/node" "*" + "@types/responselike" "*" + "@types/color-name@^1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" @@ -2487,6 +2509,11 @@ resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-5.0.0.tgz#7532440c138605ced1b555935c3115ddd20e8bef" integrity sha512-q95SP4FdkmF0CwO0F2q0H6ZgudsApaY/yCtAQNRn1gduef5fGpyEphzy0YCq/N0UFvDSnLg5V8jFK/YGXlDiCw== +"@types/http-cache-semantics@*": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz#9140779736aa2655635ee756e2467d787cfe8a2a" + integrity sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -2507,6 +2534,13 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" +"@types/keyv@*": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.1.tgz#e45a45324fca9dab716ab1230ee249c9fb52cfa7" + integrity sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw== + dependencies: + "@types/node" "*" + "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" @@ -2532,6 +2566,13 @@ resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.1.tgz#48fd98c1561fe718b61733daed46ff115b496e18" integrity sha512-eqz8c/0kwNi/OEHQfvIuJVLTst3in0e7uTKeuY+WL/zfKn0xVujOTp42bS/vUUokhK5P2BppLd9JXMOMHcgbjA== +"@types/responselike@*", "@types/responselike@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29" + integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA== + dependencies: + "@types/node" "*" + "@types/source-list-map@*": version "0.1.2" resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" @@ -4207,6 +4248,24 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" +cacheable-lookup@^4.1.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-4.1.2.tgz#07c90b15910d4a5be6f3fa1a0ce73dfb9c192dc9" + integrity sha512-qwnOjdDFv4VNVjd5g+aKg7JuRS+q6bD8t9nk7l0tGTCPfLRX2jOmCTHFYc+leooxrtSKyOFzZz5MJQPUeYYkXA== + +cacheable-request@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.1.tgz#062031c2856232782ed694a257fa35da93942a58" + integrity sha512-lt0mJ6YAnsrBErpTMWeu5kl/tg9xMAWjavYTN6VQXM1A/teBITuNcccXsCxF0tDQQJf9DfAaX5O4e0zp0KlfZw== + dependencies: + clone-response "^1.0.2" + get-stream "^5.1.0" + http-cache-semantics "^4.0.0" + keyv "^4.0.0" + lowercase-keys "^2.0.0" + normalize-url "^4.1.0" + responselike "^2.0.0" + call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" @@ -4713,6 +4772,13 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" +clone-response@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b" + integrity sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws= + dependencies: + mimic-response "^1.0.0" + clone@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" @@ -5819,6 +5885,13 @@ decompress-response@^3.2.0: dependencies: mimic-response "^1.0.0" +decompress-response@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-5.0.0.tgz#7849396e80e3d1eba8cb2f75ef4930f76461cb0f" + integrity sha512-TLZWWybuxWgoW7Lykv+gq9xvzOsUjQ9tF09Tj6NSTYGMTCHNXzrPnD6Hi+TgZq19PyTAGH4Ll/NIM/eTGglnMw== + dependencies: + mimic-response "^2.0.0" + dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" @@ -5861,6 +5934,11 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" +defer-to-connect@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.0.tgz#83d6b199db041593ac84d781b5222308ccf4c2c1" + integrity sha512-bYL2d05vOSf1JEZNx5vSAtPuBMkX8K9EUutg7zlKvTqKXHt7RhWJFbmd7qakVuf13i+IkGmp6FwSsONOf6VYIg== + define-properties@^1.1.2, define-properties@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" @@ -7625,7 +7703,7 @@ get-stream@^4.0.0, get-stream@^4.1.0: dependencies: pump "^3.0.0" -get-stream@^5.0.0: +get-stream@^5.0.0, get-stream@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== @@ -7907,6 +7985,24 @@ globule@^1.0.0: lodash "~4.17.10" minimatch "~3.0.2" +got@^11.0.2: + version "11.0.2" + resolved "https://registry.yarnpkg.com/got/-/got-11.0.2.tgz#55613d6a1b7040ff9c26cb075defea39eed58d7a" + integrity sha512-zOanxiJs1LaBAiKsV43UUw/oRlyRNtJFeuATahfi4c3MTremj09eAeJBSJ7GR2oEMhrLLRSJpz8fQaojVDijjw== + dependencies: + "@sindresorhus/is" "^2.1.0" + "@szmarczak/http-timer" "^4.0.0" + "@types/cacheable-request" "^6.0.1" + "@types/responselike" "^1.0.0" + cacheable-lookup "^4.1.1" + cacheable-request "^7.0.1" + decompress-response "^5.0.0" + get-stream "^5.0.0" + http2-wrapper "^1.0.0-beta.4.4" + lowercase-keys "^2.0.0" + p-cancelable "^2.0.0" + responselike "^2.0.0" + got@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a" @@ -8286,7 +8382,7 @@ http-cache-semantics@^3.8.1: resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== -http-cache-semantics@^4.0.3: +http-cache-semantics@^4.0.0, http-cache-semantics@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== @@ -8386,6 +8482,14 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +http2-wrapper@^1.0.0-beta.4.4: + version "1.0.0-beta.4.4" + resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.0-beta.4.4.tgz#6e1c71b5ddff3037ce16053b20d1044b1e8c0df5" + integrity sha512-CHpjljc2VeZQ1Lk02dwAfOq0k7uY+MSmt9or0zQiyPr++BIngUKIDRoy/MfX0jVZbpG/GjGVZK3K9ac5pBS//A== + dependencies: + quick-lru "^5.0.0" + resolve-alpn "^1.0.0" + https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" @@ -10650,6 +10754,11 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -10741,6 +10850,13 @@ jsx-ast-utils@^2.2.1, jsx-ast-utils@^2.2.3: array-includes "^3.0.3" object.assign "^4.1.0" +keyv@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.0.0.tgz#2d1dab694926b2d427e4c74804a10850be44c12f" + integrity sha512-U7ioE8AimvRVLfw4LffyOIRhL2xVgmE8T22L6i0BucSnBUyv4w+I7VN/zVZwRKHOI6ZRUcdMdWHQ8KSUvGpEog== + dependencies: + json-buffer "3.0.1" + killable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892" @@ -11331,6 +11447,11 @@ lowercase-keys@^1.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== +lowercase-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" + integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== + lru-cache@^4.0.1, lru-cache@^4.1.2: version "4.1.5" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" @@ -11760,6 +11881,11 @@ mimic-response@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== +mimic-response@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43" + integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== + mini-css-extract-plugin@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz#47f2cf07aa165ab35733b1fc97d4c46c0564339e" @@ -12441,6 +12567,11 @@ normalize-url@^3.0.0, normalize-url@^3.3.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== +normalize-url@^4.1.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129" + integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== + npm-bundled@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" @@ -12895,6 +13026,11 @@ p-cancelable@^0.3.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" integrity sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw== +p-cancelable@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.0.0.tgz#4a3740f5bdaf5ed5d7c3e34882c6fb5d6b266a6e" + integrity sha512-wvPXDmbMmu2ksjkB4Z3nZWTSkJEb9lqVdMaCKpZUGJG9TMiNp9XcbG3fn9fPKjem04fJMJnXoyFPk2FmgiaiNg== + p-defer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" @@ -14728,6 +14864,11 @@ quick-lru@^1.0.0: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= +quick-lru@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.0.tgz#1602f339bde554c4dace47880227ec9c2869f2e8" + integrity sha512-WjAKQ9ORzvqjLijJXiXWqc3Gcs1ivoxCj6KJmEjoWBE6OtHwuaDLSAUqGHALUiid7A1KqGqsSHZs8prxF5xxAQ== + random-string@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/random-string/-/random-string-0.2.0.tgz#a46e4375352beda9a0d7b0d19ed6d321ecd1d82d" @@ -15441,6 +15582,11 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= +resolve-alpn@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.0.0.tgz#745ad60b3d6aff4b4a48e01b8c0bdc70959e0e8c" + integrity sha512-rTuiIEqFmGxne4IovivKSDzld2lWW9QCjqv80SYjPgf+gS35eaCAjaP54CCwGAwBtnCsvNLYtqxe1Nw+i6JEmA== + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" @@ -15517,6 +15663,13 @@ resolve@^1.10.0, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.15.1: dependencies: path-parse "^1.0.6" +responselike@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.0.tgz#26391bcc3174f750f9a79eacc40a12a5c42d7723" + integrity sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw== + dependencies: + lowercase-keys "^2.0.0" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"