-
Notifications
You must be signed in to change notification settings - Fork 83
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
Remove duplicate yarn.lock and move algolia script #324
Conversation
- name: Reduce the number of dependencies to install by hiding workspaces | ||
run: | | ||
npx replace '"workspaces":' '"ignored-workspaces":' package.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trick should reduce yarn install
time by skipping all dependencies in all workspaces. We might be able to do something more ‘official’ after upgrading to Yarn Berry — docs: https://yarnpkg.com/cli/workspaces/focus
Focus-mode does not work for root package.json in Yarn 1 AFAIU.
"dev:backend:search-loader": "yarn workspace @hashintel/hash-search-loader dev", | ||
"dev:frontend": "yarn workspace @hashintel/hash-frontend dev", | ||
"exe": "ts-node --require dotenv-flow/config --transpile-only", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar setup as in the blockprotocol repo. I just did not add the swc transpiler to make our dependency tree lighter. We can introduce swc when we have more scripts and can therefore benefit more from performance.
@@ -56,9 +57,13 @@ | |||
"node-fetch": "^2.6.7" | |||
}, | |||
"devDependencies": { | |||
"algoliasearch": "4.12.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was in .github/workflows/algolia/package.json
objectId: undefined; | ||
content: string; | ||
objectID: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve been getting a type error here because of what we do on line 68 (objectId: undefined,
). @akash-joshi what’s the difference between objectId
and objectID
? I want to keep logic changes minimal, but happy to add a comment or tweak types a bit more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const env = envalid.cleanEnv(process.env, { | ||
ALGOLIA_PROJECT: envalid.str({ | ||
desc: "Algolia app id", | ||
example: "A1B2C3D4C5D6", | ||
docs: "https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript", | ||
}), | ||
ALGOLIA_WRITE_KEY: envalid.str({ | ||
desc: "Algolia app API key with write permissions (32-char HEX)", | ||
docs: "https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/javascript/?client=javascript", | ||
}), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This improves script feedback – see blockprotocol/blockprotocol#192 for details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to go once the merge conflicts are fixed.
After merge, confirm if the Action runs successfully.
🌟 What is the purpose of this PR?
This PR removes duplicate
yarn.lock
from.github/workflows/algolia/yarn.lock
and thus consolidates monorepo dependencies. This simplifies further maintenance of our codebase. A similar PR can be found in blockprotocol/blockprotocol#169Not sure if files in
[root]/scripts/*
are property covered by all linters at the moment, but at least it did not become worse.I could not test the script because I don’t have algolia keys.
🔍 What does this change?
No more duplicate
yarn.lock
New
scripts
folder andyarn exe
command (like in https://github.com/blockprotocol/blockprotocol)We now use
envalid
in the algolia script and can also use this lib in other places later.🔗 Related links
🛡 What tests cover this?
❓ How to test this?
Run
yarn exe scripts/sync-algolia-index.ts
Observe this if you don’t know Algolia credentials
OR Confirm that you get
Algolia index updated.
ortherwise.