Skip to content

Commit

Permalink
feat: use webpack for browser version
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The following changes are breaking, and may require action on the part of consumers.

* The content of the `dist` folder (used as the `browser` property in the library's `package.json`) is now generated by `webpack` instead of `babel`. The major change is that all content is packaged into a single file, `main.js`. Consumers that were attempting to reference paths in the `dist` directory may need to adjust. The interface of the exported content may have also changed, so clients may need to react.
* Deprecated Node.js versions 14, 15, 16, and 17 are no longer officially supported, but all other node versions up to 22 (current) are tested. Consumers on those node versions will need to update to use the latest version.
  • Loading branch information
mfrisbey authored May 29, 2024
1 parent c404e65 commit 61157c5
Show file tree
Hide file tree
Showing 25 changed files with 5,985 additions and 14,023 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ jobs:

strategy:
matrix:
node-version: [14.21.1, 15.14.0, 16.18.1, 17.9.0, 18.12.1]
node-version: [18.20.3, 19.9.0, 20.13.1, 21.7.3, 22.2.0]

steps:
- uses: actions/checkout@v2
- name: Setup unit test environment
run: sudo apt-get install librsvg2-bin imagemagick exiftool
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
Expand All @@ -33,7 +31,7 @@ jobs:
- name: Build
run: npm run build
- name: Lint
if: ${{ matrix.node-version == '18.12.1' }}
if: ${{ matrix.node-version == '22.2.0' }}
run: npm run lint
- name: Run unit tests
run: npm test
Expand All @@ -55,10 +53,10 @@ jobs:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Use Node.js 18.16
- name: Use Node.js 22.2.0
uses: actions/setup-node@v1
with:
node-version: '18.16'
node-version: '22.2.0'
- run: npm install
- run: npm run build
- run: npm run semantic-release
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.2.0
7 changes: 2 additions & 5 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
["@semantic-release/npm"],
"@semantic-release/npm",
["@semantic-release/git", {
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
"assets": ["package.json", "package-lock.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
"@semantic-release/github"
Expand Down
7 changes: 2 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# [1.2.0](https://github.com/adobe/cloud-service-client/compare/v1.1.0...v1.2.0) (2023-08-08)
# Change Log


### Features

* use more standardized release process. ([#13](https://github.com/adobe/cloud-service-client/issues/13)) ([77e02fb](https://github.com/adobe/cloud-service-client/commit/77e02fba6f5528ec9eeb477841a275c5546ac7aa))
See the module's [releases](https://github.com/adobe/cloud-service-client/releases) for changes.
2 changes: 1 addition & 1 deletion e2e/fetch-verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const fetch = require("node-fetch");
const fetch = require("minipass-fetch");
const assert = require("assert");

const Verifier = require("./verifier");
Expand Down
9 changes: 0 additions & 9 deletions e2e/local-webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const URL = require("url");
/**
* Retrieves the data that has been created in the webserver for the url in the given request.
* Will throw a 404 error if no data has been created at the url.
*
* @param {express.HttpRequest} req Request as provided by express.
* @returns {*} The data that was registered for the url.
*/
Expand All @@ -42,7 +41,6 @@ function getData(req) {

/**
* Sets the data in the webserver for the url in the given request.
*
* @param {express.HttpRequest} req Request as provided by express.
*/
function setData(req) {
Expand All @@ -54,7 +52,6 @@ function setData(req) {
/**
* Deletes the data in the webserver for the url in the given request. Will
* throw a 404 error if no data has been created at the url.
*
* @param {express.HttpRequest} req Request as provided by express.
*/
function deleteData(req) {
Expand All @@ -71,7 +68,6 @@ function deleteData(req) {
* Handles an incoming request by performing common operations on the request, such as
* logging information about the request, overriding normal behavior using registered
* requests, and handling errors.
*
* @param {express.HttpRequest} req Request as provided by express.
* @param {express.HttpResponse} res Response as provided by express.
* @param {Function} toRun Function to run to handle the request, assuming the
Expand Down Expand Up @@ -100,7 +96,6 @@ function handleRequest(req, res, toRun) {

/**
* Logs information about the request with the webserver.
*
* @param {express.HttpRequest} req Request as provided by express.
*/
function logRequest(req) {
Expand All @@ -110,7 +105,6 @@ function logRequest(req) {

/**
* Starts the local webserver and returns information about the host where it's running.
*
* @returns {string} URL of the host where the server is listening.
*/
module.exports = function () {
Expand Down Expand Up @@ -189,7 +183,6 @@ module.exports = function () {

/**
* Registers a raw response that should be returned by the web server on the next request(s).
*
* @param {Array<RequestInfo>} responsesToAdd Responses for the server to return.
*/
function addResponses(responsesToAdd) {
Expand All @@ -201,7 +194,6 @@ module.exports.addResponses = addResponses;
/**
* Convenience method that registers the status codes (only) that should be returned by the web server
* on the next request(s).
*
* @param {Array<number>} codes Status codes for the server to return.
*/
module.exports.addStatusCodes = (codes) => {
Expand All @@ -214,7 +206,6 @@ module.exports.addStatusCodes = (codes) => {

/**
* Retrieves all requests that have been received by the server.
*
* @returns {Array<express.HttpRequest>} Raw express requests.
*/
module.exports.getRequests = () => {
Expand Down
11 changes: 0 additions & 11 deletions e2e/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class Verifier {
// eslint-disable-next-line jsdoc/require-returns-check
/**
* Retrieves the export that should be used in conjunction with the verifier.
*
* @param {*} clientExports Exports from the HTTP client.
* @param {typedefs.ClientOptions} options Options to use with the backend.
* @returns {*} Export for the verifier.
Expand All @@ -38,7 +37,6 @@ class Verifier {
/**
* Verifies that a given object contains the custom properties expected in client
* responses.
*
* @param {*} toVerify Item to be verified.
*/
verifyClientProperties(toVerify) {
Expand All @@ -62,7 +60,6 @@ class Verifier {
*
* This function will look for client-specific values within an "options"
* property on the target.
*
* @param {*} toVerify Item to be verified.
* @param {*} expected Simple object whose keys and values will be verified
* on the target. The value of the key may be a function; if so, the function
Expand All @@ -78,7 +75,6 @@ class Verifier {
/**
* Verifies that a given object contains specific custom properties expected in
* client responses.
*
* @param {*} toVerify Item to be verified.
* @param {*} expected Simple object whose keys and values will be verified
* on the target. The value of the key may be a function; if so, the function
Expand All @@ -101,7 +97,6 @@ class Verifier {

/**
* Ensures that a given response indicates success.
*
* @param {*} res Response received from an underlying HTTP library.
* @param {number} [expectedStatus] Expected status code of the response. Default: 200.
*/
Expand All @@ -115,7 +110,6 @@ class Verifier {

/**
* Ensures that a given response indicates failure.
*
* @param {Function} toRun Function to run that will generate an HTTP response. It will receive
* no arguments, and should return a Promise that resolves to an HTTP response from the
* underlying HTTP library.
Expand All @@ -131,7 +125,6 @@ class Verifier {
/**
* Not intended to be called directly. Can be implemented by child classes to perform any
* additional library-specific verification on success responses.
*
* @param {*} res Response received from an underlying HTTP library.
*/
verifySpecificSuccess(res) {
Expand All @@ -141,7 +134,6 @@ class Verifier {
// eslint-disable-next-line jsdoc/require-returns-check
/**
* Retrieves the value of an HTTP header from a response.
*
* @param {*} res Response received from an underlying HTTP library.
* @param {string} header Name of the header to retrieve.
* @returns {string} Value of the given header.
Expand All @@ -152,7 +144,6 @@ class Verifier {

/**
* Verifies that the body of an HTTP response is an expected value.
*
* @param {*} res Response received from an underlying HTTP library.
* @param {object} expectedBody Expected value of the body, typically a simple
* javascript object.
Expand All @@ -165,7 +156,6 @@ class Verifier {

/**
* Verifies that the body of an HTTP request is empty.
*
* @param {*} res Response received from an underlying HTTP library.
* @returns {Promise} Should resolve when the verification is complete.
*/
Expand All @@ -176,7 +166,6 @@ class Verifier {

/**
* Retrieves the body of an HTTP response.
*
* @param {*} res Response received from an underlying HTTP library.
* @returns {Promise<object>} The body of the response as a simple javascript object.
*/
Expand Down
Loading

0 comments on commit 61157c5

Please sign in to comment.