tiktok-live-api 1.2.5 → 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 -55
  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,61 +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 compDir = path.join(fullPath, 'components');
278
- if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
279
- fs.writeFileSync(path.join(compDir, 'TikTokLive.vue'), VUE_TEMPLATE);
280
-
281
- const appVue = path.join(fullPath, 'app.vue');
282
- if (fs.existsSync(appVue)) {
283
- fs.writeFileSync(appVue, [
284
- '<template>',
285
- ' <main style="min-height: 100vh; background: #f9fafb; padding-top: 40px;">',
286
- ' <TikTokLive />',
287
- ' </main>',
288
- '</template>'
289
- ].join('\n') + '\n');
290
- }
291
- } else if (isNext) {
292
- const compDir = path.join(fullPath, 'src', 'components');
293
- if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
294
- fs.writeFileSync(path.join(compDir, 'TikTokLive.jsx'), REACT_TEMPLATE);
295
-
296
- const pageJs = path.join(fullPath, 'src', 'app', 'page.js');
297
- if (fs.existsSync(pageJs)) {
298
- fs.writeFileSync(pageJs, [
299
- "import TikTokLive from '@/components/TikTokLive';",
300
- "",
301
- "export default function Home() {",
302
- " return (",
303
- ' <main style={{ minHeight: "100vh", background: "#f9fafb", paddingTop: "40px" }}>',
304
- " <TikTokLive />",
305
- " </main>",
306
- " );",
307
- "}"
308
- ].join('\n') + '\n');
309
- }
310
- } else if (isVite) {
311
- const compDir = path.join(fullPath, 'src', 'components');
312
- if (!fs.existsSync(compDir)) fs.mkdirSync(compDir, { recursive: true });
313
- fs.writeFileSync(path.join(compDir, 'TikTokLive.jsx'), REACT_TEMPLATE);
314
-
315
- const appJsx = path.join(fullPath, 'src', 'App.jsx');
316
- if (fs.existsSync(appJsx)) {
317
- fs.writeFileSync(appJsx, [
318
- "import TikTokLive from './components/TikTokLive';",
319
- "",
320
- "export default function App() {",
321
- " return (",
322
- ' <main style={{ minHeight: "100vh", background: "#f9fafb", paddingTop: "40px" }}>',
323
- " <TikTokLive />",
324
- " </main>",
325
- " );",
326
- "}"
327
- ].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
+ }
328
319
  }
329
320
  }
330
321
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiktok-live-api",
3
- "version": "1.2.5",
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",