Security News
38% of CISOs Fear Theyβre Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@contentful/app-scripts
Advanced tools
@contentful/app-scripts
This project makes easy to perform some recurrent operations in Contentful's App Framework.
Locally:
npm i --save @contentful/app-scripts
Globally:
npm i -g @contentful/app-scripts
When installed
$ contentful-app-scripts create-app-definition
Otherwise
$ npx --no-install @contentful/app-scripts create-app-definition
// my-script.js
const { createAppDefinition } = require('@contentful/app-scripts')
const { myCustomLogic } = require('./my-custom-logic')
(async function main() {
myCustomLogic();
await createAppDefinition.interactive()
})()
Scripts exported from this module will all be in the following shape
interface Script<Result, Options> {
// query the user or local cache for required information
interactive: () => Result;
// run by automation (`--ci` flag), they would need all the information upfront
nonInteractive: (...options: Options) => Result;
}
:warning: Please note
Both interactive and nonInteractive version of the same script is meant to return the same result.
Allows creating a new AppDefinition provided a Content Management Token (more details here).
It only runs in interactive mode.
Example
$ npx --no-install @contentful/app-scripts create-app-definition
Allows you to upload a build directory and create a new AppBundle that is bound to an AppDefinition. It runs in interactive or non-interactive mode
Note: The command will automatically activate the bundle. To skip the activation you can pass the --skip-activation
argument in interactive and non-interactive mode and then manually activate it
In the interactive mode, the CLI will ask for all required options
Example
$ npx --no-install @contentful/app-scripts upload
When passing the --ci
argument the command will fail when the required variables are not set as arguments.
Example
$ npx --no-install @contentful/app-scripts upload --ci \ --bundle-dir ./built \ --organization-id some-org-id \ --definition-id some-app-def-id \ --token $MY_CONTENTFUL_PAT
Options:
Argument | Description |
---|---|
--bundle-dir | The directory of your build folder (e.g.: ./build ) |
--organization-id | The ID of your organisation |
--definition-id | The ID of the app to which to add the bundle |
--token | A personal access token |
--skip-activation | (optional) Boolean flag to skip the automatic activation of the AppBundle |
--comment | (optional) A comment which will be associated with the created AppBundle . Can be used to differentiate bundles. |
Note: You can also pass all arguments in interactive mode to skip being asked for it.
Allows you to activate an AppBundle for an AppDefinition. When activated the app will serve the newly activated AppBundle.
In the interactive mode, the CLI will ask for all required options
Example
$ npx --no-install @contentful/app-scripts activate
When passing the --ci
argument adding all variables as arguments is required
Example
$ npx --no-install @contentful/app-scripts activate --ci \ --bundle-id some-bundle-id \ --organization-id some-org-id \ --definition-id some-app-def-id \ --token $MY_CONTENTFUL_PAT
Options:
Argument | Description |
---|---|
--bundle-id | The ID of the AppBundle you want to activate |
--organization-id | The ID of your organisation |
--definition-id | The ID of the app to which to add the bundle |
--token | A personal access token |
Note: You can also pass all arguments in interactive mode to skip being asked for it.
It opens the settings in the contentful web app so that you can use the UI to change the settings of an AppDefinition.
Example
$ npx --no-install @contentful/app-scripts open-settings --definition-id some-definition-id
You can also execute this command without the argument if the environment variable (CONTENTFUL_APP_DEF_ID
) has been set.
Example
$ CONTENTFUL_APP_DEF_ID=some-definition-id npx --no-install @contentful/app-scripts open-settings
Allows you to clean the list of previous bundles. It fetches the list and deletes all bundles except the 50 newest ones.
You can adjust the amount you want to keep by passing --keep <amount>
to the argument, if not passed, the default is 50.
In the interactive mode, the CLI will ask for all required options
Example
$ npx --no-install @contentful/app-scripts bundle-cleanup
You can also execute this command without the argument if the environment variable (CONTENTFUL_APP_DEF_ID
) and (CONTENTFUL_ORG_ID
) has been set.
When passing the --ci
argument adding all variables as arguments is required
Example
$ npx --no-install @contentful/app-scripts bundle-cleanup --ci \ --organization-id some-org-id \ --definition-id some-app-def-id \ --token $MY_CONTENTFUL_PAT --keep 30
Options:
Argument | Description |
---|---|
--bundle-id | The ID of the AppBundle you want to activate |
--organization-id | The ID of your organisation |
--definition-id | The ID of the app to which to add the bundle |
--keep | Optional, the amount of bundles to keep |
Note: You can also pass all arguments in interactive mode to skip being asked for it.
FAQs
A collection of scripts for building Contentful Apps
The npm package @contentful/app-scripts receives a total of 2,433 weekly downloads. As such, @contentful/app-scripts popularity was classified as popular.
We found that @contentful/app-scripts 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.