Skip to content

Commit

Permalink
chore(*): change npm scope to @kong-ui-public (#40)
Browse files Browse the repository at this point in the history
* chore(rename): kong-ui-public

* chore: add global

* chore: fix names
  • Loading branch information
adamdehaven authored Jan 24, 2023
1 parent 3d0f2c7 commit c8c3c4f
Show file tree
Hide file tree
Showing 36 changed files with 166 additions and 171 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You can also run `pnpm install-completion` to integrate `pnpm` autocompletion in
Run the dev server in your `packages/{workspace}/{package-name}/sandbox/` directory with hot-module reload

```sh
pnpm --filter "@kong-ui/{workspace}-{package-name}" run dev
pnpm --filter "@kong-ui-public/{package-name}" run dev
```

### ESLint
Expand All @@ -64,18 +64,18 @@ Lint package files

```sh
# Lint only
pnpm --filter "@kong-ui/{workspace}-{package-name}" run lint
pnpm --filter "@kong-ui-public/{package-name}" run lint

# Lint and fix
pnpm --filter "@kong-ui/{workspace}-{package-name}" run lint:fix
pnpm --filter "@kong-ui-public/{package-name}" run lint:fix
```

### Type Checking

Type check your package

```sh
pnpm --filter "@kong-ui/{workspace}-{package-name}" run typecheck
pnpm --filter "@kong-ui-public/{package-name}" run typecheck
```

### Testing
Expand All @@ -84,30 +84,30 @@ Run Component or Unit tests

```sh
# Component tests
pnpm --filter "@kong-ui/{workspace}-{package-name}" run test:component
pnpm --filter "@kong-ui-public/{package-name}" run test:component

# Component tests (with UI)
pnpm --filter "@kong-ui/{workspace}-{package-name}" run test:open
pnpm --filter "@kong-ui-public/{package-name}" run test:open

# Unit tests
pnpm --filter "@kong-ui/{workspace}-{package-name}" run test:unit
pnpm --filter "@kong-ui-public/{package-name}" run test:unit

# Unit tests (with UI)
pnpm --filter "@kong-ui/{workspace}-{package-name}" run test:unit:open
pnpm --filter "@kong-ui-public/{package-name}" run test:unit:open
```

### Preview sandbox build

Build your `packages/{package-name}/sandbox/` directory for production and serve locally

```sh
pnpm --filter "@kong-ui/{workspace}-{package-name}" run preview
pnpm --filter "@kong-ui-public/{package-name}" run preview
```

### Build for production

```sh
pnpm --filter "@kong-ui/{workspace}-{package-name}" run build
pnpm --filter "@kong-ui-public/{package-name}" run build
```

### Requirements
Expand Down Expand Up @@ -140,7 +140,7 @@ Additionally, CI will use `commitlint` to validate the commits associated with a

## Running consuming application with local copy of the package

You are developing shared component (let's say `@kong-ui/forms`) and you need to run consuming application with the current version of the code you have locally in your `public-ui-components/packages/{workspace}/forms` branch. Here is how to do it:
You are developing shared component (let's say `@kong-ui-public/forms`) and you need to run consuming application with the current version of the code you have locally in your `public-ui-components/packages/{workspace}/forms` branch. Here is how to do it:

1. in the folder `public-ui-components/packages/{workspace}/forms` run

Expand All @@ -157,7 +157,7 @@ You are developing shared component (let's say `@kong-ui/forms`) and you need to
3. In the root folder of the host application/package run:

```sh
yarn link "@kong-ui/forms"
yarn link "@kong-ui-public/forms"
```

4. Run your consuming application as usual and enjoy your forms code changes visible in your local env immediately.
Expand All @@ -173,15 +173,15 @@ In some cases HMR (hot module reloading) is not working out of the box in this c
```ts
server: {
watch: {
ignored: ['!**/node_modules/@kong-ui/forms/**']
ignored: ['!**/node_modules/@kong-ui-public/forms/**']
},
```
1. add `optimizeDeps` into the root of the config:
```ts
optimizeDeps: {
exclude: ['@kong-ui/forms']
exclude: ['@kong-ui-public/forms']
},
```
Expand All @@ -198,7 +198,7 @@ In some cases HMR (hot module reloading) is not working out of the box in this c
1. In the root folder of the host application/package run:
```sh
yarn unlink "@kong-ui/forms"
yarn unlink "@kong-ui-public/forms"
yarn install --force --frozen-lockfile
```
36 changes: 18 additions & 18 deletions docs/creating-a-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ Configure the component import and usage inside the
/packages/{workspace}/demo-component/sandbox/ directory.
# Start the dev server
$ pnpm --filter "@kong-ui/core-demo-component" run dev
$ pnpm --filter "@kong-ui-public/demo-component" run dev
```

## Package Structure

This monorepo comes pre-configured with config files and other settings that :sparkles: automatically work :sparkles: for all packages when [created via the CLI](#required-use-the-provided-cli-to-scaffold-your-new-package). In order to take advantage of this shared setup, each project must be structured correctly, including:

- A `README.md` at the package root that explains the purpose of the package, usage instructions, etc. You can create additional `.md` files as needed for documentation, but please link to them from the package root `README.md`
- A `package.json` file in the package root. The package `name` must follow the pattern `@kong-ui/{workspace}-{package-name}` where `{workspace}` is the same as the child directory of `packages/` and `{package-name}` is the same as the directory name itself.
- A `package.json` file in the package root. The package `name` must follow the pattern `@kong-ui-public/{package-name}` where `{package-name}` is the same as the directory name itself.
- A `tsconfig.json` that extends the root `tsconfig.json`
- A `tsconfig.build.json` that extends the local package `tsconfig.json`
- A [`vite.config.ts`](#include-a-viteconfigts-file) that extends (via `mergeConfig`) the root `vite.config.shared.ts`
- All code **must** be contained within the `{package-name}/src` directory
- A file at `src/index.ts` that exports all of the package exports.
- If utilizing **any** text strings, your package **must** utilize a `src/locales/{lang}.json` file for the text strings and incorporate the `useI18n` helper from `@kong-ui/core`
- If utilizing **any** text strings, your package **must** utilize a `src/locales/{lang}.json` file for the text strings and incorporate the `useI18n` helper from `@kong-ui-public/core`
- All packages are initialized with their own fully-functional Vue sandbox.

## Include a `vite.config.ts` file
Expand Down Expand Up @@ -92,18 +92,18 @@ Make sure to include all explicitly versioned runtime dependencies within this s

#### Depedencies on packages also managed within this monorepo

Add the dependency to your `package.json` file by package name using the _latest_ package version (as defined in its own `package.json` file). For example, if you are developing `@kong-ui/core-new-component` and `@kong-ui/core-demo-component` already exists as a package within `public-ui-components`, add the following to the `package.json` file of `@kong-ui/core-new-component`:
Add the dependency to your `package.json` file by package name using the _latest_ package version (as defined in its own `package.json` file). For example, if you are developing `@kong-ui-public/new-component` and `@kong-ui-public/demo-component` already exists as a package within `public-ui-components`, add the following to the `package.json` file of `@kong-ui-public/new-component`:

```json
"dependencies": {
"@kong-ui/core-demo-component": "^1.6.2"
"@kong-ui-public/demo-component": "^1.6.2"
}
```

where `1.6.2` is the version that's currently listed in the `package.json` file of `@kong-ui/core-demo-component` within the `public-ui-components` repo.
where `1.6.2` is the version that's currently listed in the `package.json` file of `@kong-ui-public/demo-component` within the `public-ui-components` repo.

During local development, the local version of `@kong-ui/core-demo-component` will be symlinked and used within `@kong-ui/core-new-component`.
During our release automation, Lerna will ensure that the version of `@kong-ui/core-demo-component` required in the `package.json` of `@kong-ui/core-new-component` is kept up-to-date. That is, when a new version of `@kong-ui/core-demo-component` is released the `package.json` file of `@kong-ui/core-new-component` is also updated and thus a new version of `@kong-ui/core-new-component` is released.
During local development, the local version of `@kong-ui-public/demo-component` will be symlinked and used within `@kong-ui-public/new-component`.
During our release automation, Lerna will ensure that the version of `@kong-ui-public/demo-component` required in the `package.json` of `@kong-ui-public/new-component` is kept up-to-date. That is, when a new version of `@kong-ui-public/demo-component` is released the `package.json` file of `@kong-ui-public/new-component` is also updated and thus a new version of `@kong-ui-public/new-component` is released.

### `peerDependencies`

Expand All @@ -112,7 +112,7 @@ During our release automation, Lerna will ensure that the version of `@kong-ui/c
Include loosely bounded (SemVer-wise) peer deps, i.e. `vue` or `vue-router`

```sh
pnpm --filter="@kong-ui/core-demo-component" add --save-peer vue@latest
pnpm --filter="@kong-ui-public/demo-component" add --save-peer vue@latest
```

### `devDependencies`
Expand All @@ -128,7 +128,7 @@ pnpm add -wD @types/foo
To add package-specific `devDependencies`:

```bash
pnpm --filter="@kong-ui/core-demo-component" add -D @types/foo
pnpm --filter="@kong-ui-public/demo-component" add -D @types/foo
```

### `scripts`
Expand All @@ -152,15 +152,15 @@ Your `scripts` section may also contain as many additional scripts as you'd like

> All `scripts` MUST be executed from the root context of the monorepo
So, if you wanted to run lint the code in your package defined as the `lint` script command for a package named `@kong-ui/foo` you would run:
So, if you wanted to run lint the code in your package defined as the `lint` script command for a package named `@kong-ui-public/foo` you would run:

```sh
pnpm --filter "@kong-ui/core-demo-component" run lint
pnpm --filter "@kong-ui-public/demo-component" run lint
```

### `publishConfig`

The `publishConfig` field is important as it marks the package as public for the given organization scope (i.e. `@kong-ui/`) and leverages pnpm features to rewrite the `main` and `typings` fields at time of publish. It should look something like:
The `publishConfig` field is important as it marks the package as public for the given organization scope (i.e. `@kong-ui-public/`) and leverages pnpm features to rewrite the `main` and `typings` fields at time of publish. It should look something like:

```json
"publishConfig": {
Expand Down Expand Up @@ -234,13 +234,13 @@ In order to prevent component styles from leaking out into the consuming applica

2. All component styles must be wrapped in a unique wrapper class so that styles do not leak out into the consuming application.

The class name should follow the syntax `.kong-ui-{workspace}-{package-name}`
The class name should follow the syntax `.kong-ui-{package-name}`

This is a good practice even if you go with option one outlined above.

```html
<style lang="scss">
.kong-ui-core-demo-component {
.kong-ui-public-demo-component {
/* All other styles must go inside the wrapper */
}
</style>
Expand All @@ -254,12 +254,12 @@ We cannot control the `html` base font size and therefore these relative units a

#### CSS Variables

If your component exposes any CSS variables, they **must** be prefixed with your package name `--kong-ui-{workspace}-{package-name}`
If your component exposes any CSS variables, they **must** be prefixed with your package name `--kong-ui-{package-name}`

For example, the `@kong-ui/core-app-layout` package exposes the following CSS variables:
For example, the `@kong-ui-public/app-layout` package exposes the following CSS variables:

```css
--kong-ui-core-app-sidebar-mobile-icon-color
--kong-ui-app-sidebar-mobile-icon-color
```

## Testing
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@kong-ui/public-ui-components",
"name": "@kong-ui-public/public-ui-components",
"version": "0.0.0-development",
"private": true,
"scripts": {
Expand All @@ -16,7 +16,7 @@
"test:unit": "cross-env FORCE_COLOR=1 pnpm -r run test:unit",
"test:unit:open": "cross-env FORCE_COLOR=1 pnpm -r run test:unit:open",
"commit": "cz",
"create-package": "pnpm --filter \"@kong-ui/core-public-cli\" run create-package"
"create-package": "pnpm --filter \"@kong-ui-public/cli\" run create-package"
},
"devDependencies": {
"@babel/types": "^7.20.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/app-layout/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.10.2](https://github.com/Kong/public-ui-components/compare/@kong-ui/core-app-layout@0.10.1...@kong-ui/core-app-layout@0.10.2) (2023-01-24)
## [0.10.2](https://github.com/Kong/public-ui-components/compare/@kong-ui-public/app-layout@0.10.1...@kong-ui-public/app-layout@0.10.2) (2023-01-24)


### ♻️ Chores
Expand All @@ -14,7 +14,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline



## [0.10.1](https://github.com/Kong/public-ui-components/compare/@kong-ui/core-app-layout@0.10.0...@kong-ui/core-app-layout@0.10.1) (2023-01-23)
## [0.10.1](https://github.com/Kong/public-ui-components/compare/@kong-ui-public/app-layout@0.10.0...@kong-ui-public/app-layout@0.10.1) (2023-01-23)


### ♻️ Chores
Expand Down
10 changes: 5 additions & 5 deletions packages/core/app-layout/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @kong-ui/core-app-layout
# @kong-ui-public/app-layout

A Kong UI application layout component that provides a responsive navbar, sidebar, and main content area.

Expand Down Expand Up @@ -48,7 +48,7 @@ Reference the [individual component docs](#individual-component-documentation) f
Install the component in your host application

```sh
yarn add @kong-ui/core-app-layout
yarn add @kong-ui-public/app-layout
```

### Vue Plugin
Expand All @@ -58,7 +58,7 @@ Initialize the component as a plugin within your application's entry file (e.g.
```ts
import { createApp } from 'vue'
import App from './App.vue'
import AppLayout from '@kong-ui/core-app-layout'
import AppLayout from '@kong-ui-public/app-layout'

const app = createApp(App)

Expand All @@ -71,12 +71,12 @@ app.mount('#app')
Alternatively, import the component within your application's root component.

```ts
import { AppLayout } from '@kong-ui/core-app-layout'
import { AppLayout } from '@kong-ui-public/app-layout'
```

## Usage

> **Note**: TODO - for now, you can reference the sandbox app `pnpm --filter "@kong-ui/core-app-layout" run dev`
> **Note**: TODO - for now, you can reference the sandbox app `pnpm --filter "@kong-ui-public/app-layout" run dev`
### Props

Expand Down
4 changes: 2 additions & 2 deletions packages/core/app-layout/docs/error.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ A Kong UI dynamic error component.

## Install

[See instructions for installing the `@kong-ui/app-layout` package.](../README.md#install)
[See instructions for installing the `@kong-ui-public/app-layout` package.](../README.md#install)

---

[← Back to `@kong-ui/app-layout` docs](../README.md)
[← Back to `@kong-ui-public/app-layout` docs](../README.md)
4 changes: 2 additions & 2 deletions packages/core/app-layout/docs/navbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ A Kong UI dynamic navbar component.

## Install

[See instructions for installing the `@kong-ui/app-layout` package.](../README.md#install)
[See instructions for installing the `@kong-ui-public/app-layout` package.](../README.md#install)

## CSS Variables

Expand All @@ -45,4 +45,4 @@ Variable | Description | Default

---

[← Back to `@kong-ui/app-layout` docs](../README.md)
[← Back to `@kong-ui-public/app-layout` docs](../README.md)
12 changes: 6 additions & 6 deletions packages/core/app-layout/docs/sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ A Kong UI dynamic sidebar component.

### Install

[See instructions for installing the `@kong-ui/app-layout` package.](../README.md#install)
[See instructions for installing the `@kong-ui-public/app-layout` package.](../README.md#install)

## `AppSidebar.vue`

Expand Down Expand Up @@ -295,11 +295,11 @@ watch(() => route.path, (newPath, oldPath) => {
<script setup lang="ts">
import { watch, onBeforeMount } from 'vue'
// AppSidebar Component and types
import { AppSidebar, SidebarPrimaryItem, SidebarSecondaryItem, SidebarProfileItem } from '@kong-ui/app-layout'
import { AppSidebar, SidebarPrimaryItem, SidebarSecondaryItem, SidebarProfileItem } from '@kong-ui-public/app-layout'
import { RouteRecordRedirectOption, useRoute, useRouter } from 'vue-router'
import useSidebar from '../composables/useSidebar'
// Component styles
import '@kong-ui/app-layout/dist/style.css'
import '@kong-ui-public/app-layout/dist/style.css'
const { updateMenu, topItems, bottomItems, profileItems } = composables.useSidebar()
const router = useRouter()
Expand Down Expand Up @@ -358,7 +358,7 @@ onBeforeMount(() => {

```ts
import { ref } from 'vue'
import { SidebarPrimaryItem, SidebarProfileItem } from '@kong-ui/app-layout'
import { SidebarPrimaryItem, SidebarProfileItem } from '@kong-ui-public/app-layout'
import { RouteLocationNormalizedLoaded } from 'vue-router'
export const useSidebar = () => {
Expand Down Expand Up @@ -524,9 +524,9 @@ Variable | Description | Default
TypeScript interfaces [are available here](https://github.com/Kong/shared-ui-components/blob/main/packages/sidebar/src/types/index.ts) and can be directly imported into your host application. The following type interfaces are available for import:

```ts
import type { SidebarPrimaryItem, SidebarSecondaryItem, SidebarProfileItem } from '@kong-ui/app-layout'
import type { SidebarPrimaryItem, SidebarSecondaryItem, SidebarProfileItem } from '@kong-ui-public/app-layout'
```

---

[← Back to `@kong-ui/app-layout` docs](../README.md)
[← Back to `@kong-ui-public/app-layout` docs](../README.md)
10 changes: 5 additions & 5 deletions packages/core/app-layout/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "@kong-ui/core-app-layout",
"name": "@kong-ui-public/app-layout",
"version": "0.10.2",
"type": "module",
"main": "./dist/core-app-layout.umd.js",
"module": "./dist/core-app-layout.es.js",
"main": "./dist/app-layout.umd.js",
"module": "./dist/app-layout.es.js",
"types": "dist/types/index.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/core-app-layout.es.js",
"require": "./dist/core-app-layout.umd.js"
"import": "./dist/app-layout.es.js",
"require": "./dist/app-layout.umd.js"
},
"./package.json": "./package.json",
"./dist/*": "./dist/*"
Expand Down
Loading

0 comments on commit c8c3c4f

Please sign in to comment.