init - anconaesselmann/CLSPM GitHub Wiki

init

The init command generates an spmfile inside the project directory. spmfiles determine which packages get added to the project when the install command is run.

Options explained

--dependency

Once a package has been resolved (during install, through dependency-cache, manually added to dependencies file) the name of the dependency can be passed into init.

Example:

clspm init -d FirebaseAnalytics FirebaseCrashlytics

will create an spmfile with both dependencies if they have been resolved previously.


--csv

By default init will create a JSON spmfile. By passing the --csv flag a comma-separated list can be used instead.


--spm-file

The path for the spmfile to be generated can be passed is. Instead of generating the file at the project's root it will be generated at the given location. spmfiles that are located outside of the project's root directory can be used with the install command by providing the same --spm-file option.

Why might you want to use this feature:

  • Keeping the spmfile out of the repository
  • Generating alternative spmfiles to quickly switch many dependencies to alternative ones (e.g for switching multiple inter-dependent dependencies to use local implementations or to test out updated versions of dependencies)

--test-targets

By default init will generate an spmfile without test targets. Passing in --test-targets will create target entries for all test targets.


--force

init will not run if an spmfile is already present. To replace an existing spmfile and force the running of init pass in --force. To simply add dependencies call add instead.


--global-dependencies

TODO: add explanation


⚠️ **GitHub.com Fallback** ⚠️