@causal/compiler
v0.48.11
Published
Causal command line compiler for FDL files.
Downloads
1,115
Readme
Causal Compiler
Causal is an integrated product analytics, feature flags, and A/B testing platform. It is designed to help you write more maintainable code, collect better data, and optimize your product quickly.
Causal replaces your session tracking, feature management, and A/B testing tools into one integrated system so you can focus on your competitive advantage, not building robust data pipelines.
Full Documentation available at docs.causallabs.io
Installation
The Causal Compiler should be added as a dev depenenency to your project. This will allow you to run the compiler from the command line.
npm install --save-dev @causal/compiler
If you have a non-node project you can use the following command when you need to run the compiler:
npx @causal/compiler
Usage
After updating your FDL file, you can run the compiler to generate the appropriate code for your project. The compiler will generate a file for each platform you have enabled using the appropriate command line flag.
For example, to generate a typescript client for your project, you can run the following command:
npx @causal/compiler --push-fdl --typescript {your/project/path/components/}causal.ts fdl/causal.fdl
Command Line Flags
--compiler-classpath
Where the Java system compiler gets the Causal runtime and dependencies when compiling FDL java classes. Default is to use the current classpath, which is correct in most situations. Same format as the -cp option to javac. You should not need to change this unless you are launching the compiler in a non-standard way, for example from a Spring application.
Default: $CLASSPATH (or %CLASSPATH% on Windows)
--delete
When using --partial. In addition to replacing the specified files, delete this file. May be used more than once on the command line.
Default: []
--environment
The environment for which we are generating code.
Default: Production
--force-requery
Force grabbing data from tools.causallabs.io. Die if we cannot connect.
Default: false
--help
Print command line documentation
Default: false
--hive
File to write Hive warehouse ddl file. Will emit Hive statements, unless --redshift-schema is specified, in which case redshift DDL is emitted
Default: Not provided
--java
Directory to write java code. Default is not to emit java.
Default: Not provided
--kotlin
Directory to write kotlin code for the Android client. Default is not to emit kotlin.
Default: Not provided
--no-compatibility-check
Do not check if the current control values are incompatible with the FDL file. Setting this to true will allow you to compile FDL files that are not compatible with your current production configuration, potentially breaking your production environment
Default: false
--no-control-check
Only warn if the current control values are incompatible with the FDL file. Default is a compile error.
Default: false
--number-of-days-of-partitions
This parameter controls the number of days to look back for partitions when generating DDL statements to define the data warehouse.
Default: 14
--partial
Add (or replace) the given files with those that have already been pushed to Causal. This allows you to compile a subset of files for your project, leaving everything else in place. The files you specify will be added or replace the server-side files, which are stored locally in the .causal/fdl directory. Can be combined with --push-fdl to do the same on the server. See partial compilation.
Default: false
--push-fdl
Push the fdl code to the tools endpoint after compiling succeeds.
Default: false
--redshift
File to write Redshift warehouse ddl file. Will emit Redshift PSQL statements. You must also specify --redshift-schema.
Default: Not provided
--redshift-schema
Defines the redshift external schema in which we should generate Causal external tables.
Default: Not provided
--ruby
File to write ruby API code. Default is not to emit ruby.
Default: Not provided
--snowflake
File to write Snowflake warehouse ddl file. Will emit snowsql statements.
Default: Not provided
--swift
Directory to write swift code for the iOS client. Default is not to emit swift.
Default: Not provided
--kotlin
Directory to write kotlin code for the Android client. Default is not to emit kotlin.
Default: Not provided
--template
Expand a user supplied mustache template file. The API available to the mustache template is defined in the io.causallabs.mustache.Context class.
Default: Not provided
--template-out
Where a user supplies mustache template is expanded into.
Default: Standard out
--template-params
Name of json file to feed to the template in the 'params' context. The file should contain a single JSON object, and the object's fields are available as top level variables in the template.
Default: Not provided
--token
The authorization token with which to access data on Causal.
Default: Not provided
--ts-react-split
EXPERIMENTAL: Intend for use with react server components. Write three typescript files, a base file, one for server components, and one for client components. The provided name is the base name and the server and client files will be suffixed with .server.ts and .client.ts
Default: false
--typescript
Write the typescript module to the given file.
Default: Not provided
--version
Print the compiler version and exit.
Default: false
--warn
Only warn on warehouse compatibility checks, do not error out. Default is to error out. Using this setting in production can break your warehouse.
Default: false
--warn-on-error
Only warn on warn on compatibility checks, do not error out. Default will error when compatability fails in a staging environment for an entity in use in a production environment.
Default: false