Skip to content

Latest commit

 

History

History
103 lines (84 loc) · 3.27 KB

File metadata and controls

103 lines (84 loc) · 3.27 KB

Build Status codecov

Internet Archive Reviews

A component for displaying and editing reviews for items on the Internet Archive.

Installation

npm install @internetarchive/reviews

Usage

Note: The release currently only includes the web component for rendering the review edit form, and the form will trigger the spam detector unless a valid token is passed in.

Default review form:

<ia-review-form .identifier=${'foo'}></ia-review-form>

Form with prefilled previous review:

const myReview = new Review({
  stars: 3,
  reviewtitle: 'What a cool book!',
  reviewbody: 'I loved it.',
})

<ia-review-form .identifier=${'foo'} .oldReview=${myReview}></ia-review-form>

Submittable form with token:

import { VALID_TOKEN } from './constants.ts'

<ia-review-form .identifier=${'foo'} .token=${VALID_TOKEN}></ia-review-form>

Development

Prerequisite

npm install

Testing

npm run test

Local Demo

npm run start

Note: If you'd like ReCaptcha to work in your dev environment, you'll want to temporarily replace the defaultSiteKey in app-root.ts with the current IA site key. If you don't know what that is, ask in the UX team channel.

Watch mode

npm run test:watch

Linting

To scan the project for linting errors, run

npm run lint

You can lint with ESLint and Prettier individually as well

npm run lint:eslint
npm run lint:prettier

To automatically fix many linting errors, run

npm run format

You can format using ESLint and Prettier individually as well

npm run format:eslint
npm run format:prettier

Releasing alpha and production tagged packages to NPM

Releasing alpha and test packages

  • Use your Jira ticket to create your namespace. This will prevent collision as many people can be simultaneously working in the same repository.
    • run: npm version prerelease --preid=wedev-1234
      • this command will help auto-increment your alpha package tags inside your jira ticket namespace. refer to npm versioning docs & [guides for more info on command options](- this command will help auto-increment your alpha package tags inside your jira ticket namespace)
    • run: npm publish --tag alpha our most used development tags are: alpha, canary

Releasing production level package

We like to create a pull request specifically after the expected changes are merged into the main branch. Steps:

  • create PR with version number as branch name. Ex, if the next version is 3.2.1, your git command will be: git checkout -b v3.2.1
    • in the new branch, run the following:
      1. git pull --tags to fetch all git tags
      2. npm version X.X.X to set the new tag WITH the commit git tagged
      3. git push --tags
      4. npm publish
  • Note: version numbers must start at minimum, with 1 (1.x.x) in order for consumers to automatically receive patch updates (no tags starting with 0, like 0.x.x)