ampsalesfunnels
Functions
- getConfig(rootPath)
Get the path configurations for the project.
- run(command)
function run is the entrypoint of the AMPSalesfunnels build system.
- ampsalesfunnelsUiClean(done)
Task to delete environment variables pointing to the site and AMPSalesfunnels UI API. These need to be removed so we can wait on their creation on ampsalesfunnelsUiCreate() so we know when to write the index.html file with redirect to AMPSalesfunnels UI.
- dotenvHandler(request, response, next)
-
Get the environment variables as configured in .env file in the root of the project.
Result is object where BASIC=basic becomes {BASIC: 'basic'}
- packageJsonHandler(request, response, next)
Get the package.json file in the root of the project.
- emailSendHandler(request, response, next)
-
Handle email send.
Handle GET request in format https://myserver/emailsend/?to=&name=
- validateHandler(request, response, next)
-
Handle validator sets.
Handle GET request in format https://myserver/validate/, where can be 'all' to execute all validator sets, or a specific validator set like: dotenv
- ampsalesfunnelsUIAPI(corsOrigin)
Server to service requests from the AMPSalesfunnels UI application
- dotenvExistsAndValid(path) ⇒
Validate the given file in .env format.
-
validateSandboxProduction(dotenvConfig, variable) ⇒
ValidationResult
-
Validate occurance of variable.
If for example variable SMTP_USERNAME is available, variable SANDBOX_SMTP_USERNAME and PRODUCTION_SMTP_USERNAME should not be there. If SMTP_USERNAME is not available, then SANDBOX_SMTP_USERNAME and PRODUCTION_SMTP_USERNAME must both be available, or both not be available.
-
logValidationResults(validationResults) ⇒
void
Log the validation results.
- packageJsonValidateAll(filepath) ⇒
Execute all validations for the given file in package.json format.
- packageJsonExistsAndValid(filepath) ⇒
Validate the given file in package.json format.
-
validateAll(rootPath) ⇒
Array.<ValidationResult>
Execute all validators.
-
validateJsonWithSchema(filepath, schemafilepath) ⇒
Object
Validate the given json file against json schema.
-
loadDotenv(filepath) ⇒
Object.<string, string>
Load the environment variables from specified .env file.
-
loadPackageJson(filepath) ⇒
Object.<string, string>
Load the package.json format file from specified path.
- ampsalesfunnelsfunctions()
On change of a file in
paths.ampsalesfunnelsfunctions.src
touch the sentinel function filepaths.ampsalesfunnelsfunctions.src
so all functions are reloaded.- ampsalesfunnelsUiCreate(done)
Task to create index.html with redirect to AMPSalesfunnels UI.
- ampValidate()
Check resulting output AMP HTML pages for validity.
- clean()
Remove all files from the distribution directories for the static site and the functions, and also clean the temp folder used for intermediate build results. directory.
- favicon()
Copy favicon files to distribution.
- functions()
Copy the function files in their own folder to the distribution. In the function folders copy the .env file and the prodcts folder, because each function has a sandboxed context.
- html()
Build the HTML files. Only files in the folder 'pages' are built. We don't want to build partials! Use the AMP Optimizer to add any scripts required by AMP components, and to perform the optimizations done by AMP caches right here in our HTML, greatly speeding up our AMP pages when served from our origin.
- iframe()
Build the iframe HTML files. Only files from 'iframe' are built.
- images()
Copy images to distribution.
- rootConfig()
Copy the root config files to the distribution.
- tailwindcss()
In development copy the tailwind.min.css to the static site distribution. In production copy the optimized (purged) TailWind CSS file to the static site distribution.
- validate()
Execute all validators.
- watchmode()
Sets up live-reloading: Changes to HTML or CSS trigger a build, changes to images, favicon, root config files and server only result in images, favicon, root config files, server and helper classes being copied again to dist.
Typedefs
-
doneCallback :
function
Task done callback function.
-
Severity :
'WARNING'
|'ERROR'
-
ValidationResult :
object
getConfig(rootPath)
Get the path configurations for the project.
Kind: global function
Param | Type | Description |
---|---|---|
rootPath | string |
the root directory of the project |
run(command)
function run is the entrypoint of the AMPSalesfunnels build system.
Kind: global function
Param | Type | Description |
---|---|---|
command | string |
supported AMPSalesfunnels commands: start, startproduction, build, clean, validate, netlifyDeploySandbox, netlifyDeployProduction |
ampsalesfunnelsUiClean(done)
Task to delete environment variables pointing to the site and AMPSalesfunnels UI API. These need to be removed so we can wait on their creation on ampsalesfunnelsUiCreate() so we know when to write the index.html file with redirect to AMPSalesfunnels UI.
Kind: global function
Param | Type | Description |
---|---|---|
done | * |
done function to call at end of task |
dotenvHandler(request, response, next)
Get the environment variables as configured in .env file in the root of the project.
Result is object where BASIC=basic becomes {BASIC: 'basic'}
Kind: global function
Param | Type |
---|---|
request | * |
response | * |
next | * |
packageJsonHandler(request, response, next)
Get the package.json file in the root of the project.
Kind: global function
Param | Type |
---|---|
request | * |
response | * |
next | * |
emailSendHandler(request, response, next)
Handle email send.
Handle GET request in format https://myserver/emailsend/?to=&name=
Kind: global function
Param | Type |
---|---|
request | * |
response | * |
next | * |
validateHandler(request, response, next)
Handle validator sets.
Handle GET request in format https://myserver/validate/, where can be 'all' to execute all validator sets, or a specific validator set like: dotenv
Kind: global function
Param | Type |
---|---|
request | * |
response | * |
next | * |
ampsalesfunnelsUIAPI(corsOrigin)
Server to service requests from the AMPSalesfunnels UI application
Kind: global function
Param | Type | Description |
---|---|---|
corsOrigin | string |
domain accessing the AMPSalesfunnels UI API |
dotenvExistsAndValid(path) ⇒
Validate the given file in .env format.
Kind: global function Returns:
ValidationResults[]
Param | Type |
---|---|
path | string |
Array.<ValidationResult>
dotenvExistsAndValid~validationResults : Kind: inner constant of dotenvExistsAndValid
ValidationResult
dotenvExistsAndValid~validationResult : Kind: inner constant of dotenvExistsAndValid
ValidationResult
validateSandboxProduction(dotenvConfig, variable) ⇒ Validate occurance of variable.
If for example variable SMTP_USERNAME is available, variable SANDBOX_SMTP_USERNAME and PRODUCTION_SMTP_USERNAME should not be there. If SMTP_USERNAME is not available, then SANDBOX_SMTP_USERNAME and PRODUCTION_SMTP_USERNAME must both be available, or both not be available.
Kind: global function
Param | Type | Description |
---|---|---|
dotenvConfig | * |
.env configuration |
variable | string |
variable base name |
void
logValidationResults(validationResults) ⇒ Log the validation results.
Kind: global function
Param | Type |
---|---|
validationResults | Array.<ValidationResult> |
packageJsonValidateAll(filepath) ⇒
Execute all validations for the given file in package.json format.
Kind: global function Returns:
ValidationResults[]
Param | Type |
---|---|
filepath | string |
packageJsonExistsAndValid(filepath) ⇒
Validate the given file in package.json format.
Kind: global function Returns:
ValidationResults[]
Param | Type |
---|---|
filepath | string |
Array.<ValidationResult>
validateAll(rootPath) ⇒ Execute all validators.
Kind: global function
Param | Type |
---|---|
rootPath | string |
Array.<ValidationResult>
validateAll~validationResults : Kind: inner property of validateAll
Object
validateJsonWithSchema(filepath, schemafilepath) ⇒ Validate the given json file against json schema.
Kind: global function
Param | Type | Description |
---|---|---|
filepath | string |
file path to the JSON file |
schemafilepath | string |
file path to the JSON Schema file |
Array.<ValidationResult>
validateJsonWithSchema~validationResults : Kind: inner constant of validateJsonWithSchema
Object.<string, string>
loadDotenv(filepath) ⇒ Load the environment variables from specified .env file.
Kind: global function
Returns: Object.<string, string>
-
- object where BASIC=basic becomes {BASIC: 'basic'}
Param | Type | Description |
---|---|---|
filepath | string |
path to .env file |
Object.<string, string>
loadPackageJson(filepath) ⇒ Load the package.json format file from specified path.
Kind: global function
Returns: Object.<string, string>
-
- object where BASIC=basic becomes {BASIC: 'basic'}
Param | Type | Description |
---|---|---|
filepath | string |
path to .env file |
function
doneCallback : Task done callback function.
'WARNING'
| 'ERROR'
Severity :
object
ValidationResult : Kind: global typedef Properties
Name | Type | Description |
---|---|---|
severity | Severity |
severity of the validation result (WARNING, ERROR) |
title | string |
title of the validation result |
description | string |
description of the validation result |
[solution] | string |
key indicating solution for validation result (used by AMPSalesfunnels UI) |
ampsalesfunnelsfunctions()
On change of a file in paths.ampsalesfunnelsfunctions.src
touch the sentinel function file paths.ampsalesfunnelsfunctions.src
so all functions are reloaded.
Kind: global function Category: Gulp task
ampsalesfunnelsUiCreate(done)
Task to create index.html with redirect to AMPSalesfunnels UI.
Kind: global function Category: Gulp task
Param | Type | Description |
---|---|---|
done | * |
done function to call at end of task |
ampValidate()
Check resulting output AMP HTML pages for validity.
Kind: global function Category: Gulp task
clean()
Remove all files from the distribution directories for the static site and the functions, and also clean the temp folder used for intermediate build results. directory.
Kind: global function Category: Gulp task
favicon()
Copy favicon files to distribution.
Kind: global function Category: Gulp task
functions()
Copy the function files in their own folder to the distribution. In the function folders copy the .env file and the prodcts folder, because each function has a sandboxed context.
Kind: global function Category: Gulp task
html()
Build the HTML files. Only files in the folder 'pages' are built. We don't want to build partials! Use the AMP Optimizer to add any scripts required by AMP components, and to perform the optimizations done by AMP caches right here in our HTML, greatly speeding up our AMP pages when served from our origin.
Kind: global function Category: Gulp task
iframe()
Build the iframe HTML files. Only files from 'iframe' are built.
Kind: global function Category: Gulp task
images()
Copy images to distribution.
Kind: global function Category: Gulp task
rootConfig()
Copy the root config files to the distribution.
Kind: global function Category: Gulp task
tailwindcss()
In development copy the tailwind.min.css to the static site distribution. In production copy the optimized (purged) TailWind CSS file to the static site distribution.
Kind: global function Category: Gulp task
validate()
Execute all validators.
Kind: global function Category: Gulp task
Array.<ValidationResult>
validate~validationResults : Kind: inner constant of validate
watchmode()
Sets up live-reloading: Changes to HTML or CSS trigger a build, changes to images, favicon, root config files and server only result in images, favicon, root config files, server and helper classes being copied again to dist.
Kind: global function Category: Gulp task
© 2021 Dellariva Solutions