Skip to content

Commit

Permalink
Rename package (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkucharczyk authored Nov 8, 2023
1 parent 9ca05e2 commit b06b1fe
Show file tree
Hide file tree
Showing 43 changed files with 114 additions and 48 deletions.
5 changes: 5 additions & 0 deletions .changeset/warm-pianos-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ember-provide-consume-context': minor
---

Rename package to ember-provide-consume-context
2 changes: 1 addition & 1 deletion .github/workflows/push-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
with:
branch: dist
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: ember-context
working-directory: ember-provide-consume-context
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Installation

- `git clone <repository-url>`
- `cd ember-context`
- `cd ember-provide-consume-context`
- `npm install`

## Linting
Expand All @@ -13,7 +13,7 @@

## Building the addon

- `cd ember-context`
- `cd ember-provide-consume-context`
- `npm build`

## Running tests
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @customerio/ember-context
# ember-provide-consume-context

This addon provides a way to share data through to nested components without
having to pass arguments at each level (i.e. no prop drilling).
Expand All @@ -11,7 +11,7 @@ having to pass arguments at each level (i.e. no prop drilling).
## Installation

```
ember install @customerio/ember-context
ember install ember-provide-consume-context
```

## Usage
Expand All @@ -28,7 +28,7 @@ descendants to look up the value.

```ts
import Component from '@glimmer/component';
import { provide } from '@customerio/ember-context';
import { provide } from 'ember-provide-consume-context';

export default class MyComponent extends Component {
@provide('my-context-name')
Expand All @@ -43,7 +43,7 @@ It is possible to expose tracked properties in context, by adding a

```ts
import Component from '@glimmer/component';
import { provide } from '@customerio/ember-context';
import { provide } from 'ember-provide-consume-context';

export default class MyComponent extends Component {
@tracked myTrackedValue = 'some value';
Expand Down Expand Up @@ -82,7 +82,7 @@ similar to working with an Ember service:

```ts
import Component from '@glimmer/component';
import { consume } from '@customerio/ember-context';
import { consume } from 'ember-provide-consume-context';

export default class MyChildComponent extends Component {
@consume('my-context-name') myContextValue!: string;
Expand Down Expand Up @@ -122,7 +122,7 @@ interface, as described in the [Glint docs](https://typed-ember.gitbook.io/glint
// types/global.d.ts
import '@glint/environment-ember-loose';

import type EmberContextTemplateRegistry from '@customerio/ember-context/template-registry';
import type EmberContextTemplateRegistry from 'ember-provide-consume-context/template-registry';

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry extends EmberContextTemplateRegistry, /* other addon registries */ {
Expand All @@ -138,7 +138,7 @@ keys with the type of value.
First, you'll need to add

```ts
import '@customerio/ember-context/context-registry';
import 'ember-provide-consume-context/context-registry';
```

somewhere in your source files or type declaration files. This will force
Expand All @@ -147,7 +147,7 @@ TypeScript to merge type declarations for the registry.
Next, you'll need to declare the value type for your context keys, like this:

```ts
declare module '@customerio/ember-context/context-registry' {
declare module 'ember-provide-consume-context/context-registry' {
export default interface ContextRegistry {
'my-context-name': string;
'AuthContext': AuthInterface;
Expand All @@ -162,7 +162,7 @@ them, like this:

```ts
import Component from '@glimmer/component';
import { provide } from '@customerio/ember-context';
import { provide } from 'ember-provide-consume-context';

export default class MyComponent extends Component {
@provide('my-context-name')
Expand All @@ -171,7 +171,7 @@ export default class MyComponent extends Component {
}
}

declare module '@customerio/ember-context/context-registry' {
declare module 'ember-provide-consume-context/context-registry' {
export default interface ContextRegistry {
'my-context-name': string;
}
Expand All @@ -187,8 +187,8 @@ retrieved using the registry like this:

```ts
import Component from '@glimmer/component';
import { consume } from '@customerio/ember-context';
import type ContextRegistry from '@customerio/ember-context/context-registry';
import { consume } from 'ember-provide-consume-context';
import type ContextRegistry from 'ember-provide-consume-context/context-registry';

export default class MyChildComponent extends Component {
@consume('my-context-name') myContextValue!: ContextRegistry['my-context-name'];
Expand All @@ -210,7 +210,7 @@ your context keys as constants:

```ts
import Component from '@glimmer/component';
import { provide } from '@customerio/ember-context';
import { provide } from 'ember-provide-consume-context';

export const MyContext = 'my-context-name' as const;

Expand All @@ -221,7 +221,7 @@ export default class MyComponent extends Component {
}
}

declare module '@customerio/ember-context/context-registry' {
declare module 'ember-provide-consume-context/context-registry' {
export default interface ContextRegistry {
[MyContext]: string;
}
Expand All @@ -230,9 +230,9 @@ declare module '@customerio/ember-context/context-registry' {

```ts
import Component from '@glimmer/component';
import { consume } from '@customerio/ember-context';
import { consume } from 'ember-provide-consume-context';
import { MyContext } from 'my-app/components/my-component';
import type ContextRegistry from '@customerio/ember-context/context-registry';
import type ContextRegistry from 'ember-provide-consume-context/context-registry';

export default class MyChildComponent extends Component {
@consume(MyContext) myContextValue!: ContextRegistry[typeof MyContext];
Expand All @@ -250,7 +250,7 @@ The idea was to create an API similar to the Context API in React
- [`ember-context`](https://github.com/alexlafroscia/ember-context): Another
Ember addon that also implements a similar Context API. However, that addon's
implementation relies has providers racing on a provider key, while our addon
uses the actual Ember component tree
uses the Ember component tree

## Contributing

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@customerio/ember-context",
"name": "ember-provide-consume-context",
"version": "0.0.1",
"description": "A context API implementation for Ember.js",
"keywords": [
"ember-addon"
],
"repository": {
"type": "git",
"url": "git+https://github.com/customerio/ember-context.git"
"url": "git+https://github.com/customerio/ember-provide-consume-context.git"
},
"license": "MIT",
"author": "Customer.io (https://customer.io)",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
75 changes: 68 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"private": true,
"repository": {
"type": "git",
"url": "git+https://github.com/customerio/ember-context.git"
"url": "git+https://github.com/customerio/ember-provide-consume-context.git"
},
"license": "MIT",
"author": "Customer.io (https://customer.io)",
"scripts": {
"build": "npm run build --workspace ember-context",
"build": "npm run build --workspace ember-provide-consume-context",
"lint": "npm run lint --workspaces --if-present",
"lint:fix": "npm run lint:fix --workspaces --if-present",
"prepare": "npm run build",
"start": "concurrently 'npm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow",
"start:addon": "npm start --workspace ember-context -- --no-watch.clearScreen",
"start:addon": "npm start --workspace ember-provide-consume-context -- --no-watch.clearScreen",
"start:test-app": "npm start --workspace test-app",
"test": "npm run test --workspaces --if-present",
"test:ember": "npm run test:ember --workspaces --if-present",
Expand All @@ -25,7 +25,7 @@
"prettier-plugin-ember-template-tag": "^1.1.0"
},
"workspaces": [
"ember-context",
"ember-provide-consume-context",
"test-app"
],
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test-app/app/components/a-component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@glimmer/component';
import { provide } from '@customerio/ember-context';
import { provide } from 'ember-provide-consume-context';

export interface AComponentSignature {
Element: HTMLDivElement;
Expand Down
6 changes: 3 additions & 3 deletions test-app/app/components/custom-provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from '@glimmer/component';
import { provide } from '@customerio/ember-context';
import type ContextRegistry from '@customerio/ember-context/context-registry';
import { provide } from 'ember-provide-consume-context';
import type ContextRegistry from 'ember-provide-consume-context/context-registry';

export interface CustomProviderComponentSignature {
Args: {
Expand All @@ -25,7 +25,7 @@ declare module '@glint/environment-ember-loose/registry' {
}
}

declare module '@customerio/ember-context/context-registry' {
declare module 'ember-provide-consume-context/context-registry' {
export default interface ContextRegistry {
testContext: string | number;
}
Expand Down
4 changes: 2 additions & 2 deletions test-app/app/components/test-component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from '@glimmer/component';
import { consume } from '@customerio/ember-context';
import type ContextRegistry from '@customerio/ember-context/context-registry';
import { consume } from 'ember-provide-consume-context';
import type ContextRegistry from 'ember-provide-consume-context/context-registry';
import { NumberContext } from 'test-app/controllers/application';

export interface TestComponentSignature {
Expand Down
2 changes: 1 addition & 1 deletion test-app/app/controllers/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class ApplicationController extends Controller {
}
}

declare module '@customerio/ember-context/context-registry' {
declare module 'ember-provide-consume-context/context-registry' {
export default interface ContextRegistry {
[NumberContext]: number;
}
Expand Down
2 changes: 1 addition & 1 deletion test-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function (defaults) {
let app = new EmberApp(defaults, {
'ember-cli-babel': { enableTypeScriptTransform: true },
autoImport: {
watchDependencies: ['ember-context'],
watchDependencies: ['ember-provide-consume-context'],
},
});

Expand Down
Loading

0 comments on commit b06b1fe

Please sign in to comment.