Skip to content

Commit

Permalink
Bump actions, pmap genPng, fix nodejs version, fix issues with node 1…
Browse files Browse the repository at this point in the history
…4.17 (Shopify#7482)
  • Loading branch information
alex-page authored Oct 21, 2022
1 parent 2f16b23 commit 0ec6961
Show file tree
Hide file tree
Showing 23 changed files with 115 additions and 79 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-shoes-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'polaris.shopify.com': patch
---

Bump GitHub action versions and add p-map for gen-og-images CI failure
4 changes: 2 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node with v16.13.0
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16.13.0

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-a11y-vrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node with v16.13.0
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16.13.0
cache: yarn

- name: Restore cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
**/.turbo
Expand Down Expand Up @@ -59,18 +59,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # Chromatic git history to track changes

- name: Setup Node with v16.13.0
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16.13.0
cache: yarn

- name: Restore cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
**/.turbo
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ on:

jobs:
build:
name: 'Validate with Node v${{ matrix.node_version }}'
name: 'Validate with Node v${{ matrix.node-version }}'
runs-on: ubuntu-latest
strategy:
matrix:
node_version: ['14.17.0', '16.13.0']
node-version: ['14.17.0', '16.13.0']
steps:
- name: Checkout branch
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node with v${{ matrix.node_version }}
- name: Setup Node with v${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node_version: ${{ matrix.node_version }}
node-version: ${{ matrix.node-version }}
cache: yarn

- name: Restore cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
**/.eslintcache
**/.turbo
node_modules/.cache/turbo
polaris.shopify.com/.next/cache
key: ${{ runner.os }}-node${{ matrix.node_version }}-test-v1-${{ github.sha }}
key: ${{ runner.os }}-node${{ matrix.node-version }}-test-v1-${{ github.sha }}
restore-keys: |
${{ runner.os }}-node${{ matrix.node_version }}-test-v1-
${{ runner.os }}-node${{ matrix.node-version }}-test-v1-
- name: Install dependencies
run: yarn --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/non-committable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-polaris-for-vscode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
name: Checkout

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
name: Use Node.js 16.x
with:
node-version: 16
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/snapit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
repo: context.repo.repo,
pull_number: context.issue.number,
})
// Pull request from fork
if (context.payload.repository.full_name !== pullRequest.data.head.repo.full_name) {
const errorMessage = '`/snapit` is not supported on pull requests from forked repositories.'
Expand All @@ -58,7 +58,7 @@ jobs:
}
- name: Checkout default branch
uses: actions/checkout@v2
uses: actions/checkout@v3

# issue_comment requires us to checkout the branch
# https://github.com/actions/checkout/issues/331#issuecomment-1120113003
Expand All @@ -78,7 +78,7 @@ jobs:
fi
- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16.x

Expand Down
2 changes: 1 addition & 1 deletion documentation/Nodejs support.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The `package.json` engines. This should match the `.github/workflows/ci.yml` and
The GitHub actions `.github/workflows/ci.yml` file. This should match the `package.json` and list all supported versions.

```yml
node_version: ['14.17.0', '16.13.0']
node-version: ['14.17.0', '16.13.0']
```
The `dev.yml` file which creates a local development environment. This should match the `.nvmrc` file.
Expand Down
6 changes: 3 additions & 3 deletions polaris-migrator/plopfile.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'node:fs';
import * as url from 'node:url';
import * as path from 'node:path';
import * as fs from 'fs';
import * as url from 'url';
import * as path from 'path';

import {plopDir} from 'plop-dir';

Expand Down
6 changes: 3 additions & 3 deletions polaris-migrator/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as url from 'node:url';
import * as fs from 'fs';
import * as path from 'path';
import * as url from 'url';

import {babel} from '@rollup/plugin-babel';
import {nodeResolve} from '@rollup/plugin-node-resolve';
Expand Down
4 changes: 2 additions & 2 deletions polaris-migrator/src/migrate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'node:fs';
import path from 'node:path';
import fs from 'fs';
import path from 'path';

// @ts-expect-error TS can't resolve the type of this import
import * as jscodeshift from 'jscodeshift/src/Runner';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

node.value = `var(${borderWidthLengthMap[valueInPx]})`;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

return;
}
Expand All @@ -125,7 +125,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {
},
];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;
}

if (isSassFunction(namespacedBorder, node)) {
Expand All @@ -151,7 +151,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {
},
];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;
}

if (isSassFunction(namespacedBorderWidth, node)) {
Expand All @@ -177,7 +177,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {
},
];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;
}

return StopWalkingFunctionNodes;
Expand Down Expand Up @@ -206,7 +206,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

node.value = `var(${borderRadiusLengthMap[valueInPx]})`;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

return;
}
Expand All @@ -233,7 +233,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {
},
];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;
}

if (isSassFunction(namespacedBorderRadius, node)) {
Expand All @@ -259,7 +259,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {
},
];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;
}

return StopWalkingFunctionNodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

if (!isKeyOf(spaceMap, valueInPx)) return;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = `var(${spaceMap[valueInPx]})`;
return;
Expand All @@ -105,7 +105,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

if (!isKeyOf(spaceMap, valueInPx)) return;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = 'var';
node.nodes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

const fontFamilyCustomProperty = fontFamilyMap[family];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = 'var';
node.nodes = [
Expand Down Expand Up @@ -146,7 +146,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

if (!isKeyOf(fontSizeMap, fontSizeInPx)) return;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = `var(${fontSizeMap[fontSizeInPx]})`;
return;
Expand All @@ -173,7 +173,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

const fontSizeVariant = fontSizeStyle[variantArg];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

if (fontSizeVariant.startsWith('--')) {
node.value = 'var';
Expand Down Expand Up @@ -203,7 +203,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

if (!isKeyOf(fontSizeMap, fontSizeInPx)) return;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = 'var';
node.nodes = [
Expand Down Expand Up @@ -239,7 +239,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

if (!isKeyOf(fontWeightMap, fontWeight)) return;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = `var(${fontWeightMap[fontWeight]})`;
}
Expand All @@ -262,7 +262,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

if (!isKeyOf(fontLineHeightMap, lineHeighInPx)) return;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = `var(${fontLineHeightMap[lineHeighInPx]})`;

Expand Down Expand Up @@ -290,7 +290,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

const lineHeightVariant = lineHeightStyle[variantArg];

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

if (lineHeightVariant.startsWith('--')) {
node.value = 'var';
Expand Down Expand Up @@ -320,7 +320,7 @@ const plugin = (options: PluginOptions = {}): Plugin => {

if (!isKeyOf(fontLineHeightMap, lineHeightInPx)) return;

targets.at(-1)!.replaced = true;
targets[targets.length - 1]!.replaced = true;

node.value = 'var';
node.nodes = [
Expand Down
4 changes: 2 additions & 2 deletions polaris-migrator/src/utilities/testUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable jest/no-export, jest/valid-title, @typescript-eslint/no-var-requires */
import fs from 'node:fs';
import path from 'node:path';
import fs from 'fs';
import path from 'path';

import prettier from 'prettier';

Expand Down
1 change: 1 addition & 0 deletions polaris.shopify.com/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"js-yaml": "^4.1.0",
"lodash.set": "^4.3.2",
"playroom": "^0.28.0",
"p-map": "^5.5.0",
"marked": "^4.0.16",
"puppeteer": "^16.0.0",
"style-loader": "^3.3.1",
Expand Down
2 changes: 1 addition & 1 deletion polaris.shopify.com/playroom.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// So we need to build into that public asset folder. Hence no dev mode and HMR
// Workaround: restart the next dev server after each change to the playroom config and associated files.

const path = require('node:path');
const path = require('path');
const {breakpoints, toPx} = require('@shopify/polaris-tokens');
const {playroom} = require('./constants');

Expand Down
Loading

0 comments on commit 0ec6961

Please sign in to comment.