Skip to content

Commit

Permalink
feat: mock user in dev (#221)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Roe <[email protected]>
  • Loading branch information
patak-dev and danielroe authored Nov 29, 2022
1 parent 59802f0 commit ea04cc2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.mock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MOCK_USER='{"user":{"server":"universeodon.com","token":"BLMfvYGgiEPgLpiunVS0JYxxqzga3S58C60DDwu1jvw","account":{"id":"109424142224653388","username":"elkdev","acct":"elkdev","displayName":"Elk Dev Team","locked":false,"bot":false,"discoverable":null,"group":false,"createdAt":"2022-11-28T00:00:00.000Z","note":"","url":"https://universeodon.com/@elkdev","avatar":"https://universeodon.com/avatars/original/missing.png","avatarStatic":"https://universeodon.com/avatars/original/missing.png","header":"https://universeodon.com/headers/original/missing.png","headerStatic":"https://universeodon.com/headers/original/missing.png","followersCount":0,"followingCount":0,"statusesCount":0,"lastStatusAt":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"followRequestsCount":0},"emojis":[],"fields":[],"role":{"id":"-99","name":"","permissions":"65536","color":"","highlighted":false}}},"server":{"109424142224653388":{"uri":"universeodon.com","title":"Universeodon","shortDescription":"Be one with the fediverse.","description":"","email":"[email protected]","version":"4.0.2","urls":{"streamingApi":"wss://universeodon.com"},"stats":{"userCount":57026,"statusCount":283364,"domainCount":11515},"thumbnail":"https://media.universeodon.com/site_uploads/files/000/000/003/@1x/9de6fc1bbd150b05.png","languages":["en"],"registrations":true,"approvalRequired":false,"invitesEnabled":true,"configuration":{"accounts":{"maxFeaturedTags":10},"statuses":{"maxCharacters":500,"maxMediaAttachments":4,"charactersReservedPerUrl":23},"mediaAttachments":{"supportedMimeTypes":["image/jpeg","image/png","image/gif","image/heic","image/heif","image/webp","image/avif","video/webm","video/mp4","video/quicktime","video/ogg","audio/wave","audio/wav","audio/x-wav","audio/x-pn-wave","audio/vnd.wave","audio/ogg","audio/vorbis","audio/mpeg","audio/mp3","audio/webm","audio/flac","audio/aac","audio/m4a","audio/x-m4a","audio/mp4","audio/3gpp","video/x-ms-asf"],"imageSizeLimit":10485760,"imageMatrixLimit":16777216,"videoSizeLimit":41943040,"videoFrameRateLimit":60,"videoMatrixLimit":2304000},"polls":{"maxOptions":4,"maxCharactersPerOption":50,"minExpiration":300,"maxExpiration":2629746}},"contactAccount":{"id":"109287809647205395","username":"supernovae","acct":"supernovae","displayName":"Supernovae","locked":false,"bot":false,"discoverable":true,"group":false,"createdAt":"2022-11-04T00:00:00.000Z","note":"","url":"https://universeodon.com/@supernovae","avatar":"https://media.universeodon.com/accounts/avatars/109/287/809/647/205/395/original/551eafba585d19e5.jpg","avatarStatic":"https://media.universeodon.com/accounts/avatars/109/287/809/647/205/395/original/551eafba585d19e5.jpg","header":"https://media.universeodon.com/accounts/headers/109/287/809/647/205/395/original/5de388c5945925c5.jpg","headerStatic":"https://media.universeodon.com/accounts/headers/109/287/809/647/205/395/original/5de388c5945925c5.jpg","followersCount":6387,"followingCount":305,"statusesCount":1753,"lastStatusAt":"2022-11-28","noindex":false,"emojis":[],"fields":[]},"rules":[]}}}'
2 changes: 1 addition & 1 deletion .stackblitzrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"installDependencies": true,
"startCommand": "npm run dev"
"startCommand": "npm run dev:mocked"
}
4 changes: 2 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Inspect from 'vite-plugin-inspect'
import { isCI } from 'std-env'
import { isCI, isDevelopment } from 'std-env'

export default defineNuxtConfig({
ssr: false,
Expand Down Expand Up @@ -31,7 +31,7 @@ export default defineNuxtConfig({
define: {
'import.meta.env.__BUILD_TIME__': JSON.stringify(new Date().toISOString()),
'process.env.VSCODE_TEXTMATE_DEBUG': 'false',
'process.mock': isCI && process.env.PULL_REQUEST === 'true' && process.env.MOCK_USER,
'process.mock': ((isDevelopment || (isCI && process.env.PULL_REQUEST === 'true')) && process.env.MOCK_USER) || 'false',
},
build: {
target: 'esnext',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build": "nuxi build",
"dev": "nuxi dev --port 5314",
"dev:mocked": "nuxi dev --port 5314 --dotenv .env.mock",
"start": "PORT=5314 node .output/server/index.mjs",
"lint": "eslint .",
"prepare": "esno scripts/prepare.ts",
Expand Down

0 comments on commit ea04cc2

Please sign in to comment.