@graphcommerce/cli 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @graphcommerce/cli
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1429](https://github.com/graphcommerce-org/graphcommerce/pull/1429) [`ba8cd4d34`](https://github.com/graphcommerce-org/graphcommerce/commit/ba8cd4d3480a7ec7e555b051cfd0fbc809c7aa12) Thanks [@paales](https://github.com/paales)! - mesh couldn’t be generated properly in a non-monorepo setup
8
+
3
9
  ## 1.0.2
4
10
 
5
11
  ### Patch Changes
package/bin/mesh.ts CHANGED
@@ -26,20 +26,19 @@ const relativePath = path.join(path.relative(meshDir, root), '/')
26
26
 
27
27
  const isMonoRepo = relativePath.startsWith('../../examples')
28
28
 
29
- const artifactsDir = path.join(path.relative(root, meshDir), '/.mesh')
30
-
31
29
  const cliParams: GraphQLMeshCLIParams = {
32
30
  ...DEFAULT_CLI_PARAMS,
33
- artifactsDir,
34
31
  playgroundTitle: 'GraphCommerce® Mesh',
35
32
  }
36
33
 
37
34
  const tmpMesh = `_tmp_mesh_${Math.random().toString(36).substring(2, 15)}`
38
35
  const tmpMeshLocation = path.join(root, `.${tmpMesh}rc.yml`)
39
36
 
40
- function cleanup() {
37
+ async function cleanup() {
41
38
  try {
42
- return fs.unlink(tmpMeshLocation)
39
+ await fs.stat(tmpMeshLocation).then((r) => {
40
+ if (r.isFile()) return fs.unlink(tmpMeshLocation)
41
+ })
43
42
  } catch (e) {
44
43
  // ignore
45
44
  }
@@ -84,6 +83,11 @@ const main = async () => {
84
83
 
85
84
  await fs.writeFile(tmpMeshLocation, yaml.stringify(conf))
86
85
 
86
+ // Reexport the mesh to is can be used by packages
87
+ await fs.writeFile(`${meshDir}/.mesh.ts`, `export * from '${relativePath}.mesh'`, {
88
+ encoding: 'utf8',
89
+ })
90
+
87
91
  await graphqlMesh({ ...cliParams, configName: tmpMesh })
88
92
 
89
93
  await cleanup()
package/dist/bin/mesh.js CHANGED
@@ -28,17 +28,18 @@ const root = process.cwd();
28
28
  const meshDir = path_1.default.dirname(require.resolve('@graphcommerce/graphql-mesh'));
29
29
  const relativePath = path_1.default.join(path_1.default.relative(meshDir, root), '/');
30
30
  const isMonoRepo = relativePath.startsWith('../../examples');
31
- const artifactsDir = path_1.default.join(path_1.default.relative(root, meshDir), '/.mesh');
32
31
  const cliParams = {
33
32
  ...cli_1.DEFAULT_CLI_PARAMS,
34
- artifactsDir,
35
33
  playgroundTitle: 'GraphCommerce® Mesh',
36
34
  };
37
35
  const tmpMesh = `_tmp_mesh_${Math.random().toString(36).substring(2, 15)}`;
38
36
  const tmpMeshLocation = path_1.default.join(root, `.${tmpMesh}rc.yml`);
39
- function cleanup() {
37
+ async function cleanup() {
40
38
  try {
41
- return fs_1.promises.unlink(tmpMeshLocation);
39
+ await fs_1.promises.stat(tmpMeshLocation).then((r) => {
40
+ if (r.isFile())
41
+ return fs_1.promises.unlink(tmpMeshLocation);
42
+ });
42
43
  }
43
44
  catch (e) {
44
45
  // ignore
@@ -78,6 +79,10 @@ const main = async () => {
78
79
  if (!conf.serve.playgroundTitle)
79
80
  conf.serve.playgroundTitle = 'GraphCommerce® Mesh';
80
81
  await fs_1.promises.writeFile(tmpMeshLocation, yaml_1.default.stringify(conf));
82
+ // Reexport the mesh to is can be used by packages
83
+ await fs_1.promises.writeFile(`${meshDir}/.mesh.ts`, `export * from '${relativePath}.mesh'`, {
84
+ encoding: 'utf8',
85
+ });
81
86
  await (0, cli_1.graphqlMesh)({ ...cliParams, configName: tmpMesh });
82
87
  await cleanup();
83
88
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/cli",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "1.0.2",
5
+ "version": "1.0.3",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "scripts": {