Skip to content

Commit 14e78df

Browse files
noahtallendkooadekbadek
authored
Update WordPress dependencies (Automattic#1135)
* Update WordPress dependencies * Add node to engines * Update jest * Add 'missing' eslint plugins * Resolve all lint errors * Dedupe node modules * fix: update NPM version to v16; plus all NPM packages * chore: add .nvmrc to specify node version * fix: update stylelint package name in config file * chore: add dependabot config file to enable auto-updates * fix: eslint errors * fix: add missing key in dependabot.yml * ci: correct path to release ZIP * fix: webpack as dev dependency; patch asset/resource pubilcPath * fix: update calypso-build to v10.0.0 * chore: update Components version and packages * chore: use ES modules instead of CommonJS when imported as a package; downgrade react-router-dom * fix: replace recharts with react-google-charts to fix build issues * fix: eslint * fix: console error resulting from mediaelement-core * chore: automatically assign dependabot PRs to Newspack Product group * style: revert whitespace changes to improved diff readability * ci: fix WP version at 5.8.1 until the PHPUnit changes are addressed https://make.wordpress.org/core/2021/09/27/changes-to-the-wordpress-core-php-test-suite/ * test: update popups tests Co-authored-by: Derrick Koo <[email protected]> Co-authored-by: Adam Borowski <[email protected]>
1 parent b34cbd7 commit 14e78df

File tree

28 files changed

+54012
-69591
lines changed

28 files changed

+54012
-69591
lines changed

.distignore

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ node_modules
4242
/tests
4343
/bin
4444
/assets
45+
/release
4546
.cache
4647
codecov
4748
__mocks__

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
],
1010
env: {
1111
browser: true,
12+
jest: true,
1213
},
1314
globals: {
1415
newspack_urls: 'readonly',

.github/dependabot.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Dependabot config.
2+
# Keep NPM and Composer packages up-to-date.
3+
# Let's start out with daily updates and then drop back to less frequent intervals after everything is up-to-date.
4+
5+
version: 2
6+
updates:
7+
# Enable version updates for npm
8+
- package-ecosystem: 'npm'
9+
# Look for `package.json` and `lock` files in the `root` directory
10+
directory: '/'
11+
# Check the npm registry for updates every day (weekdays)
12+
schedule:
13+
interval: 'daily'
14+
# Add reviewers
15+
reviewers:
16+
- 'Automattic/newspack-product'
17+
18+
# Enable version updates for npm
19+
- package-ecosystem: 'npm'
20+
# Look for `package.json` and `lock` files in the `assets/components` directory
21+
directory: '/assets/components'
22+
# Check the npm registry for updates every day (weekdays)
23+
schedule:
24+
interval: 'daily'
25+
# Add reviewers
26+
reviewers:
27+
- 'Automattic/newspack-product'
28+
29+
# Enable version updates for Composer
30+
- package-ecosystem: 'composer'
31+
# Look for a `composer.lock` in the `root` directory
32+
directory: '/'
33+
# Check for updates every day (weekdays)
34+
schedule:
35+
interval: 'daily'
36+
# Add reviewers
37+
reviewers:
38+
- 'Automattic/newspack-product'

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Thumbs.db
3333
/assets/components/dist
3434
/assets/components/shared
3535
/assets/components/node_modules
36-
/assets/release
36+
release
3737

3838
# Tests
3939
codecov/

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16.11.1

.stylelintrc

+19-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
{
2-
"extends": ["stylelint-config-wordpress/scss", "stylelint-prettier/recommended"],
3-
"rules": {
4-
"rule-empty-line-before": null,
5-
"at-rule-empty-line-before": null,
6-
"comment-empty-line-before": null,
7-
"string-quotes": "single",
8-
"no-descending-specificity": null,
9-
"function-url-quotes": null,
10-
"declaration-property-unit-whitelist": null,
11-
"font-weight-notation": null,
12-
"color-named": null,
13-
"function-parentheses-space-inside": "always-single-line",
14-
"media-feature-parentheses-space-inside": "always",
15-
"selector-pseudo-class-parentheses-space-inside": "always",
16-
"selector-class-pattern": null
17-
}
2+
"extends": [
3+
"@wordpress/stylelint-config/scss",
4+
"stylelint-prettier/recommended"
5+
],
6+
"rules": {
7+
"rule-empty-line-before": null,
8+
"at-rule-empty-line-before": null,
9+
"comment-empty-line-before": null,
10+
"string-quotes": "single",
11+
"no-descending-specificity": null,
12+
"function-url-quotes": null,
13+
"declaration-property-unit-whitelist": null,
14+
"font-weight-notation": null,
15+
"color-named": null,
16+
"function-parentheses-space-inside": "always-single-line",
17+
"media-feature-parentheses-space-inside": "always",
18+
"selector-pseudo-class-parentheses-space-inside": "always",
19+
"selector-class-pattern": null
20+
}
1821
}

assets/components/package.json

+49-49
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
{
2-
"name": "newspack-components",
3-
"version": "1.6.1",
4-
"description": "Newspack design system components",
5-
"author": "Automattic",
6-
"license": "GPL-2.0-or-later",
7-
"keywords": [
8-
"wordpress",
9-
"newspack",
10-
"components"
11-
],
12-
"bugs": {
13-
"url": "https://github.com/Automattic/newspack-plugin/issues"
14-
},
15-
"homepage": "https://github.com/Automattic/newspack-plugin",
16-
"repository": {
17-
"type": "git",
18-
"url": "https://github.com/Automattic/newspack-plugin.git",
19-
"directory": "assets/src/components"
20-
},
21-
"main": "dist/cjs/index.js",
22-
"publishConfig": {
23-
"access": "public"
24-
},
25-
"dependencies": {
26-
"@wordpress/base-styles": "^3.5.1",
27-
"@wordpress/components": "^12.0.6",
28-
"@wordpress/element": "^2.19.0",
29-
"@wordpress/i18n": "^3.17.0",
30-
"@wordpress/icons": "^4.0.1",
31-
"classnames": "^2.2.6",
32-
"lodash": "^4.17.20",
33-
"qs": "^6.9.6",
34-
"react-router-dom": "^5.2.0"
35-
},
36-
"devDependencies": {
37-
"@automattic/calypso-build": "^6.3.0",
38-
"@babel/cli": "^7.0.0",
39-
"@babel/core": "^7.12.10",
40-
"recursive-copy": "2.0.10"
41-
},
42-
"babel": {
43-
"ignore": [
44-
"./node_modules"
45-
]
46-
},
47-
"scripts": {
48-
"prepublishOnly": "transpile && node copy-styles.js",
49-
"postpublish": "rm -r dist && rm -r shared"
50-
}
2+
"name": "newspack-components",
3+
"version": "1.7.0",
4+
"description": "Newspack design system components",
5+
"author": "Automattic",
6+
"license": "GPL-2.0-or-later",
7+
"keywords": [
8+
"wordpress",
9+
"newspack",
10+
"components"
11+
],
12+
"bugs": {
13+
"url": "https://github.com/Automattic/newspack-plugin/issues"
14+
},
15+
"homepage": "https://github.com/Automattic/newspack-plugin",
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/Automattic/newspack-plugin.git",
19+
"directory": "assets/src/components"
20+
},
21+
"main": "dist/esm/index.js",
22+
"publishConfig": {
23+
"access": "public"
24+
},
25+
"dependencies": {
26+
"@wordpress/base-styles": "^4.0.0",
27+
"@wordpress/components": "^17.0.0",
28+
"@wordpress/element": "^4.0.1",
29+
"@wordpress/i18n": "^4.2.2",
30+
"@wordpress/icons": "^5.0.2",
31+
"classnames": "^2.3.1",
32+
"lodash": "^4.17.21",
33+
"qs": "^6.10.1",
34+
"react-router-dom": "^5.3.0"
35+
},
36+
"devDependencies": {
37+
"@automattic/calypso-build": "^10.0.0",
38+
"@babel/cli": "^7.15.0",
39+
"@babel/core": "^7.15.0",
40+
"recursive-copy": "^2.0.13"
41+
},
42+
"babel": {
43+
"ignore": [
44+
"./node_modules"
45+
]
46+
},
47+
"scripts": {
48+
"prepublishOnly": "transpile && node copy-styles.js",
49+
"postpublish": "rm -r dist && rm -r shared"
50+
}
5151
}

assets/components/src/autocomplete-with-suggestions/index.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,13 @@ const AutocompleteWithSuggestions = ( {
176176
const selections = selectedPost ? [ ...selectedItems, selectedPost ] : selectedItems;
177177
const selectedMessage = multiSelect
178178
? sprintf(
179-
__( '%s %s selected', 'newspack' ),
179+
// Translators: %1: the length of selections. %2: the selection leabel.
180+
__( '%1$s %2$s selected', 'newspack' ),
180181
selections.length,
181182
selections.length > 1 ? postTypeLabelPlural : postTypeLabel
182183
)
183-
: sprintf( __( 'Selected %s', 'newspack' ), postTypeLabel );
184+
: // Translators: %s: The label for the selection.
185+
sprintf( __( 'Selected %s', 'newspack' ), postTypeLabel );
184186

185187
return (
186188
<div className="newspack-autocomplete-with-suggestions__selected-items">
@@ -216,6 +218,7 @@ const AutocompleteWithSuggestions = ( {
216218
return (
217219
<SelectControl
218220
label={ sprintf(
221+
// Translators: %s: The name of the type.
219222
__( '%s type', 'newspack' ),
220223
postTypeLabel.charAt( 0 ).toUpperCase() + postTypeLabel.slice( 1 )
221224
) }
@@ -280,7 +283,12 @@ const AutocompleteWithSuggestions = ( {
280283
<>
281284
{ ! hideHelp && (
282285
<p className="newspack-autocomplete-with-suggestions__label">
283-
{ sprintf( __( 'Or, select a recent %s:', 'newspack' ), postTypeLabel ) }
286+
{
287+
/* Translators: %s: the name of a post type. */ sprintf(
288+
__( 'Or, select a recent %s:', 'newspack' ),
289+
postTypeLabel
290+
)
291+
}
284292
</p>
285293
) }
286294
<div className={ className }>
@@ -291,7 +299,7 @@ const AutocompleteWithSuggestions = ( {
291299
isSecondary
292300
onClick={ () => setIsLoadingMore( true ) }
293301
>
294-
{ isLoadingMore ? __( 'Loading...', 'newspack' ) : __( 'Load more', 'newspack' ) }
302+
{ isLoadingMore ? __( 'Loading', 'newspack' ) : __( 'Load more', 'newspack' ) }
295303
</Button>
296304
) }
297305
</div>

assets/components/src/plugin-installer/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class PluginInstaller extends Component {
181181
{ ( ! pluginInfo || ! Object.keys( pluginInfo ).length ) && (
182182
<div className="newspack-plugin-installer_is-waiting">
183183
<Waiting isLeft />
184-
{ __( 'Retrieving plugin information...' ) }
184+
{ __( 'Retrieving plugin information' ) }
185185
</div>
186186
) }
187187
{ pluginInfo &&
@@ -193,7 +193,7 @@ class PluginInstaller extends Component {
193193
const isButton = ! isWaiting && Status !== 'active';
194194
let actionText;
195195
if ( installationStatus === PLUGIN_STATE_INSTALLING ) {
196-
actionText = __( 'Installing...' );
196+
actionText = __( 'Installing' );
197197
} else if ( Status === 'uninstalled' ) {
198198
actionText = (
199199
<span className="newspack-plugin-installer__status">

assets/components/src/plugin-toggle/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,21 @@ class PluginToggle extends Component {
133133
if ( 'configure' === inFlight ) {
134134
return (
135135
<Fragment>
136-
{ __( 'Installing...', 'newspack' ) } <Waiting isRight />
136+
{ __( 'Installing', 'newspack' ) } <Waiting isRight />
137137
</Fragment>
138138
);
139139
}
140140
if ( 'deactivate' === inFlight ) {
141141
return (
142142
<Fragment>
143-
{ __( 'Deactivating...', 'newspack' ) } <Waiting isRight />
143+
{ __( 'Deactivating', 'newspack' ) } <Waiting isRight />
144144
</Fragment>
145145
);
146146
}
147147
if ( ! name ) {
148148
return (
149149
<Fragment>
150-
{ __( 'Loading...', 'newspack' ) } <Waiting isRight />
150+
{ __( 'Loading', 'newspack' ) } <Waiting isRight />
151151
</Fragment>
152152
);
153153
}

assets/components/src/web-preview/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class WebPreview extends Component {
119119
{ ! loaded && (
120120
<div className="newspack-web-preview__is-waiting">
121121
<Waiting isLeft />
122-
{ __( 'Loading...', 'newspack' ) }
122+
{ __( 'Loading', 'newspack' ) }
123123
</div>
124124
) }
125125
<iframe

assets/setupTests.js

+15
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,18 @@ import '@testing-library/jest-dom';
33
window.newspack_aux_data = {
44
is_debug_mode: false,
55
};
6+
7+
// matchMedia does not exist in JSDOM, see https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
8+
Object.defineProperty( window, 'matchMedia', {
9+
writable: true,
10+
value: jest.fn().mockImplementation( query => ( {
11+
matches: false,
12+
media: query,
13+
onchange: null,
14+
addListener: jest.fn(), // deprecated
15+
removeListener: jest.fn(), // deprecated
16+
addEventListener: jest.fn(),
17+
removeEventListener: jest.fn(),
18+
dispatchEvent: jest.fn(),
19+
} ) ),
20+
} );

assets/wizards/advertising/views/ad-unit/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class AdUnit extends Component {
3434
*
3535
* @param {string} key Ad Unit field
3636
* @param {any} value New value for field
37-
*
3837
*/
3938
handleOnChange( key, value ) {
4039
const { adUnit, onChange, service } = this.props;

assets/wizards/componentsDemo/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class ComponentsDemo extends Component {
333333
<ActionCard
334334
title={ __( 'Example Three', 'newspack' ) }
335335
description={ __( 'Waiting/in-progress state, no action button.', 'newspack' ) }
336-
actionText={ __( 'Installing...', 'newspack' ) }
336+
actionText={ __( 'Installing', 'newspack' ) }
337337
isWaiting
338338
/>
339339
<ActionCard

assets/wizards/connections/views/main/google.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const GoogleOAuth = ( { setError, canBeConnected } ) => {
5454
const [ authState, setAuthState ] = useState( {} );
5555

5656
const userBasicInfo = authState.user_basic_info;
57-
const isConnected = Boolean( userBasicInfo && userBasicInfo.email );
5857
const canUseOauth = newspack_connections_data.can_connect_google;
5958

6059
const [ inFlight, setInFlight ] = useState( false );
@@ -77,6 +76,8 @@ const GoogleOAuth = ( { setError, canBeConnected } ) => {
7776
return null;
7877
}
7978

79+
const isConnected = Boolean( userBasicInfo && userBasicInfo.email );
80+
8081
// Redirect user to Google auth screen.
8182
const goToAuthPage = () => {
8283
setInFlight( true );
@@ -106,6 +107,7 @@ const GoogleOAuth = ( { setError, canBeConnected } ) => {
106107
return __( 'Loading…', 'newspack' );
107108
}
108109
if ( isConnected ) {
110+
// Translators: user connection status message.
109111
return sprintf( __( 'Connected as %s', 'newspack' ), userBasicInfo.email );
110112
}
111113
if ( ! canBeConnected ) {

assets/wizards/popups/components/prompt-action-card/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ const PromptActionCard = props => {
181181
{ isDuplicatePromptModalVisible && (
182182
<Modal
183183
className="newspack-popups__duplicate-modal"
184-
title={ sprintf( __( 'Duplicate “%s”', 'newspack' ), title ) }
184+
title={
185+
// Translators: %s: The title of the item.
186+
sprintf( __( 'Duplicate “%s”', 'newspack' ), title )
187+
}
185188
onRequestClose={ () => {
186189
setIsDuplicatePromptModalVisible( false );
187190
setDuplicateTitle( null );
@@ -193,6 +196,7 @@ const PromptActionCard = props => {
193196
<Notice
194197
isSuccess
195198
noticeText={ sprintf(
199+
// Translators: %s: The title of the item.
196200
__( 'Duplicate of “%s” created as a draft.', 'newspack' ),
197201
title
198202
) }

0 commit comments

Comments
 (0)