Compare commits
3 Commits
010bc723d3
...
00b79f3537
Author | SHA1 | Date | |
---|---|---|---|
00b79f3537 | |||
6a5bc8d194 | |||
76a0656ab4 |
28
Dockerfile
28
Dockerfile
@ -50,26 +50,26 @@ RUN echo "export const users = {}; export const scripts = {}; export const ratin
|
|||||||
|
|
||||||
# Create comprehensive mock API files using printf for reliable multiline content
|
# Create comprehensive mock API files using printf for reliable multiline content
|
||||||
|
|
||||||
# Mock API index with proper types
|
# Mock API index with proper types and re-exports
|
||||||
RUN printf 'export const generateId = () => Math.random().toString(36).substr(2, 9);\nexport class ApiError extends Error {\n constructor(message: string, public status: number) {\n super(message);\n this.status = status;\n }\n}' > src/lib/api/index.ts
|
RUN printf 'export const generateId = () => Math.random().toString(36).substr(2, 9);\nexport class ApiError extends Error {\n constructor(message: string, public status: number = 500) {\n super(message);\n this.name = "ApiError";\n }\n}\nexport * from "./scripts";\nexport * from "./users";\nexport * from "./ratings";\nexport * from "./analytics";\nexport * from "./collections";\nexport * from "./auth";' > src/lib/api/index.ts
|
||||||
|
|
||||||
# Mock auth API with complete interface
|
# Mock auth API with individual function exports
|
||||||
RUN printf 'export const authApi = {\n login: async (data: any) => ({ token: "demo", user: { id: "1", username: "demo" } }),\n register: async (data: any) => ({ token: "demo", user: { id: "1", username: "demo" } }),\n changePassword: async (data: any) => ({}),\n refreshToken: async () => ({ token: "demo" })\n};' > src/lib/api/auth.ts
|
RUN printf 'export interface LoginCredentials {\n email: string;\n password: string;\n}\nexport interface RegisterData {\n email: string;\n username: string;\n displayName: string;\n password: string;\n}\nexport interface AuthToken {\n token: string;\n user: any;\n}\nexport async function login(credentials: LoginCredentials): Promise<AuthToken> {\n return { token: "demo-token", user: { id: "1", username: "demo", email: "demo@example.com", displayName: "Demo User", isAdmin: false, isModerator: false } };\n}\nexport async function register(data: RegisterData): Promise<AuthToken> {\n return { token: "demo-token", user: { id: "1", username: data.username, email: data.email, displayName: data.displayName, isAdmin: false, isModerator: false } };\n}\nexport async function refreshToken(token: string): Promise<AuthToken> {\n return { token: "demo-token", user: { id: "1", username: "demo", email: "demo@example.com", displayName: "Demo User", isAdmin: false, isModerator: false } };\n}\nexport async function changePassword(userId: string, currentPassword: string, newPassword: string): Promise<boolean> {\n return true;\n}' > src/lib/api/auth.ts
|
||||||
|
|
||||||
# Mock scripts API with all required methods
|
# Mock scripts API with individual function exports
|
||||||
RUN printf 'export interface ScriptFilters {\n search?: string;\n categories?: string[];\n compatibleOs?: string[];\n sortBy?: string;\n limit?: number;\n isApproved?: boolean;\n}\nexport interface UpdateScriptData {\n name?: string;\n description?: string;\n content?: string;\n}\nexport const scriptsApi = {\n getScripts: async (filters?: ScriptFilters) => ({ scripts: [], total: 0 }),\n getScriptById: async (id: string) => null,\n getPopularScripts: async () => [],\n getRecentScripts: async () => [],\n createScript: async (data: any) => ({ id: "mock" }),\n updateScript: async (id: string, data: UpdateScriptData, userId: string) => ({ id }),\n deleteScript: async (id: string, userId: string) => ({}),\n moderateScript: async (id: string, isApproved: boolean, moderatorId: string) => ({ id, isApproved }),\n incrementViewCount: async (id: string) => ({}),\n incrementDownloadCount: async (id: string) => ({})\n};' > src/lib/api/scripts.ts
|
RUN printf 'export interface ScriptFilters {\n search?: string;\n categories?: string[];\n compatibleOs?: string[];\n sortBy?: string;\n limit?: number;\n isApproved?: boolean;\n}\nexport interface UpdateScriptData {\n name?: string;\n description?: string;\n content?: string;\n}\nexport interface CreateScriptData {\n name: string;\n description: string;\n content: string;\n categories: string[];\n compatibleOs: string[];\n tags?: string[];\n}\nexport async function getScripts(filters?: ScriptFilters) {\n return { scripts: [], total: 0 };\n}\nexport async function getScriptById(id: string) {\n return null;\n}\nexport async function getPopularScripts() {\n return [];\n}\nexport async function getRecentScripts() {\n return [];\n}\nexport async function createScript(data: CreateScriptData, userId: string) {\n return { id: "mock-script-id", ...data, authorId: userId };\n}\nexport async function updateScript(id: string, data: UpdateScriptData, userId: string) {\n return { id, ...data };\n}\nexport async function deleteScript(id: string, userId: string) {\n return { success: true };\n}\nexport async function moderateScript(id: string, isApproved: boolean, moderatorId: string) {\n return { id, isApproved };\n}\nexport async function incrementViewCount(id: string) {\n return { success: true };\n}\nexport async function incrementDownloadCount(id: string) {\n return { success: true };\n}' > src/lib/api/scripts.ts
|
||||||
|
|
||||||
# Mock ratings API with complete interface
|
# Mock ratings API with individual function exports
|
||||||
RUN printf 'export const ratingsApi = {\n submitRating: async (data: any) => ({ scriptId: data.scriptId }),\n rateScript: async (data: any) => ({ scriptId: data.scriptId }),\n getUserRating: async (scriptId: string, userId?: string) => null,\n getScriptRatings: async (scriptId: string) => [],\n getScriptRatingStats: async (scriptId: string) => ({ averageRating: 0, totalRatings: 0, distribution: {} }),\n deleteRating: async (scriptId: string, userId: string) => ({})\n};' > src/lib/api/ratings.ts
|
RUN printf 'export interface CreateRatingData {\n scriptId: string;\n userId: string;\n rating: number;\n}\nexport async function rateScript(data: CreateRatingData) {\n return { id: "mock-rating-id", ...data, createdAt: new Date(), updatedAt: new Date() };\n}\nexport async function getUserRating(scriptId: string, userId: string) {\n return null;\n}\nexport async function getScriptRatings(scriptId: string) {\n return [];\n}\nexport async function getScriptRatingStats(scriptId: string) {\n return { averageRating: 0, totalRatings: 0, distribution: [] };\n}\nexport async function deleteRating(scriptId: string, userId: string) {\n return { success: true };\n}' > src/lib/api/ratings.ts
|
||||||
|
|
||||||
# Mock analytics API with complete interface
|
# Mock analytics API with individual function exports
|
||||||
RUN printf 'export interface AnalyticsFilters {\n startDate?: Date;\n endDate?: Date;\n}\nexport const analyticsApi = {\n trackEvent: async (data: any) => ({}),\n getAnalytics: async () => ({ views: [], downloads: [], topScripts: [], userGrowth: [] }),\n getAnalyticsEvents: async (filters?: AnalyticsFilters) => [],\n getScriptAnalytics: async (scriptId: string) => ({ views: [], downloads: [] }),\n getPlatformAnalytics: async () => ({ totalUsers: 0, totalScripts: 0 }),\n getUserAnalytics: async (userId: string) => ({ views: [], downloads: [] })\n};' > src/lib/api/analytics.ts
|
RUN printf 'export interface TrackEventData {\n scriptId: string;\n eventType: string;\n userId?: string;\n userAgent?: string;\n ipAddress?: string;\n referrer?: string;\n}\nexport interface AnalyticsFilters {\n scriptId?: string;\n eventType?: string;\n startDate?: Date;\n endDate?: Date;\n userId?: string;\n}\nexport async function trackEvent(data: TrackEventData) {\n return { success: true };\n}\nexport async function getAnalyticsEvents(filters?: AnalyticsFilters) {\n return [];\n}\nexport async function getScriptAnalytics(scriptId: string, days?: number) {\n return { eventCounts: [], dailyActivity: [], referrers: [], periodDays: days || 30 };\n}\nexport async function getPlatformAnalytics(days?: number) {\n return { totals: { totalScripts: 0, approvedScripts: 0, pendingScripts: 0 }, activityByType: [], popularScripts: [], dailyTrends: [], periodDays: days || 30 };\n}\nexport async function getUserAnalytics(userId: string, days?: number) {\n return { userScripts: [], recentActivity: [], periodDays: days || 30 };\n}' > src/lib/api/analytics.ts
|
||||||
|
|
||||||
# Mock collections API with complete interface
|
# Mock collections API with individual function exports
|
||||||
RUN printf 'export interface UpdateCollectionData {\n name?: string;\n description?: string;\n}\nexport const collectionsApi = {\n getCollections: async () => [],\n getCollectionById: async (id: string) => null,\n getUserCollections: async (userId: string) => [],\n getPublicCollections: async () => [],\n createCollection: async (data: any) => ({ id: "mock" }),\n updateCollection: async (id: string, data: UpdateCollectionData) => ({ id }),\n deleteCollection: async (id: string) => ({}),\n addScriptToCollection: async (collectionId: string, scriptId: string) => ({}),\n removeScriptFromCollection: async (collectionId: string, scriptId: string) => ({}),\n isScriptInCollection: async (collectionId: string, scriptId: string) => false\n};' > src/lib/api/collections.ts
|
RUN printf 'export interface CreateCollectionData {\n name: string;\n description?: string;\n authorId: string;\n isPublic?: boolean;\n}\nexport interface UpdateCollectionData {\n name?: string;\n description?: string;\n isPublic?: boolean;\n}\nexport async function createCollection(data: CreateCollectionData) {\n return { id: "mock-collection-id", ...data, createdAt: new Date(), updatedAt: new Date() };\n}\nexport async function getCollectionById(id: string) {\n return null;\n}\nexport async function getUserCollections(userId: string) {\n return [];\n}\nexport async function getPublicCollections(limit?: number, offset?: number) {\n return [];\n}\nexport async function updateCollection(id: string, data: UpdateCollectionData, userId: string) {\n return { id, ...data, updatedAt: new Date() };\n}\nexport async function deleteCollection(id: string, userId: string) {\n return { success: true };\n}\nexport async function addScriptToCollection(collectionId: string, scriptId: string, userId: string) {\n return { id: "mock-collection-script-id", collectionId, scriptId, addedAt: new Date() };\n}\nexport async function removeScriptFromCollection(collectionId: string, scriptId: string, userId: string) {\n return { success: true };\n}\nexport async function isScriptInCollection(collectionId: string, scriptId: string) {\n return false;\n}' > src/lib/api/collections.ts
|
||||||
|
|
||||||
# Mock users API with complete interface
|
# Mock users API with individual function exports
|
||||||
RUN printf 'export interface UpdateUserData {\n username?: string;\n displayName?: string;\n bio?: string;\n}\nexport const usersApi = {\n getUser: async (id: string) => null,\n getUserById: async (id: string) => null,\n getAllUsers: async () => [],\n searchUsers: async (query: string) => [],\n createUser: async (data: any) => ({ id: "mock" }),\n updateUser: async (id: string, data: UpdateUserData) => ({ id }),\n updateUserPermissions: async (id: string, permissions: any) => ({ id })\n};' > src/lib/api/users.ts
|
RUN printf 'export interface CreateUserData {\n email: string;\n username: string;\n displayName: string;\n avatarUrl?: string;\n bio?: string;\n}\nexport interface UpdateUserData {\n username?: string;\n displayName?: string;\n avatarUrl?: string;\n bio?: string;\n}\nexport async function createUser(data: CreateUserData) {\n return { id: "mock-user-id", ...data, isAdmin: false, isModerator: false, createdAt: new Date(), updatedAt: new Date() };\n}\nexport async function getUserById(id: string) {\n return null;\n}\nexport async function getUserByEmail(email: string) {\n return null;\n}\nexport async function getUserByUsername(username: string) {\n return null;\n}\nexport async function updateUser(id: string, data: UpdateUserData) {\n return { id, ...data, updatedAt: new Date() };\n}\nexport async function updateUserPermissions(id: string, permissions: any) {\n return { id, ...permissions, updatedAt: new Date() };\n}\nexport async function searchUsers(query: string, limit?: number) {\n return [];\n}\nexport async function getAllUsers(limit?: number, offset?: number) {\n return [];\n}' > src/lib/api/users.ts
|
||||||
|
|
||||||
# Create a custom package.json script that skips TypeScript
|
# Create a custom package.json script that skips TypeScript
|
||||||
RUN echo '{"name":"scriptshare","scripts":{"build-no-ts":"vite build --mode development"}}' > package-build.json
|
RUN echo '{"name":"scriptshare","scripts":{"build-no-ts":"vite build --mode development"}}' > package-build.json
|
||||||
|
Reference in New Issue
Block a user