@cloudcommerce/cli 0.0.126 → 0.0.127

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @cloudcommerce/cli@0.0.125 build /home/leo/code/ecomplus/cloud-commerce/packages/cli
2
+ > @cloudcommerce/cli@0.0.126 build /home/leo/code/ecomplus/cloud-commerce/packages/cli
3
3
  > sh ../../scripts/build-lib.sh
4
4
 
package/bin/run.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import run from '../lib/index.js';
2
+ import run from '../lib/cli.js';
3
3
 
4
4
  run();
package/lib/build.js CHANGED
@@ -1,17 +1,24 @@
1
- import path from 'path';
1
+ import { join as joinPath } from 'node:path';
2
2
  import { fs } from 'zx';
3
3
 
4
4
  const copyFunctionsConfig = async () => {
5
- const functionsDir = path.join(process.cwd(), 'functions');
6
- const filesToCopy = ['.env', 'config.json'];
5
+ const functionsDir = joinPath(process.cwd(), 'functions');
6
+ const filesToCopy = ['.env', 'config.json', 'ssr/content/settings.json'];
7
7
  const dirents = await fs.readdir(functionsDir, { withFileTypes: true });
8
8
  for (let i = 0; i < dirents.length; i++) {
9
9
  if (dirents[i].isDirectory() && dirents[i].name.charAt(0) !== '.') {
10
+ const codebase = dirents[i].name;
11
+ const codebaseDir = joinPath(functionsDir, codebase);
12
+ // eslint-disable-next-line no-await-in-loop
13
+ await fs.ensureDir(joinPath(codebaseDir, 'content'));
10
14
  for (let ii = 0; ii < filesToCopy.length; ii++) {
11
- const srcPath = path.join(functionsDir, filesToCopy[ii]);
12
- if (fs.existsSync(srcPath)) {
13
- // eslint-disable-next-line no-await-in-loop
14
- await fs.copy(srcPath, path.join(functionsDir, dirents[i].name, filesToCopy[ii]));
15
+ const fileToCopy = filesToCopy[ii];
16
+ if (codebase !== 'ssr' || !fileToCopy.includes('ssr/')) {
17
+ const srcPath = joinPath(functionsDir, fileToCopy);
18
+ if (fs.existsSync(srcPath) && srcPath) {
19
+ // eslint-disable-next-line no-await-in-loop
20
+ await fs.copy(srcPath, joinPath(codebaseDir, fileToCopy.replace('ssr/', '')));
21
+ }
15
22
  }
16
23
  }
17
24
  }
@@ -1,5 +1,5 @@
1
- import url from 'url';
2
- import path from 'path';
1
+ import url from 'node:url';
2
+ import path from 'node:path';
3
3
  import {
4
4
  $, argv, fs, echo, chalk,
5
5
  } from 'zx';
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import path from 'node:path';
2
2
  import { $, fs } from 'zx';
3
3
 
4
4
  const serviceAccountId = 'cloud-commerce-gh-actions';
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.0.126",
4
+ "version": "0.0.127",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
8
8
  },
9
- "main": "lib/index.js",
9
+ "main": "lib/cli.js",
10
10
  "exports": {
11
- ".": "./lib/index.js",
11
+ ".": "./lib/cli.js",
12
12
  "./create-auth": "./create-auth.js"
13
13
  },
14
14
  "repository": {
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/cli#readme",
25
25
  "dependencies": {
26
- "@cloudcommerce/api": "0.0.126",
27
26
  "libsodium-wrappers": "^0.7.10",
28
27
  "md5": "^2.3.0",
29
- "zx": "^7.1.1"
28
+ "zx": "^7.1.1",
29
+ "@cloudcommerce/api": "0.0.127"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "sh ../../scripts/build-lib.sh"
package/src/build.ts CHANGED
@@ -1,20 +1,27 @@
1
- import path from 'path';
1
+ import { join as joinPath } from 'node:path';
2
2
  import { fs } from 'zx';
3
3
 
4
4
  const copyFunctionsConfig = async () => {
5
- const functionsDir = path.join(process.cwd(), 'functions');
6
- const filesToCopy = ['.env', 'config.json'];
5
+ const functionsDir = joinPath(process.cwd(), 'functions');
6
+ const filesToCopy = ['.env', 'config.json', 'ssr/content/settings.json'];
7
7
  const dirents = await fs.readdir(functionsDir, { withFileTypes: true });
8
8
  for (let i = 0; i < dirents.length; i++) {
9
9
  if (dirents[i].isDirectory() && dirents[i].name.charAt(0) !== '.') {
10
+ const codebase = dirents[i].name;
11
+ const codebaseDir = joinPath(functionsDir, codebase);
12
+ // eslint-disable-next-line no-await-in-loop
13
+ await fs.ensureDir(joinPath(codebaseDir, 'content'));
10
14
  for (let ii = 0; ii < filesToCopy.length; ii++) {
11
- const srcPath = path.join(functionsDir, filesToCopy[ii]);
12
- if (fs.existsSync(srcPath)) {
13
- // eslint-disable-next-line no-await-in-loop
14
- await fs.copy(
15
- srcPath,
16
- path.join(functionsDir, dirents[i].name, filesToCopy[ii]),
17
- );
15
+ const fileToCopy = filesToCopy[ii];
16
+ if (codebase !== 'ssr' || !fileToCopy.includes('ssr/')) {
17
+ const srcPath = joinPath(functionsDir, fileToCopy);
18
+ if (fs.existsSync(srcPath) && srcPath) {
19
+ // eslint-disable-next-line no-await-in-loop
20
+ await fs.copy(
21
+ srcPath,
22
+ joinPath(codebaseDir, fileToCopy.replace('ssr/', '')),
23
+ );
24
+ }
18
25
  }
19
26
  }
20
27
  }
@@ -1,5 +1,5 @@
1
- import url from 'url';
2
- import path from 'path';
1
+ import url from 'node:url';
2
+ import path from 'node:path';
3
3
  import {
4
4
  $,
5
5
  argv,
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import path from 'node:path';
2
2
  import { $, fs } from 'zx';
3
3
 
4
4
  const serviceAccountId = 'cloud-commerce-gh-actions';