tiktok-live-api 1.2.6 → 1.2.7

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.
Files changed (2) hide show
  1. package/bin/demo.mjs +46 -56
  2. package/package.json +1 -1
package/bin/demo.mjs CHANGED
@@ -262,7 +262,7 @@ function runScaffold(choice, targetDir, pm) {
262
262
 
263
263
  try {
264
264
  if (isNuxt) {
265
- execSync(npxCmd + ' nuxi@latest init "' + targetDir + '" --packageManager ' + pm, { stdio: 'inherit' });
265
+ execSync(npxCmd + ' degit tiktool/tiktok-live-nuxt "' + targetDir + '"', { stdio: 'inherit' });
266
266
  } else if (isNext) {
267
267
  execSync(npxCmd + ' create-next-app@latest "' + targetDir + '" --js --eslint --tailwind --app --src-dir --import-alias "@/*" --use-' + pm, { stdio: 'inherit' });
268
268
  } else if (isVite) {
@@ -270,62 +270,52 @@ function runScaffold(choice, targetDir, pm) {
270
270
  execSync(createCmd + ' "' + targetDir + '" -- --template react', { stdio: 'inherit' });
271
271
  }
272
272
 
273
- console.log("\n " + B + "📦 Installing " + C.cyan + "tiktok-live-api" + B + " SDK..." + R + "\n");
274
- execSync(installCmd, { cwd: fullPath, stdio: 'inherit' });
275
-
276
273
  if (isNuxt) {
277
- const isNuxt4 = fs.existsSync(path.join(fullPath, 'app', 'app.vue')) || !fs.existsSync(path.join(fullPath, 'app.vue'));
278
- const baseApp = isNuxt4 ? path.join(fullPath, 'app') : fullPath;
279
-
280
- const compDir = path.join(baseApp, 'components');
281
- if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
282
- fs.writeFileSync(path.join(compDir, 'TikTokLive.vue'), VUE_TEMPLATE);
283
-
284
- const appVue = path.join(baseApp, 'app.vue');
285
- fs.writeFileSync(appVue, [
286
- '<template>',
287
- ' <main style="min-height: 100vh; background: #f9fafb; padding-top: 40px;">',
288
- ' <TikTokLive />',
289
- ' </main>',
290
- '</template>'
291
- ].join('\\n') + '\\n');
292
- } else if (isNext) {
293
- const compDir = path.join(fullPath, 'src', 'components');
294
- if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
295
- fs.writeFileSync(path.join(compDir, 'TikTokLive.jsx'), REACT_TEMPLATE);
296
-
297
- const pageJs = path.join(fullPath, 'src', 'app', 'page.js');
298
- if (fs.existsSync(pageJs)) {
299
- fs.writeFileSync(pageJs, [
300
- "import TikTokLive from '@/components/TikTokLive';",
301
- "",
302
- "export default function Home() {",
303
- " return (",
304
- ' <main style={{ minHeight: "100vh", background: "#f9fafb", paddingTop: "40px" }}>',
305
- " <TikTokLive />",
306
- " </main>",
307
- " );",
308
- "}"
309
- ].join('\n') + '\n');
310
- }
311
- } else if (isVite) {
312
- const compDir = path.join(fullPath, 'src', 'components');
313
- if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
314
- fs.writeFileSync(path.join(compDir, 'TikTokLive.jsx'), REACT_TEMPLATE);
315
-
316
- const appJsx = path.join(fullPath, 'src', 'App.jsx');
317
- if (fs.existsSync(appJsx)) {
318
- fs.writeFileSync(appJsx, [
319
- "import TikTokLive from './components/TikTokLive';",
320
- "",
321
- "export default function App() {",
322
- " return (",
323
- ' <main style={{ minHeight: "100vh", background: "#f9fafb", paddingTop: "40px" }}>',
324
- " <TikTokLive />",
325
- " </main>",
326
- " );",
327
- "}"
328
- ].join('\n') + '\n');
274
+ console.log("\\n " + B + "📦 Installing dependencies using " + pm + "..." + R + "\\n");
275
+ const installAllCmd = pm === 'npm' ? 'npm install' : pm === 'yarn' ? 'yarn' : pm === 'pnpm' ? 'pnpm install' : 'bun install';
276
+ execSync(installAllCmd, { cwd: fullPath, stdio: 'inherit' });
277
+ } else {
278
+ console.log("\\n " + B + "📦 Installing " + C.cyan + "tiktok-live-api" + B + " SDK..." + R + "\\n");
279
+ execSync(installCmd, { cwd: fullPath, stdio: 'inherit' });
280
+
281
+ if (isNext) {
282
+ const compDir = path.join(fullPath, 'src', 'components');
283
+ if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
284
+ fs.writeFileSync(path.join(compDir, 'TikTokLive.jsx'), REACT_TEMPLATE);
285
+
286
+ const pageJs = path.join(fullPath, 'src', 'app', 'page.js');
287
+ if (fs.existsSync(pageJs)) {
288
+ fs.writeFileSync(pageJs, [
289
+ "import TikTokLive from '@/components/TikTokLive';",
290
+ "",
291
+ "export default function Home() {",
292
+ " return (",
293
+ ' <main style={{ minHeight: "100vh", background: "#f9fafb", paddingTop: "40px" }}>',
294
+ " <TikTokLive />",
295
+ " </main>",
296
+ " );",
297
+ "}"
298
+ ].join('\n') + '\n');
299
+ }
300
+ } else if (isVite) {
301
+ const compDir = path.join(fullPath, 'src', 'components');
302
+ if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
303
+ fs.writeFileSync(path.join(compDir, 'TikTokLive.jsx'), REACT_TEMPLATE);
304
+
305
+ const appJsx = path.join(fullPath, 'src', 'App.jsx');
306
+ if (fs.existsSync(appJsx)) {
307
+ fs.writeFileSync(appJsx, [
308
+ "import TikTokLive from './components/TikTokLive';",
309
+ "",
310
+ "export default function App() {",
311
+ " return (",
312
+ ' <main style={{ minHeight: "100vh", background: "#f9fafb", paddingTop: "40px" }}>',
313
+ " <TikTokLive />",
314
+ " </main>",
315
+ " );",
316
+ "}"
317
+ ].join('\n') + '\n');
318
+ }
329
319
  }
330
320
  }
331
321
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiktok-live-api",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "Unofficial TikTok LIVE API Client — Real-time chat, gifts, viewers, battles, and AI live captions from any TikTok livestream. Managed WebSocket API with 99.9% uptime.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",