Skip to content

Commit

Permalink
windows - git populate scripts (#782)
Browse files Browse the repository at this point in the history
* windows - git populate scripts

Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com>

* removed the script using git populate

Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com>

* removed git-env shell script file

Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com>

Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com>
  • Loading branch information
GermaVinsmoke authored Sep 23, 2022
1 parent 6460d9e commit 642cddf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
NEXT_PUBLIC_MEASUREMENTS_URL=https://api.ooni.io
NEXT_PUBLIC_AGGREGATION_API=https://api.ooni.io
NEXT_PUBLIC_EXPLORER_URL=http://localhost:3100

RUN_GIT_COMMIT_SHA_SHORT=yarn --silent git:getCommitSHA:short
RUN_GIT_COMMIT_SHA=yarn --silent git:getCommitSHA
RUN_GIT_COMMIT_REF=yarn --silent git:getCommitRef
RUN_GIT_COMMIT_TAGS=yarn --silent git:getReleasesAndTags
7 changes: 6 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Used only in producition
# Used only in producition
# To override locally, make a copy called `.env.production.local`
# Refer: https://nextjs.org/docs/basic-features/environment-variables

NEXT_PUBLIC_MEASUREMENTS_URL=https://api.ooni.io
NEXT_PUBLIC_AGGREGATION_API=https://api.ooni.io
NEXT_PUBLIC_SENTRY_DSN=https://49af7fff247c445b9a7c98ee21ddfd2f@o155150.ingest.sentry.io/1427510
NEXT_PUBLIC_EXPLORER_URL=https://explorer.ooni.org

RUN_GIT_COMMIT_SHA_SHORT=yarn --silent git:getCommitSHA:short
RUN_GIT_COMMIT_SHA=yarn --silent git:getCommitSHA
RUN_GIT_COMMIT_REF=yarn --silent git:getCommitRef
RUN_GIT_COMMIT_TAGS=yarn --silent git:getReleasesAndTags
18 changes: 14 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// https://nextjs.org/docs/api-reference/next.config.js/introduction
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
const { withSentryConfig } = require('@sentry/nextjs')
const { execSync } = require('child_process')

const SentryWebpackPluginOptions = {
// https://github.com/getsentry/sentry-webpack-plugin#options
Expand All @@ -24,12 +25,21 @@ module.exports = withSentryConfig({
},

webpack: (config, options) => {
const gitCommitSHAShort = execSync(process.env.RUN_GIT_COMMIT_SHA_SHORT)
const gitCommitSHA = execSync(process.env.RUN_GIT_COMMIT_SHA)
const gitCommitRef = execSync(process.env.RUN_GIT_COMMIT_REF)
const gitCommitTags = execSync(process.env.RUN_GIT_COMMIT_TAGS)

config.plugins.push(
new options.webpack.DefinePlugin({
'process.env.GIT_COMMIT_SHA_SHORT': JSON.stringify(process.env.GIT_COMMIT_SHA_SHORT),
'process.env.GIT_COMMIT_SHA': JSON.stringify(process.env.GIT_COMMIT_SHA),
'process.env.GIT_COMMIT_REF': JSON.stringify(process.env.GIT_COMMIT_REF),
'process.env.GIT_COMMIT_TAGS': JSON.stringify(process.env.GIT_COMMIT_TAGS),
'process.env.GIT_COMMIT_SHA_SHORT': JSON.stringify(
gitCommitSHAShort.toString()
),
'process.env.GIT_COMMIT_SHA': JSON.stringify(gitCommitSHA.toString()),
'process.env.GIT_COMMIT_REF': JSON.stringify(gitCommitRef.toString()),
'process.env.GIT_COMMIT_TAGS': JSON.stringify(
gitCommitTags.toString()
),
'process.env.WDYR': JSON.stringify(process.env.WDYR),
})
)
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,18 @@
"start-server-and-test": "^1.14.0"
},
"scripts": {
"dev": ". ./scripts/populate-git-env.sh && next dev -p 3100",
"debug": ". ./scripts/populate-git-env.sh && WDYR=1 NODE_OPTIONS='--inspect' next dev -p 3100",
"dev": "next dev -p 3100",
"debug": "WDYR=1 NODE_OPTIONS='--inspect' next dev -p 3100",
"start": "next start -p 3100",
"build": ". ./scripts/populate-git-env.sh && next build",
"export": ". ./scripts/populate-git-env.sh && next export",
"build": "next build",
"export": "next export",
"lint": "next lint",
"test:e2e": "yarn build && start-server-and-test start http://localhost:3100 cypress:run",
"cypress:run": "cypress run",
"test": "yarn run test:e2e",
"script:build-translations": "node ./scripts/build-translations.js",
"script:extract-i18n-keys": "yarn build && node ./scripts/extract-react-intl-keys.js",
"script:populate-git-env:print": ". ./scripts/populate-git-env.sh && echo 'SHA: '${GIT_COMMIT_SHA} && echo 'SHA (short): '${GIT_COMMIT_SHA_SHORT} && echo 'REF (current branch/tag): '${GIT_COMMIT_REF} && echo 'TAGS: '${GIT_COMMIT_TAGS}",
"git:getReleasesAndTags": "git tag --points-at HEAD | tr '\\r\\n' ' '",
"git:getReleasesAndTags": "git tag --points-at HEAD",
"git:getCommitSHA": "git rev-parse HEAD",
"git:getCommitSHA:short": "git rev-parse --short HEAD",
"git:getCommitRef": "git symbolic-ref HEAD"
Expand Down
6 changes: 0 additions & 6 deletions scripts/populate-git-env.sh

This file was deleted.

1 comment on commit 642cddf

@vercel
Copy link

@vercel vercel bot commented on 642cddf Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.