1.0.2-dev.2 • Published 9 months ago

@scrippsproduct/scripps-external-component-library v1.0.2-dev.2

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

Scripps External Component Library

A collection of React components in Storybook for use with ORION related applications. The library can be viewed at Chormatic - External Component Libray. The NPM package can be found here: ORION Component Library.

Getting Started

  • clone this repository to a local folder and navigate to that folder
  • make sure you are using a Node LTS version of 20.15.0 or higher (it is recommended to use NVM for node version management)
  • install dependencies (run npm install)
  • run the project (npm run storybook) - this will start a local server on port 6006
    • the script will automatically open the project in a browser tab at https://localhost:6006
    • 6006 is the default port, the script may ask to open on a differnet port if it detects 6006 is already in use

Adding New Components

This library is setup to handle either tsx or jsx components.

Manual Approach

  • create a new folder in the components folder corresponding to the name of the component you will be creating.
  • inside this folder create 4 new files
    1. index.ts/js - this file will only conatain an import of your component (import { Example } from './Example')
    2. a tsx/jsx file named after the component (Example.tsx)
    3. a stories file named after the component (Example.stories.tsx)
    4. and a scss module file also named after the component (Example.module.scss)
    • if you are using TypeScript you may also wish to create a separate file to define your types (Example.types.ts)
    • this is the minimum set of files in this folder, there may be circumstatnces where you will require others
  • in order for your component to be available in the package you will need to export it from src/index.ts (export { Example } from './components/Example')

Automated Approach

  • there is a helper script to help facilitate creating new components
    • use the command npm run create-component {component name} {component file type tsx/jsx} (i.e. npm run create-component newComponent tsx)
    • a new folder with the component name will be created in the components folder and it will contain a base set of new files that contain some boilerplate code

Publishing prerelease versions for testing or review

  • create a new brach off of the master branch
    • name this branch by incrementing the patch version number by 1 and prefixing with a v and followed by a prerelease id of -dev
      • current version 0.1.0 => v0.1.1-dev
  • update the version number of the main package.json file to reflect the number used to create the branch (i.e. "version": "0.1.1-dev.0") and commit this update to the branch
  • you may merge any branches that contain updates for this version, or create your updates directly on this branch
  • push your changes to this branch
  • to publish this version run npm build and then npm publish
    • note that if you use an authenticator app as your method of 2FA you can add the code directly in the command line by using the otp option: npm publish --otp={code from app}
  • once the version is published it can be used in a project by using the version number you created (i.e. "@scrippsproduct/orion-component-library": "~0.1.1-dev.0")
  • if after review futher revisions are required, you will need to change the version number in the package.json file.
    • 0.1.1-dev.0 => 0.1.1-dev.1 (this is neccessay because NPM will not allow a package to be published with the same version number)
    • if all of your changes have been commited this may also be accomplished by running npm run version prerelease --preid=dev
  • then publish as described previously

Publishing a new patch, minor or major version

  • create a new branch from master and name it with the new version number (i.e. a new patch version v0.1.2)
  • merge all updates to be included in the new version to this new branch
  • update the version number in the main package.json file ("version": "0.1.2")
  • commit the changes & push the new branch
  • make a merge request to have this branch merged with master and published
    • in your merge request include a list of the changes from the previous version

Publishing the library to Chromatic for reviewers

  • run the chromatic script (npm run chromatic)
    • this will create a new build on Chromatic from the current active branch
  • if you run into visual discrepencies those will need to be approved prior to reviewers being able to view the new build
  • once the build has passed approval direct reviewers to the project on Chromatic by using your branch name in this URL: https://{branch name here}--.chromatic.com (i.e. https://v0.1.1-dev--6320f9b58155e710d0652e0d.chromatic.com)
    • note that since this is a URL if you use a forward slash in your branch (i.e. feature/something) the forward slash will need to be a dash (-) in the URL (https://feature-something--6320f9b58155e710d0652e0d.chromatic.com)

Available Scripts

  • storybook: compiles and runs the project locally on localhost:6006
  • build: compiles TypeScript and Javascript files into the dist folder
    • the files produced are ready to be published as a new version
    • the dist folder is the only folder that is included in the published package
  • chromatic: will create a new build version on Chromatic
    • this process will run a visual test of all components, if there are any discrepancies they will have to be approved before the new version will be available to view
  • create-component: requires 2 paramters, 1) the component name 2) the component file type (tsx/jsx), will create a new component folder with boilerplate files
  • build-storybook: builds a production ready version of the project for hosting the library on a server
    • this can be useful for debugging build errors while trying to build to Chromatic

Using this library in a local project

This isn't working currently

  • run the distribute script (npm run distribute)
  • in the package.json of your project link your library dependency to the root folder of this library (i.e. "@scrippsproduct/brightspot-component-library": "file:../brightspot-component-library")
  • re-install the dependencies in the local project
  • you can now import components from the local library into your project
1.0.2-dev.1

9 months ago

1.0.2-dev.2

9 months ago

1.0.2-dev.0

9 months ago

0.2.71-dev

1 year ago

0.2.70-dev

1 year ago

0.2.73

12 months ago

0.2.72

12 months ago

0.2.70

1 year ago

0.2.69-dev

1 year ago

0.2.72-dev

1 year ago

0.2.70-beta.0

1 year ago

0.2.70-beta.1

1 year ago

1.0.1

11 months ago

1.0.0

11 months ago

0.2.69

1 year ago

0.2.68

1 year ago

0.2.67

1 year ago

0.2.66

1 year ago

0.2.65

1 year ago

0.2.64

1 year ago

0.2.73-beta.7

11 months ago

0.2.73-beta.4

11 months ago

0.2.73-beta.3

11 months ago

0.2.73-beta.6

11 months ago

0.2.73-beta.5

11 months ago

0.2.73-beta.2

11 months ago

0.2.73-beta.1

11 months ago

1.0.1-dev.0

11 months ago

1.0.1-dev.1

11 months ago

1.0.1-dev.3

11 months ago

0.2.62-dev

1 year ago

0.2.62

1 year ago

0.2.61

1 year ago

0.2.59-dev

1 year ago

0.2.60

1 year ago

0.2.59

1 year ago

0.2.58

1 year ago

0.2.57

1 year ago

0.2.56

1 year ago

0.2.54-dev

1 year ago

0.2.55-dev

1 year ago

0.2.54

1 year ago

0.2.52

1 year ago

0.2.51

1 year ago

0.2.50

1 year ago

0.2.53

1 year ago

0.2.49

1 year ago

0.2.48

1 year ago

0.2.47

1 year ago

0.2.46

1 year ago

0.2.45

1 year ago

0.2.44

1 year ago

0.2.43

1 year ago

0.2.42

1 year ago

0.2.41

1 year ago

0.2.40

1 year ago

0.2.39

1 year ago

0.2.38

1 year ago

0.2.37

1 year ago

0.2.36

1 year ago

0.2.35

1 year ago

0.2.34

1 year ago

0.2.33

1 year ago

0.2.32

1 year ago

0.2.30

1 year ago

0.2.31

1 year ago

0.2.29

1 year ago

0.2.28

1 year ago

0.2.27

2 years ago

0.2.26-dev

2 years ago

0.2.26

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.1.190

2 years ago

0.1.192

2 years ago

0.1.191

2 years ago

0.1.198

2 years ago

0.1.197

2 years ago

0.1.199

2 years ago

0.1.194

2 years ago

0.1.193

2 years ago

0.1.196

2 years ago

0.1.195

2 years ago

0.2.16

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.1.179

2 years ago

0.1.176

2 years ago

0.1.175

2 years ago

0.1.178

2 years ago

0.1.177

2 years ago

0.1.172

2 years ago

0.1.171

2 years ago

0.1.174

2 years ago

0.1.173

2 years ago

0.1.181

2 years ago

0.1.180

2 years ago

0.2.1

2 years ago

0.2.7

2 years ago

0.1.187

2 years ago

0.2.6

2 years ago

0.1.186

2 years ago

0.2.9

2 years ago

0.1.189

2 years ago

0.2.8

2 years ago

0.1.188

2 years ago

0.2.3

2 years ago

0.1.183

2 years ago

0.2.2

2 years ago

0.1.182

2 years ago

0.2.5

2 years ago

0.1.185

2 years ago

0.2.4

2 years ago

0.1.184

2 years ago

0.1.170

2 years ago

0.1.118

2 years ago

0.1.117

2 years ago

0.1.119

2 years ago

0.1.114

2 years ago

0.1.113

2 years ago

0.1.116

2 years ago

0.1.115

2 years ago

0.1.110

2 years ago

0.1.112

2 years ago

0.1.111

2 years ago

0.1.129

2 years ago

0.1.128

2 years ago

0.1.125

2 years ago

0.1.124

2 years ago

0.1.127

2 years ago

0.1.126

2 years ago

0.1.121

2 years ago

0.1.120

2 years ago

0.1.123

2 years ago

0.1.122

2 years ago

0.1.139

2 years ago

0.1.136

2 years ago

0.1.135

2 years ago

0.1.138

2 years ago

0.1.137

2 years ago

0.1.132

2 years ago

0.1.131

2 years ago

0.1.134

2 years ago

0.1.133

2 years ago

0.1.130

2 years ago

0.1.147

2 years ago

0.1.146

2 years ago

0.1.149

2 years ago

0.1.148

2 years ago

0.1.143

2 years ago

0.1.142

2 years ago

0.1.145

2 years ago

0.1.144

2 years ago

0.1.141

2 years ago

0.1.140

2 years ago

0.1.158

2 years ago

0.1.157

2 years ago

0.1.159

2 years ago

0.1.154

2 years ago

0.1.153

2 years ago

0.1.156

2 years ago

0.1.155

2 years ago

0.1.150

2 years ago

0.1.152

2 years ago

0.1.151

2 years ago

0.1.169

2 years ago

0.1.168

2 years ago

0.1.165

2 years ago

0.1.164

2 years ago

0.1.167

2 years ago

0.1.166

2 years ago

0.1.161

2 years ago

0.1.160

2 years ago

0.1.163

2 years ago

0.1.162

2 years ago

0.1.107

2 years ago

0.1.106

2 years ago

0.1.109

2 years ago

0.1.108

2 years ago

0.1.105

2 years ago

0.1.104

2 years ago

0.1.52

2 years ago

0.1.53

2 years ago

0.1.54

2 years ago

0.1.55

2 years ago

0.1.56

2 years ago

0.1.57

2 years ago

0.1.58

2 years ago

0.1.59

2 years ago

0.1.50

2 years ago

0.1.51

2 years ago

0.1.49

2 years ago

0.1.41

2 years ago

0.1.42

2 years ago

0.1.43

2 years ago

0.1.44

2 years ago

0.1.45

2 years ago

0.1.46

2 years ago

0.1.47

2 years ago

0.1.48

2 years ago

0.1.40

2 years ago

0.1.38

2 years ago

0.1.39

2 years ago

0.1.30

2 years ago

0.1.31

2 years ago

0.1.32

2 years ago

0.1.33

2 years ago

0.1.34

2 years ago

0.1.35

2 years ago

0.1.36

2 years ago

0.1.37

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.29

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.19

2 years ago

0.1.96

2 years ago

0.1.97

2 years ago

0.1.98

2 years ago

0.1.99

2 years ago

0.1.90

2 years ago

0.1.91

2 years ago

0.1.92

2 years ago

0.1.93

2 years ago

0.1.94

2 years ago

0.1.95

2 years ago

0.1.85

2 years ago

0.1.86

2 years ago

0.1.87

2 years ago

0.1.88

2 years ago

0.1.89

2 years ago

0.1.80

2 years ago

0.1.81

2 years ago

0.1.82

2 years ago

0.1.83

2 years ago

0.1.84

2 years ago

0.1.74

2 years ago

0.1.75

2 years ago

0.1.76

2 years ago

0.1.77

2 years ago

0.1.78

2 years ago

0.1.79

2 years ago

0.1.70

2 years ago

0.1.71

2 years ago

0.1.72

2 years ago

0.1.73

2 years ago

0.1.63

2 years ago

0.1.64

2 years ago

0.1.65

2 years ago

0.1.66

2 years ago

0.1.67

2 years ago

0.1.68

2 years ago

0.1.69

2 years ago

0.1.60

2 years ago

0.1.61

2 years ago

0.1.62

2 years ago

0.1.103

2 years ago

0.1.102

2 years ago

0.1.101

2 years ago

0.1.100

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.8

2 years ago

0.1.17

2 years ago

0.1.7

2 years ago

0.1.18

2 years ago

0.1.9

2 years ago

0.1.4

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago