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

fix(javascript): update template to include correct dependency version #328

Merged
merged 9 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion clients/algoliasearch-client-javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test:size": "bundlesize",
"test:lint": "eslint . --ext .js,.ts",
"test:types": "yarn tsc --noEmit",
"release:bump": "lerna version ${0:-patch} --no-changelog --no-git-tag-version --no-push --yes",
"release:bump": "lerna version ${0:-patch} --no-changelog --no-git-tag-version --no-push --exact --yes",
"release:publish": "ts-node scripts/publish.ts"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import execa from 'execa'; // https://github.com/sindresorhus/execa/tree/v5.1.1
import { hashElement } from 'folder-hash';
import { remove } from 'fs-extra';

import clientsConfig from '../config/clients.config.json';
import openapitools from '../openapitools.json';

import { createSpinner } from './oraLog';
Expand All @@ -31,7 +32,10 @@ export const GENERATORS: Record<string, Generator> = {
key: 'javascript-algoliasearch',
additionalProperties: {
packageName: '@experimental-api-clients-automation/algoliasearch',
packageVersion: '0.0.5',
packageVersion:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We pull the version from the main package (in case of js, it's client-search).

Copy link
Member

@shortcuts shortcuts Apr 4, 2022

Choose a reason for hiding this comment

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

We could also import it from algoliasearch's package.json file directly, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then we need to assume openapitools.json and package.json files are always in sync at any point of time. But I'm not sure if we can make such an assumption. It's easier to maintain if we take openapitools.json as a single and only source of truth. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

package.json depends on openapitools.json, so we know that the package.json will be up to date when changes happen in the main file, but once we remove clients from main we won't have this package.json actually so let's go with your solution

openapitools['generator-cli'].generators[
clientsConfig.javascript.mainPackage
].additionalProperties.packageVersion,
},
},
};
Expand Down
6 changes: 3 additions & 3 deletions templates/javascript/package.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"node": ">= 14.0.0"
},
"dependencies": {
"@experimental-api-clients-automation/client-common": "0.0.5",
"@experimental-api-clients-automation/requester-browser-xhr": "0.0.5",
"@experimental-api-clients-automation/requester-node-http": "0.0.5"
"@experimental-api-clients-automation/client-common": "^0.0.1",
"@experimental-api-clients-automation/requester-browser-xhr": "^0.0.1",
"@experimental-api-clients-automation/requester-node-http": "^0.0.1,"
},
"devDependencies": {
"@types/node": "16.11.26",
Expand Down