Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

[WIP] Upgrade to PureScript 0.13 #96

Open
wants to merge 15 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .babelignore

This file was deleted.

1 change: 0 additions & 1 deletion .babelrc

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.un~
*.sw[a-z]
dist/
bower_components/
node_modules/
output/
.psci*
Expand All @@ -10,3 +9,7 @@ src/.webpack.js
package
*.tgz
*.log
/.spago
/docs/index.html
/lib.js
/generated-docs
3 changes: 0 additions & 3 deletions .npmignore

This file was deleted.

5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Contributing #
# Contributing

**Contributions are highly encouraged and welcome**.
Bug fixes and clean ups do no need much coordination, but if you're interested
in contributing a feature, contact me at [email protected] and we can
get the ball rolling — There's plenty to do. To get up and running, run:

```sh
npm i && bower i && npm test
npm install && npm test
```

NB: Purescript is declared a devDependency in package.json, so no need to bring
your own. Also, during development, `npm run watch` is extremely useful to get
During development, `npm run watch` is extremely useful to get
immediate feedback.

> A quick overview of the implementation for potential contributors
Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ MD_SOURCES=\

docs/index.html: $(MD_SOURCES) docs/template.html docs/docs.css
pandoc $(SHARED_PANDOC_OPTIONS) \
-t html5 \
--to html5 \
--standalone \
-S \
--toc \
--chapters \
--top-level-division chapter \
"--metadata=subtitle:$(VERSION)" \
--no-highlight \
-c docs.css \
-o docs/index.html \
--base-header-level=2 \
--css docs.css \
--output docs/index.html \
--shift-heading-level-by 2 \
--template=docs/template.html \
$(MD_SOURCES)

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ install:
- npm install
- npm run deps
build_script:
- npm run -s build
- npm run build
test_script:
- npm test
80 changes: 0 additions & 80 deletions bower.json

This file was deleted.

29 changes: 29 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const neodoc = require('./lib.js')

helpText = `
Usage: neodoc [options]

Options:
--dont-exit Do not exit upon error or when parsing --help or --version.
--env Override process.env
--argv Override process.argv
--options-first Parse until the first command or <positional> argument, then collect the rest into an array, given the help indicates another, repeatable, positional argument.
--smart-options Enable parsing groups that "look like" options as options.
--stop-at Stop parsing at the given options, i.e. [ -n ].
--require-flags Require flags be present in the input. In neodoc, flags are optional by default and can be omitted.
--lax-placement Relax placement rules. Positionals and commands are no longer solid anchors.
--version-flags An array of flags that trigger the special version behavior: Print the program version and exit with code 0.
--version The version to print for the special version behavior.
--help-flags An array of flags that trigger the special help behavior: Print the full program help text and exit with code 0.
--repeatable-options Allow options to be repeated even if the spec does not explicitly allow this.
--transforms-presolve An array of functions to be called prior to "solving" the input.
--transforms-postsolve An array of functions to be called after "solving" the input, just prior to passing the spec to the arg-parser.
--allow-unknown Collect unknown options under a special key ? instead of failing.

Examples:
neodoc --options-first < help.txt
`

console.info(
neodoc.run(helpText, {laxPlacement: true})
)
42 changes: 0 additions & 42 deletions example-purs/Main.purs

This file was deleted.

38 changes: 37 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
module.exports = require('./dist/neodoc.js');
var neodocLib = require('./lib.js')

module.exports.run = function (helpOrSpec, options = {}) {
options.argv =
(Array.isArray(options.argv)
? options.argv
: (process.argv || [])
).slice(2)
options.env = Object.entries(
options.env && typeof options.env == 'object'
? options.env
: (process.env || {})
)

var result

if (helpOrSpec) {
if (typeof helpOrSpec === 'string') {
result = neodocLib.runStringJs(helpOrSpec)(options)
}
else if (typeof helpOrSpec === 'object') {
result = neodocLib.runSpecJs(helpOrSpec)(options)
}
}

if (!result ) {
throw new Error('Either provide a help text or a command specification')
}

if (result.errors) {
throw new Error(result.errors)
}

return Array.isArray(result)
? Object.fromEntries(result)
: result
}
12 changes: 0 additions & 12 deletions lib/neodoc.js

This file was deleted.

Loading