1.0.54 • Published 2 years ago

@sds-stream/library v1.0.54

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

SDS Nextjs Component Library

To directly view an example of how this library works, look at the existing files in the src folder.

It is desirable to abstract out components that are regularly used across sites into a separate library which you then call from a higher level. Often when using components in sites, you use default exports. When importing your component to this library, you want to use named exports. For example

const Component = ... // Code for component
... // Misc other supporting code

export default Component;

The above is instead written as

const Component = ... // Code for component
... // Misc other supporting code

export { Component };

You also don't need the index.js file instead of the component folder. In the library, the index.js file lives one folder up in the parent and exports the individual components like so:

export { Component } from './Component/Component';

All of this will be fairly clear when going over the existing components and index.js file in the src folder.

How to update library

Once you're done adding your component appropriately, run the following commands: NOTE: DO THE LOG IN ONLY THE FIRST TIME

git add . # run this on whatever particular folder/files you want to add
git commit -m 'commit message'
npm login # the username is 'sds-stream', pw is raa1lu2M555, choose your own email address
npm run build
npm version patch # the npm version command can take other flags like major, minor, patch. but going with patch for now
npm publish

Using components from library in other places

The above steps are only really necessary when you're adding or modifying the library. If you simply want to use a component from the library, you don't even need to clone this repository. All you do is go inside the folder that you'd like to add a component to and run the following:

npm install @sds-stream/library

And then in your appropriate source code, do an import like:

import { Component1, Component2, ... } from '@sds-stream/library';
1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.49

2 years ago

1.0.44

2 years ago

1.0.45

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.39

2 years ago

1.0.17

2 years ago

1.0.38

2 years ago

1.0.16

2 years ago

1.0.40

2 years ago

1.0.22

2 years ago

1.0.43

2 years ago

1.0.21

2 years ago

1.0.42

2 years ago

1.0.20

2 years ago

1.0.41

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago