Home Manual Reference Source

Typedef

Static Public Summary
public
public
public

BuildEngineGetCommand(target: Target, buildType: string, forceRun: boolean, forceWatch: boolean, forceInspect: boolean): string: function

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

Static Public

public BrowserTarget: Object source

Properties:

NameTypeAttributeDescription
engine string

This will tell projext which build engine you are going to bundle the target code with.

hasFolder boolean

Whether your target code is on a sub folder of the source directory (src/[target-name]/) or the contents of the source directory are your target code (useful when working with a single target).

createFolder boolean

Whether or not to create a folder for your targets code on the distribution directory when the target is bundled/copied.

folder string

If either hasFolder or createFolder is true, this can be used to specify a different folder name than the target's name.

entry ProjectConfigurationTargetTemplateEntry

The target entry files for each specific build type.

output ProjectConfigurationTargetTemplateOutput

The target output settings for each specific build type.

originalOutput ProjectConfigurationTargetTemplateOutput

The target output settings for each specific build type, without the placeholders replaced.

sourceMap ProjectConfigurationTargetTemplateSourceMapSettings

The target source map settings for each specific environment build.

html ProjectConfigurationBrowserTargetTemplateHTMLSettings

In the case the target is an app, these are the options for the html file that will include the bundle <script />; and if your target is a library, this can be used to test your library.

css ProjectConfigurationBrowserTargetTemplateCSSSettings

These options help you customize the way the bundling process handles your CSS code.

includeModules Array

This setting can be used to specify a list of node modules you want to process on your bundle. This means that JS files from modules on this list will be transpiled.

includeTargets Array

This setting can be used to specify a list of other targets you want to process on your bundle. This means that JS and SCSS files from these targets will be transpiled/processed.

uglifyOnProduction boolean

When a bundle is created, this setting will tell the build engine whether to uglify the code for production or not.

runOnDevelopment boolean

This will tell the build engine that when you build the target for a development environment, it should bring up an http server to "run" your target.

watch ProjectConfigurationTargetWatchOptions

The settings for the projext watch mode, which watches the target files for changes and updates the build without executing it.

babel ProjectConfigurationBrowserTargetTemplateBabelSettings

These options are used by the build engine to configure Babel:

flow boolean

Whether or not your target uses flow. This will update the Babel configuration in order to add support for it.

typeScript boolean

Whether or not your target uses TypeScript. This will update the Babel configuration in order to add support for it.

library boolean

This will tell the build engine that it needs to be builded as a library to be required.

libraryOptions ProjectConfigurationBrowserTargetTemplateLibraryOptions

In case library is true, these options are going to be used by the build engine to configure your library.

cleanBeforeBuild boolean

Whether or not to remove all code from previous builds from the distribution directory when making a new build.

copy Array

A list of files to copy during the bundling process. It can be a list of file paths relative to the target source directory, in which case they'll be copied to the target distribution directory root; or a list of ProjectConfigurationTargetTemplateCopyItem.

dotEnv ProjectConfigurationTargetTemplateDotEnvSettings

These options are used by both projext and the build engine in order to load "environment files".

devServer ProjectConfigurationBrowserTargetTemplateDevServerSettings

These are the options for the http server projext will use when running the target on a development environment.

configuration ProjectConfigurationBrowserTargetTemplateConfigurationSettings

These are the settings for the feature that allows a browser target to have a dynamic configuration file.

is TargetTypeCheck

To check whether the target type is node or browser

paths TargetPaths

The target absolute paths to both the source directory folder and the distribution directory folder.

folders TargetFolders

The target relative paths to both the source directory folder and the distribution directory folder.

public BuildEngine: Object source

Properties:

NameTypeAttributeDescription
getBuildCommand BuildEngineGetCommand

The method used by projext in order to get the shell comands to build and/or run a target.

public BuildEngineGetCommand(target: Target, buildType: string, forceRun: boolean, forceWatch: boolean, forceInspect: boolean): string: function source

Params:

NameTypeAttributeDescription
target Target

The target information.

buildType string

The intended build type: development or production.

forceRun boolean
  • optional
  • default: false

Force the target to run even if the runOnDevelopment setting is false.

forceWatch boolean
  • optional
  • default: false

Force the build engine to watch the target files even if the watch setting for the required build type is set to false.

forceInspect boolean
  • optional
  • default: false

Force the build engine to use the Node inspector even if the target setting is disabled. This only applies for Node targets.

Return:

string

The command the shell script will use to build the target.

public CLIBuildCommandNormalizedOptions: Object source

Properties:

NameTypeAttributeDescription
development boolean

Whether or not the intended build type is development.

run boolean

Whether or not the target needs to be executed.

watch boolean

Whether or not the target files will be watched.

inspect boolean

Whether or not to enable the Node inspector.

public CLIBuildCommandOptions: Object source

Properties:

NameTypeAttributeDescription
type string

The intended build type: development or production.

run boolean

Whether or not the target needs to be executed.

watch boolean

Whether or not the target files will be watched.

inspect boolean

Whether or not to enable the Node inspector.

public CLIBuildCommandParams: Object source

Properties:

NameTypeAttributeDescription
target Target

The target information.

type string

The intended build type: development or production.

run boolean

Whether or not the target needs to be executed.

build boolean

Whether or not a build will be created. This is always true for browser targets but it may be false for Node targets if bundling and transpiling is disabled.

watch boolean

Whether or not the target files will be watched.

inspect boolean

Whether or not to enable the Node inspector.

public NodeInspectorSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean

Whether or not to enable the Node inspector.

host string

The host where the Node inspector will run.

port number

The port where the Node inspector will run.

command string

The Node inspector flag command (inspect or inspect-brk).

ndb boolean

Whether or not to use Google's ndb instead of the native inspector. The way it will be used will be by calling the executable without path, so it's up to the project to install it (global or local).

public NodeTarget: Object source

Properties:

NameTypeAttributeDescription
bundle boolean

Whether or not the target needs to be bundled. If the value is false, when running on a development environment, and if the target doesn't need transpilation, the code won't be moved to the distribution directory.

transpile boolean

This option is kind of tied to the previous one: You may not want to bundle your Node target, but you can transpile it with Babel if you want to use a feature not yet supported by the runtime.

engine string

In case bundle is true, this will tell projext which build engine you are going to bundle the target code with.

hasFolder boolean

Whether your target code is on a sub folder of the source directory (src/[target-name]/) or the contents of the source directory are your target code (useful when working with a single target).

createFolder boolean

Whether or not to create a folder for your targets code on the distribution directory when the target is bundled/copied.

folder string

If either hasFolder or createFolder is true, this can be used to specify a different folder name than the target's name.

entry ProjectConfigurationTargetTemplateEntry

The target entry files for each specific build type.

output ProjectConfigurationTargetTemplateOutput

The target output settings for each specific build type.

originalOutput ProjectConfigurationTargetTemplateOutput

The target output settings for each specific build type, without the placeholders replaced.

sourceMap ProjectConfigurationTargetTemplateSourceMapSettings

The target source map settings for each specific environment build.

inspect ProjectConfigurationNodeTargetInspectSettings

The target settings for the Node inspector.

css ProjectConfigurationNodeTargetTemplateCSSSettings

These options help you customize the way the bundling process handles your CSS code.

includeModules Array

This setting can be used to specify a list of node modules you want to process on your bundle. This means that JS files from modules on this list will be transpiled.

excludeModules Array

This setting can be used to specify a list of modules that should never be bundled. By default, projext will exclude all the dependencies from the package.json, but if you import modules using a sub path (like colors/safe instead of colors), you need to specify it on this list so the build engine won't try to put it inside the bundle it.

includeTargets Array

This setting can be used to specify a list of other targets you want to process on your bundle. This means that JS and SCSS files from these targets will be transpiled/processed.

runOnDevelopment boolean

This tells projext that when the target is builded (bundled/copied) on a development environment, it should execute it.

watch ProjectConfigurationTargetWatchOptions

The settings for the projext watch mode, which watches the target files for changes and updates the build without executing it.

babel ProjectConfigurationNodeTargetTemplateBabelSettings

The target transpilation options.

flow boolean

Whether or not your target uses flow. This will update the Babel configuration in order to add support and, in case it was disabled, enable transpilation.

typeScript boolean

Whether or not your target uses TypeScript. This will update the Babel configuration in order to add support and, in case it was disabled, enable transpilation.

library boolean

If the project is bundled, this will tell the build engine that it needs to be builded as a library to be required.

libraryOptions ProjectConfigurationNodeTargetTemplateLibraryOptions

In case library is true, these options are going to be used by the build engine to configure your library

cleanBeforeBuild boolean

Whether or not to remove all code from previous builds from the distribution directory when making a new build.

copy Array

A list of files to copy during the bundling process. It can be a list of file paths relative to the target source directory, in which case they'll be copied to the target distribution directory root; or a list of ProjectConfigurationTargetTemplateCopyItem.

is TargetTypeCheck

To check whether the target type is node or browser

paths TargetPaths

The target absolute paths to both the source directory folder and the distribution directory folder.

folders TargetFolders

The target relative paths to both the source directory folder and the distribution directory folder.

dotEnv ProjectConfigurationTargetTemplateDotEnvSettings

These options are used by both projext and the build engine in order to load "environment files".

public ProjectConfigurationBrowserTargetTemplate: Object source

Properties:

NameTypeAttributeDescription
engine string
  • optional
  • default: 'webpack'

This will tell projext which build engine you are going to bundle the target code with.

hasFolder boolean
  • optional
  • default: true

Whether your target code is on a sub folder of the source directory (src/[target-name]/) or the contents of the source directory are your target code (useful when working with a single target).

createFolder boolean
  • optional
  • default: true

Whether or not to create a folder for your targets code on the distribution directory when the target is bundled/copied.

folder string
  • optional
  • default: ''

If either hasFolder or createFolder is true, this can be used to specify a different folder name than the target's name.

entry ProjectConfigurationTargetTemplateEntry
  • optional

The target entry files for each specific build type.

output ProjectConfigurationTargetTemplateOutput
  • optional

The target output settings for each specific build type.

sourceMap ProjectConfigurationTargetTemplateSourceMapSettings
  • optional

The target source map settings for each specific environment build.

html ProjectConfigurationBrowserTargetTemplateHTMLSettings
  • optional

In the case the target is an app, these are the options for the html file that will include the bundle <script />; and if your target is a library, this can be used to test your library.

css ProjectConfigurationBrowserTargetTemplateCSSSettings
  • optional

These options help you customize the way the bundling process handles your CSS code.

includeModules Array
  • optional
  • default: []

This setting can be used to specify a list of node modules you want to process on your bundle. This means that JS files from modules on this list will be transpiled.

includeTargets Array
  • optional
  • default: []

This setting can be used to specify a list of other targets you want to process on your bundle. This means that JS and SCSS files from these targets will be transpiled/processed.

uglifyOnProduction boolean
  • optional
  • default: true

When a bundle is created, this setting will tell the build engine whether to uglify the code for production or not.

runOnDevelopment boolean
  • optional
  • default: false

This will tell the build engine that when you build the target for a development environment, it should bring up an http server to "run" your target.

watch ProjectConfigurationTargetWatchOptions
  • optional

The settings for the projext watch mode, which watches the target files for changes and updates the build without executing it.

babel ProjectConfigurationBrowserTargetTemplateBabelSettings
  • optional

These options are used by the build engine to configure Babel:

flow boolean
  • optional
  • default: false

Whether or not your target uses flow. This will update the Babel configuration in order to add support for it.

typeScript boolean
  • optional
  • default: false

Whether or not your target uses TypeScript. This will update the Babel configuration in order to add support for it.

library boolean
  • optional
  • default: false

This will tell the build engine that it needs to be builded as a library to be required.

libraryOptions ProjectConfigurationBrowserTargetTemplateLibraryOptions
  • optional

In case library is true, these options are going to be used by the build engine to configure your library.

cleanBeforeBuild boolean
  • optional
  • default: true

Whether or not to remove all code from previous builds from the distribution directory when making a new build.

copy Array
  • optional
  • default: []

A list of files to copy during the bundling process. It can be a list of file paths relative to the target source directory, in which case they'll be copied to the target distribution directory root; or a list of ProjectConfigurationTargetTemplateCopyItem.

dotEnv ProjectConfigurationTargetTemplateDotEnvSettings
  • optional

These options are used by both projext and the build engine in order to load "environment files".

devServer ProjectConfigurationBrowserTargetTemplateDevServerSettings
  • optional

These are the options for the http server projext will use when running the target on a development environment.

configuration ProjectConfigurationBrowserTargetTemplateConfigurationSettings
  • optional

These are the settings for the feature that allows a browser target to have a dynamic configuration file.

public ProjectConfigurationBrowserTargetTemplateBabelSettings: Object source

Properties:

NameTypeAttributeDescription
features ProjectConfigurationTargetTemplateBabelFeatures
  • optional

This object can be used to enable/disable the Babel plugins projext includes. If you need other plugins, they can be included on the overwrites option.

browserVersions number
  • optional
  • default: 2

When building the Babel configuration, projext uses the @babel/preset-env to just include the necessary stuff. This setting tells how many old versions of the major browsers the target needs transpilation for. Major browsers: Firefox, Chrome, Safari and Edge.

mobileSupport boolean
  • optional
  • default: true

If true, the configuration will add to the list of major browsers iOS and Android.

polyfill boolean
  • optional
  • default: true

Whether or not the configuration for the @babel/preset-env should include the settings for for useBuiltIns and corejs.

overwrites Object
  • optional
  • default: {}

If you know how to use Babel and need stuff that is not covered by projext, you can use this setting to overwrite/add any value you may need.

env Object
  • optional
  • default: {}

Custom settings that projext will use as base when generating the ones for the @babel/preset-env.

public ProjectConfigurationBrowserTargetTemplateCSSSettings: Object source

Properties:

NameTypeAttributeDescription
modules boolean
  • optional
  • default: false

Whether or not your application uses CSS Modules. If this is enabled, all your styles will be prefixed with a unique identifier.

inject boolean
  • optional
  • default: false

If this setting is set to true, instead of generating a CSS file with your styles, they'll be dynamically injected on HTML when the bundle gets executed.

public ProjectConfigurationBrowserTargetTemplateConfigurationSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean
  • optional
  • default: false

Whether or not the feature is enabled.

default null | Object
  • optional
  • default: null

The default configuration. If none is specified, when the target is builded, it will try to use [target-name].config.js, located on the configuration folder.

path string
  • optional
  • default: 'config/'

The path where the configuration files are located.

hasFolder boolean
  • optional
  • default: true

Whether or not there's a folder with the target name on the configuration path.

defineOn string
  • optional
  • default: 'process.env.CONFIG'

The name of the variable where the configuration is going to be replaced on your code when bundled.

environmentVariable string
  • optional
  • default: 'CONFIG'

The name of the environment variable projext will check when building the target in order to load a dynamic configuration.

loadFromEnvironment boolean
  • optional
  • default: true

Whether or not projext should check for the environment variable value.

filenameFormat string
  • optional
  • default: '[target-name].[configuration-name].config.js'

The name format of the configuration files.

public ProjectConfigurationBrowserTargetTemplateDevServerProxiedSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean
  • optional
  • default: false

Whether or not the dev server is being proxied.

host string
  • optional
  • default: null
  • nullable: true

The host used to proxy the dev server. If null, it will use the host defined on the dev server main settings.

https boolean
  • optional
  • default: null
  • nullable: true

Whether or not the proxied host uses https. If null and you have provided SSL certificates for the server, it will become true, otherwise it will be false.

public ProjectConfigurationBrowserTargetTemplateDevServerSSLSettings: Object source

Properties:

NameTypeAttributeDescription
key string
  • optional
  • default: null

The path to the SSL key (.key).

cert string
  • optional
  • default: null

The path to the SSL certificate (.crt).

ca string
  • optional
  • default: null

The path to the SSL public file (.pem).

public ProjectConfigurationBrowserTargetTemplateDevServerSettings: Object source

Properties:

NameTypeAttributeDescription
port number
  • optional
  • default: 2509

The server port.

reload boolean
  • optional
  • default: true

Whether or not to reload the browser when the code changes.

open boolean
  • optional
  • default: true

Whether or not to open the browser when server is ready.

host string
  • optional
  • default: 'localhost'

The dev server hostname.

ssl ProjectConfigurationBrowserTargetTemplateDevServerSSLSettings
  • optional

The paths to the files to enable SSL on the dev server.

proxied ProjectConfigurationBrowserTargetTemplateDevServerProxiedSettings
  • optional

When the dev server is being proxied (using nginx for example), there are certain functionalities, like hot module replacement and live reload that need to be aware of this.

public ProjectConfigurationBrowserTargetTemplateHTMLSettings: Object source

Properties:

NameTypeAttributeDescription
default string
  • optional
  • default: 'index.html'

This setting can be used to set the same value of default template and filename at once. But it will only overwrite settings with a null value, if one is specified, the value of this setting will be ignored.

template string
  • optional
  • default: null

The file inside your target source that will be used to generate the html. If null, it will fallback to the value of the default setting.

filename string
  • optional
  • default: null

The file that will be generated when your target is bundled. It will automatically include the <script /> tag to the generated bundle. If null, it will fallback to the value of the default setting.

public ProjectConfigurationBrowserTargetTemplateLibraryOptions: Object source

Properties:

NameTypeAttributeDescription
libraryTarget string
  • optional
  • default: 'umd'

How the library will be exposed: commonjs2, umd or window.

compress boolean
  • optional
  • default: false

Whether or not to use gzip compression on the generated library file.

public ProjectConfigurationCopyFeatureSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean
  • optional
  • default: false

Whether or not the feature is enabled.

items Array
  • optional
  • default: []

A list of files and/or directories that will be copied. All with paths relative to the project directory.

copyOnBuild ProjectConfigurationFeatureTriggerSettings
  • optional

Since the feature is also available through the projext CLI, you can configure how the feature behaves when building.

public ProjectConfigurationFeatureTriggerSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean
  • optional
  • default: true

Whether or not the feature should be triggered when a target is being build.

onlyOnProduction boolean
  • optional
  • default: true

This tells projext if the feature should be triggered only when building for production, or if it should do it for development too.

targets Array
  • optional
  • default: []

This can be used to specify the targets that will trigger the feature when builded. If no target is specified, the feature will be triggered by all the targets.

public ProjectConfigurationNodeTargetInspectSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean
  • optional
  • default: false

Whether or not to enable the Node inspector when running the app for development.

host string
  • optional
  • default: '0.0.0.0'

The host where the Node inspector will run.

port number
  • optional
  • default: 9229

The port the Node inspector will use.

command string
  • optional
  • default: 'inspect'

The Node inspector flag command (inspect or inspect-brk).

ndb boolean
  • optional
  • default: false

Whether or not to use Google's ndb instead of the native inspector. The way it will be used will be by calling the executable without path, so it's up to the project to install it (global or local).

public ProjectConfigurationNodeTargetTemplate: Object source

Properties:

NameTypeAttributeDescription
bundle boolean
  • optional
  • default: false

Whether or not the target needs to be bundled. If the value is false, when running on a development environment, and if the target doesn't need transpilation, the code won't be moved to the distribution directory.

transpile boolean
  • optional
  • default: false

This option is kind of tied to the previous one: You may not want to bundle your Node target, but you can transpile it with Babel if you want to use a feature not yet supported by the runtime.

engine string
  • optional
  • default: 'webpack'

In case bundle is true, this will tell projext which build engine you are going to bundle the target code with.

hasFolder boolean
  • optional
  • default: true

Whether your target code is on a sub folder of the source directory (src/[target-name]/) or the contents of the source directory are your target code (useful when working with a single target).

createFolder boolean
  • optional
  • default: true

Whether or not to create a folder for your targets code on the distribution directory when the target is bundled/copied.

folder string
  • optional
  • default: ''

If either hasFolder or createFolder is true, this can be used to specify a different folder name than the target's name.

entry ProjectConfigurationTargetTemplateEntry
  • optional

The target entry files for each specific build type.

output ProjectConfigurationTargetTemplateOutput
  • optional

The target output settings for each specific build type.

sourceMap ProjectConfigurationTargetTemplateSourceMapSettings
  • optional

The target source map settings for each specific environment build.

inspect ProjectConfigurationNodeTargetInspectSettings
  • optional

The target settings for the Node inspector.

css ProjectConfigurationNodeTargetTemplateCSSSettings
  • optional

These options help you customize the way the bundling process handles your CSS code.

includeModules Array
  • optional
  • default: []

This setting can be used to specify a list of node modules you want to process on your bundle.

excludeModules Array
  • optional
  • default: []

This setting can be used to specify a list of modules that should never be bundled. By default, projext will exclude all the dependencies from the package.json, but if you import modules using a sub path (like colors/safe instead of colors), you need to specify it on this list so the build engine won't try to put it inside the bundle it.

includeTargets Array
  • optional
  • default: []

This setting can be used to specify a list of other targets you want to process on your bundle. This means that JS and SCSS files from these targets will be transpiled/processed.

runOnDevelopment boolean
  • optional
  • default: false

This tells projext that when the target is builded (bundled/copied) on a development environment, it should execute it.

watch ProjectConfigurationTargetWatchOptions
  • optional

The settings for the projext watch mode, which watches the target files for changes and updates the build without executing it.

babel ProjectConfigurationNodeTargetTemplateBabelSettings
  • optional

The target transpilation options.

flow boolean
  • optional
  • default: false

Whether or not your target uses flow. This will update the Babel

typeScript boolean
  • optional
  • default: false

Whether or not your target uses TypeScript. This will update the Babel configuration in order to add support and, in case it was disabled, enable transpilation.

library boolean
  • optional
  • default: false

If the project is bundled, this will tell the build engine that it needs to be builded as a library to be required.

libraryOptions ProjectConfigurationNodeTargetTemplateLibraryOptions
  • optional

In case library is true, these options are going to be used by the build engine to configure your library

cleanBeforeBuild boolean
  • optional
  • default: true

Whether or not to remove all code from previous builds from the distribution directory when making a new build.

copy Array
  • optional
  • default: []

A list of files to copy during the bundling process. It can be a list of file paths relative to the target source directory, in which case they'll be copied to the target distribution directory root; or a list of ProjectConfigurationTargetTemplateCopyItem.

dotEnv ProjectConfigurationTargetTemplateDotEnvSettings
  • optional

These options are used by both projext and the build engine in order to load "environment files".

public ProjectConfigurationNodeTargetTemplateBabelSettings: Object source

Properties:

NameTypeAttributeDescription
features ProjectConfigurationTargetTemplateBabelFeatures
  • optional

This object can be used to enable/disable the Babel plugins projext includes. If you need other plugins, they can be included on the overwrites option.

nodeVersion string
  • optional
  • default: 'current'

When building the Babel configuration, projext uses the @babel/preset-env to just include the necessary stuff. This setting tells the preset the version of Node it should "complete".

env Object
  • optional
  • default: {}

Custom settings that projext will use as base when generating the ones for the @babel/preset-env.

overwrites Object
  • optional
  • default: {}

If you know how to use Babel and need stuff that is not covered by projext, you can use this setting to overwrite/add any value you may need.

public ProjectConfigurationNodeTargetTemplateCSSSettings: Object source

Properties:

NameTypeAttributeDescription
modules boolean
  • optional
  • default: false

Whether or not your application uses CSS Modules. If this is enabled, all your styles will be prefixed with a unique identifier.

public ProjectConfigurationNodeTargetTemplateLibraryOptions: Object source

Properties:

NameTypeAttributeDescription
libraryTarget string
  • optional
  • default: 'commonjs2'

How the library will be exposed: commonjs2 or umd.

public ProjectConfigurationNodemonSettings: Object source

Properties:

NameTypeAttributeDescription
legacyWatch boolean
  • optional
  • default: true

Whether or not to enable nodemon legacy watch mode.

public ProjectConfigurationOtherSettings: Object source

Properties:

NameTypeAttributeDescription
These ProjectConfigurationTargetFinderSettings

are the settings for projext "targets finder", the feature that reads the project in order to identify targets and their settings.

This ProjectConfigurationWatchSettings

is used by projext to configure watchpack, which is used to watch Node files that need to be transpiled.

This ProjectConfigurationNodemonSettings

is used by projext to configure nodemon, which is used to execute and watch Node targets.

public ProjectConfigurationPathSettings: Object source

Properties:

NameTypeAttributeDescription
source string
  • optional
  • default: 'src'

The directory, relative to your project path, where your targets code is located. On the documentation is often referred as the "source directory".

build string
  • optional
  • default: 'dist'

The directory, relative to your project path, where your targets bundled code will be located. On the documentation is often referred as the "distribution directory".

privateModules string
  • optional
  • default: 'private'

This is for the feature that copies when bundling. In case you are using the feature to copy an npm module that, let's say, is not published, projext will save that module (without its dependencies) on that folder.

public ProjectConfigurationSettings: Object source

Properties:

NameTypeAttributeDescription
paths ProjectConfigurationPathSettings
  • optional

This setting is all about where your code is located and where it will be bundled

targetsTemplates ProjectConfigurationTargetTemplates
  • optional

There was no way to have "smart defaults" for targets and at the same time allow projext an unlimited amount of targets, and that's why the this setting exists. The targets will extend the template which name is the same as their type property.

targets Object

This will be a dictionary with the Target definitions.

copy ProjectConfigurationCopyFeatureSettings
  • optional

These settings are for the feature that enables projext to copy files when building targets.

version ProjectConfigurationVersionSettings
  • optional

These settings are for the feature that manages your project version.

others ProjectConfigurationOtherSettings
  • optional

Miscellaneous options.

public ProjectConfigurationTargetFinderSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean
  • optional
  • default: true

Whether or not to automatically search for targets on the project folders.

public ProjectConfigurationTargetTemplateBabelFeatures: Object source

Properties:

NameTypeAttributeDescription
classProperties boolean
  • optional
  • default: false

This enables @babel/plugin-proposal-class-properties so the targets can use classes with properties.

decorators boolean
  • optional
  • default: false

This enables @babel/plugin-proposal-decorators so the targets can use decorators (based on the current TC39 proposal).

dynamicImports boolean
  • optional
  • default: true

This enables @babel/plugin-syntax-dynamic-import so the targets can do dynamic imports and code splitting.

objectRestSpread boolean
  • optional
  • default: true

This enables @babel/plugin-proposal-object-rest-spread so the targets can use rest and spread with objects.

public ProjectConfigurationTargetTemplateCopyItem: Object source

Properties:

NameTypeAttributeDescription
from string

The path to the file, relative to the target source directory.

to string
  • nullable: true

The path where the file will be copied, relative to the target distribution directory. If not specified, the file will be copied to the root of the target distribution directory.

public ProjectConfigurationTargetTemplateEntry: Object source

Properties:

NameTypeAttributeDescription
default string
  • optional
  • default: 'index.js'

The target entry file for all types of build that don't have a specified entry.

development string
  • optional
  • default: null

The target entry file on a development build. If null, it will fallback to the one specified on default.

production string
  • optional
  • default: null

The target entry file on a production build. If null, it will fallback to the one specified on default.

public ProjectConfigurationTargetTemplateOutput: Object source

Properties:

NameTypeAttributeDescription
default ProjectConfigurationTargetTemplateOutputPaths
  • optional

The target output settings for all types of build that don't have specified settings.

development ProjectConfigurationTargetTemplateOutputPaths
  • optional

The target output settings on a development build. If null, it will fallback to the ones specified on default.

production ProjectConfigurationTargetTemplateOutputPaths
  • optional

The target output settings on a production build. If null, it will fallback to the ones specified on default.

public ProjectConfigurationTargetTemplateOutputPaths: Object source

Properties:

NameTypeAttributeDescription
js string
  • optional

The path to generated Javascript files on the distribution directory.

The available placeholders are:

  • [target-name]: The name of the target.
  • [hash]: A random hash generated for cache busting.

The default value is:

  • For node targets, on all build types: [target-name].js.
  • For browser targets:
    • development: 'statics/js/[target-name].js'.
    • production: 'statics/js/[target-name].[hash].js'.
css string
  • optional

The path to generated stylesheets on the distribution directory.

The available placeholders are:

  • [target-name]: The name of the target.
  • [hash]: A random hash generated for cache busting.

The default value is, for both node and browser targets:

  • development: 'statics/styles/[target-name].css'.
  • production: 'statics/styles/[target-name].[hash].css'.
fonts string
  • optional

The path to font files once they are copied to the distribution directory.

The available placeholders are:

  • [target-name]: The name of the target.
  • [name]: The file original name.
  • [ext]: The file original extension.
  • [hash]: A random hash generated for cache busting.

The default value is, for both node and browser targets:

  • development: 'statics/fonts/[name]/[name][ext]'.
  • production: 'statics/fonts/[name]/[name].[hash].[ext]'.
fonts string
  • optional

The path to image files once they are copied to the distribution directory.

The available placeholders are:

  • [target-name]: The name of the target.
  • [name]: The file original name.
  • [ext]: The file original extension.
  • [hash]: A random hash generated for cache busting.

The default value is, for both node and browser targets:

  • development: 'statics/images/[name][ext]'.
  • production: 'statics/images/[name].[hash].[ext]'.

public ProjectConfigurationTargetTemplateSourceMapSettings: Object source

Properties:

NameTypeAttributeDescription
development boolean
  • optional
  • default: false

Whether or not to generate a source map on a development build.

production boolean
  • optional
  • default: true

Whether or not to generate a source map on a production build.

public ProjectConfigurationTargetTemplates: Object source

Properties:

NameTypeAttributeDescription
node ProjectConfigurationNodeTargetTemplate
  • optional

The template settings for all targets with the type node.

browser ProjectConfigurationBrowserTargetTemplate
  • optional

The template settings for all targets with the type browser.

public ProjectConfigurationTargetWatchOptions: Object source

Properties:

NameTypeAttributeDescription
development boolean
  • optional
  • default: false

Whether or not to watch the target files when it gets build for development. If the target type is Node and it doesn't require bundling nor transpiling, it won't do anything.

production boolean
  • optional
  • default: false

Whether or not to watch the target files when it gets build for production.

public ProjectConfigurationVersionRevisionSettings: Object source

Properties:

NameTypeAttributeDescription
enabled boolean
  • optional
  • default: false

Whether or not the revision file feature is enabled.

copy boolean
  • optional
  • default: true

Whether or not to copy the revision file when the project files are being copied to the distribution directory.

filename string
  • optional
  • default: 'revision'

The name of the revision file.

createRevisionOnBuild ProjectConfigurationFeatureTriggerSettings
  • optional

Since the feature is also available through the projext CLI, you can configure how the feature behaves when building.

public ProjectConfigurationVersionSettings: Object source

Properties:

NameTypeAttributeDescription
defineOn string
  • optional
  • default: 'process.env.VERSION'

The name of the variable where the version is going to be replaced on your code when bundled.

environmentVariable string
  • optional
  • default: 'VERSION'

The name of the environment variable projext should check to get the project version.

revision ProjectConfigurationVersionRevisionSettings
  • optional

This is like a sub-feature. A revision file is a file that contains the version of your project. This is useful when deploying the project to an environment where you have no access to the environment variable.

The way the revision file works is by first checking if the environment variable is available and, if not, it will check if the project is on a GIT repository and try to get the hash of the last commit.

public ProjectConfigurationWatchSettings: Object source

Properties:

NameTypeAttributeDescription
poll boolean
  • optional
  • default: true

Whether or not to use polling to get the changes on the file system, and if so, it can also be used to specify the ms interval.

public Provider: Object source

Properties:

NameTypeAttributeDescription
register ProviderRegisterMethod

The method that gets called by projext when registering the provider.

public ProviderRegisterMethod(app: Projext): function source

Params:

NameTypeAttributeDescription
app Projext

A reference to the projext dependency injection container.

public Target: BrowserTarget | NodeTarget source

public TargetConfigurationCreator(overwritePath: string, baseConfiguration: ConfigurationFile): ConfigurationFile: function source

Params:

NameTypeAttributeDescription
overwritePath string

The path to the file that can create the configuration.

baseConfiguration ConfigurationFile

The configuration service that will be extended.

public TargetDefaultHTMLSettings: Object source

Properties:

NameTypeAttributeDescription
title string

The value of the <title /> tag.

bodyAttributes string

Extra attributes for the <body /> tag.

bodyContents string

The content of the <body /> tag.

public TargetExtraFile: Object source

Properties:

NameTypeAttributeDescription
from string

The file origin path.

to string

The file destination path.

transform TargetExtraFileTransform
  • nullable: true

A custom function to modify the contents of the file to copy.

public TargetExtraFileTransform(contents: Buffer): Promise<string, Error>: function source

Params:

NameTypeAttributeDescription
contents Buffer

The original contents of the file.

Return:

Promise<string, Error>

The updated contents.

public TargetFileRuleFilesSettings: Object source

Properties:

NameTypeAttributeDescription
include Array

The list of expressions that match the allowed files for a rule.

exclude Array

The list of expressions that match the files that should be excluded from a rule.

glob TargetFileRuleGlobFilesSettings

The settings for files but on glob pattern version. For plugins and libraries that don't support, or maybe prefer glob over, expressions.

public TargetFileRuleGlobFilesSettings: Object source

Properties:

NameTypeAttributeDescription
include Array

The list of glob patterns that match the allowed files for a rule.

exclude Array

The list of glob patterns that match the files that should be excluded from a rule.

public TargetFileRuleHandler(target: Target, hasTarget: boolean, currentRule: TargetFileRuleSettings): function source

Params:

NameTypeAttributeDescription
target Target

The target information.

hasTarget boolean

Whether or not the rule already has a target, or if this is the first one being added.

currentRule TargetFileRuleSettings

The current settings of the rule.

public TargetFileRulePathSettings: Object source

Properties:

NameTypeAttributeDescription
include Array

The list of expressions that match the allowed paths for a rule.

exclude Array

The list of expressions that match the paths that should be excluded from a rule.

public TargetFileRuleSettings: Object source

Properties:

NameTypeAttributeDescription
extension RegExp

A expression that validates the extension(s) the rule is for.

glob string

A glob pattern that validates the extension(s) the rule is for.

paths TargetFileRulePathSettings

A set of allowed and excluded expressions to validate the paths where the files can be found.

files TargetFileRuleFilesSettings

A set of allowed and excluded expressions and glob patterns for files that would match with the rule.

public TargetFilesRules: Object source

Properties:

NameTypeAttributeDescription
js TargetFileRule

The rule for JS files.

scss TargetFileRule

The rule for SCSS files.

css TargetFileRule

The rule for CSS files.

fonts TargetFontsFileRules

The rules for font files.

images TargetFileRule

The rule for image files.

favicon TargetFileRule

The rule for favicon files.

public TargetFolders: Object source

Properties:

NameTypeAttributeDescription
source string

The relative path to the target source directory.

build string

The relative path to the folder, inside the distribution directory, where the target will be bundled/copied.

public TargetFontsFileRules: Object source

Properties:

NameTypeAttributeDescription
common TargetFileRule

The rule for all font files that aren't SVG.

svg TargetFileRule

The rule for SVG fonts.

public TargetPaths: Object source

Properties:

NameTypeAttributeDescription
source string

The absolute path to the target source directory.

build string

The absolute path to the folder, inside the distribution directory, where the target will be bundled/copied.

public TargetTypeCheck: Object source

Properties:

NameTypeAttributeDescription
node boolean

Whether the target type is node or not.

browser boolean

Whether the target type is browser or not.

public UpdateEnvPresetFunction(options: Object): Object: function source

Params:

NameTypeAttributeDescription
options Object

The current options of the env preset.

Return:

Object

The updated options for the env preset.