Skip to content

Commit

Permalink
Merge pull request #2873 from Shopify/bump-sk-new
Browse files Browse the repository at this point in the history
Enable Typescript 3.8 and update Sewing-kit to latest
  • Loading branch information
BPScott authored Mar 25, 2020
2 parents 23e1503 + 158af27 commit 86e72e9
Show file tree
Hide file tree
Showing 399 changed files with 3,307 additions and 3,462 deletions.
5 changes: 3 additions & 2 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ module.exports = {
loader: 'css-loader',
query: {
sourceMap: false,
modules: true,
importLoaders: 1,
localIdentName: '[name]-[local]_[hash:base64:5]',
modules: {
localIdentName: '[name]-[local]_[hash:base64:5]',
},
},
},
{
Expand Down
2 changes: 2 additions & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

### Dependency upgrades

- Updated sewing-kit to v0.120.0, and typescript to 3.8.3 ([#2873](https://github.com/Shopify/polaris-react/pull/2873))

### Code quality

### Deprecations
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function(api) {
module.exports = function (api) {
// When building (using rollup) or running storybook (using babel-loader) we
// want to compile for the web otherwise compile for node usage (within jest)
const isWeb = api.caller((caller = {}) => {
Expand Down
1 change: 1 addition & 0 deletions config/rollup/namespaced-classname.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const {basename} = require('path');

const {camelCase} = require('change-case');

const cache = {
Expand Down
1 change: 1 addition & 0 deletions config/rollup/plugins/image.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const {readFileSync} = require('fs');
const {extname} = require('path');

const {createFilter} = require('rollup-pluginutils');

const MIME_TYPES = {
Expand Down
2 changes: 1 addition & 1 deletion config/rollup/plugins/styles.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const util = require('util');
const path = require('path');

const postcss = require('postcss');
const {ensureDir, outputFile, readFileSync, writeFile} = require('fs-extra');
const glob = require('glob');
const nodeSass = require('node-sass');
const {createFilter} = require('rollup-pluginutils');
const cssnano = require('cssnano');

const cssModulesExtractImports = require('postcss-modules-extract-imports');
const cssModulesLocalByDefault = require('postcss-modules-local-by-default');
const cssModulesScope = require('postcss-modules-scope');
Expand Down
2 changes: 2 additions & 0 deletions config/typescript/react-transition-group.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
declare module '@material-ui/react-transition-group' {
// Import order rule doesn't like doing asignment with require
// eslint-disable-next-line import/order
import {Component} from 'react';

import CSSTransitionNameSpace = require('react-transition-group/CSSTransition');
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
"@octokit/rest": "^16.36.0",
"@percy/storybook": "^3.2.0",
"@shopify/jest-dom-mocks": "^2.1.1",
"@shopify/react-testing": "^1.8.0",
"@shopify/sewing-kit": "^0.112.0",
"@shopify/react-testing": "^2.0.0",
"@shopify/sewing-kit": "^0.120.0",
"@shopify/shrink-ray": "^2.3.1",
"@shopify/splash": "^0.0.8",
"@storybook/addon-a11y": "^5.3.2",
Expand Down Expand Up @@ -162,14 +162,15 @@
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-pluginutils": "^2.8.2",
"sass-loader": "^8.0.0",
"scss-parser": "^1.0.3",
"semver": "^6.3.0",
"serve": "^11.1.0",
"shelljs": "^0.8.3",
"shx": "^0.3.2",
"storybook-chromatic": "^3.4.1",
"svgo": "^1.3.0",
"typescript": "~3.7.2"
"typescript": "~3.8.3"
},
"peerDependencies": {
"react": "^16.8.6",
Expand All @@ -193,7 +194,7 @@
"@shopify/app-bridge": "^1.3.0",
"@shopify/javascript-utilities": "^2.4.1",
"@shopify/polaris-icons": "^3.10.0",
"@shopify/polaris-tokens": "^2.12.0",
"@shopify/polaris-tokens": "^2.12.2",
"@shopify/useful-types": "^1.2.4",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/react": "^16.8.15",
Expand All @@ -202,5 +203,8 @@
"hoist-non-react-statics": "^3.3.0",
"lodash": "^4.17.4",
"tslib": "^1.9.3"
},
"resolutions": {
"prettier": "2.0.2"
}
}
1 change: 1 addition & 0 deletions playground/DetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
DuplicateMinor,
ViewMinor,
} from '@shopify/polaris-icons';

import {
ActionList,
Card,
Expand Down
1 change: 1 addition & 0 deletions playground/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';

import {Page} from '../src';

export function Playground() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {readFileSync} from 'fs';

import glob from 'glob';
import {parse, InputStreamPosition} from 'scss-parser';
import chalk from 'chalk';
Expand Down Expand Up @@ -103,7 +104,7 @@ export function analyzeCustomProperties({
totalCustomProperties: 0,
};

glob(pattern, {}, function(err, files) {
glob(pattern, {}, function (err, files) {
if (err) reject(err);

for (const file of files) {
Expand Down
2 changes: 2 additions & 0 deletions scripts/analyze-custom-properties/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {readFileSync, writeFileSync} from 'fs';

import program from 'commander';

import {analyzeCustomProperties} from './analyze-custom-properties';

type LogLevel = 'verbose' | 'info' | 'error' | 'never';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import glob from 'glob';

import {analyzeCustomProperties} from '../analyze-custom-properties';

jest.mock('glob', () => ({
__esModule: true,
default: jest.fn((_a, _b, cb) =>
// eslint-disable-next-line node/no-callback-literal
cb(false, ['scripts/analyze-custom-properties/tests/fixtures.scss']),
),
}));
Expand Down Expand Up @@ -38,6 +40,7 @@ describe('analyzeCustomProperties', () => {
});

it(`catches errors rather than throwing`, async () => {
// eslint-disable-next-line node/no-callback-literal
globSpy.mockImplementationOnce((_a, _b, cb) => cb(true, []));
let error = false;
await analyzeCustomProperties({}).catch((err) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {handleMessage} from '../analyze-custom-properties';

import {mockCustomProperties, mockCustomPropertyErrors} from './fixtures';

describe('handleMessage', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {isCustomPropertyDeclaration} from '../analyze-custom-properties';

import {
mockVarNode,
mockPunctuation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {isVarFunction} from '../analyze-custom-properties';

import {mockVarNode, mockPunctuation, mockArguments} from './fixtures';

describe('isVarFunction', () => {
Expand Down
1 change: 1 addition & 0 deletions scripts/analyze-custom-properties/tests/visit-all.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {visitAll} from '../analyze-custom-properties';

import {mockVarNode, mockPunctuation, mockStringSingle} from './fixtures';

describe('visitAll', () => {
Expand Down
1 change: 1 addition & 0 deletions scripts/build-consumer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-console */

const {resolve} = require('path');

const {config, cp, mkdir, rm} = require('shelljs');

const packageJSON = require('../package.json');
Expand Down
1 change: 1 addition & 0 deletions scripts/build-shrink-ray.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const {resolve} = require('path');
const {execSync} = require('child_process');

const {readFileSync} = require('fs-extra');
const {Logger, Build, ShrinkRayAPI, Check} = require('@shopify/shrink-ray');

Expand Down
1 change: 1 addition & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {execSync} = require('child_process');
const {join, resolve: resolvePath} = require('path');

const {ensureDirSync, writeFileSync, readFileSync} = require('fs-extra');
const {rollup} = require('rollup');
const {cp, mv, rm} = require('shelljs');
Expand Down
2 changes: 2 additions & 0 deletions scripts/color-system-docs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const {resolve: resolvePath} = require('path');

const {writeFileSync} = require('fs-extra');
const {
config: roleVariants,
} = require('@shopify/polaris-tokens/dist-modern/configs/base');
const theme = require('@shopify/polaris-tokens/dist-modern/theme/base.json');
const {colorFactory} = require('@shopify/polaris-tokens/dist-modern');

const {
rgbToHex,
UNSTABLE_toCssCustomPropertySyntax: cssify,
Expand Down
2 changes: 2 additions & 0 deletions scripts/new-version-pr-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
const {execSync} = require('child_process');
const {readFileSync} = require('fs');
const path = require('path');

const {mkdir} = require('shelljs');
const yaml = require('js-yaml');
const semver = require('semver');

const {version: PACKAGE_VERSION} = require('../package.json');
const secrets = require('../secrets.json');

const retry = require('./utilities/retry');

const repositories = ['polaris-styleguide', 'web'];
Expand Down
3 changes: 3 additions & 0 deletions scripts/readme-update-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

const {resolve} = require('path');
const {execSync} = require('child_process');

const {writeFileSync, readFileSync} = require('fs-extra');

const {version: newVersion} = require('../package.json');

const {semverRegExp, readmes} = require('./utilities');

const root = resolve(__dirname, '..');
Expand Down
1 change: 1 addition & 0 deletions scripts/splash/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'path';

import React, {useState, useEffect} from 'react';
import {Box, Text, Color, render} from 'ink';
import sortBy from 'lodash/sortBy';
Expand Down
1 change: 1 addition & 0 deletions scripts/updateQuartiles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-console, babel/camelcase */
const fs = require('fs');

const Octokit = require('@octokit/rest');

const LATEST_PR = new Date('2020-01-17T16:30:44Z');
Expand Down
1 change: 1 addition & 0 deletions sewing-kit.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {join} from 'path';

import {ConfigurationCallback, Env, Plugins} from '@shopify/sewing-kit';

const tests = join(__dirname, 'tests');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
// eslint-disable-next-line no-restricted-imports
import {mountWithAppProvider} from 'test-utilities/legacy';
import {Avatar, buttonFrom} from 'components';

import {AccountConnection} from '../AccountConnection';

describe('<AccountConnection />', () => {
Expand Down
1 change: 1 addition & 0 deletions src/components/ActionList/ActionList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ $item-vertical-padding: ($item-min-height - line-height(body)) / 2;
color: color('ink', 'lightest');
pointer-events: none;

// stylelint-disable-next-line selector-max-class
.Image {
@include recolor-icon(color('ink', 'lightest'), color('white'));
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/ActionList/ActionList.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';

import {ActionListItemDescriptor, ActionListSection} from '../../types';
import {useFeatures} from '../../utilities/features';
import {classNames} from '../../utilities/css';
import {Section} from './components';

import {Section} from './components';
import styles from './ActionList.scss';

export interface ActionListProps {
Expand Down
1 change: 0 additions & 1 deletion src/components/ActionList/components/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {Icon} from '../../../Icon';
import {UnstyledLink} from '../../../UnstyledLink';
import {Badge} from '../../../Badge';
import {TextStyle} from '../../../TextStyle';

import styles from '../../ActionList.scss';

export type ItemProps = ActionListItemDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import {mountWithAppProvider} from 'test-utilities/legacy';
import {mountWithApp} from 'test-utilities';
import {UnstyledLink} from 'components';

import {Item} from '../Item';
import {TextStyle} from '../../../../TextStyle';

Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionList/components/Section/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import {Item} from '../Item';
import {ActionListItemDescriptor, ActionListSection} from '../../../../types';

import styles from '../../ActionList.scss';

export interface SectionProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
// eslint-disable-next-line no-restricted-imports
import {mountWithAppProvider} from 'test-utilities/legacy';

import {Item} from '../../Item';
import {Section} from '../Section';

Expand Down Expand Up @@ -68,12 +69,7 @@ describe('<Section />', () => {
/>,
);

expect(
section
.find(Item)
.first()
.prop('content'),
).toBe('Import file');
expect(section.find(Item).first().prop('content')).toBe('Import file');
});

it('passes helpText to Item', () => {
Expand All @@ -89,12 +85,7 @@ describe('<Section />', () => {
/>,
);

expect(
section
.find(Item)
.first()
.prop('helpText'),
).toBe('Foo');
expect(section.find(Item).first().prop('helpText')).toBe('Foo');
});

it('passes the onActionAnyItem callback to Item', () => {
Expand All @@ -112,10 +103,7 @@ describe('<Section />', () => {
/>,
);

section
.find('Item button')
.first()
.simulate('click');
section.find('Item button').first().simulate('click');

expect(spy).toHaveBeenCalledTimes(1);
});
Expand Down
5 changes: 3 additions & 2 deletions src/components/ActionList/tests/ActionList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {ImportMinor, ExportMinor} from '@shopify/polaris-icons';
// eslint-disable-next-line no-restricted-imports
import {mountWithAppProvider} from 'test-utilities/legacy';
import {mountWithApp} from 'test-utilities';

import {ActionList} from '../ActionList';
import {Badge} from '../../Badge';
import {Item, Section} from '../components';
Expand Down Expand Up @@ -72,7 +73,7 @@ describe('<ActionList />', () => {
});
});

it('it passes actionRole to Section', () => {
it('passes actionRole to Section', () => {
const actionList = mountWithAppProvider(
<ActionList
items={[{content: 'Add discount'}]}
Expand Down Expand Up @@ -125,7 +126,7 @@ describe('<ActionList />', () => {
expect(actionList.find(Section).text()).toContain('File option');
});

it('it renders an item with a badge', () => {
it('renders an item with a badge', () => {
const actionList = mountWithAppProvider(
<ActionList
items={[
Expand Down
Loading

0 comments on commit 86e72e9

Please sign in to comment.