epicshop 6.48.1 → 6.48.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/dist/commands/workshops.js +30 -44
- package/package.json +3 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import '@epic-web/workshop-utils/init-env';
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
3
2
|
import * as fs from 'node:fs';
|
|
4
3
|
import * as os from 'node:os';
|
|
5
4
|
import * as path from 'node:path';
|
|
@@ -7,7 +6,9 @@ import { cachified, githubCache } from '@epic-web/workshop-utils/cache.server';
|
|
|
7
6
|
import { parseEpicshopConfig } from '@epic-web/workshop-utils/config.server';
|
|
8
7
|
import { getAuthInfo } from '@epic-web/workshop-utils/db.server';
|
|
9
8
|
import { userHasAccessToWorkshop } from '@epic-web/workshop-utils/epic-api.server';
|
|
9
|
+
import { getErrorMessage } from '@epic-web/workshop-utils/utils';
|
|
10
10
|
import chalk from 'chalk';
|
|
11
|
+
import { execa } from 'execa';
|
|
11
12
|
import { matchSorter, rankings } from 'match-sorter';
|
|
12
13
|
import ora from 'ora';
|
|
13
14
|
import { assertCanPrompt, isCiEnvironment } from "../utils/cli-runtime.js";
|
|
@@ -375,10 +376,13 @@ export async function add(options) {
|
|
|
375
376
|
if (await workshopExists(repoName)) {
|
|
376
377
|
const message = `Workshop "${repoName}" already exists`;
|
|
377
378
|
if (!silent) {
|
|
379
|
+
const { getWorkshop } = await import('@epic-web/workshop-utils/workshops.server');
|
|
378
380
|
const reposDir = await getReposDirectory();
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
const
|
|
381
|
+
const workshop = await getWorkshop(repoName);
|
|
382
|
+
const workshopPath = workshop?.path ?? path.join(reposDir, repoName);
|
|
383
|
+
const workshopRepoName = workshop?.repoName ?? repoName;
|
|
384
|
+
const openCommand = `npx epicshop open ${workshopRepoName}`;
|
|
385
|
+
const startCommand = `npx epicshop start ${workshopRepoName}`;
|
|
382
386
|
console.log(chalk.yellow(`⚠️ ${message}`));
|
|
383
387
|
console.log(chalk.gray(` Location on disk: ${workshopPath}`));
|
|
384
388
|
console.log(chalk.gray(` You can run:`));
|
|
@@ -1829,48 +1833,30 @@ function resolveCliCommand(command) {
|
|
|
1829
1833
|
return command;
|
|
1830
1834
|
}
|
|
1831
1835
|
function runCommand(command, args, options) {
|
|
1832
|
-
return
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
resolve({ success: false, message: error.message, error });
|
|
1840
|
-
});
|
|
1841
|
-
child.on('close', (code) => {
|
|
1842
|
-
if (code === 0) {
|
|
1843
|
-
resolve({ success: true });
|
|
1844
|
-
}
|
|
1845
|
-
else {
|
|
1846
|
-
resolve({
|
|
1847
|
-
success: false,
|
|
1848
|
-
message: `Command exited with code ${code}`,
|
|
1849
|
-
});
|
|
1850
|
-
}
|
|
1851
|
-
});
|
|
1836
|
+
return execa(resolveCliCommand(command), args, {
|
|
1837
|
+
cwd: options.cwd,
|
|
1838
|
+
stdio: options.silent ? 'pipe' : 'inherit',
|
|
1839
|
+
}).then(() => ({ success: true }), (error) => {
|
|
1840
|
+
const message = getErrorMessage(error, 'Command failed');
|
|
1841
|
+
const err = error instanceof Error ? error : new Error(message);
|
|
1842
|
+
return { success: false, message, error: err };
|
|
1852
1843
|
});
|
|
1853
1844
|
}
|
|
1854
1845
|
function runCommandInteractive(command, args, options) {
|
|
1855
|
-
return
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
success: false,
|
|
1871
|
-
message: `Command exited with code ${code}`,
|
|
1872
|
-
});
|
|
1873
|
-
}
|
|
1874
|
-
});
|
|
1846
|
+
return execa(resolveCliCommand(command), args, {
|
|
1847
|
+
cwd: options.cwd,
|
|
1848
|
+
stdio: 'inherit',
|
|
1849
|
+
}).then(() => ({ success: true }), (error) => {
|
|
1850
|
+
// If the process was terminated by a signal (e.g. user presses Ctrl+C),
|
|
1851
|
+
// treat it as success so we don't show a confusing error message.
|
|
1852
|
+
if (error &&
|
|
1853
|
+
typeof error === 'object' &&
|
|
1854
|
+
'signal' in error &&
|
|
1855
|
+
typeof error.signal === 'string') {
|
|
1856
|
+
return { success: true };
|
|
1857
|
+
}
|
|
1858
|
+
const message = getErrorMessage(error, 'Command failed');
|
|
1859
|
+
const err = error instanceof Error ? error : new Error(message);
|
|
1860
|
+
return { success: false, message, error: err };
|
|
1875
1861
|
});
|
|
1876
1862
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epicshop",
|
|
3
|
-
"version": "6.48.
|
|
3
|
+
"version": "6.48.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -50,10 +50,11 @@
|
|
|
50
50
|
"build:watch": "nx watch --projects=epicshop -- nx run \\$NX_PROJECT_NAME:build"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@epic-web/workshop-utils": "6.48.
|
|
53
|
+
"@epic-web/workshop-utils": "6.48.3",
|
|
54
54
|
"@inquirer/prompts": "^7.5.1",
|
|
55
55
|
"chalk": "^5.6.2",
|
|
56
56
|
"close-with-grace": "^2.3.0",
|
|
57
|
+
"execa": "^9.6.0",
|
|
57
58
|
"get-port": "^7.1.0",
|
|
58
59
|
"match-sorter": "^8.2.0",
|
|
59
60
|
"openid-client": "^6.8.1",
|