Skip to content

Commit 1f8950c

Browse files
authored
Replaced glob with globby (#6881)
* Replaced glob with globby * Update build-validate.js * Update build-validate.js * rm @types/glob * Add back project deps
1 parent 912f8da commit 1f8950c

File tree

12 files changed

+28
-21
lines changed

12 files changed

+28
-21
lines changed

.changeset/rare-pumas-confess.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'polaris-for-vscode': patch
3+
'@shopify/polaris-icons': patch
4+
'@shopify/polaris': patch
5+
'polaris.shopify.com': patch
6+
---
7+
8+
Replaced glob with globby

polaris-for-vscode/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@
4343
},
4444
"devDependencies": {
4545
"@shopify/polaris-tokens": "^5.5.1",
46-
"@types/glob": "^7.2.0",
4746
"@types/node": "14.x",
4847
"@types/vscode": "^1.64.0",
4948
"@vscode/test-electron": "^2.1.2",
50-
"glob": "^7.2.0",
49+
"globby": "^11.1.0",
5150
"vsce": "^2.7.0"
5251
}
5352
}

polaris-icons/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"homepage": "https://polaris.shopify.com/icons",
5454
"devDependencies": {
5555
"@svgr/core": "^4.3.3",
56-
"glob": "^7.1.6",
56+
"globby": "^11.1.0",
5757
"hast-util-select": "^3.0.0",
5858
"js-yaml": "^4.0.0",
5959
"rehype-parse": "^7.0.1",

polaris-icons/rollup.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import * as path from 'path';
55
import {createFilter} from '@rollup/pluginutils';
66
import {babel} from '@rollup/plugin-babel';
77
import virtual from '@rollup/plugin-virtual';
8-
import glob from 'glob';
8+
import globby from 'globby';
99
import jsYaml from 'js-yaml';
1010
import svgr from '@svgr/core';
1111
import {optimize} from 'svgo';
1212

1313
const convert = svgr.default;
1414
const iconBasePath = new URL('./icons', import.meta.url).pathname;
15-
const iconPaths = glob.sync(path.join(iconBasePath, '*.yml'));
15+
const iconPaths = globby.sync(path.join(iconBasePath, '*.yml'));
1616

1717
const iconExports = [];
1818
const iconTypes = [];

polaris-icons/tests/validate-data-pairs.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
const path = require('path');
22

3-
const glob = require('glob');
3+
const globby = require('globby');
44

55
const iconBasePath = path.resolve(__dirname, '../icons');
66

7-
const allSVGs = glob
7+
const allSVGs = globby
88
.sync('*.svg', {
99
cwd: iconBasePath,
1010
})
1111
.map((filename) => path.basename(filename));
1212

13-
const allYMLs = glob
13+
const allYMLs = globby
1414
.sync('*.yml', {
1515
cwd: iconBasePath,
1616
})

polaris-icons/tests/validate-svg-content.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs');
22
const path = require('path');
33

4-
const glob = require('glob');
4+
const globby = require('globby');
55
const unified = require('unified');
66
const parse = require('rehype-parse');
77
const {select, selectAll} = require('hast-util-select');
@@ -13,7 +13,7 @@ const configPerSet = new Map([
1313
['Minor', {viewbox: '0 0 20 20', colors: ['#5C5F62', '#5c5f62']}],
1414
]);
1515

16-
const allIconFiles = glob
16+
const allIconFiles = globby
1717
.sync(path.resolve(__dirname, '../icons/*.svg'))
1818
.map((absoluteIconPath) => {
1919
// We don't care about the first item, only the groups matches

polaris-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"chromatic": "^6.5.4",
9999
"core-js": "^3.6.5",
100100
"create-file-webpack": "^1.0.2",
101-
"glob": "^7.1.6",
101+
"globby": "^11.1.0",
102102
"node-cmd": "^3.0.0",
103103
"node-sass": "^7.0.1",
104104
"object-hash": "^1.3.1",

polaris-react/scripts/build-validate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const assert = require('assert').strict;
33
const fs = require('fs');
44

5-
const glob = require('glob');
5+
const globby = require('globby');
66

77
const packageJSON = require('../package.json');
88

@@ -22,7 +22,7 @@ function validateStandardBuild() {
2222
// Assert it uses named exports rather than properties from the React default
2323
// export to help tree-shaking.
2424
// React.createElement and React.Fragment are the allowed exceptions
25-
const files = glob.sync('./build/cjs/**/*.js');
25+
const files = globby.sync('./build/cjs/**/*.js');
2626
assert.notStrictEqual(files.length, 0);
2727
const filesContainingUnwantedReactUsage = [];
2828
files.forEach((file) => {
@@ -91,7 +91,7 @@ function validateAncillaryOutput() {
9191
}
9292

9393
function validateVersionReplacement() {
94-
const files = glob.sync('./build/**/*.{js,mjs,esnext,css}');
94+
const files = globby.sync('./build/**/*.{js,mjs,esnext,css}');
9595

9696
assert.notStrictEqual(files.length, 0);
9797

@@ -118,7 +118,7 @@ function validateVersionReplacement() {
118118
'./build/cjs/configure.js',
119119
'./build/esm/configure.js',
120120
'./build/esm/styles.css',
121-
'./build/esnext/components/AppProvider/AppProvider.css',
122121
'./build/esnext/configure.esnext',
122+
'./build/esnext/components/AppProvider/AppProvider.css',
123123
]);
124124
}

polaris.shopify.com/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"@shopify/polaris-tokens": "^5.5.1",
2424
"codesandbox": "^2.2.3",
2525
"fuse.js": "^6.5.3",
26-
"glob": "^7.1.6",
2726
"next": "12.1.0",
2827
"prismjs": "^1.27.0",
2928
"react": "^17.0.2",
@@ -43,6 +42,7 @@
4342
"eslint-config-next": "12.1.0",
4443
"frontmatter": "^0.0.3",
4544
"generact": "^0.4.0",
45+
"globby": "^11.1.0",
4646
"js-yaml": "^4.1.0",
4747
"marked": "^4.0.16",
4848
"rehype-raw": "^6.1.1",

polaris.shopify.com/src/pages/components/[component].tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'fs';
2-
import glob from 'glob';
2+
import globby from 'globby';
33
import path from 'path';
44
import type {GetStaticPaths, GetStaticProps} from 'next';
55
import ComponentExamples from '../../components/ComponentExamples';
@@ -133,7 +133,7 @@ export const getStaticProps: GetStaticProps<
133133

134134
export const getStaticPaths: GetStaticPaths = async () => {
135135
const globPath = path.resolve(process.cwd(), 'content/components/*/*.md');
136-
const paths = glob.sync(globPath).map((fileName: string) => {
136+
const paths = globby.sync(globPath).map((fileName: string) => {
137137
return fileName
138138
.replace(`${process.cwd()}/content`, '')
139139
.replace('/index.md', '');

0 commit comments

Comments
 (0)