svelte-realtime 0.4.1 → 0.4.2
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/cli.js +14 -16
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -83,33 +83,26 @@ if (p.isCancel(template)) {
|
|
|
83
83
|
const agent = detectAgent(process.env.npm_config_user_agent);
|
|
84
84
|
|
|
85
85
|
if (template === 'demo') {
|
|
86
|
-
|
|
87
|
-
s.start('Cloning demo repository');
|
|
86
|
+
p.log.step('Cloning demo repository');
|
|
88
87
|
run(`git clone ${DEMO_REPO} "${name}"`);
|
|
89
|
-
s.stop('Cloned.');
|
|
90
88
|
|
|
91
|
-
|
|
89
|
+
p.log.step('Installing dependencies');
|
|
92
90
|
run(`${agent} install`, dest);
|
|
93
|
-
s.stop('Installed.');
|
|
94
91
|
|
|
95
92
|
p.outro(`Done. cd ${name} && ${agent} run dev`);
|
|
96
93
|
process.exit(0);
|
|
97
94
|
}
|
|
98
95
|
|
|
99
|
-
|
|
96
|
+
p.log.step('Creating SvelteKit project');
|
|
97
|
+
run(`npx -y sv create "${name}" --template minimal --types ts --no-add-ons --no-install`);
|
|
100
98
|
|
|
101
|
-
|
|
102
|
-
run(`npx -y sv create "${name}" --template minimal --types ts`);
|
|
103
|
-
s.stop('Project created.');
|
|
104
|
-
|
|
105
|
-
s.start('Installing dependencies');
|
|
99
|
+
p.log.step('Installing dependencies');
|
|
106
100
|
const add = agent === 'npm' ? 'install' : 'add';
|
|
107
101
|
run(`${agent} ${add} svelte-adapter-uws svelte-realtime`, dest);
|
|
108
102
|
run(`${agent} ${add} uNetworking/uWebSockets.js#v20.60.0`, dest);
|
|
109
103
|
run(`${agent} ${add} -D ws`, dest);
|
|
110
|
-
s.stop('Dependencies installed.');
|
|
111
104
|
|
|
112
|
-
|
|
105
|
+
p.log.step('Configuring svelte-realtime');
|
|
113
106
|
|
|
114
107
|
writeFileSync(
|
|
115
108
|
join(dest, 'svelte.config.js'),
|
|
@@ -189,17 +182,22 @@ export const counter = live.stream('count', () => {
|
|
|
189
182
|
);
|
|
190
183
|
}
|
|
191
184
|
|
|
192
|
-
|
|
185
|
+
p.log.success('Configured.');
|
|
193
186
|
|
|
194
187
|
p.outro(`Done. cd ${name} && ${agent} run dev`);
|
|
195
188
|
|
|
196
189
|
// ---------------------------------------------------------------------------
|
|
197
190
|
|
|
191
|
+
/** @param {string} cmd @param {string} [cwd] */
|
|
198
192
|
function run(cmd, cwd) {
|
|
199
193
|
try {
|
|
200
|
-
execSync(cmd, {
|
|
194
|
+
execSync(cmd, {
|
|
195
|
+
cwd,
|
|
196
|
+
stdio: 'inherit',
|
|
197
|
+
env: { ...process.env, NODE_ENV: undefined }
|
|
198
|
+
});
|
|
201
199
|
} catch (e) {
|
|
202
|
-
p.cancel(`Command failed: ${cmd}\n${e.stderr || e.message}`);
|
|
200
|
+
p.cancel(`Command failed: ${cmd}\n${/** @type {any} */ (e).stderr || /** @type {any} */ (e).message}`);
|
|
203
201
|
process.exit(1);
|
|
204
202
|
}
|
|
205
203
|
}
|