@swell/cli 2.9.15 → 2.9.17
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/dist/commands/app/push.js +11 -1
- package/dist/lib/api.js +2 -2
- package/dist/lib/apps/index.d.ts +1 -1
- package/dist/lib/apps/index.js +1 -1
- package/dist/lib/apps/paths.d.ts +1 -0
- package/dist/lib/apps/paths.js +10 -0
- package/dist/push-app-command.js +8 -1
- package/oclif.manifest.json +5 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import { AllConfigPaths, filePathExistsAsync, isPathDirectory, } from '../../lib/apps/index.js';
|
|
3
|
+
import { affectsFrontendDeployment, AllConfigPaths, filePathExistsAsync, isPathDirectory, } from '../../lib/apps/index.js';
|
|
4
4
|
import style from '../../lib/style.js';
|
|
5
5
|
import { PushAppCommand } from '../../push-app-command.js';
|
|
6
6
|
export default class AppPush extends PushAppCommand {
|
|
@@ -22,6 +22,9 @@ If the app does not exist, it will be created and its global ID saved to a .swel
|
|
|
22
22
|
- If a file is specified, only that file will be pushed to the store.
|
|
23
23
|
- If a directory is specified, only files in that directory will be pushed.
|
|
24
24
|
|
|
25
|
+
Pushing anything under frontend/ also builds and deploys the app frontend, so
|
|
26
|
+
the deployed frontend matches what was pushed. Use --no-deploy to skip it.
|
|
27
|
+
|
|
25
28
|
App file directories:
|
|
26
29
|
${Object.values(AllConfigPaths)
|
|
27
30
|
.map((dir) => style.path(`${dir}/`))
|
|
@@ -30,6 +33,8 @@ ${Object.values(AllConfigPaths)
|
|
|
30
33
|
'swell app push',
|
|
31
34
|
'swell app push content',
|
|
32
35
|
'swell app push models/products.json',
|
|
36
|
+
'swell app push frontend',
|
|
37
|
+
'swell app push frontend --no-deploy',
|
|
33
38
|
];
|
|
34
39
|
static flags = {
|
|
35
40
|
force: Flags.boolean({
|
|
@@ -84,6 +89,11 @@ ${Object.values(AllConfigPaths)
|
|
|
84
89
|
await ((await isPathDirectory(filePath))
|
|
85
90
|
? this.pushFilePath(relativePath, force)
|
|
86
91
|
: this.pushFile(relativePath));
|
|
92
|
+
// Uploading frontend sources doesn't change what the Worker serves,
|
|
93
|
+
// so scoped pushes need the same pipeline as an unscoped one
|
|
94
|
+
if (!noDeploy && affectsFrontendDeployment(relativePath)) {
|
|
95
|
+
await this.deployAppFrontend(force);
|
|
96
|
+
}
|
|
87
97
|
this.log();
|
|
88
98
|
this.logDashboardUrl(flags);
|
|
89
99
|
return;
|
package/dist/lib/api.js
CHANGED
|
@@ -195,9 +195,9 @@ export default class Api {
|
|
|
195
195
|
if (!hasTestEnv) {
|
|
196
196
|
const targetStoreId = storeId || this.storeId || config.getDefaultStore();
|
|
197
197
|
const settingsUrl = `${getLoginHost(targetStoreId)}/admin/settings/general`;
|
|
198
|
-
throw new Error(`
|
|
198
|
+
throw new Error(`This store has no test environment.
|
|
199
199
|
|
|
200
|
-
Enable it in the
|
|
200
|
+
Enable it in the store admin under Settings > General > Test environment:
|
|
201
201
|
${settingsUrl}`);
|
|
202
202
|
}
|
|
203
203
|
this.envId = envId;
|
package/dist/lib/apps/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import { AppConfig } from './app-config.js';
|
|
4
4
|
export { AppConfig, FunctionProcessingError, IgnoringFileError, } from './app-config.js';
|
|
5
|
-
export { allBaseFilesInDir, allConfigDirsPaths, allConfigFilesInDir, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, globAllFilesByPath, isPathDirectory, toPosixPath, } from './paths.js';
|
|
5
|
+
export { affectsFrontendDeployment, allBaseFilesInDir, allConfigDirsPaths, allConfigFilesInDir, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, globAllFilesByPath, isPathDirectory, toPosixPath, } from './paths.js';
|
|
6
6
|
export declare const PUSH_CONCURRENCY = 3;
|
|
7
7
|
/**
|
|
8
8
|
* An app as defined by the Swell API. This is different than an app
|
package/dist/lib/apps/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as path from 'node:path';
|
|
|
5
5
|
import { detectPackageManager, transformCommand } from '../package-manager.js';
|
|
6
6
|
import { AppConfig } from './app-config.js';
|
|
7
7
|
export { AppConfig, FunctionProcessingError, IgnoringFileError, } from './app-config.js';
|
|
8
|
-
export { allBaseFilesInDir, allConfigDirsPaths, allConfigFilesInDir, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, globAllFilesByPath, isPathDirectory, toPosixPath, } from './paths.js';
|
|
8
|
+
export { affectsFrontendDeployment, allBaseFilesInDir, allConfigDirsPaths, allConfigFilesInDir, allConfigFilesPaths, allConfigFilesPathsByType, getAllConfigPaths, globAllFilesByPath, isPathDirectory, toPosixPath, } from './paths.js';
|
|
9
9
|
export const PUSH_CONCURRENCY = 3;
|
|
10
10
|
export var SwellJsonFields;
|
|
11
11
|
(function (SwellJsonFields) {
|
package/dist/lib/apps/paths.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ConfigType } from './index.js';
|
|
|
3
3
|
export declare function toPosixPath(inputPath: string): string;
|
|
4
4
|
export declare function globAllFilesByPath(appPath: string, dirPath?: string): Promise<string[]>;
|
|
5
5
|
export declare function getGlobIgnorePathsChecker(appPath: string): Promise<GlobbyFilterFunction>;
|
|
6
|
+
export declare function affectsFrontendDeployment(relativePath: string): boolean;
|
|
6
7
|
export declare function allConfigDirsPaths(appPath: string): Generator<{
|
|
7
8
|
configDir: string;
|
|
8
9
|
configType: ConfigType;
|
package/dist/lib/apps/paths.js
CHANGED
|
@@ -43,6 +43,16 @@ export function globAllFilesByPath(appPath, dirPath) {
|
|
|
43
43
|
export function getGlobIgnorePathsChecker(appPath) {
|
|
44
44
|
return isGitIgnored({ cwd: appPath });
|
|
45
45
|
}
|
|
46
|
+
// Must cover the same files PushAppCommand.getFrontendDeploymentHash hashes,
|
|
47
|
+
// or a scoped push can change the hash without triggering a deploy. A match
|
|
48
|
+
// only runs the pipeline; the hash decides whether a build happens.
|
|
49
|
+
export function affectsFrontendDeployment(relativePath) {
|
|
50
|
+
const frontendDir = AllConfigPaths.FRONTEND;
|
|
51
|
+
const posixPath = toPosixPath(relativePath).replace(/\/+$/, '');
|
|
52
|
+
return (posixPath === frontendDir ||
|
|
53
|
+
posixPath.startsWith(`${frontendDir}/`) ||
|
|
54
|
+
posixPath === 'package.json');
|
|
55
|
+
}
|
|
46
56
|
function getConfigDirsPaths(appPath) {
|
|
47
57
|
const configDirsPaths = [];
|
|
48
58
|
for (const [type, configType] of Object.entries(ConfigType)) {
|
package/dist/push-app-command.js
CHANGED
|
@@ -316,7 +316,14 @@ export class PushAppCommand extends RemoteAppCommand {
|
|
|
316
316
|
return false;
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
else if (
|
|
319
|
+
else if (file) {
|
|
320
|
+
// Targeting a file: don't update the app from swell.json, but keep the
|
|
321
|
+
// remote one to diff config hashes and the frontend deployment hash
|
|
322
|
+
if (app) {
|
|
323
|
+
this.app = app;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
320
327
|
// Update existing app if not targeting a file
|
|
321
328
|
this.app = await this.getCreateUpdateApp(app, force);
|
|
322
329
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1180,11 +1180,13 @@
|
|
|
1180
1180
|
"name": "file"
|
|
1181
1181
|
}
|
|
1182
1182
|
},
|
|
1183
|
-
"description": "Push all app files, a specific file, or a specific configuration\ntype to an app in your store's test environment.\n\nIf the app does not exist, it will be created and its global ID saved to a .swellrc file.\n\n- If no file is specified, all configuration files will be pushed to the store.\n This includes the app icon (assets/icon.png), screenshots (assets/screenshots/),\n README.md, and swell.json.\n- If a file is specified, only that file will be pushed to the store.\n- If a directory is specified, only files in that directory will be pushed.\n\nApp file directories:\nassets/\ncontent/\nfrontend/\ncomponents/\nfunctions/\nmodels/\nnotifications/\nsettings/\ntheme/\nwebhooks/",
|
|
1183
|
+
"description": "Push all app files, a specific file, or a specific configuration\ntype to an app in your store's test environment.\n\nIf the app does not exist, it will be created and its global ID saved to a .swellrc file.\n\n- If no file is specified, all configuration files will be pushed to the store.\n This includes the app icon (assets/icon.png), screenshots (assets/screenshots/),\n README.md, and swell.json.\n- If a file is specified, only that file will be pushed to the store.\n- If a directory is specified, only files in that directory will be pushed.\n\nPushing anything under frontend/ also builds and deploys the app frontend, so\nthe deployed frontend matches what was pushed. Use --no-deploy to skip it.\n\nApp file directories:\nassets/\ncontent/\nfrontend/\ncomponents/\nfunctions/\nmodels/\nnotifications/\nsettings/\ntheme/\nwebhooks/",
|
|
1184
1184
|
"examples": [
|
|
1185
1185
|
"swell app push",
|
|
1186
1186
|
"swell app push content",
|
|
1187
|
-
"swell app push models/products.json"
|
|
1187
|
+
"swell app push models/products.json",
|
|
1188
|
+
"swell app push frontend",
|
|
1189
|
+
"swell app push frontend --no-deploy"
|
|
1188
1190
|
],
|
|
1189
1191
|
"flags": {
|
|
1190
1192
|
"app-path": {
|
|
@@ -3601,5 +3603,5 @@
|
|
|
3601
3603
|
]
|
|
3602
3604
|
}
|
|
3603
3605
|
},
|
|
3604
|
-
"version": "2.9.
|
|
3606
|
+
"version": "2.9.17"
|
|
3605
3607
|
}
|