Skip to content

Commit 82fce55

Browse files
committed
Make examples a sub-package to fix the imports
1 parent e11fcfb commit 82fce55

File tree

9 files changed

+65
-21
lines changed

9 files changed

+65
-21
lines changed

examples/kafkajs/admin.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
2-
// Since this example is within the package itself, we use '../..', but code
3-
// will typically use '@confluentinc/kafka-javascript'.
4-
const { Kafka } = require('../..').KafkaJS;
2+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
53

64
async function adminStart() {
75
const kafka = new Kafka({

examples/kafkajs/consumer-confluent-cloud.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
2-
// Since this example is within the package itself, we use '../..', but code
3-
// will typically use '@confluentinc/kafka-javascript'.
4-
const { Kafka } = require('../..').KafkaJS;
2+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
53

64
async function consumerStart() {
75
let consumer;

examples/kafkajs/consumer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
2-
// Since this example is within the package itself, we use '../..', but code
3-
// will typically use '@confluentinc/kafka-javascript'.
4-
const { Kafka } = require('../..').KafkaJS;
2+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
53

64
async function consumerStart() {
75
let consumer;

examples/kafkajs/eos.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
2-
// Since this example is within the package itself, we use '../..', but code
3-
// will typically use '@confluentinc/kafka-javascript'.
4-
const { Kafka } = require('../..').KafkaJS;
2+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
53

64
async function eosStart() {
75
const kafka = new Kafka({

examples/kafkajs/producer-confluent-cloud.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
2-
// Since this example is within the package itself, we use '../..', but code
3-
// will typically use '@confluentinc/kafka-javascript'.
4-
const { Kafka } = require('../..').KafkaJS;
2+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
53

64
async function producerStart() {
75
const CLUSTER_BOOTSTRAP_URL = 'your_cluster_url_here';

examples/kafkajs/producer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
2-
// Since this example is within the package itself, we use '../..', but code
3-
// will typically use '@confluentinc/kafka-javascript'.
4-
const { Kafka } = require('../..').KafkaJS;
2+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
53

64
async function producerStart() {
75
const kafka = new Kafka({

examples/kafkajs/sr.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
2-
// Since this example is within the package itself, we use '../..', but code
3-
// will typically use '@confluentinc/kafka-javascript'.
4-
const { Kafka } = require('../..').KafkaJS;
2+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
53

64
// Note: The kafkajs/confluent-schema-registry will need to be installed separately to run this example,
75
// as it isn't a dependency of confluent-kafka-javascript.

examples/package-lock.json

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "examples",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "MIT",
11+
"dependencies": {
12+
"@confluentinc/kafka-javascript": "file:.."
13+
}
14+
}

0 commit comments

Comments
 (0)