![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@schibsted/googoo
Advanced tools
Library that allows to create review apps using Serverless framework.
First, you need to install this library as dependency in your project - npm install --save-dev @schibsted/googoo
Add a script in your package.json
:
{
"scripts": {
"deploy-review-app": "npx node_modules/@schibsted/googoo deploy -c googoo.config.js",
"cleanup-review-app": "npx node_modules/@schibsted/googoo cleanup -c googoo.config.js"
}
}
Create googoo.config.js
file. Example below:
module.exports = {
github: {
token: 'GITHUB_TOKEN',
baseUrl: 'https://github.mycompany.io/api/v3',
org: 'myAwesomeGithubOrg',
repo: 'myProject',
},
ci: {
prNumber: '4077',
},
app: {
prefix: 'myapp-pr-',
useCustomDomain: true,
serverlessConfigFile: 'serverless.review.yml',
},
buildCommand: 'npm run build',
createAppLink: (url, site, appName) => {
return `- [**${site}**](${url}) This is great!`;
},
hooks: {
beforeBuild: (site, appName) => {},
afterBuild: (site, appName) => {},
beforeDeploy: (site, appName) => {},
afterDeploy: (site, appName, isDeployed, reviewAppUrl) => {},
},
};
Configuration options:
github.token
- required. Library calls Github API to retrieve PR description and update it with links.github.baseUrl
- optional. By default, public Github API will be called, but you might want to use it with your Github Enterprisegithub.org
- required. Github organization where the repo belongs to.github.repo
- required. Your Github repository nameci.prNumber
- required. PR number. Usually you will retrieve this from env variables in your CI. It is used in the app name.app.prefix
- optional. By default, your app name will be prefixed with review-
, but you might want to customize itapp.useCustomDomain
- optional. Allows you to have your custom domain to be used with review apps. Keep in mind that the domain has to be delegated to Route53 then and ACM certificate has to exist in us-east-1 region.app.serverlessConfigFile
- optional. Name of file with serverless app config. Defaults to serverless.yml
buildCommand
- optional. Allows to call additional script before deploying the appcreateAppLink
- optional. Once the app is deployed, library will post app link as comment in PR. You might want to customize the format.hooks
- optional. An object consisting of JS functions to call during the process:
beforeBuild
- called before running the buildCommand
(only if buildCommand
is defined)afterBuild
- called after running the buildCommand
(only if buildCommand
is defined)beforeDeploy
- called before running serverless deployafterDeploy
- called after running serverless deploy. It receives two additional arguments:
isDeployed
- boolean with the status of the deployreviewAppUrl
- final review app URLExample of serverless.yml
file:
service: ${env:SERVICE_NAME}
plugins:
- serverless-offline
- serverless-domain-manager
frameworkVersion: '2'
useDotenv: true
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: 20201221
logRetentionInDays: 7
region: eu-north-1
apiGateway:
binaryMediaTypes:
- '*/*'
environment:
DEFAULT_HOST: https://${self:service}.pr.example.com
IS_REVIEW_APP: true
custom:
customDomain:
domainName: ${self:service}.pr.example.com
basePath: ''
stage: ${self:provider.stage}
createRoute53Record: true
package:
exclude:
- .git/**
- .idea/**
functions:
app:
handler: ./serverless.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
environment: ${file(./serverless.review.env.yml):environment} # this is optional - you can use it to be able to set env variables in PR description
Now make sure to call review apps scripts somewhere in your CI:
npm run deploy-review-app
should be ideally called when running CI for PRs and you're done with testing.
npm run cleanup-review-app
will remove all review apps that do not have opened PR. For example, it can be called using cron once per day.
It is a bit boring now, but only one step is left :) Add optional PR template to your Github repo. Create .github/PULL_REQUEST_TEMPLATE.md
file:
**Review app**
Check "Create review app" and at least **one** APP to deploy a review app. **Note** that you can deploy multiple review apps at once by checking several publications.
- [ ] Create review app
- [ ] deploy **app**
Additionally, you can override env variables in the review app. Just uncomment the line below and fill in with your desired values.
// SET ENV FOO="BAR BAZ BAT" ANOTHER_ENV_VAR="bar baz bat"
You are done! :)
nvm use
npm install
npm start
FAQs
Deploy review app using Serverless framework
The npm package @schibsted/googoo receives a total of 2 weekly downloads. As such, @schibsted/googoo popularity was classified as not popular.
We found that @schibsted/googoo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.