1.5.34 • Published 7 months ago

@looker/components-providers v1.5.34

Weekly downloads
6,007
License
MIT
Repository
github
Last release
7 months ago

Build Status

This repository hosts the Looker UI Components library and the platform needed to generate our style guide. If you're looking for documentation for using Looker UI Components within your own application, you can view the documentation online at http://components.looker.com

Bugs & Feature Requests

Please file issues on Github Issues

Contents

  1. Setting up the Project
  2. Looker UI Components Development
  3. Yarn Link

Setting up

Install Yarn

This is a monorepo utilizing Lerna and Yarn Workspaces. It is composed of a collection of packages.

If you don't have yarn installed, have a look at https://yarnpkg.com/en/docs/install and choose the appropriate installation for your environment.

We recommend using Node Version Manager (NVM) to manage multiple versions of Node. Once installed you can simply type nvm use in side the repository to get the appropriate version of Node installed. Then you'll need to install Yarn globally via NPM - npm install --global yarn

Clone this Repository & Setup

  1. git clone git@github.com:looker-open-source/components.git
  2. yarn

Packages

  • @looker/components — The shared component library which powers various Looker applications
  • @looker/design-tokens — Default design values as well as our connection to styled-system
  • @looker/icons — SVG icon library, normally consumed by the <Icon /> component in our shared component library
  • @looker/components-test-utils — Useful functions for mocking values and testing components.
  • www — The Gatsby site which powers our living style guide
  • playground — A convenient React environment used for developing Looker UI Components
  • server — A local proxy server used for querying data from production endpoints while in development.

Common Project Commands

  • yarn develop shortcut for booting up www, playground, and server packages for local development
  • yarn workspace www develop starts the Gatsby server
  • yarn workspace @looker/components develop builds the component library with a --watch flag. Useful when actively developing a component and you wish to see the changes appear in either the style guide or react playground
  • yarn workspace playground develop starts a bare-bones React app used for developing our shared components
  • yarn workspace server develop starts a local proxy server to facilitate local fetch requests
  • yarn build runs build across all packages. This calls several subtasks
    • yarn build:es use lerna to do babel build on all packages in proper order
    • yarn postbuild use lerna to typescript declarations in proper order and then run lint (see lint below)
  • yarn lint runs all lint checks in parallel
    • yarn lint:css run stylelint
    • yarn lint:es run eslint
    • yarn lint:ts run tsc
  • yarn test runs Jest across all packages

Workspace Commands

If you're working with a specific workspace you can run commands within that specific workspace (package) by pre-pending the yarn command like so:

yarn workspace [workspace-package-name] [command]

E.g.: yarn workspace @looker/components build:es

Publishing Components

We follow a semantic versioning scheme. That means:

  1. API changes are only allowed in major version changes.
  2. Backwards compatible API changes can occur in minor version changes.
  3. Bug fixes occur in patch version changes.

Update Changelog & Version

  1. Increment the version number according to sematic versioning philosophy in package.json
  2. Update CHANGELOG
  3. PR for package.json & CHANGELOG changes
  4. Merge PR

4. Tooling

Automate code formatting and correctness whenever possible

This project takes the perspective that, as much as possible, code style (code formatting, alignment, interchangeable idioms, etc) should be dictated by automated tooling. This means tooling that can statically analyze code and actually rewrite it, either for the purpose of consistent formatting or correctness. This approach not only saves time by eliminating arguments about preferred code styles, it also reduces arbitrary diff noise for code reviewers, and decreases an engineer's overhead needed to keep code consistent with a code style or linter.

Use lint rules to eliminate dangerous anti-patterns

When automated tooling cannot reformat code without causing logical errors, this project employs linter rules to ensure it produces consistent, correct code. An example of one of these rules is the TSLint no-namespace rule. Namespacing, while a valid feature in Typescript, is the byproduct of Typescript evolving during a time when ES6 style modules did not exist (nor did the tooling around them). Typescript itself calls out ES6 modules as the best approach to code organization moving forward:

Starting with ECMAScript 2015, modules are native part of the language, and should be supported by all compliant engine implementations. Thus, for new projects modules would be the recommended code organization mechanism.

To ensure Typescript namespaces are never introduced into this project (because we use ES6 modules), our linter configuration disallows any use of them in code.

Automated Tooling

The monorepo leverages with a few code tools baked into the component authoring workflow:

  • Prettier simply reformats code. It has few options, intentionally, to eliminate discussion about how to configure those options.
  • ESLint is the standard Javascript & Typescript linting tool. It comes with a --fix flag which can fix many of the errors it finds.
  • Stylelint lints the CSS code in the app.
Using the tooling

The majority of the time, using these tools should be transparent as they are hooked into a fast pre-commit hook that is enabled for all developers. If one of the lint or prettier steps fail during the pre-commit hook you'll have to fix the error before committing.

You can also configure some editors to apply their formatting on save, this is discussed in a different section below. Sometimes, however you might want to run each command manually. Below is a list of the available commands:

yarn <command>

  • lint Runs all of the linters in order
  • lint:es Lint all of the ES6 & Typescript files, including tests
  • lint:css Lint all of the CSS, including inlined CSS
  • lint:ts Run Typescript compiler to verify type-safety

5. IDE Support & Configuration

Code in this project is written in Typescript and the core team uses VSCode as our IDE of choice. Please feel free to add your favorite editor's mechanism of support if you wish.

VS Code

A settings.json file is checked into the repository, which contains some required settings for VS Code.

Additionally a simplistic launch.json file is also included which should allow developers to quickly run and debug tests locally, through the Jest test runner. This file is based off of the recommendations here.

Running Tests
  1. Go to the "Debug" panel in VS Code
  2. In the top left choose either "Jest All" or "Jest Current File"
  3. Click the Play button
Strongly Recommended Plugins
  • Styled Components enables sytax highlighting and intellisense for inline CSS.
  • ESLint enables inline linting and fixing of code on save. If you have the older vscode-tslint plugin installed, uninstall it first.
Very Helpful Plugins
  • Spell Check enables spell checking in code
  • Colorize displays known colors (string values, hex, rgb, etc) as their actual color value
  • Prettier enables Prettier code formatting on save
  • Rewrap wraps comments at the 80 character column mark automatically
  • Sort Lines quickly resort lines of code

Yarn Link

Since Looker UI Components are often developed in tandem with another repo it can be useful to use Yarn's link functionality to develop new components and test the built output without having to commit and publish the changes.

See Yarn's Link documentation (https://yarnpkg.com/lang/en/docs/cli/link/) for setting up the link between the @looker/components package and your project.

To work properly you'll need to make this addition to your webpack.config.js file:

  resolve: {
    alias: {
      'styled-components': path.resolve(
        __dirname,
        'node_modules',
        'styled-components',
      ),
    }
  }

Finally, only changes that have been built will be reflected in the linked package so run yarn build when you want to refresh the locally-built version.

1.5.32

8 months ago

1.5.34

7 months ago

1.5.33

8 months ago

1.5.31

1 year ago

1.5.30

1 year ago

1.5.29

1 year ago

1.5.27

2 years ago

1.5.28

2 years ago

1.5.25

2 years ago

1.5.24

2 years ago

1.5.26

2 years ago

1.5.21

2 years ago

1.5.20

2 years ago

1.5.23

2 years ago

1.5.22

2 years ago

1.5.18

2 years ago

1.5.19

2 years ago

1.5.14

2 years ago

1.5.16

2 years ago

1.5.15

2 years ago

1.5.17

2 years ago

1.5.10

3 years ago

1.5.12

3 years ago

1.5.11

3 years ago

1.5.13

3 years ago

1.5.9

3 years ago

1.5.8

3 years ago

1.5.5

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.5.0-alpha.1

3 years ago

1.5.0-alpha.0

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.3-alpha.0

3 years ago

1.4.2

3 years ago

1.4.2-alpha.1

3 years ago

1.4.2-alpha.0

3 years ago

1.4.1

3 years ago

1.4.1-alpha.0

3 years ago

1.4.1-alpha.1

3 years ago

1.4.0

3 years ago

1.4.0-alpha.1

3 years ago

1.4.0-alpha.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.3.0-alpha.1

3 years ago

1.3.0-alpha.0

3 years ago

1.2.0

3 years ago

1.2.0-alpha.5

3 years ago

1.2.0-alpha.4

3 years ago

1.2.0-alpha.3

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.2.0-alpha.2

3 years ago

1.2.0-alpha.1

3 years ago

1.2.0-alpha.0

3 years ago

1.1.1

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.0-canary.241

3 years ago

1.0.0

3 years ago

0.18.0

3 years ago

0.17.0

3 years ago

0.16.2-canary.0

3 years ago

0.16.1

3 years ago

0.16.2

3 years ago

0.16.1-canary.0

3 years ago

0.16.0

3 years ago

0.15.1

3 years ago

0.15.2-canary.0

3 years ago

0.15.1-canary.0

3 years ago

0.14.2-canary.0

3 years ago

0.14.1

3 years ago

0.14.0

3 years ago

0.14.1-canary.0

3 years ago

0.13.0

3 years ago

0.13.1-canary.0

3 years ago

0.12.1-canary.0

3 years ago

0.12.0

3 years ago

0.11.0

3 years ago

0.11.1-canary.0

3 years ago

0.10.4-canary.0

3 years ago

0.10.3

3 years ago

0.10.5-canary.0

3 years ago

0.10.4

3 years ago

0.10.3-canary.0

3 years ago

0.10.2-canary.0

3 years ago

0.10.1

3 years ago

0.10.2

3 years ago

0.10.1-canary.0

3 years ago

0.10.0

3 years ago

0.9.30-alpha.37

3 years ago

0.9.29

3 years ago

0.9.27

3 years ago

0.9.26

3 years ago

0.9.25

3 years ago

0.9.24

3 years ago

0.9.23

3 years ago

0.9.23-alpha.6

4 years ago

0.9.21

4 years ago

0.9.20

4 years ago

0.9.17

4 years ago

0.9.16

4 years ago

0.9.15

4 years ago

0.9.14

4 years ago

0.9.12

4 years ago

0.9.10

4 years ago

0.9.8-faux.44

4 years ago

0.9.8-faux.46

4 years ago

0.9.8-alpha.44

4 years ago

0.9.8-alpha.47

4 years ago

0.9.8-alpha.48

4 years ago

0.9.8-alpha.46

4 years ago

0.9.8-alpha.45

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.4

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.7

4 years ago

0.8.5

4 years ago

0.8.3

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.36

4 years ago

0.7.35-beta.3.2

4 years ago

0.7.35-beta.2.2

4 years ago

0.7.35-beta.2.1

4 years ago

0.7.35-beta.1

4 years ago

0.7.35-alpha.6

4 years ago

0.7.35-alpha.5

4 years ago

0.7.35-alpha.2

4 years ago

0.7.35-alpha.0

4 years ago

0.7.35-alpha.1

4 years ago

0.7.34

4 years ago

0.7.33

4 years ago

0.7.32

4 years ago

0.7.30

4 years ago

0.7.29

4 years ago

0.7.28

4 years ago

0.7.26

4 years ago