@cloudcommerce/cli 0.6.10 → 0.6.11
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/.turbo/turbo-build.log +1 -1
- package/config/firebase.json +1 -1
- package/lib/build.js +11 -2
- package/lib/cli.js +5 -3
- package/package.json +2 -2
- package/src/build.ts +12 -2
- package/src/cli.ts +5 -3
package/.turbo/turbo-build.log
CHANGED
package/config/firebase.json
CHANGED
package/lib/build.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join as joinPath } from 'node:path';
|
|
2
|
-
import { fs } from 'zx';
|
|
2
|
+
import { $, fs } from 'zx';
|
|
3
3
|
|
|
4
4
|
const copyFunctionsConfig = async () => {
|
|
5
5
|
const functionsDir = joinPath(process.cwd(), 'functions');
|
|
@@ -24,5 +24,14 @@ const copyFunctionsConfig = async () => {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
+
const buildCodebase = async (codebase) => {
|
|
28
|
+
copyFunctionsConfig();
|
|
29
|
+
if (codebase === 'ssr') {
|
|
30
|
+
await $`npm --prefix "functions/ssr" run build 2>ssr-build-warns.log &&
|
|
31
|
+
printf '\n--- // ---\n' && cat ssr-build-warns.log`;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default buildCodebase;
|
|
27
36
|
|
|
28
|
-
export
|
|
37
|
+
export { buildCodebase, copyFunctionsConfig };
|
package/lib/cli.js
CHANGED
|
@@ -52,7 +52,9 @@ export default async () => {
|
|
|
52
52
|
return $`firebase --project=${projectId} ${cmd} ${options}`;
|
|
53
53
|
};
|
|
54
54
|
if (argv._.includes('serve')) {
|
|
55
|
-
|
|
55
|
+
if (argv.build !== false) {
|
|
56
|
+
await build(argv.codebase);
|
|
57
|
+
}
|
|
56
58
|
return $firebase('emulators:start').catch(async (err) => {
|
|
57
59
|
await echo`
|
|
58
60
|
Try killing open emulators with:
|
|
@@ -71,7 +73,7 @@ ${chalk.bold('npx kill-port 4000 9099 5001 8080 5000 8085 9199 4400 4500')}
|
|
|
71
73
|
return $firebase('functions:log');
|
|
72
74
|
}
|
|
73
75
|
if (argv._.includes('build')) {
|
|
74
|
-
return build();
|
|
76
|
+
return build(argv.codebase);
|
|
75
77
|
}
|
|
76
78
|
if (argv._.includes('deploy')) {
|
|
77
79
|
return $firebase('deploy');
|
|
@@ -91,7 +93,7 @@ ECOM_STORE_ID=${storeId}
|
|
|
91
93
|
}
|
|
92
94
|
if (argv.commit !== false) {
|
|
93
95
|
await fs.writeFile(path.join(pwd, 'functions', 'config.json'), JSON.stringify({ storeId }, null, 2));
|
|
94
|
-
await build();
|
|
96
|
+
await build(argv.codebase);
|
|
95
97
|
try {
|
|
96
98
|
await $`git add .firebaserc functions/config.json`;
|
|
97
99
|
await $`git commit -m "Setup store [skip ci]"`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.11",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce CLI tools",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cloudcommerce": "./bin/run.mjs"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"libsodium-wrappers": "^0.7.11",
|
|
27
27
|
"md5": "^2.3.0",
|
|
28
28
|
"zx": "^7.2.0",
|
|
29
|
-
"@cloudcommerce/api": "0.6.
|
|
29
|
+
"@cloudcommerce/api": "0.6.11"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "sh ../../scripts/build-lib.sh"
|
package/src/build.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join as joinPath } from 'node:path';
|
|
2
|
-
import { fs } from 'zx';
|
|
2
|
+
import { $, fs } from 'zx';
|
|
3
3
|
|
|
4
4
|
const copyFunctionsConfig = async () => {
|
|
5
5
|
const functionsDir = joinPath(process.cwd(), 'functions');
|
|
@@ -28,4 +28,14 @@ const copyFunctionsConfig = async () => {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const buildCodebase = async (codebase?: string) => {
|
|
32
|
+
copyFunctionsConfig();
|
|
33
|
+
if (codebase === 'ssr') {
|
|
34
|
+
await $`npm --prefix "functions/ssr" run build 2>ssr-build-warns.log &&
|
|
35
|
+
printf '\n--- // ---\n' && cat ssr-build-warns.log`;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default buildCodebase;
|
|
40
|
+
|
|
41
|
+
export { buildCodebase, copyFunctionsConfig };
|
package/src/cli.ts
CHANGED
|
@@ -67,7 +67,9 @@ export default async () => {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
if (argv._.includes('serve')) {
|
|
70
|
-
|
|
70
|
+
if (argv.build !== false) {
|
|
71
|
+
await build(argv.codebase);
|
|
72
|
+
}
|
|
71
73
|
return $firebase('emulators:start').catch(async (err: any) => {
|
|
72
74
|
await echo`
|
|
73
75
|
Try killing open emulators with:
|
|
@@ -87,7 +89,7 @@ ${chalk.bold('npx kill-port 4000 9099 5001 8080 5000 8085 9199 4400 4500')}
|
|
|
87
89
|
return $firebase('functions:log');
|
|
88
90
|
}
|
|
89
91
|
if (argv._.includes('build')) {
|
|
90
|
-
return build();
|
|
92
|
+
return build(argv.codebase);
|
|
91
93
|
}
|
|
92
94
|
if (argv._.includes('deploy')) {
|
|
93
95
|
return $firebase('deploy');
|
|
@@ -116,7 +118,7 @@ ECOM_STORE_ID=${storeId}
|
|
|
116
118
|
JSON.stringify({ storeId }, null, 2),
|
|
117
119
|
);
|
|
118
120
|
|
|
119
|
-
await build();
|
|
121
|
+
await build(argv.codebase);
|
|
120
122
|
try {
|
|
121
123
|
await $`git add .firebaserc functions/config.json`;
|
|
122
124
|
await $`git commit -m "Setup store [skip ci]"`;
|