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

createMeshExample adds default dependencies #93

Merged
merged 2 commits into from
Dec 4, 2022
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
5 changes: 5 additions & 0 deletions .changeset/perfect-impalas-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nx-mesh': patch
---

Mesh examples share base dependencies
2 changes: 0 additions & 2 deletions libs/nx-mesh/src/generators/base/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
addCypress,
addJest,
addLinting,
addMeshDependencies,
addProjectConfig,
createFiles,
nodeGenerator,
Expand All @@ -27,7 +26,6 @@ export async function baseGenerator(tree: Tree, baseOptions: BaseOptions) {

const tasks: GeneratorCallback[] = [await nodeGenerator(tree, options)];

addMeshDependencies(tree, options);
createFiles(tree, options);
addProjectConfig(tree, options);
setDefaults(tree, options);
Expand Down
22 changes: 0 additions & 22 deletions libs/nx-mesh/src/generators/base/lib/add-mesh-dependencies.ts

This file was deleted.

1 change: 0 additions & 1 deletion libs/nx-mesh/src/generators/base/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './add-cypress';
export * from './add-jest';
export * from './add-linting';
export * from './add-mesh-dependencies';
export * from './add-project-config';
export * from './create-files';
export * from './node-generator';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ exports[`addDependencies should add country-info dependencies to the package.jso
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/soap\\": \\"0.16.0\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/soap\\": \\"0.16.0\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand All @@ -15,7 +19,11 @@ exports[`addDependencies should add fake-api dependencies to the package.json 1`
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/json-schema\\": \\"0.35.33\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/json-schema\\": \\"0.35.33\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand All @@ -26,7 +34,11 @@ exports[`addDependencies should add javascript-wiki dependencies to the package.
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/openapi\\": \\"0.33.34\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/openapi\\": \\"0.33.34\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand All @@ -37,7 +49,11 @@ exports[`addDependencies should add movies dependencies to the package.json 1`]
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/neo4j\\": \\"0.20.34\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/neo4j\\": \\"0.20.34\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand All @@ -48,7 +64,11 @@ exports[`addDependencies should add rfam dependencies to the package.json 1`] =
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/mysql\\": \\"0.17.30\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/mysql\\": \\"0.17.30\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand All @@ -59,7 +79,11 @@ exports[`addDependencies should add stackexchange dependencies to the package.js
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/openapi\\": \\"0.33.34\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/openapi\\": \\"0.33.34\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand All @@ -70,7 +94,11 @@ exports[`addDependencies should add star-wars-api dependencies to the package.js
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/graphql\\": \\"0.31.31\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/graphql\\": \\"0.31.31\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand All @@ -81,7 +109,11 @@ exports[`addDependencies should add trippin dependencies to the package.json 1`]
"{
\\"name\\": \\"test-name\\",
\\"dependencies\\": {
\\"@graphql-mesh/odata\\": \\"0.20.31\\"
\\"@graphql-mesh/cli\\": \\"0.79.3\\",
\\"@graphql-mesh/odata\\": \\"0.20.31\\",
\\"@graphql-mesh/runtime\\": \\"0.44.31\\",
\\"@graphql-mesh/utils\\": \\"0.42.6\\",
\\"graphql\\": \\"16.6.0\\"
},
\\"devDependencies\\": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('addDependencies', () => {
}
}

expect(dependenciesCount).toBeGreaterThan(0);
expect(dependenciesCount).toBeGreaterThan(4);
expect(packageJson).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ export function addDependencies(
host: Tree,
options: Pick<CreateMeshExampleOptions, 'example'>
) {
let exampleDeps = {};
let exampleDeps = {
...versions['@graphql-mesh/cli'],
...versions['@graphql-mesh/runtime'],
...versions['@graphql-mesh/utils'],
...versions['graphql'],
};

examples[options.example].dependencies.forEach((dep) => {
exampleDeps = {
Expand Down