@pulse-editor/cli 0.1.1-beta.4 → 0.1.1-beta.6
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/cli.js +1 -0
- package/dist/components/commands/dev.js +6 -1
- package/dist/components/commands/help.js +2 -1
- package/dist/components/commands/preview.js +6 -1
- package/dist/lib/execa-utils/clean.js +1 -1
- package/dist/lib/manual.js +38 -0
- package/dist/lib/server/express.js +6 -6
- package/dist/lib/server/preview/backend/load-remote.cjs +23 -23
- package/dist/lib/server/preview/frontend/index.html +11 -11
- package/package.json +5 -2
- package/readme.md +28 -0
- package/dist/components/commands/preview copy.d.ts +0 -5
- package/dist/components/commands/preview copy.js +0 -14
- package/dist/components/commands/start copy.d.ts +0 -5
- package/dist/components/commands/start copy.js +0 -14
- package/dist/lib/deps.d.ts +0 -1
- package/dist/lib/deps.js +0 -5
- package/dist/lib/node_module_bin.d.ts +0 -1
- package/dist/lib/node_module_bin.js +0 -7
package/dist/cli.js
CHANGED
|
@@ -34,7 +34,12 @@ export default function Dev({ cli }) {
|
|
|
34
34
|
}
|
|
35
35
|
// Start dev server
|
|
36
36
|
await cleanDist();
|
|
37
|
-
await execa(
|
|
37
|
+
await execa(getDepsBinPath('concurrently'), [
|
|
38
|
+
'--prefix',
|
|
39
|
+
'none',
|
|
40
|
+
'"npx webpack --mode development --watch"',
|
|
41
|
+
'"tsx watch --clear-screen=false node_modules/@pulse-editor/cli/dist/lib/server/express.js"',
|
|
42
|
+
], {
|
|
38
43
|
stdio: 'inherit',
|
|
39
44
|
shell: true,
|
|
40
45
|
env: {
|
|
@@ -4,5 +4,6 @@ import { commandsManual } from '../../lib/manual.js';
|
|
|
4
4
|
import Header from '../header.js';
|
|
5
5
|
export default function Help({ cli }) {
|
|
6
6
|
const subCommand = cli.input[1];
|
|
7
|
-
return (_jsx(_Fragment, { children: subCommand ? (_jsx(Text, { children: commandsManual[subCommand]
|
|
7
|
+
return (_jsx(_Fragment, { children: subCommand ? (_jsx(Text, { children: commandsManual[subCommand]?.trimEnd() ??
|
|
8
|
+
`No help found for command: ${subCommand}` })) : (_jsxs(_Fragment, { children: [_jsx(Header, {}), _jsx(Text, { children: cli.help })] })) }));
|
|
8
9
|
}
|
|
@@ -37,7 +37,12 @@ export default function Preview({ cli }) {
|
|
|
37
37
|
}
|
|
38
38
|
// Start preview server
|
|
39
39
|
await cleanDist();
|
|
40
|
-
await execa(
|
|
40
|
+
await execa(getDepsBinPath('concurrently'), [
|
|
41
|
+
'--prefix',
|
|
42
|
+
'none',
|
|
43
|
+
'"npx webpack --mode development --watch"',
|
|
44
|
+
'"tsx watch --clear-screen=false node_modules/@pulse-editor/cli/dist/lib/server/express.js"',
|
|
45
|
+
], {
|
|
41
46
|
stdio: 'inherit',
|
|
42
47
|
shell: true,
|
|
43
48
|
env: {
|
package/dist/lib/manual.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const help = `\
|
|
2
2
|
help [command] Show help for a command.
|
|
3
|
+
|
|
3
4
|
`;
|
|
4
5
|
const chat = `\
|
|
5
6
|
chat [message] (WIP) Chat with the Pulse Editor AI assistant.
|
|
@@ -22,9 +23,11 @@ const login = `\
|
|
|
22
23
|
`;
|
|
23
24
|
const logout = `\
|
|
24
25
|
logout Logout from the Pulse Editor Platform.
|
|
26
|
+
|
|
25
27
|
`;
|
|
26
28
|
const publish = `\
|
|
27
29
|
publish Publish Pulse Editor Extension in current directory to the Pulse Editor Platform.
|
|
30
|
+
|
|
28
31
|
`;
|
|
29
32
|
const create = `\
|
|
30
33
|
create Create a new Pulse App using the starter template.
|
|
@@ -38,6 +41,36 @@ const create = `\
|
|
|
38
41
|
--visibility, -v [visibility]
|
|
39
42
|
The visibility of the new project. Options are private,
|
|
40
43
|
public, and unlisted.
|
|
44
|
+
|
|
45
|
+
`;
|
|
46
|
+
const preview = `\
|
|
47
|
+
preview Build the Pulse App in development mode and
|
|
48
|
+
start a preview server accessible via browser
|
|
49
|
+
with live reloading.
|
|
50
|
+
|
|
51
|
+
`;
|
|
52
|
+
const dev = `\
|
|
53
|
+
dev Build the Pulse App in development mode and
|
|
54
|
+
start a local development server for Pulse Editor
|
|
55
|
+
to load the app from, with live reloading.
|
|
56
|
+
|
|
57
|
+
`;
|
|
58
|
+
const build = `\
|
|
59
|
+
build Build the Pulse App for production deployment.
|
|
60
|
+
Flags:
|
|
61
|
+
--target, -t [target]
|
|
62
|
+
The build target. Options are 'client', 'server', or
|
|
63
|
+
unspecified (both client and server).
|
|
64
|
+
|
|
65
|
+
`;
|
|
66
|
+
const start = `\
|
|
67
|
+
start Build the Pulse App in production mode and
|
|
68
|
+
start a local server for Pulse Editor to load the app from.
|
|
69
|
+
|
|
70
|
+
`;
|
|
71
|
+
const clean = `\
|
|
72
|
+
clean Clean the dist/ directory.
|
|
73
|
+
|
|
41
74
|
`;
|
|
42
75
|
export const commandsManual = {
|
|
43
76
|
help,
|
|
@@ -46,4 +79,9 @@ export const commandsManual = {
|
|
|
46
79
|
logout,
|
|
47
80
|
publish,
|
|
48
81
|
create,
|
|
82
|
+
preview,
|
|
83
|
+
dev,
|
|
84
|
+
build,
|
|
85
|
+
start,
|
|
86
|
+
clean,
|
|
49
87
|
};
|
|
@@ -94,12 +94,12 @@ else {
|
|
|
94
94
|
/* Production mode */
|
|
95
95
|
app.use(`/${pulseConfig.id}/${pulseConfig.version}`, express.static('dist'));
|
|
96
96
|
app.listen(3030, '0.0.0.0', () => {
|
|
97
|
-
console.log(`\
|
|
98
|
-
🎉 Your Pulse extension \x1b[1m${pulseConfig.displayName}\x1b[0m is LIVE!
|
|
99
|
-
|
|
100
|
-
⚡️ Local: http://localhost:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
101
|
-
⚡️ Network: http://${getLocalNetworkIP()}:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
102
|
-
|
|
97
|
+
console.log(`\
|
|
98
|
+
🎉 Your Pulse extension \x1b[1m${pulseConfig.displayName}\x1b[0m is LIVE!
|
|
99
|
+
|
|
100
|
+
⚡️ Local: http://localhost:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
101
|
+
⚡️ Network: http://${getLocalNetworkIP()}:3030/${pulseConfig.id}/${pulseConfig.version}/
|
|
102
|
+
|
|
103
103
|
✨ Try it out in the Pulse Editor and let the magic happen! 🚀`);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const { createInstance } = require("@module-federation/runtime");
|
|
2
|
-
|
|
3
|
-
async function loadAndCall(func, req, appId, origin, version) {
|
|
4
|
-
// here we assign the return value of the init() function, which can be used to do some more complex
|
|
5
|
-
// things with the module federation runtime
|
|
6
|
-
const instance = createInstance({
|
|
7
|
-
name: "server_function_runner",
|
|
8
|
-
remotes: [
|
|
9
|
-
{
|
|
10
|
-
name: appId + "_server",
|
|
11
|
-
entry: `${origin}/${appId}/${version}/server/remoteEntry.js`,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const loadedFunc = (await instance.loadRemote(`${appId}_server/${func}`))
|
|
17
|
-
.default;
|
|
18
|
-
|
|
19
|
-
const res = await loadedFunc(req);
|
|
20
|
-
return res;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = { loadAndCall };
|
|
1
|
+
const { createInstance } = require("@module-federation/runtime");
|
|
2
|
+
|
|
3
|
+
async function loadAndCall(func, req, appId, origin, version) {
|
|
4
|
+
// here we assign the return value of the init() function, which can be used to do some more complex
|
|
5
|
+
// things with the module federation runtime
|
|
6
|
+
const instance = createInstance({
|
|
7
|
+
name: "server_function_runner",
|
|
8
|
+
remotes: [
|
|
9
|
+
{
|
|
10
|
+
name: appId + "_server",
|
|
11
|
+
entry: `${origin}/${appId}/${version}/server/remoteEntry.js`,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const loadedFunc = (await instance.loadRemote(`${appId}_server/${func}`))
|
|
17
|
+
.default;
|
|
18
|
+
|
|
19
|
+
const res = await loadedFunc(req);
|
|
20
|
+
return res;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { loadAndCall };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Pulse App</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body style="height: 100vh; width: 100vw">
|
|
9
|
-
<div id="root" style="height: 100%; width: 100%"></div>
|
|
10
|
-
</body>
|
|
11
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Pulse App</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body style="height: 100vh; width: 100vw">
|
|
9
|
+
<div id="root" style="height: 100%; width: 100%"></div>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulse-editor/cli",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pulse": "dist/cli.js"
|
|
@@ -26,15 +26,18 @@
|
|
|
26
26
|
"connect-livereload": "^0.6.1",
|
|
27
27
|
"cors": "^2.8.5",
|
|
28
28
|
"cross-env": "^10.1.0",
|
|
29
|
+
"dotenv": "^17.2.3",
|
|
29
30
|
"execa": "^9.6.0",
|
|
30
31
|
"express": "^5.1.0",
|
|
31
32
|
"ink": "^6.5.0",
|
|
32
33
|
"ink-select-input": "^6.2.0",
|
|
33
34
|
"ink-spinner": "^5.0.0",
|
|
34
35
|
"ink-text-input": "^6.0.0",
|
|
36
|
+
"livereload": "^0.10.3",
|
|
35
37
|
"meow": "^14.0.0",
|
|
36
38
|
"openid-client": "^6.8.1",
|
|
37
39
|
"react": "^19.2.0",
|
|
40
|
+
"react-dom": "^19.2.0",
|
|
38
41
|
"rimraf": "^6.1.0",
|
|
39
42
|
"tsx": "^4.20.6"
|
|
40
43
|
},
|
|
@@ -45,6 +48,7 @@
|
|
|
45
48
|
"@types/express": "^5.0.5",
|
|
46
49
|
"@types/livereload": "^0.9.5",
|
|
47
50
|
"@types/react": "^19.2.5",
|
|
51
|
+
"@types/react-dom": "^19.2.3",
|
|
48
52
|
"@vdemedes/prettier-config": "^2.0.1",
|
|
49
53
|
"ava": "^6.4.1",
|
|
50
54
|
"chalk": "^5.6.2",
|
|
@@ -52,7 +56,6 @@
|
|
|
52
56
|
"eslint-plugin-react": "^7.37.5",
|
|
53
57
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
54
58
|
"ink-testing-library": "^4.0.0",
|
|
55
|
-
"livereload": "^0.10.3",
|
|
56
59
|
"prettier": "^3.6.2",
|
|
57
60
|
"ts-node": "^10.9.2",
|
|
58
61
|
"typescript": "^5.9.3",
|
package/readme.md
CHANGED
|
@@ -17,6 +17,7 @@ npm run link
|
|
|
17
17
|
|
|
18
18
|
Commands
|
|
19
19
|
help [command] Show help for a command.
|
|
20
|
+
|
|
20
21
|
chat [message] (WIP) Chat with the Pulse Editor AI assistant.
|
|
21
22
|
|
|
22
23
|
Flags:
|
|
@@ -33,13 +34,40 @@ npm run link
|
|
|
33
34
|
Login using a browser flow.
|
|
34
35
|
|
|
35
36
|
logout Logout from the Pulse Editor Platform.
|
|
37
|
+
|
|
36
38
|
publish Publish Pulse Editor Extension in current directory to the Pulse Editor Platform.
|
|
39
|
+
|
|
37
40
|
create Create a new Pulse App using the starter template.
|
|
38
41
|
Flags:
|
|
39
42
|
--framework, -f [framework]
|
|
40
43
|
The framework to use for the new app.
|
|
41
44
|
Currently available options: react.
|
|
42
45
|
Future options: vue, angular, etc.
|
|
46
|
+
--name, -n [project-name]
|
|
47
|
+
The name of the new project.
|
|
48
|
+
--visibility, -v [visibility]
|
|
49
|
+
The visibility of the new project. Options are private,
|
|
50
|
+
public, and unlisted.
|
|
51
|
+
|
|
52
|
+
preview Build the Pulse App in development mode and
|
|
53
|
+
start a preview server accessible via browser
|
|
54
|
+
with live reloading.
|
|
55
|
+
|
|
56
|
+
dev Build the Pulse App in development mode and
|
|
57
|
+
start a local development server for Pulse Editor
|
|
58
|
+
to load the app from, with live reloading.
|
|
59
|
+
|
|
60
|
+
build Build the Pulse App for production deployment.
|
|
61
|
+
Flags:
|
|
62
|
+
--target, -t [target]
|
|
63
|
+
The build target. Options are 'client', 'server', or
|
|
64
|
+
unspecified (both client and server).
|
|
65
|
+
|
|
66
|
+
start Build the Pulse App in production mode and
|
|
67
|
+
start a local server for Pulse Editor to load the app from.
|
|
68
|
+
|
|
69
|
+
clean Clean the dist/ directory.
|
|
70
|
+
|
|
43
71
|
|
|
44
72
|
Examples
|
|
45
73
|
pulse help publish
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Text } from 'ink';
|
|
3
|
-
import { useEffect } from 'react';
|
|
4
|
-
import { execa } from 'execa';
|
|
5
|
-
export default function Preview({ cli }) {
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
// Start dev server
|
|
8
|
-
execa('npm run preview', {
|
|
9
|
-
stdio: 'inherit',
|
|
10
|
-
shell: true,
|
|
11
|
-
});
|
|
12
|
-
}, []);
|
|
13
|
-
return (_jsx(_Fragment, { children: _jsx(Text, { children: "Starting preview server..." }) }));
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Text } from 'ink';
|
|
3
|
-
import { useEffect } from 'react';
|
|
4
|
-
import { execa } from 'execa';
|
|
5
|
-
export default function Start({ cli }) {
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
// Start dev server
|
|
8
|
-
execa('npm run start', {
|
|
9
|
-
stdio: 'inherit',
|
|
10
|
-
shell: true,
|
|
11
|
-
});
|
|
12
|
-
}, []);
|
|
13
|
-
return (_jsx(_Fragment, { children: _jsx(Text, { children: "Starting prod server..." }) }));
|
|
14
|
-
}
|
package/dist/lib/deps.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getDepsBinPath(name: string): string;
|
package/dist/lib/deps.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Get deps bin at node_modules/@pulse-editor/cli/node_modules
|
|
2
|
-
export function getDepsBinPath(name) {
|
|
3
|
-
const workingDir = process.cwd();
|
|
4
|
-
return `${workingDir}/node_modules/@pulse-editor/cli/node_modules/.bin/${process.platform === 'win32' ? `${name}.cmd` : name}`;
|
|
5
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function bin(name: string): string;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
4
|
-
const __dirname = path.dirname(__filename);
|
|
5
|
-
export function bin(name) {
|
|
6
|
-
return path.join(__dirname, 'node_modules', '.bin', process.platform === 'win32' ? `${name}.cmd` : name);
|
|
7
|
-
}
|