Skip to content
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

Build config #1

Merged
merged 17 commits into from
Jun 21, 2023
Merged

Build config #1

merged 17 commits into from
Jun 21, 2023

Conversation

nonumpa
Copy link
Member

@nonumpa nonumpa commented May 11, 2023

Features

  • Add build script and dockerfile
  • Add lint
  • Use dotenv

Build elasticsearch extension

tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json

Since tsconfig cannot rename output files, we use three different config tsconfig.cjs.json tsconfig.esm.json tsconfig.types.json to build different target

Dockerfile

TODO

  • Test and CI
  • Rollbar log

@nonumpa nonumpa requested a review from MrOrz May 11, 2023 11:13
# copy monorepo's build outputs
# ref: https://github.com/lerna/lerna/issues/2381
#
COPY --from=builder /srv/www/hocuspocus-extension-elasticsearch/dist ./hocuspocus-extension-elasticsearch/dist
Copy link
Member

Choose a reason for hiding this comment

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

Note: if we don't add this, then tsc outside will still build hocuspocus-extension-elasticsearch.
However, the directory structure does not match the one written in hocuspocus-extension-elasticsearch's package.json's export key.


export interface ElasticsearchConfiguration extends DatabaseConfiguration {
elasticsearchOpts?: elasticsearch.ClientOptions;
db_index?: string;
Copy link
Member

Choose a reason for hiding this comment

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

Question: why snake_case here while everywhere else is camelCased?

const { body: docExist } = await this.db?.exists({ index: 'ydocs', id: documentName, type: 'doc' }) || {}
// console.log(`DB fetch ${documentName}`);
const { body: docExist } =
(await this.db?.exists({
Copy link
Member

Choose a reason for hiding this comment

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

For not exist error, I think we can either check the status code returned by this.db?.get, or try-catch if it throws an error. In this case we don't need an extra exist() call to the database.

Copy link
Member

@MrOrz MrOrz left a comment

Choose a reason for hiding this comment

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

LGTM!

@nonumpa nonumpa merged commit ca95ca2 into main Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants