Skip to content

Commit

Permalink
Add env linter (#7697)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored Feb 27, 2024
1 parent 5a3498c commit 3e1b544
Show file tree
Hide file tree
Showing 29 changed files with 143 additions and 96 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
- ./packages/ddex/webapp/node_modules
- ./packages/ddex/publisher/node_modules
- ./packages/trpc-server/node_modules
- ./packages/dotenv-linter/bin

generate-release-branch:
working_directory: ~/audius-protocol
Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ddex/webapp/client/.env.stage.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# For testing staging locally (ie, npm run stage)
VITE_DDEX_KEY_OVERRIDE=49d5e13d355709b615b7cce7369174fb240b6b39
VITE_ENV_OVERRIDE=stage
VITE_NODE_URL_OVERRIDE=https://audius-ddex.staging.audius.co
VITE_DDEX_KEY_OVERRIDE=49d5e13d355709b615b7cce7369174fb240b6b39
4 changes: 3 additions & 1 deletion packages/ddex/webapp/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
"serve": "vite preview",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint --fix src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:env": "dotenv-linter",
"typecheck": "tsc",
"verify": "concurrently \"npm:typecheck\" \"npm:lint\""
"verify": "concurrently \"npm:typecheck\" \"npm:lint\" \"npm:lint:env\""
},
"dependencies": {
"@audius/harmony": "*",
Expand Down Expand Up @@ -43,6 +44,7 @@
"web3": "4.3.0"
},
"devDependencies": {
"@audius/dotenv-linter": "*",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.0",
"@vitejs/plugin-react-swc": "3.5.0",
Expand Down
1 change: 1 addition & 0 deletions packages/dotenv-linter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/*
19 changes: 19 additions & 0 deletions packages/dotenv-linter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@audius/dotenv-linter",
"private": true,
"version": "1.5.67",
"description": "dotenv lint",
"author": "Audius",
"homepage": "https://github.com/AudiusProject/audius-protocol#readme",
"license": "Apache-2.0",
"bin": {
"dotenv-linter": "bin/dotenv-linter"
},
"scripts": {
"install": "BINDIR=./bin curl -sSfL https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/v3.3.0/install.sh | sh -s",
"rebuild": "npm rebuild --ignore-scripts"
},
"bugs": {
"url": "https://github.com/AudiusProject/audius-protocol/issues"
}
}
8 changes: 4 additions & 4 deletions packages/embed/.env.dev
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
VITE_AUDIUS_SCHEME=http
VITE_AMPLITUDE_KEY=72a58ce4ad1f9bafcba0b92bedb6c33d
VITE_AMPLITUDE_API_PROXY=gain.audius.co
VITE_AMPLITUDE_KEY=72a58ce4ad1f9bafcba0b92bedb6c33d
VITE_AUDIUS_SCHEME=http
VITE_ENVIRONMENT=development
VITE_IDENTITY_ENDPOINT=https://identityservice.staging.audius.co
VITE_HOSTNAME_REDIRECT=redirect.staging.audius.co
VITE_IDENTITY_ENDPOINT=https://identityservice.staging.audius.co
VITE_OPEN_SEA_API_KEY=639642f563224bf894274aaf77dd1ce7
VITE_SOLANA_RPC_ENDPOINT=https://audius-fe.rpcpool.com
VITE_SOLANA_RPC_ENDPOINT=https://audius-fe.rpcpool.com
12 changes: 6 additions & 6 deletions packages/embed/.env.prod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
VITE_AUDIUS_SCHEME=https
VITE_IDENTITY_ENDPOINT=https://identityservice.audius.co
VITE_AMPLITUDE_KEY=86760558b8bb1b3aae61656efd4ddacb
VITE_AMPLITUDE_API_PROXY=gain.audius.co
VITE_HOSTNAME=audius.co
VITE_HOSTNAME_REDIRECT=redirect.audius.co
VITE_AMPLITUDE_KEY=86760558b8bb1b3aae61656efd4ddacb
VITE_AUDIUS_SCHEME=https
VITE_ENVIRONMENT=production
VITE_GA_MEASUREMENT_ID=G-V6N1ZTVGS5
VITE_HOSTNAME=audius.co
VITE_HOSTNAME_REDIRECT=redirect.audius.co
VITE_IDENTITY_ENDPOINT=https://identityservice.audius.co
VITE_OPEN_SEA_API_KEY=639642f563224bf894274aaf77dd1ce7
VITE_SOLANA_RPC_ENDPOINT=https://audius-fe.rpcpool.com
VITE_SOLANA_RPC_ENDPOINT=https://audius-fe.rpcpool.com
10 changes: 5 additions & 5 deletions packages/embed/.env.stage
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
VITE_AUDIUS_SCHEME=https
VITE_IDENTITY_ENDPOINT=https://identityservice.staging.audius.co
VITE_AMPLITUDE_KEY=72a58ce4ad1f9bafcba0b92bedb6c33d
VITE_AMPLITUDE_API_PROXY=gain.audius.co
VITE_AMPLITUDE_KEY=72a58ce4ad1f9bafcba0b92bedb6c33d
VITE_AUDIUS_SCHEME=https
VITE_ENVIRONMENT=staging
VITE_HOSTNAME=staging.audius.co
VITE_HOSTNAME_REDIRECT=redirect.staging.audius.co
VITE_ENVIRONMENT=staging
VITE_IDENTITY_ENDPOINT=https://identityservice.staging.audius.co
VITE_OPEN_SEA_API_KEY=639642f563224bf894274aaf77dd1ce7
VITE_SOLANA_RPC_ENDPOINT=https://audius-fe.rpcpool.com
VITE_SOLANA_RPC_ENDPOINT=https://audius-fe.rpcpool.com
5 changes: 4 additions & 1 deletion packages/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
"build:prod": "env-cmd -f .env.prod npm run build && npm run build-api && mv build build-production",
"build-api": "webpack --config src/api/webpack.config.js -o build/api.js",
"lint:fix": "eslint --cache --fix --ext=js,jsx,ts,tsx src",
"lint": "eslint --cache --ext=js,jsx,ts,tsx src"
"lint": "eslint --cache --ext=js,jsx,ts,tsx src",
"lint:env": "dotenv-linter",
"verify": "concurrently \"npm:lint:fix\" \"npm:lint:env\""
},
"devDependencies": {
"@audius/dotenv-linter": "*",
"@cloudflare/kv-asset-handler": "^0.3.0",
"@vitejs/plugin-react": "4.1.0",
"env-cmd": "10.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/embed/src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ const App = (props) => {
const artworkClickURL =
tracksResponse?.permalink || collectionsResponse?.permalink
? stripLeadingSlash(
tracksResponse?.permalink || collectionsResponse?.permalink
)
tracksResponse?.permalink || collectionsResponse?.permalink
)
: null
const listenOnAudiusURL = artworkClickURL
const flavor = requestState.playerFlavor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const ListenOnAudiusCTA = ({ audiusURL, streamConditions }) => {
const onClick = () => {
window.open(getCopyableLink(audiusURL), '_blank')
}
const isPurchaseable =
streamConditions && 'usdc_purchase' in streamConditions
const isPurchaseable = streamConditions && 'usdc_purchase' in streamConditions

return (
<Button
Expand All @@ -24,11 +23,11 @@ const ListenOnAudiusCTA = ({ audiusURL, streamConditions }) => {
<Text variant='title' size='l'>
{isPurchaseable
? `${messages.buy} $${USDC(
streamConditions.usdc_purchase.price / 100
).toLocaleString('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
})}`
streamConditions.usdc_purchase.price / 100
).toLocaleString('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
})}`
: messages.listen}
</Text>
</Button>
Expand Down
3 changes: 1 addition & 2 deletions packages/embed/src/components/pausedpopover/PrimaryLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const messages = {
}

const PrimaryLabel = ({ streamConditions }) => {
const isPurchaseable =
streamConditions && 'usdc_purchase' in streamConditions
const isPurchaseable = streamConditions && 'usdc_purchase' in streamConditions

return (
<Text color='default' variant='heading' size='s'>
Expand Down
3 changes: 1 addition & 2 deletions packages/embed/src/components/track/TrackPlayerCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ const TrackPlayerCard = ({
}
setArtworkWrapperStyle(newStyle)
}, [height, width])
const isPurchaseable =
streamConditions && 'usdc_purchase' in streamConditions
const isPurchaseable = streamConditions && 'usdc_purchase' in streamConditions

return (
<Card
Expand Down
3 changes: 1 addition & 2 deletions packages/embed/src/components/track/TrackPlayerCompact.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const TrackPlayerCompact = ({
backgroundColor,
streamConditions
}) => {
const isPurchaseable =
streamConditions && 'usdc_purchase' in streamConditions
const isPurchaseable = streamConditions && 'usdc_purchase' in streamConditions

return (
<div
Expand Down
3 changes: 1 addition & 2 deletions packages/embed/src/components/track/TrackPlayerTiny.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ const TrackPlayerTiny = ({
infoStyle['--info-width'] = `${infoWidth + MARQUEE_SPACING}px`
}

const isPurchaseable =
streamConditions && 'usdc_purchase' in streamConditions
const isPurchaseable = streamConditions && 'usdc_purchase' in streamConditions

return (
<div className={styles.wrapper}>
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/.env.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ENVIRONMENT=development
TIKTOK_APP_ID=awa9re2w7ec3xrn6
TIKTOK_APP_ID=awa9re2w7ec3xrn6
2 changes: 1 addition & 1 deletion packages/mobile/.env.prod
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ENVIRONMENT=production
TIKTOK_APP_ID=awa9re2w7ec3xrn6
TIKTOK_APP_ID=awa9re2w7ec3xrn6
2 changes: 1 addition & 1 deletion packages/mobile/.env.stage
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ENVIRONMENT=staging
TIKTOK_APP_ID=awa9re2w7ec3xrn6
TIKTOK_APP_ID=awa9re2w7ec3xrn6
4 changes: 3 additions & 1 deletion packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"jetifier": "jetifier",
"lint:fix": "eslint --cache --fix --ext=js,jsx,ts,tsx src",
"lint": "eslint --cache --ext=js,jsx,ts,tsx src",
"lint:env": "dotenv-linter",
"react-devtools": "npx react-devtools",
"redux-devtools": "redux-devtools --port=8000 --open",
"start:e2e": "RN_E2E=true react-native start",
Expand All @@ -49,7 +50,7 @@
"typecheck": "tsc",
"upgrade": "react-native upgrade",
"upload:ios": "xcrun altool --upload-app -type ios --file build/AudiusReactNative.ipa --username $APPLE_ID --password $APPLE_ID_PASSWORD",
"verify": "concurrently \"npm:typecheck\" \"npm:lint:fix\""
"verify": "concurrently \"npm:typecheck\" \"npm:lint:fix\" \"npm:lint:env\""
},
"dependencies": {
"@amplitude/react-native": "2.17.2",
Expand Down Expand Up @@ -189,6 +190,7 @@
"ios-deploy": "1.11.4"
},
"devDependencies": {
"@audius/dotenv-linter": "*",
"@babel/core": "7.21.0",
"@babel/plugin-transform-export-namespace-from": "7.23.4",
"@babel/plugin-transform-react-jsx": "7.21.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/web/env/.env.prod
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_ENVIRONMENT=production
VITE_PORT=3002
VITE_PORT=3002
2 changes: 1 addition & 1 deletion packages/web/env/.env.ssr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_SSR=true
VITE_SSR=true
2 changes: 1 addition & 1 deletion packages/web/env/.env.stage
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_ENVIRONMENT=staging
VITE_PORT=3001
VITE_PORT=3001
4 changes: 3 additions & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build": "npm run write-sha && NODE_OPTIONS=--max-old-space-size=8192 env-cmd ./env/.env.git vite build",
"lint:fix": "eslint --cache --fix --ext=js,jsx,ts,tsx src",
"lint": "eslint --cache --ext=js,jsx,ts,tsx src",
"lint:env": "dotenv-linter env",
"prebuild": "npm run publish-scripts",
"preview:prod": "npm run build:prod && vite preview --outDir build-production",
"publish-scripts": "./scripts/publishScripts.sh",
Expand All @@ -34,7 +35,7 @@
"test": "vitest",
"typecheck:watch": "tsc --watch",
"typecheck": "tsc",
"verify": "concurrently \"npm:typecheck\" \"npm:lint:fix\" \"npm:stylelint:fix\"",
"verify": "concurrently \"npm:typecheck\" \"npm:lint:fix\" \"npm:stylelint:fix\" \"npm:lint:env\"",
"worker-ssr:dev": "npx wrangler dev --env test --config ./src/ssr/wrangler.toml",
"worker:dev": "npx wrangler dev --env test",
"write-sha": "./scripts/writeSHA.sh",
Expand Down Expand Up @@ -201,6 +202,7 @@
"extends": null
},
"devDependencies": {
"@audius/dotenv-linter": "*",
"@electron/notarize": "2.2.0",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@pinata/sdk": "1.1.13",
Expand Down
42 changes: 19 additions & 23 deletions protocol-dashboard/.env.prod
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
VITE_AUDIUS_NETWORK_ID=31524
VITE_AUDIUS_URL=https://audius.co
VITE_CLAIMABLE_TOKEN_PDA=5ZiE3vAkrdXBgyFL7KqG3RoEGBws4CjRcXVbABDLZTgx
VITE_CLAIMABLE_TOKEN_PROGRAM_ADDRESS=Ewkv3JahEFRKkcJmpoKB7pXbnUHwjAyXiwEo4ZY2rezQ
VITE_CLAIM_DISTRIBUTION_CONTRACT_ADDRESS=0x683c19E621A0F107a291fdAB38f80179809d61B5
VITE_ENTITY_MANAGER_ADDRESS=0x1Cd8a543596D499B9b6E7a6eC15ECd2B7857Fd64
VITE_ENVIRONMENT=production
VITE_ETH_NETWORK_ID=1
VITE_ETH_OWNER_WALLET=0xC7310a03e930DD659E15305ed7e1F5Df0F0426C5
VITE_ETH_PROVIDER_URL=https://eth-mainnet.alchemyapi.io/v2/hELYSivAlDc8LV29Mw_LumSdCZ4HQEge,https://eth-mainnet.alchemyapi.io/v2/Iy15fLTuL7wfRNqhMWZOyusLiqG2LGHJ,https://eth-mainnet.alchemyapi.io/v2/dKWeJWSF5lz5y_o0lQNVR2BfcmYglClO,https://eth-mainnet.alchemyapi.io/v2/W--Uss7AqotdfKao0PH6aTQa9bOG4osc
VITE_ETH_REGISTRY_ADDRESS=0xd976d3b4f4e22a238c1A736b6612D22f17b6f64C
VITE_ETH_TOKEN_ADDRESS=0x18aAA7115705e8be94bfFEBDE57Af9BFc265B998
VITE_ETH_PROVIDER_URL=https://eth-mainnet.alchemyapi.io/v2/hELYSivAlDc8LV29Mw_LumSdCZ4HQEge,https://eth-mainnet.alchemyapi.io/v2/Iy15fLTuL7wfRNqhMWZOyusLiqG2LGHJ,https://eth-mainnet.alchemyapi.io/v2/dKWeJWSF5lz5y_o0lQNVR2BfcmYglClO,https://eth-mainnet.alchemyapi.io/v2/W--Uss7AqotdfKao0PH6aTQa9bOG4osc
VITE_ETH_OWNER_WALLET=0xC7310a03e930DD659E15305ed7e1F5Df0F0426C5
VITE_QUERY_PROPOSAL_START_BLOCK = 11818009

VITE_ETH_NETWORK_ID=1
VITE_AUDIUS_NETWORK_ID=31524

VITE_AUDIUS_URL=https://audius.co
VITE_GQL_URI=https://gateway.thegraph.com/api/372f3681a94e4a45867d46cf59423e22/subgraphs/id/0x819fd65026848d710fe40d8c0439f1220e069398-0
VITE_GQL_BACKUP_URI=https://api.thegraph.com/subgraphs/name/audius-infra/audius-network-mainnet
VITE_REGISTRY_ADDRESS=0xC611C82150b56E6e4Ec5973AcAbA8835Dd0d75A2
VITE_ENTITY_MANAGER_ADDRESS=0x1Cd8a543596D499B9b6E7a6eC15ECd2B7857Fd64

VITE_GQL_URI=https://gateway.thegraph.com/api/372f3681a94e4a45867d46cf59423e22/subgraphs/id/0x819fd65026848d710fe40d8c0439f1220e069398-0
VITE_IDENTITY_SERVICE_ENDPOINT=https://identityservice.audius.co

VITE_WORMHOLE_ADDRESS=0x6E7a1F7339bbB62b23D44797b63e4258d283E095
VITE_CLAIM_DISTRIBUTION_CONTRACT_ADDRESS=0x683c19E621A0F107a291fdAB38f80179809d61B5
VITE_SOLANA_WEB3_CLUSTER=mainnet-beta
VITE_SOLANA_CLUSTER_ENDPOINT=https://solana-mainnet.g.alchemy.com/v2/fCWqhO4QJ7X8XqXvi213Mzclmn-30-ie
VITE_WAUDIO_MINT_ADDRESS=9LzCMqDgTKYz9Drzqnpgee3SGa89up3a247ypMj2xrqM
VITE_USDC_MINT_ADDRESS=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
VITE_SOLANA_TOKEN_PROGRAM_ADDRESS=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
VITE_CLAIMABLE_TOKEN_PDA=5ZiE3vAkrdXBgyFL7KqG3RoEGBws4CjRcXVbABDLZTgx
VITE_SOLANA_FEE_PAYER_ADDRESS=CgJhbUdHQNN5HBeNEN7J69Z89emh6BtyYX1CPEGwaeqi
VITE_CLAIMABLE_TOKEN_PROGRAM_ADDRESS=Ewkv3JahEFRKkcJmpoKB7pXbnUHwjAyXiwEo4ZY2rezQ
VITE_QUERY_PROPOSAL_START_BLOCK=11818009
VITE_REGISTRY_ADDRESS=0xC611C82150b56E6e4Ec5973AcAbA8835Dd0d75A2
VITE_REWARDS_MANAGER_PROGRAM_ID=DDZDcYdQFEMwcu2Mwo75yGFjJ1mUQyyXLWzhZLEVFcei
VITE_REWARDS_MANAGER_PROGRAM_PDA=71hWFVYokLaN1PNYzTAWi13EfJ7Xt9VbSWUKsXUT8mxE
VITE_REWARDS_MANAGER_TOKEN_PDA=3V9opXNpHmPPymKeq7CYD8wWMH8wzFXmqEkNdzfsZhYq
VITE_SOLANA_CLUSTER_ENDPOINT=https://solana-mainnet.g.alchemy.com/v2/fCWqhO4QJ7X8XqXvi213Mzclmn-30-ie
VITE_SOLANA_FEE_PAYER_ADDRESS=CgJhbUdHQNN5HBeNEN7J69Z89emh6BtyYX1CPEGwaeqi
VITE_SOLANA_TOKEN_PROGRAM_ADDRESS=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
VITE_SOLANA_WEB3_CLUSTER=mainnet-beta
VITE_USDC_MINT_ADDRESS=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
VITE_WAUDIO_MINT_ADDRESS=9LzCMqDgTKYz9Drzqnpgee3SGa89up3a247ypMj2xrqM
VITE_WORMHOLE_ADDRESS=0x6E7a1F7339bbB62b23D44797b63e4258d283E095
Loading

0 comments on commit 3e1b544

Please sign in to comment.