
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@emartech/client-publish
Advanced tools
Deployer for client side projects. Uploads the bundled client application to target distribution platform (Amazon S3 and/or Firebase) and sets up redirection to that bucket for S3 deploys.
npm install @emartech/client-publish --save-dev
This package exposes a command called client-publish
. It can be used for several things:
revision
)deploy
)tag
)merge
)For detailed usage see help:
client-publish help
To deploy the project, some options must be configured via environment variables. These environment variables must be set on the CI/CD pipeline.
env var | description | required | default value |
---|---|---|---|
DEPLOY_ENV | deployment env, can be "staging" or "production" | "staging" | |
LOCAL_DIRECTORY | place of the bundled application | "dist" |
env var | description | required | default value |
---|---|---|---|
FIREBASE_DEPLOY | if true, it will deploy to the Firebase platform or not | false | |
FIREBASE_PROJECT | the name of the GCP project for Firebase Hosting | true | |
FIREBASE_SITE | the Firebase Hosting site used to host the asset | true | |
GOOGLE_APPLICATION_CREDENTIALS_JSON | the base64 encoded Google service account credential for Firebase deploy | true |
env var | description | required | default value |
---|---|---|---|
PROJECT_NAME | name of the project, will be used as the subdirectory in the S3 bucket | true | |
S3_ACL | S3 buckets ACL setting | "public-read" | |
S3_CACHE_CONTROL | S3 buckets cache control | "max-age=315360000, no-transform, public" | |
AWS_REGION | AWS region | "eu-west-1" | |
AWS_ACCESS_KEY_ID | AWS access key | true | |
AWS_SECRET_ACCESS_KEY | AWS secret for access key | true | |
REDIRECTOR_API_SECRET | secret of the redirector service | true |
Some furter options for the redirector deploy can be overridden but are not required if the DEPLOY_ENV
env variable is set.
env var | description | default value for staging | default value for production |
---|---|---|---|
S3_BUCKET | the S3 bucket where the application will be uploaded to | 'ems-assets-staging' | 'ems-assets' |
REDIRECTOR_URL | URL of the redirector service | 'https://redirector-staging.gservice.emarsys.com' | 'https://redirector.gservice.emarsys.net' |
REDIRECTOR_TARGET | the domain where the redirector should point | 'assets.emarsys.com' | 'assets.emarsys.net' |
Set the following environment variables:
PROJECT_NAME
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
REDIRECTOR_API_SECRET_STAGING
REDIRECTOR_API_SECRET_PRODUCTION
FIREBASE_PROJECT_STAGING
(optional)FIREBASE_PROJECT_STAGING
(optional)GOOGLE_APPLICATION_CREDENTIALS_JSON
(optional)FIREBASE_SITE_STAGING
(optional)FIREBASE_SITE_PRODUCTION
(optional)GOOGLE_APPLICATION_CREDENTIALS_JSON_PRODUCTION
(optional)Set up the following NPM scripts in your package.json
. You can pass additional arguments to the client-publish command here.
{
"scripts": {
"deploy-staging": "client-publish deploy --target-env staging",
"deploy-production": "client-publish deploy --target-env production"
}
}
Set up deployment for master and production branch.
# master branch
export REDIRECTOR_API_SECRET=REDIRECTOR_API_SECRET_STAGING
export FIREBASE_DEPLOY=true # enables deploying to Firebase
export FIREBASE_PROJECT=FIREBASE_PROJECT_STAGING
export FIREBASE_SITE=FIREBASE_SITE_STAGING
export GOOGLE_APPLICATION_CREDENTIALS_JSON=GOOGLE_APPLICATION_CREDENTIALS_JSON_STAGING
npm run build
npm run deploy-staging
# production branch
export REDIRECTOR_API_SECRET=REDIRECTOR_API_SECRET_STAGING
export FIREBASE_DEPLOY=true # enables deploying to Firebase
export FIREBASE_PROJECT=FIREBASE_PROJECT_STAGING
export FIREBASE_SITE=FIREBASE_SITE_STAGING
export GOOGLE_APPLICATION_CREDENTIALS_JSON=GOOGLE_APPLICATION_CREDENTIALS_JSON_STAGING
npm run build
npm run deploy-production
For compatibility with older versions this package also exposes four other commands:
client-deploy
: deploy applicationclient-deploy-staging
: sets defaults for staging and deploy applicationclient-deploy-production
: sets defaults for production and deploy applicationclient-merge
: merge and push to production from masterTo use these commands the environment variables in the Deployment Configuration section must be present. You can also use these commands npm scripts.
{
"scripts": {
"deploy-staging": "client-deploy-staging",
"deploy-production": "client-deploy-production",
"merge-production": "client-merge"
}
}
FAQs
Deployer for client side projects
We found that @emartech/client-publish demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 216 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.