Skip to content

chore: Update publish docs #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ This will create db.sql file (a Sqlite database) with a table `Names` and two re

## Building and publishing the plugin

Use the following command to build a container with the plugin:
1. Update the plugin metadata in [src/plugins.ts](src/plugin.ts#L99) to match your team and plugin name.
2. Run `npm run build` to build the plugin.
3. Run `node dist/main.js package -m "Initial release" v0.0.1 .`. `-m` specifies changelog and `v0.0.1` is the version.
4. Run `cloudquery plugin publish -f` to publish the plugin to the CloudQuery registry.

```shell
npm run package:container
```

Check out the [Releasing and Deploying Your Plugin
](https://www.cloudquery.io/docs/developers/creating-new-plugin/javascript-source#releasing-and-deploying-your-plugin) in our documentation to learn more about publishing your own plugin for wider use.
> More about publishing plugins [here](https://docs.cloudquery.io/docs/developers/publishing-an-addon-to-the-hub)
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# JavaScript Source Plugin Template
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least once doc file is needed for publishing to work


This is the plugin documentation that will get published to Hub. Read more about publishing at [CloudQuery Docs](https://docs.cloudquery.io/docs/developers/publishing-a-plugin-to-the-hub)
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"scripts": {
"dev": "ts-node --esm src/main.ts serve",
"build": "rm -rf dist && tsc",
"package:container": "docker build -t cq-js-sample:latest .",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was outdated, the JS SDK will run docker build instead

"format": "prettier --write 'src/**/*.ts'",
"format:check": "prettier --check 'src/**/*.ts'",
"lint": "eslint --max-warnings 0 --ext .ts src",
Expand Down
4 changes: 2 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ export const newSamplePlugin = () => {
spec,
{ noConnection },
) => {
pluginClient.spec = parseSpec(spec);
Copy link
Member Author

@erezrokah erezrokah Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the package command and some others pass an empty spec and noConnection: true so we should skip parsing the spec and initializing the client for noConnection: true

pluginClient.client = { id: () => "cq-js-sample" };
if (noConnection) {
pluginClient.allTables = [];
return pluginClient;
}
pluginClient.spec = parseSpec(spec);
pluginClient.client = { id: () => "cq-js-sample" };
pluginClient.allTables = await getTables();

return pluginClient;
Expand Down
8 changes: 3 additions & 5 deletions sync-packaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ kind: source
spec:
name: "cq-js-sample"
registry: "docker"
path: "cq-js-sample:latest"
version: "v1.0.0"
tables:
["*"]
path: "docker.cloudquery.io/cloudquery/source-cq-js-sample:v0.0.1-linux-arm64"
tables: ["*"]
destinations:
- "sqlite"
spec: {}
Expand All @@ -16,4 +14,4 @@ spec:
path: cloudquery/sqlite
version: "v2.4.9"
spec:
connection_string: ./db.sql
connection_string: ./db.sql