Skip to main content

Package.json action

You can do some processing on the package.json file in the website project.

Format the package.json file​

This will reorder the contents, set the correct license, update the scripts, and dev dependencies.

This can be used when setting up a new site or converting a gulp-build process to use this package.

aptuitiv-build package-json format
aptuitiv-build package-json format -t <theme>
aptuitiv-build package-json format --theme <theme>

You can specify the theme name to use for the package.json scripts. By default it will use "custom". For example, to set the theme name to "my-theme", you can run the following command:

aptuitiv-build package-json format -t my-theme
aptuitiv-build package-json format --theme my-theme

Update the scripts in the package.json file​

This will update the scripts section of the package.json file to use the latest recommended ones.

aptuitiv-build package-json scripts
aptuitiv-build package-json scripts -t <theme>
aptuitiv-build package-json scripts --theme <theme>

You can specify the theme name to use for the package.json scripts. By default it will use "custom". For example, to set the theme name to "my-theme", you can run the following command:

aptuitiv-build package-json scripts -t my-theme
aptuitiv-build package-json scripts --theme my-theme

Available scripts in the package.json file​

The following scripts are available in the package.json file:

Build and process css, js, images, fonts, and templates​

npm run build

Copy files to the build directory​

npm run copy

Process CSS​

# Process and lint the CSS files
npm run css

# Lint the CSS files
npm run stylelint

Delete files​

npm run delete
npm run delete theme/css/file.css

Download files​

npm run download
npm run download theme/css

# Download the docs folder
npm run download-docs

# Download the images folder
npm run download-images

# Download the theme folder
npm run download-theme

# Download the theme config folder
npm run download-theme-config

# Download the theme fonts folder
npm run download-theme-fonts

# Download the theme images folder
npm run download-theme-images

# Download the theme js folder
npm run download-theme-js

# Download the theme templates folder
npm run download-theme-templates

Configure the environment variables​

npm run env

Export the files to the build directory​

npm run export

Process fonts​

npm run fonts

Format the theme.json file​

npm run format-theme-json

Process icons​

npm run icons

Process images​

npm run images

Initialize the project​

npm run init

Process js​

npm run js

Lint the js files​

npm run jslint

Check for updates to installed packages​

npm run ncu

Format the package.json file​

npm run package-json-format

Update the package.json scripts​

npm run package-json-scripts

Copy files from the build directory to the source directory​

# Copy template files from the build directory to the source templates directory
npm run pull-templates

# Copy the theme config from the build directory to the source theme config directory
npm run pull-theme-config

# Copy the theme fonts from the build directory to the source theme fonts directory
npm run pull-theme-fonts

# Copy the theme images from the build directory to the source theme images directory
npm run pull-theme-images

Run the build and start the watch process​

npm run start

Copy the theme template files from the source theme directory to the build theme directory​

npm run templates

Build the theme configuration JSON files​

npm run theme-config

Upload the files to the FTP server​

# Upload all files to the FTP server
npm run upload
npm run upload images/file.jpg
npm run upload images/folder

# Upload the docs folder to the FTP server
npm run upload-docs

# Upload the images folder to the FTP server
npm run upload-images

# Upload the theme folder to the FTP server
npm run upload-theme

# Upload the theme config folder to the FTP server
npm run upload-theme-config

# Upload the theme CSS files to the FTP server
npm run upload-theme-css

# Upload the theme fonts folder to the FTP server
npm run upload-theme-fonts

# Upload the theme images folder to the FTP server
npm run upload-theme-images

# Upload the theme js folder to the FTP server
npm run upload-theme-js

# Upload the theme templates folder to the FTP server
npm run upload-theme-templates

Watch for changes and rebuild the files​

npm run watch