Skip to content

sjsyrek/ps-react-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get Started

Install PureScript (the language itself), Pulp (the build tool), and psc-package (a package manager):

yarn global add purescript pulp psc-package

Do not install bower.

Create a new directory, and initialize the project:

mkdir my-purescript-project

cd my-purescript-project

pulp --psc-package init

To add packages to a project, run the command psc-package install package-name. Note that you should drop purescript- from the beginning of any package name. This command will automatically insert the package into your .psc-package.json file.

Put your source files in the /src directory. To compile, pulp build. To compile with dead code elimination, pulp build --optimise. Output files will end up in the /output directory as CommonJS modules, so you can require() them.

You can also output optimised JavaScript as a bundle, pulp build --to code.js, or use Browserify to bundle it: pulp browserify --to code.js (this command will include any npm packages you require() in your PureScript code files. You optimise the last step, as well: pulp browserify --optimise --to code.js, but this should only be done for production code (to lesson compile times during development).

You can also run your code directly in node, compiling if necessary beforehand with pulp run.

See the pulp documentation for more information about testing, building documentation, the PureScript REPL, webpack integration, etc.

Add custom package sets

Fork https://github.com/purescript/package-sets and edit your newly copied /package-sets/packages.json, adding any necessary packages to the file according to this pattern:

{

  ...

  "package-name": {
    "dependencies": [
      "functions",
      "eff",
      "some-other-dependency"
    ],
    "repo": "https://github.com/username/purescript-package-name.git",
    "version": "v0.1.0"
  }

  ...

}

Then, create a new release for your package-sets repo, giving it whatever tag and name you like. For example: https://github.com/sjsyrek/package-sets/releases/tag/schokoriegel. Then, you can add that tag name as a set to your psc-package.json file:

{
    "name": "my-purescript-project",
    "set": "schokoriegel",
    "source": "https://github.com/sjsyrek/package-sets.git",
    "depends": [
        "react-basic",
        "prelude"
    ]
}

Now you can run:

psc-package update

And you should have everything you need.

About

PureScript and React. Together. At last.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published