Skip to content

Commit 4226459

Browse files
committed
copy missing progress fn (this is temporary)
1 parent f6edccf commit 4226459

File tree

4 files changed

+127
-3
lines changed

4 files changed

+127
-3
lines changed

packages/gatsby-source-wordpress/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@rematch/core": "^1.3.0",
1212
"@rematch/immer": "^1.2.0",
1313
"async-retry": "^1.3.1",
14+
"progress": "2.0.3",
1415
"atob": "^2.1.2",
1516
"axios": "^0.21.1",
1617
"axios-rate-limit": "^1.3.0",
@@ -31,7 +32,7 @@
3132
"gatsby-core-utils": "^2.1.0-next.1",
3233
"gatsby-image": "^3.1.0-next.1",
3334
"gatsby-plugin-catch-links": "^3.1.0-next.1",
34-
"gatsby-source-filesystem": "^3.1.0-next.1",
35+
"gatsby-source-filesystem": "2.11.1",
3536
"glob": "^7.1.6",
3637
"got": "^11.7.0",
3738
"graphql-query-compress": "^1.2.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
exports.__esModule = true
2+
exports.getRemoteFileExtension = getRemoteFileExtension
3+
exports.getRemoteFileName = getRemoteFileName
4+
exports.createProgress = createProgress
5+
exports.createFilePath = createFilePath
6+
7+
const path = require(`path`)
8+
9+
const Url = require(`url`)
10+
11+
const ProgressBar = require(`progress`)
12+
/**
13+
* getParsedPath
14+
* --
15+
* Parses remote url to a path object
16+
*
17+
*
18+
* @param {String} url
19+
* @return {Object} path
20+
*/
21+
22+
function getParsedPath(url) {
23+
return path.parse(Url.parse(url).pathname)
24+
}
25+
/**
26+
* getRemoteFileExtension
27+
* --
28+
* Parses remote url to retrieve remote file extension
29+
*
30+
*
31+
* @param {String} url
32+
* @return {String} extension
33+
*/
34+
35+
function getRemoteFileExtension(url) {
36+
return getParsedPath(url).ext
37+
}
38+
/**
39+
* getRemoteFileName
40+
* --
41+
* Parses remote url to retrieve remote file name
42+
*
43+
*
44+
* @param {String} url
45+
* @return {String} filename
46+
*/
47+
48+
function getRemoteFileName(url) {
49+
return getParsedPath(url).name
50+
} // TODO remove in V3
51+
52+
function createProgress(message, reporter) {
53+
if (reporter && reporter.createProgress) {
54+
return reporter.createProgress(message)
55+
}
56+
57+
const bar = new ProgressBar(
58+
` [:bar] :current/:total :elapsed s :percent ${message}`,
59+
{
60+
total: 0,
61+
width: 30,
62+
clear: true,
63+
}
64+
)
65+
return {
66+
start() {},
67+
68+
tick() {
69+
bar.tick()
70+
},
71+
72+
done() {},
73+
74+
set total(value) {
75+
bar.total = value
76+
},
77+
}
78+
}
79+
/**
80+
* createFilePath
81+
* --
82+
*
83+
* @param {String} directory
84+
* @param {String} filename
85+
* @param {String} ext
86+
* @return {String}
87+
*/
88+
89+
function createFilePath(directory, filename, ext) {
90+
return path.join(directory, `${filename}${ext}`)
91+
}

packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { isWebUri } = require(`valid-url`)
88
const Queue = require(`better-queue`)
99
const readChunk = require(`read-chunk`)
1010
const fileType = require(`file-type`)
11-
const { createProgress } = require(`gatsby-source-filesystem/utils`)
11+
const { createProgress } = require(`./create-progress`)
1212

1313
const { createFileNode } = require(`gatsby-source-filesystem/create-file-node`)
1414
const {

yarn.lock

+33-1
Original file line numberDiff line numberDiff line change
@@ -13177,6 +13177,19 @@ gather-stream@^1.0.0:
1317713177
version "1.0.0"
1317813178
resolved "https://registry.yarnpkg.com/gather-stream/-/gather-stream-1.0.0.tgz#b33994af457a8115700d410f317733cbe7a0904b"
1317913179

13180+
gatsby-core-utils@^1.10.1:
13181+
version "1.10.1"
13182+
resolved "https://registry.yarnpkg.com/gatsby-core-utils/-/gatsby-core-utils-1.10.1.tgz#97bed40df3fa79800e7ce0c0491680f0aadd6ce7"
13183+
integrity sha512-4P3feGCJckg+DRWWl2beFk7N9c63zmCryEGPaU1OHCp+ZT2bO0ihCBuXywDWuuEp6SYP9PZ1fs0YJ/Rt6q6lag==
13184+
dependencies:
13185+
ci-info "2.0.0"
13186+
configstore "^5.0.1"
13187+
fs-extra "^8.1.0"
13188+
node-object-hash "^2.0.0"
13189+
proper-lockfile "^4.1.1"
13190+
tmp "^0.2.1"
13191+
xdg-basedir "^4.0.0"
13192+
1318013193
gatsby-design-tokens@^2.0.2:
1318113194
version "2.0.13"
1318213195
resolved "https://registry.yarnpkg.com/gatsby-design-tokens/-/gatsby-design-tokens-2.0.13.tgz#33f5fa84a399b821ae224b9921847d7b37c45600"
@@ -13227,6 +13240,25 @@ gatsby-plugin-webfonts@^1.1.4:
1322713240
postcss "^8.2.2"
1322813241
postcss-js "^3.0.3"
1322913242

13243+
13244+
version "2.11.1"
13245+
resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-2.11.1.tgz#c90f49c096c4bdafd8e68462966b3a6e21fd746b"
13246+
integrity sha512-Ao526Mmhm8KkF+0Tvf9Le5kKnqX7kgC1wecp82BW2KLQgdtG7UIgmHvG6PkjuFNiJ2ghXPC3vRK3J/vDPyLtkA==
13247+
dependencies:
13248+
"@babel/runtime" "^7.12.5"
13249+
better-queue "^3.8.10"
13250+
chokidar "^3.4.3"
13251+
file-type "^16.0.0"
13252+
fs-extra "^8.1.0"
13253+
gatsby-core-utils "^1.10.1"
13254+
got "^9.6.0"
13255+
md5-file "^5.0.0"
13256+
mime "^2.4.6"
13257+
pretty-bytes "^5.4.1"
13258+
progress "^2.0.3"
13259+
valid-url "^1.0.9"
13260+
xstate "^4.14.0"
13261+
1323013262
gauge@~2.7.3:
1323113263
version "2.7.4"
1323213264
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
@@ -21544,7 +21576,7 @@ process@~0.5.1:
2154421576
version "0.5.2"
2154521577
resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf"
2154621578

21547-
progress@^2.0.0, progress@^2.0.1, progress@^2.0.3:
21579+
progress@2.0.3, progress@^2.0.0, progress@^2.0.1, progress@^2.0.3:
2154821580
version "2.0.3"
2154921581
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
2155021582

0 commit comments

Comments
 (0)