Skip to content

Commit

Permalink
chore: update dependencies and dev branch (magento#1006)
Browse files Browse the repository at this point in the history
* chore: update dependencies and dev branch

* chore: refactor dangerfile to lazy require dependencies
  • Loading branch information
zetlen authored Mar 12, 2019
1 parent a2b7a94 commit 94cdc53
Show file tree
Hide file tree
Showing 19 changed files with 2,898 additions and 3,149 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
save-prefix="~"
save-prefix="^"
2 changes: 1 addition & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
save-prefix "~"
save-prefix "^"
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const config = api => {
*/
development: {
// Ignore everything with underscores except stories
ignore: [/\/__(tests?|mocks|fixtures|helpers)__\//],
ignore: [/\/__(tests?|mocks|fixtures|helpers|dist)__\//],
plugins: [
...plugins,
[
Expand Down
36 changes: 21 additions & 15 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
const fs = require('fs');
const path = require('path');
const execa = require('execa');
const mkdirp = require('mkdirp');
const xml = require('xml');
const { fail, warn, markdown, danger } = require('danger');
const prettierVersion = require('prettier/package.json').version;
const eslintJUnitReporter = require('eslint/lib/formatters/junit');

const fromRoot = p => path.relative('', p);
const fromRoot = p => require('path').relative('', p);

const packageNames = {
'venia-concept': 'Venia',
'pwa-buildpack': 'Buildpack',
peregrine: 'Peregrine'
};
const pathToPackageName = filepath => {
const path = require('path');
const packageDir = path
.normalize(path.relative('packages', filepath))
.split(path.sep)[0];
Expand All @@ -23,6 +17,8 @@ const pathToPackageName = filepath => {

const reportDir = './test-results/';
const reportFile = name => {
const path = require('path');
const mkdirp = require('mkdirp');
const subdir = path.join(reportDir, name);
mkdirp.sync(subdir);
return path.join(subdir, 'results.xml');
Expand Down Expand Up @@ -51,6 +47,8 @@ function timer() {
}

function jUnitSuite(title) {
const fs = require('fs');
const xml = require('xml');
const stopwatch = timer();
let failureCount = 0;
let errorCount = 0;
Expand Down Expand Up @@ -128,16 +126,20 @@ const tasks = [
const junit = jUnitSuite('Prettier');
let stdout, stderr;
try {
const result = execa.sync('npm', [
const execa = require('execa');
const result = execa.sync('yarn', [
'run',
'--silent',
'prettier:check',
'--',
'--loglevel=debug'
]);
stdout = result.stdout;
stderr = result.stderr;
} catch (err) {
if (typeof stdout !== 'string') {
// execa didn't require
throw err;
}
stdout = err.stdout;
stderr = err.stderr;
}
Expand Down Expand Up @@ -172,6 +174,7 @@ const tasks = [
);
if (!coveredFiles || coveredFiles.length === 0) {
let warning = 'Prettier did not appear to cover any files.';
const prettierVersion = require('prettier/package.json').version;
if (prettierVersion !== '1.13.5') {
warning +=
'\nThis may be due to an unexpected change in debug output in a version of Prettier later than 1.13.5.';
Expand All @@ -196,21 +199,23 @@ const tasks = [
if (failedFiles.length > 0) {
fail(
'The following file(s) were not ' +
'formatted with **prettier**. Make sure to execute `npm run prettier` ' +
'formatted with **prettier**. Make sure to execute `yarn run prettier` ' +
`locally prior to committing.\n${codeFence(stdout)}`
);
}
},

function eslintCheck() {
const fs = require('fs');
const eslintJUnitReporter = require('eslint/lib/formatters/junit');
const stopwatch = timer();
let stdout;
try {
({ stdout } = execa.sync('npm', [
const execa = require('execa');
({ stdout } = execa.sync('yarn', [
'run',
'--silent',
'lint',
'--',
'-f',
'json'
]));
Expand All @@ -233,7 +238,7 @@ const tasks = [
if (errFiles.length > 0) {
fail(
'The following file(s) did not pass **ESLint**. Execute ' +
'`npm run lint` locally for more details\n' +
'`yarn run lint` locally for more details\n' +
codeFence(errFiles.join('\n'))
);
}
Expand All @@ -244,7 +249,8 @@ const tasks = [
try {
summary = require('./test-results.json');
} catch (e) {
execa.sync('npm', ['run', '-s', 'test:ci']);
const execa = require('execa');
execa.sync('yarn', ['run', '-s', 'test:ci']);
summary = require('./test-results.json');
}
const failedTests = summary.testResults.filter(
Expand Down
16 changes: 6 additions & 10 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ const jestConfig = {
inPackage('scripts/fetch-mock.js')
],
// Set up Enzyme React 16 adapter for testing React components
setupTestFrameworkScriptFile: path.join(
'<rootDir>',
'scripts',
'jest-enzyme-setup.js'
),
setupFilesAfterEnv: [
path.join('<rootDir>', 'scripts', 'jest-enzyme-setup.js')
],
// Give jsdom a real URL for router testing.
testURL: 'https://localhost/'
})),
Expand Down Expand Up @@ -117,11 +115,9 @@ const jestConfig = {
'<rootDir>/node_modules'
],
// Set up Enzyme React 16 adapter for testing React components
setupTestFrameworkScriptFile: path.join(
'<rootDir>',
'scripts',
'jest-enzyme-setup.js'
),
setupFilesAfterEnv: [
path.join('<rootDir>', 'scripts', 'jest-enzyme-setup.js')
],
// Give jsdom a real URL for router testing.
testURL: 'https://localhost/',
transform: {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.0",
"version": "2.1.0-dev",
"packages": [
"packages/peregrine",
"packages/pwa-buildpack",
Expand Down
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/pwa-studio",
"version": "2.0.0",
"version": "2.1.0-dev",
"private": true,
"workspaces": [
"packages/peregrine",
Expand Down Expand Up @@ -47,29 +47,30 @@
"babel-eslint": "~10.0.1",
"babel-plugin-module-resolver": "~3.2.0",
"chalk": "~2.4.2",
"chokidar": "~2.0.4",
"coveralls": "~3.0.2",
"danger": "~7.0.2",
"eslint": "~5.12.0",
"chokidar": "^2.1.2",
"coveralls": "^3.0.3",
"danger": "^7.0.14",
"eslint": "^5.14.1",
"eslint-plugin-babel": "~5.3.0",
"eslint-plugin-graphql": "~3.0.1",
"eslint-plugin-jsx-a11y": "~6.1.2",
"eslint-plugin-graphql": "^3.0.3",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-node": "~8.0.1",
"eslint-plugin-package-json": "~0.1.3",
"eslint-plugin-react": "~7.12.3",
"eslint-plugin-react": "^7.12.4",
"execa": "~1.0.0",
"figures": "~2.0.0",
"graphql": "~14.0.2",
"graphql": "^14.1.1",
"graphql-tag": "^2.10.1",
"husky": "~1.3.1",
"jest": "~23.6.0",
"jest-fetch-mock": "~2.1.0",
"jest-junit": "~6.0.1",
"jest": "^24.3.1",
"jest-fetch-mock": "^2.1.1",
"jest-junit": "^6.3.0",
"jest-transform-graphql": "~2.1.0",
"keypress": "~0.2.1",
"lerna": "~3.10.7",
"lerna": "^3.13.0",
"lodash.debounce": "~4.0.8",
"multispinner": "~0.2.1",
"prettier": "1.15.3",
"prettier": "^1.16.4",
"prettier-check": "~2.0.0",
"stream-snitch": "~0.0.3",
"wait-for-expect": "~1.1.0"
Expand Down
42 changes: 21 additions & 21 deletions packages/peregrine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/peregrine",
"version": "2.0.0",
"version": "2.1.0-dev",
"publishConfig": {
"access": "public"
},
Expand All @@ -26,28 +26,28 @@
},
"homepage": "https://github.com/magento-research/pwa-studio/tree/master/packages/peregrine#readme",
"devDependencies": {
"@babel/cli": "~7.2.3",
"@babel/core": "~7.2.2",
"@babel/plugin-proposal-class-properties": "~7.2.3",
"@babel/plugin-proposal-object-rest-spread": "~7.2.0",
"@babel/plugin-syntax-dynamic-import": "~7.2.0",
"@babel/plugin-syntax-jsx": "~7.2.0",
"@babel/plugin-transform-react-jsx": "~7.2.0",
"@babel/plugin-transform-runtime": "~7.2.0",
"@babel/runtime": "~7.2.0",
"@storybook/react": "~4.1.11",
"concurrently": "~4.1.0",
"intl": "~1.2.5",
"react": "~16.8.0",
"react-dom": "~16.8.0",
"react-router-dom": "~4.4.0-beta.6",
"rimraf": "~2.6.3"
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-jsx": "^7.2.0",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/runtime": "^7.3.4",
"@storybook/react": "^4.1.13",
"concurrently": "^4.1.0",
"intl": "^1.2.5",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-router-dom": "^4.4.0-beta.6",
"rimraf": "^2.6.3"
},
"peerDependencies": {
"@babel/runtime": "~7.2.0",
"react": "~16.8.0",
"react-dom": "~16.8.0",
"react-router-dom": "~4.4.0-beta.6"
"@babel/runtime": "^7.2.0",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-router-dom": "^4.4.0-beta.6"
},
"engines": {
"node": ">=10.7.0",
Expand Down
73 changes: 37 additions & 36 deletions packages/pwa-buildpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/pwa-buildpack",
"version": "2.0.0",
"version": "2.1.0-dev",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -28,43 +28,44 @@
},
"homepage": "https://github.com/magento-research/pwa-studio/tree/master/packages/pwa-buildpack#readme",
"dependencies": {
"@babel/core": "~7.2.2",
"@babel/helper-module-imports": "~7.0.0",
"@babel/plugin-syntax-dynamic-import": "~7.2.0",
"@babel/plugin-transform-react-jsx": "~7.2.0",
"@magento/directive-parser": "~0.1.6",
"@magento/express-sharp": "~2.1.1-newdeps.1",
"@magento/upward-js": "^2.0.0",
"ajv": "~6.6.2",
"apicache": "~1.2.3",
"babel-loader": "~8.0.5",
"boxen": "~2.1.0",
"chalk": "~2.4.2",
"debug": "~4.1.1",
"debug-error-middleware": "~1.3.0",
"devcert": "~1.0.0",
"execa": "~1.0.0",
"express": "~4.16.4",
"graphql-playground-middleware-express": "~1.7.8",
"lodash": "~4.17.11",
"node-fetch": "~2.3.0",
"portscanner": "~2.2.0",
"readdir-enhanced": "~2.2.4",
"redis": "~2.8.0",
"virtual-module-webpack-plugin": "~0.4.1",
"webpack": "~4.28.4",
"webpack-sources": "~1.3.0",
"workbox-webpack-plugin": "~3.6.3",
"write-file-webpack-plugin": "~4.5.0"
"@babel/core": "^7.3.4",
"@babel/helper-module-imports": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@magento/directive-parser": "^0.1.6",
"@magento/express-sharp": "^2.1.1-newdeps.1",
"@magento/upward-js": "^2.1.0-dev",
"ajv": "^6.9.2",
"apicache": "^1.4.0",
"babel-loader": "^8.0.5",
"boxen": "^3.0.0",
"chalk": "^2.4.2",
"debug": "^4.1.1",
"debug-error-middleware": "^1.3.0",
"devcert": "^1.0.0",
"execa": "^1.0.0",
"express": "^4.16.4",
"graphql-playground-middleware-express": "^1.7.12",
"lodash": "^4.17.11",
"node-fetch": "^2.3.0",
"portscanner": "^2.2.0",
"readdir-enhanced": "^2.2.4",
"redis": "^2.8.0",
"virtual-module-webpack-plugin": "^0.4.1",
"webpack": "^4.29.5",
"webpack-sources": "^1.3.0",
"workbox-webpack-plugin": "^3.6.3",
"write-file-webpack-plugin": "^4.5.0"
},
"devDependencies": {
"@babel/cli": "~7.2.3",
"@babel/plugin-proposal-class-properties": "~7.2.3",
"dedent": "~0.7.0",
"memory-fs": "~0.4.1",
"rimraf": "~2.6.3",
"strip-ansi": "~5.0.0",
"terser-webpack-plugin": "~1.2.1"
"@babel/cli": "^7.2.3",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"dedent": "^0.7.0",
"memory-fs": "^0.4.1",
"rimraf": "^2.6.3",
"sharp": "^0.21.2",
"strip-ansi": "^5.0.0",
"terser-webpack-plugin": "^1.2.3"
},
"engines": {
"node": ">=10.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class MagentoRootComponentsPlugin {
this.contents = `
const rootComponentsMap = {
${Object.entries(rootComponentImporters)
.map(entry => entry.join(':'))
.join(',\n')}
.map(entry => entry.join(':'))
.join(',\n')}
};
const key = ${toRootComponentMapKey.toString()};
export default function fetchRootComponent(type, variant = 'default') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ test('force parses a specific file type', async () => {
file: 'anything',
parse: 'turns-into-graphql'
});
expect(gqlDoc).toMatchObject({
compile: expect.any(Function),
render: expect.any(Function)
});
expect(gqlDoc.compile()).resolves.not.toThrow();
expect(gqlDoc.render()).resolves.toMatchObject({
definitions: [
{
Expand Down
Loading

0 comments on commit 94cdc53

Please sign in to comment.