In Front End Hosting - Basic, one Static Site application such as Static Site Generator (SSG) is provisioned with three environments:
Development (Dev)
Staging (Stg)
Production (Prod)
To view an application:
Click View <application name>.
New environments are provisioned with the default content page.
To verify that a site is working correctly, visit the default URL of a specific environment:
Clone the application’s repository.
Code Assembly is enabled by default.
Create a new branch and push your development code without node_modules
.
Code Assembly runs the install
and build
commands as defined in the package.json
file and creates a new branch with the prefix CODE-ASSEMBLY-BUILD-
, which will contain a deployable artifact.
Deploy the CODE-ASSEMBLY-BUILD-<new-branch>
branch.
For more information, visit Deploying code in the same environment. After you deploy the branch, any new commits to the new branch will update the Code Assembly-generated branch and trigger its deployment.
For information about viewing your subscription details, visit Viewing subscriptions.
For information about monitoring a site, visit Using Stack Metrics to monitor activity on your environments.
package.json
file.extra
section along with deployment configuration details because that section is a requirement for SSG applications.When Code Assembly is enabled in Cloud Platform, the extra
section must contain the following properties:
{
"extra": {
"acquia": {
"code-assembly.node_version": "18",
"code-assembly.install_command": "npm install",
"code-assembly.build_command": "npm run build",
"code-assembly.output_directory": "html/",
"code-assembly.root_directory": "./"
}
}
}
When Code Assembly is disabled in Cloud Platform, the extra
section must contain the following properties:
{
"extra": {
"acquia": {
"code-assembly.output_directory": "html/",
"code-assembly.root_directory": "./"
}
}
}
When Code Assembly is enabled in Cloud Platform, it attempts to install dependencies by running the command defined in code-assembly.install_command
. However, it runs the defined command only if the package.json
file is present in the path defined in the root directory. Otherwise, it runs the npm install command by default. Code Assembly aborts the installation if the node_modules
directory already exists in the branch.
Code Assembly reads the package.json
file from the root directory. If it does not find the file in the root directory, it reverts to default configuration.
When Code Assembly is disabled in Cloud Platform, Cloud Platform does not read code-assembly.install_command
.
If the package.json
file contains the code-assembly.build_command
command in extra.acquia
, then that command is used to build the static site.
npm run build
. This command can be overridden by specifying the code-assembly.build_command
command in the package.json
file. This output directory contains build outputs such as HTML, CSS, and JavaScript files, which are served for the Front End Hosting - Basic hosting. The default output directory is html/
. This directory can be overridden by specifying the output directory in the package.json
file.
The main directory of your project may not always align with your application's build root. For example, a repository might have a frontend
directory, which contains a stand-alone Next.js application. Therefore, you must set the root directory to ensure that the commands are executed from the correct directory of your project.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Thu Oct 03 2024 17:14:27 GMT+0000 (Coordinated Universal Time)