-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove all dist dependencies * remove lint * add tests * node 12.12 * build then test * version for release
- Loading branch information
Showing
6 changed files
with
2,498 additions
and
2,332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"presets": ["env", "react"], | ||
"plugins": ["transform-object-rest-spread", "babel-plugin-transform-runtime"] | ||
} | ||
"presets": [ | ||
["@babel/preset-env", {"useBuiltIns": false}] | ||
], | ||
"plugins": [ | ||
"@babel/plugin-transform-runtime" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ dist/ | |
dist | ||
.idea | ||
|
||
coverage | ||
.nyc* | ||
docs/_book | ||
gatsby-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
{ | ||
"name": "gatsby-plugin-asset-path", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Gatsby plugin that copies JS and CSS files and static folder to a custom folder", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "babel src --out-dir .", | ||
"lint": "eslint src", | ||
"test": "echo \"No test for now... yes we know.. it's baaaad\"" | ||
"test": "mocha", | ||
"test:watch": "mocha --watch", | ||
"test:html": "nyc --reporter=html mocha" | ||
}, | ||
"author": "Ryan Chung <[email protected]>", | ||
"license": "mit", | ||
|
@@ -21,32 +22,18 @@ | |
"subdirectory" | ||
], | ||
"dependencies": { | ||
"fs-extra": "^7.0.0", | ||
"history": "^4.7.2", | ||
"react": "^16.4.2", | ||
"react-router-dom": "^4.3.1" | ||
"fs-extra": "^7.0.0" | ||
}, | ||
"peerDependencies": { | ||
"gatsby": ">2.4.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^10.0.2", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"eslint": "^5.4.0", | ||
"eslint-config-madecomfy": "^1.0.1", | ||
"eslint-config-prettier": "^3.0.1", | ||
"eslint-plugin-cypress": "^2.0.1", | ||
"eslint-plugin-graphql": "^2.1.1", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jest": "^21.21.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-prettier": "^2.6.2", | ||
"eslint-plugin-promise": "^3.8.0", | ||
"eslint-plugin-react": "^7.11.1", | ||
"eslint-plugin-standard": "^3.1.0" | ||
"@babel/cli": "^7.12.13", | ||
"@babel/core": "^7.12.13", | ||
"@babel/plugin-transform-runtime": "^7.12.13", | ||
"@babel/preset-env": "^7.12.13", | ||
"mocha": "^8.2.1", | ||
"mock-fs": "^4.13.0", | ||
"nyc": "^15.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const mock = require("mock-fs"); | ||
const assert = require("assert"); | ||
const fs = require("fs"); | ||
|
||
const { | ||
onCreateWebpackConfig, // no need to test this. | ||
onPostBuild, | ||
} = require("./gatsby-node"); | ||
|
||
describe("onPostBuild", function () { | ||
beforeEach(function () { | ||
mock({ | ||
public: { | ||
"script.js": "javascript", | ||
"style.css": "css", | ||
"image.png": "png", | ||
static: { | ||
"one.jpg": "jpeg", | ||
"two.png": "png", | ||
}, | ||
resources: { | ||
"textfile.txt": "text", | ||
}, | ||
}, | ||
}); | ||
}); | ||
afterEach(mock.restore); | ||
|
||
after(mock.restore); // for nyc to run... | ||
|
||
it("should copy files with path", function (done) { | ||
onPostBuild({ pathPrefix: "/target/" }, {}).then(function () { | ||
const files = fs.readdirSync("public/target"); | ||
const static = fs.readdirSync("public/target/static"); | ||
assert.deepEqual(files, ["script.js", "static", "style.css"]); | ||
assert.deepEqual(static, ["one.jpg", "two.png"]); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("should copy files with domain", function (done) { | ||
onPostBuild({ pathPrefix: "http://www.domain.com/target/" }, {}).then( | ||
function () { | ||
const files = fs.readdirSync("public/target"); | ||
const static = fs.readdirSync("public/target/static"); | ||
assert.deepEqual(files, ["script.js", "static", "style.css"]); | ||
assert.deepEqual(static, ["one.jpg", "two.png"]); | ||
done(); | ||
}, | ||
); | ||
}); | ||
|
||
it("should copy specific fileTypes other than static files", function (done) { | ||
onPostBuild({ pathPrefix: "/assets/" }, { fileTypes: ["css", "png"] }).then( | ||
function () { | ||
const files = fs.readdirSync("public/assets"); | ||
const static = fs.readdirSync("public/assets/static"); | ||
assert.deepEqual(files, ["image.png", "static", "style.css"]); | ||
assert.deepEqual(static, ["one.jpg", "two.png"]); | ||
done(); | ||
}, | ||
); | ||
}); | ||
|
||
it("should copy specific paths", function (done) { | ||
onPostBuild({ pathPrefix: "/assets/" }, { paths: ["resources"] }).then( | ||
function () { | ||
const files = fs.readdirSync("public/assets"); | ||
const resources = fs.readdirSync("public/assets/resources"); | ||
assert.deepEqual(files, ["resources", "script.js", "style.css"]); | ||
assert.deepEqual(resources, ["textfile.txt"]); | ||
done(); | ||
}, | ||
); | ||
}); | ||
}); |
Oops, something went wrong.