Skip to content

Commit

Permalink
copy missing progress fn (this is temporary)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBarnes committed Feb 27, 2021
1 parent f6edccf commit 4226459
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/gatsby-source-wordpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@rematch/core": "^1.3.0",
"@rematch/immer": "^1.2.0",
"async-retry": "^1.3.1",
"progress": "2.0.3",
"atob": "^2.1.2",
"axios": "^0.21.1",
"axios-rate-limit": "^1.3.0",
Expand All @@ -31,7 +32,7 @@
"gatsby-core-utils": "^2.1.0-next.1",
"gatsby-image": "^3.1.0-next.1",
"gatsby-plugin-catch-links": "^3.1.0-next.1",
"gatsby-source-filesystem": "^3.1.0-next.1",
"gatsby-source-filesystem": "2.11.1",
"glob": "^7.1.6",
"got": "^11.7.0",
"graphql-query-compress": "^1.2.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
exports.__esModule = true
exports.getRemoteFileExtension = getRemoteFileExtension
exports.getRemoteFileName = getRemoteFileName
exports.createProgress = createProgress
exports.createFilePath = createFilePath

const path = require(`path`)

const Url = require(`url`)

const ProgressBar = require(`progress`)
/**
* getParsedPath
* --
* Parses remote url to a path object
*
*
* @param {String} url
* @return {Object} path
*/

function getParsedPath(url) {
return path.parse(Url.parse(url).pathname)
}
/**
* getRemoteFileExtension
* --
* Parses remote url to retrieve remote file extension
*
*
* @param {String} url
* @return {String} extension
*/

function getRemoteFileExtension(url) {
return getParsedPath(url).ext
}
/**
* getRemoteFileName
* --
* Parses remote url to retrieve remote file name
*
*
* @param {String} url
* @return {String} filename
*/

function getRemoteFileName(url) {
return getParsedPath(url).name
} // TODO remove in V3

function createProgress(message, reporter) {
if (reporter && reporter.createProgress) {
return reporter.createProgress(message)
}

const bar = new ProgressBar(
` [:bar] :current/:total :elapsed s :percent ${message}`,
{
total: 0,
width: 30,
clear: true,
}
)
return {
start() {},

tick() {
bar.tick()
},

done() {},

set total(value) {
bar.total = value
},
}
}
/**
* createFilePath
* --
*
* @param {String} directory
* @param {String} filename
* @param {String} ext
* @return {String}
*/

function createFilePath(directory, filename, ext) {
return path.join(directory, `${filename}${ext}`)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { isWebUri } = require(`valid-url`)
const Queue = require(`better-queue`)
const readChunk = require(`read-chunk`)
const fileType = require(`file-type`)
const { createProgress } = require(`gatsby-source-filesystem/utils`)
const { createProgress } = require(`./create-progress`)

const { createFileNode } = require(`gatsby-source-filesystem/create-file-node`)
const {
Expand Down
34 changes: 33 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13177,6 +13177,19 @@ gather-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/gather-stream/-/gather-stream-1.0.0.tgz#b33994af457a8115700d410f317733cbe7a0904b"

gatsby-core-utils@^1.10.1:
version "1.10.1"
resolved "https://registry.yarnpkg.com/gatsby-core-utils/-/gatsby-core-utils-1.10.1.tgz#97bed40df3fa79800e7ce0c0491680f0aadd6ce7"
integrity sha512-4P3feGCJckg+DRWWl2beFk7N9c63zmCryEGPaU1OHCp+ZT2bO0ihCBuXywDWuuEp6SYP9PZ1fs0YJ/Rt6q6lag==
dependencies:
ci-info "2.0.0"
configstore "^5.0.1"
fs-extra "^8.1.0"
node-object-hash "^2.0.0"
proper-lockfile "^4.1.1"
tmp "^0.2.1"
xdg-basedir "^4.0.0"

gatsby-design-tokens@^2.0.2:
version "2.0.13"
resolved "https://registry.yarnpkg.com/gatsby-design-tokens/-/gatsby-design-tokens-2.0.13.tgz#33f5fa84a399b821ae224b9921847d7b37c45600"
Expand Down Expand Up @@ -13227,6 +13240,25 @@ gatsby-plugin-webfonts@^1.1.4:
postcss "^8.2.2"
postcss-js "^3.0.3"

gatsby-source-filesystem@2.11.1:
version "2.11.1"
resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-2.11.1.tgz#c90f49c096c4bdafd8e68462966b3a6e21fd746b"
integrity sha512-Ao526Mmhm8KkF+0Tvf9Le5kKnqX7kgC1wecp82BW2KLQgdtG7UIgmHvG6PkjuFNiJ2ghXPC3vRK3J/vDPyLtkA==
dependencies:
"@babel/runtime" "^7.12.5"
better-queue "^3.8.10"
chokidar "^3.4.3"
file-type "^16.0.0"
fs-extra "^8.1.0"
gatsby-core-utils "^1.10.1"
got "^9.6.0"
md5-file "^5.0.0"
mime "^2.4.6"
pretty-bytes "^5.4.1"
progress "^2.0.3"
valid-url "^1.0.9"
xstate "^4.14.0"

gauge@~2.7.3:
version "2.7.4"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
Expand Down Expand Up @@ -21544,7 +21576,7 @@ process@~0.5.1:
version "0.5.2"
resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf"

progress@^2.0.0, progress@^2.0.1, progress@^2.0.3:
progress@2.0.3, progress@^2.0.0, progress@^2.0.1, progress@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"

Expand Down

0 comments on commit 4226459

Please sign in to comment.