Commit graph

44 commits

Author SHA1 Message Date
IGI-111
3efc60e22b
Bump to v0.43.0 (#4897) 2023-08-02 22:57:10 +02:00
Chris-san
e5d3185abf
forc doc: Generate dependency documentation (#4546)
## Description

Generates the documentation for dependencies & small improvements to the
API.

These changes **DO NOT** create links between dependency docs and the main docs, but generates the dependency docs and ensures there are no conflicts when generating these docs.

What's new so far:
- [x] Programs get their own folders, just like `cargo doc`
- [x] Generates documentation for dependencies by default: Closes #4533 
- [x] Fixes possible conflict with `assets` folder: Closes #4545 
- [x] Removes old docs before generating new ones: Closes #4544 

## Checklist

- [x] I have linked to any relevant issues. 
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Chris O'Brien <eureka@noctua.attlocal.net>
2023-05-22 21:27:32 +03:00
Mohammad Yasir
800089eb62
Updated the sway.js file by adding mod and type in keyword (#4427)
## Description
fixes #4424 
closes #4424 


## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2023-04-12 22:39:45 +00:00
AndrésF
63382365bd
doc: Adding annotations support on highlight.js (#4186)
## Description

resolves #2740
closes #4157

> In order to give a better highlighting I picked the "meta" scope as
seen in [highlight.js
docs](https://highlightjs.readthedocs.io/en/latest/css-classes-reference.html)
> 
> The ["Mode"
](https://highlightjs.readthedocs.io/en/latest/language-guide.html) I've
added provides the html class: _hljs-meta_ however, the result is a
white color for annotation (like plain text) and not a blue color as
requested in the issue.
> 
> The solution I've found for this is to add an additional css file to
specify custom behavior for the desired class. I haven't added this file
because I think it's out of scope.


## Checklist

- [ ] I have linked to any relevant issues.
- [ ?] I have commented my code, particularly in hard-to-understand
areas.
- [ ?] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ?] I have added tests that prove my fix is effective or that my
feature works.
- [] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel
Labs Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ?] I have requested a review from the relevant team or maintainers.

Co-authored-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
2023-03-10 15:24:50 +00:00
Chris O'Brien
af217d0943
Add syntax highlighting to code blocks in forc doc (#4176)
## Description
Applies the ayu theme to `<pre>` wrapped code blocks using the
`highlight.js` file used in the markdown books.

![Screenshot from 2023-02-23
19-55-31](https://user-images.githubusercontent.com/57543709/221073023-9209d927-febf-4cb7-bf90-13302596af4d.png)


## Checklist

- [x] I have linked to any relevant issues. Closes #4175 
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2023-02-24 02:12:42 +00:00
mitchmindtree
4ffa867b3d
refactor: Move the examples workspace manifest into examples directory. Use it in CI. (#4145)
## Description

This moves the examples workspace manifest introduced in #4118 into the
`examples/` directory and cleans it up a bit.

We also now integrate the examples workspace into CI, making the old
`examples-checker` script redundant. This old script is also removed as
a part of this PR.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
2023-02-21 11:15:29 +11:00
Brandon Kite
67b37ce4cc
Fuel Core v0.17.0 Upgrade (#3961) 2023-02-08 20:01:12 +11:00
Mitchell Mackert
4eb4edd17a
Update sway book README (#3983)
Closes #3981

---------

Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
2023-02-07 10:34:49 +11:00
Nick Furfaro
ed1bc39c67
Run cargo clippy --fix in the sway repo (#3903)
Co-authored-by: Sophie <sophiedankel@gmail.com>
2023-01-26 16:05:13 -05:00
David Ma
02d9b3d31c
Fix highlightjs/build.sh to point to correct directories (#3632) 2022-12-19 08:36:35 -05:00
Mohammad Fawaz
2e20b089d8
Address Clippy warnings due to rustc 1.65 (#3274)
So far I'm addressing all Clippy warnings except for `result_large_err`:

Example:
```console
warning: the `Err`-variant returned from this function is very large
   --> sway-core/src/semantic_analysis/namespace/items.rs:130:56
    |
130 |     pub(crate) fn check_symbol(&self, name: &Ident) -> Result<&ty::TyDeclaration, CompileError> {
    |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `Err`-variant is at least 224 bytes
```
Addressing this seems like it will take some time. Might have to throw
in `Box` in various places. To unblock everyone from working, I'm
allowing `clippy::result_large_err` in CI for now.
2022-11-03 21:44:33 +00:00
bing
567ac2e14f
forc documenter refactor (#3182) 2022-10-31 05:53:13 -04:00
mitchmindtree
dab1c74b2a
Remove Rust integration testing behaviour from forc test in anticipation of unit testing support (#2264)
This PR is a WIP that aims to address the first 3 steps in #1833.

This is in anticipation of using `forc test` to support unit testing
(rather than Rust integration testing) #1832.

The `forc test` command remains for now, but outputs a message
explaining that the command is now reserved for unit testing and links
to the issues above.

## TODO

- [x] Create a new `sway-test-rs` repo or similar that can be used as a
`cargo generate` template.
- [x] Update Rust integration testing docs in the Sway book to describe
how to use the `cargo generate` command to easily add Sway integration
testing to an existing Rust project.

## Follow-up

- Create a `forc-test-rs` crate that re-exports and extends `fuels` with
useful `forc` functionality for integration testing (e.g. re-exporting
`forc_pkg::build` to ensure sway code is built and available under
`out/` at the start of testing).
2022-10-10 12:27:13 +11:00
Joshua Batty
58f2021ad0
Add some missing keywords for mdBook syntax highlighting (#2903)
Add some missing keywords to the `sway.js` file. This was triggered by
@Braqzen noticing some inconsistent highlighting in the generated MD
books.

Doesn't address custom types not being highlighted but that can be for a
future PR.
2022-09-29 23:23:06 -05:00
Kaya Gökalp
1ed1cf1fa0
Split client interaction commands into a forc-client plugin (#2440) 2022-08-18 01:46:12 +00:00
John Adler
fddb2067dd
Create markdown-lint.yml (#2534)
* Create markdown-lint.yml

* Fix lint errors.
2022-08-15 12:45:07 -04:00
Kaya Gökalp
87e0a488cf
Fix new clippy lints (with rust version 1.63) (#2518) 2022-08-11 19:13:33 +00:00
Deniz Surmeli
243ab81f47
2474/generic repo name (#2476)
* fix directory name dependency when running `examples-checker`(#2474)

* chore: fix formatting
2022-08-09 03:43:19 +00:00
bing
3b87465c0f
Deprecate forc gm (#2382)
* remove forc-gm dir

* remove forc-gm from workspace

* Update 'forc gm' reference in tests to 'forc explore'
2022-07-27 00:57:05 +08:00
John Adler
9dc04fca7f
Fix and clean up forc reference docs. (#2233)
* Fix and clean up forc reference docs.

* Revert path surround change.

* Surround with backticks.
2022-07-06 00:49:00 +00:00
rashad
fd3a96f13b
Distinguish between forc init and forc new (Copy over changes from PR#1669) (#2175)
* Copy over changes from PR#1669

* Rework `forc new` in terms of `forc init`

This removes all of the duplicated logic from the `forc new` command in
favour of re-using the `forc init` op.

* Add missing doc

* Add missing comment

Co-authored-by: Rashad Alston <rashad@Rashads-MacBook-Pro.local>
Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>
Co-authored-by: Rashad Alston <rashad@Rashads-MBP.attlocal.net>
2022-07-01 10:09:07 -07:00
r-sitko
e06e9933ca
#2039 - add storage keyword highlighting in book (#2141)
* #2039 - add storage keyword highlighting in book

* Changes after review

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-06-28 16:12:52 +00:00
bing
3de2557657
preprocessor strictness change (#1987)
* add toml dependency

* add check for 'strict' env var

* update CI with env var

* Update READMEs

* Wording
2022-06-15 10:59:48 +00:00
bing
4fab68f9ee
update README related to Forc commands/plugins (#1728)
* Add instructions to update mdbook-forc-documenter if 'Commands' or 'Plugins' chapter names change

* replace forc gm example with forc explore, and add 'or plugin' after every reference to command

* Add instructions to add plugin installation within CI

* newline

* more info on taking action

* consistent wording

* Clearer wording on removing plugin

* fix: behaviour -> behavior

* Use permalinks

* use permalink in docs/README.d as well
2022-05-27 13:19:01 -04:00
John Adler
e3ac9c4eca
Add more highlighted languages (#1699)
* Clean up build script.

* Regenerate highlight.js file with shell.

* Add JSON to build script.

* Add JSON.

* Use 11.3.1.
2022-05-26 17:26:37 -04:00
Kaya Gökalp
53361ee726
forc template implementation (#1614)
* forc template resolves the HEAD and fetches the repo. Prints the requested directorie's path

* forc template works with and without template name

* forc init --template removed, pkg.rs unused pub modifier removed

* extra info added before copy, cargo-toml-lint, udeps fix, mdbook fix

* invoke CI

* Update scripts/mdbook-forc-documenter/examples/forc_template.md

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Update scripts/mdbook-forc-documenter/examples/forc_template.md

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* default url provided, project_name is last parameter to pass without --project_name

* cargo fmt

* println to tracing::info

* local_repo_name to template_name

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-05-24 02:47:41 +03:00
bing
17b9e24730
document native plugins within the Sway book (#1582)
* Refactoring to get ready for plugin documentation integration

* Check for errors when updating doucmentation

* Fix formatting of error text

* Remove unused BorrowMut

* Add plugin docs

* strip whitespace to remove version no. from plugin command header

* Better naming for commands/plugins within preprocessor

* extract inject_content

* handle parsing subcommand

* Refactor

* Install plugins within ci and gh-pages

* order plugins alphabetically

* official_plugin_commands -> plugin_commands, since they mean the same

* Handle error messages better

* subcommand_is_parsed -> has_parsed_subcommand_header for consistency

* More consistent expect message

* Add additional white spaces for test_format_subcommand_line

* cargo install --debug to speed things up

* Update input from &Vec<String> to &[String]

* Move forc-explore, forc-fmt, forc-lsp, into forc-plugins dir

* Update CI ymls with new plugins path

* Update all references to forc plugins in ci

* Programatically get plugins from forc-plugins

* Update ci.yml

* Properly install plugins

* Re-add removed cancel-previous-run

* Remove unused actions-rs/cargo

* Update plugins installation for gh-pages.yml

* Improve plugins.rs

* Improved find_forc_plugins_dir

* Remove return line within format_header_line

* Fix bug where preprocessor would panic if not in Sway root (#1618)

While testing, I noticed that the build would panic if you attempted to
`mdbook build` the book while in the `docs` directory. I then realised
we had a misuse of the `current_dir` function which must have slipped
through in a previous PR review. I've fixed this by adding a
`find_sway_repo_root` fn and implementing functions to find the plugins
and examples directories in terms of it.

Co-authored-by: mitchmindtree <mitchell.nordine@fuel.sh>
2022-05-23 11:12:53 +08:00
Kaya Gökalp
1cf7696e5e
Transition to tracing in forc (and throughout sway) over println (#1575) 2022-05-20 11:18:01 +03:00
bing
e75cbd7c97
Use forc-documenter as an mdbook preprocessor instead (#1545)
* mdbook-forc-documenter

* Cargo.toml update

* Delete forc documenter script folder

* Introduce mdbook-forc-documenter

* Update CI

* Cargo.lock

* make clippy happy

* Remove println

* Add examples in .md format

* Load examples

* Make clippy happy

* Delete forc_completions

* Re-add forc_completions

* Reorder cargo.toml dependencies

* Add README for mdbook-forc-documenter

* Update book README

* Update make_app

* Revert ci.yml

* Remove forc-documenter-dry-run from ci.yml

* Add mechanism to detect inconsistencies between forc commands and documentation

* Handle removed commands and new commands separately

* make clippy happy :)

* Fix errors in Cargo.toml

* typo: competions -> completions

* Remove redundant \n

* Update Cargo.toml

* Update Cargo.lock
2022-05-17 15:02:28 +08:00
bing
efcf6d7d84
Improve forc documenter (#1505)
* Accumulate errors instead of returning

* Update run write-docs message

* Better printing

* Handle index.md and summary.md reporting

* Fix passing in wrong contents into check_index_diff

* Remove RUN_WRITE_DOCS_MESSAGE entirely since it's only used in one place now

* Re-add println Done at the end of script

* Better error message

* Use bail!

* use bail!, again
2022-05-10 13:33:53 +08:00
bing
eb19599177
move forc completions help text into the book (#1248)
* Add indentation for code block within forc deploy

* Separate examples from constants

* Update examples.rs to the latest version

* Remove long-form discussion in forc completions help

* Update examples and docs

* Revert examples check to shorten diff forn ow

* Newline

* Newline for docs

* Better formatting

* Add link to book within help

* Update docs

* Remove redundant shell command prefixes $ and PS

* Missed the C:s

* Run write-docs script

* Re-add FORC_COMPLETIONS_EXAMPLE
2022-05-10 12:41:03 +08:00
bing
7585d07c17
Extract forc documentation examples from constants.rs into examples.rs (#1504)
* Extract forc docs examples from constants.rs into examples.rs

* Pull latest updated examples
2022-05-10 10:02:07 +08:00
bing
8b5a6f7837
Update parse bytecode example (#1467)
* Update parse-bytecode output

* Remove intermediate instructions to reduce verbosity

* Update parse-bytecode docs

* Manually truncate parse-bytecode output for now

* Update parse bytecode docs

Co-authored-by: binggh <binggh@proton.me>
2022-05-05 00:52:13 +08:00
bing
b89ec66ddb
Move build all examples (#1398)
* Move build-all-examples to scripts

* Remove print

* Reorder scripts/build-all-examples alphabetically

* use clap for build-all-examples

* Cargo.lock update

* Take paths for build-all-examples

* Remove unused import

* Rename build-all-examples -> build-examples

* Update ci.yml with new build-examples command

* Update Cargo.lock

* Add help text for build-examples script

* Use --all and --paths args to differentiate between building all and specific paths

* build-examples --all -> --all-examples to make it even more explicit

* Better description for script

* Refactor script

* Rename build-examples to examples-checker

* update Cargo.toml and Cargo.lock with new script name

* Update CI workflow

* Better usage of Path

* Remove redundant builds, add dedicated fmt job

* Remove usage of success bool in run_forc_command

* Use [] instead of &Vec<>

* handle print_summary failure as error instead of exit(1)

Co-authored-by: bing <binggh@proton.me>
2022-05-02 11:05:14 +08:00
bing
1d149d8d83
Clearer failure message for forc-documenter (#1443)
* Clearer failure message for forc-documenter

* Missing backtick

Co-authored-by: binggh <binggh@proton.me>
2022-05-02 10:00:27 +08:00
mitchmindtree
45441f8aa5
Concat forc's stdout and stderr output in forc-documenter (#1364)
This is a temporary workaround for #1363 until we work out what's really
going on there.
2022-04-22 14:50:31 +10:00
bing
505984dd97
Forc deploy docs update (#1306)
* Update example text for forc deploy

* Update forc deploy

* Better link to page
2022-04-21 04:07:58 -04:00
Mohammad Fawaz
c65b9b3d30
don't publish forc documenter (#1293) 2022-04-18 08:46:27 -04:00
bing
a39ec9507e
Script to generate docs for forc commands + examples (#1047)
* Update book with forc commands

* Fix SUMMARY.md errors when merging

* Move all command pages under /commands dir

* Fix broken link to commands/index.md

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Prelim version of a script

* Generation of all command pages based on forc --help

* Clean up main.rs

* Re-generate docs with script

* Fix test_format_option_line test

* Re-build docs without comma after options

* Remove extra printlns

* Add logic to insert examples

* Re-generate docs with examples

* generate forc_deploy.md

* Rename command to write-docs

* Fix dependencies ordering within Cargo.toml

* Move more constants

* added dry-run for checking

* Fix clippy checks

* Rework some error handling when doing dry run

* Integrate mdbook build and forc-documenter checks into ci

* Test a hack for checking errors in mdbook

* Add uses checkout

* Fix dashes

* Fix uses/run in single step

* Try if grep

* fix yaml syntax

* fix yaml syntax, for real

* Fix running forc-documenter from project root

* Try cat for github action

* Fix Cargo.lock

* add install forc to forc-documenter job

* Missed out args line

* Trim newline from start and end of md files

* Fix index header duplicate and add trim() to result

* Fix dry-run behaviour for index

* Remove all commands before starting write-docs to remove outdated commands

* Re-generate

* Remove outdated forc commands from SUMMARY.md

* Extract code from main.rs into helpers.rs

* Handle updating SUMMARY.md as well

* Fix cargo clippy stuff

* Add readme for forc-documenter

* Add version message

* Re-generate docs

* Re-generate docs

* Revert unintended formatting changes

* Fix typo in forc-documenter README.md

* Rename _command to command

* Refactor code within script

* Separate check functions from helpers module

* More refactoring into components

* Re-arrange functions in main

* Add hello world test as a code block instead of a link

* Add docs for forc plugins

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
2022-04-12 18:02:33 +10:00
John Adler
734d383453
Add toml syntax highlighting. (#551) 2022-01-01 18:05:16 -05:00
John Adler
da7cf05677
Add Rust syntax highlighting (#547)
* Add Rust to built languages.

* Update highlight.js file.
2022-01-01 11:05:35 -05:00
John Adler
d242ba047d
Update manifest files (#479)
* Update authors.

* Add more fields.

* Update highligh.js gen script author.

* Update author on Forc manifest files.

* Change author on missed files too, and fix formatting.

* Fix typo from merge.
2021-12-23 14:08:12 -05:00
alex-matthe
e8f381592d
Update syntax highlighting (#426)
* Update highlighted data types

* Update keywords

* Add highlight.js bundled file

* Fix types

Co-authored-by: Alexandru Matei <alexandrumatei3693@gmail.com>
2021-12-07 14:18:58 +02:00
Elvis
919c18c98f
added sway highlight.js (#129)
* added sway highlight.js

* added higlightjs/sway and its build script

* added initial prism for sway

* added script for prism

* added prism-sway and instructions

* rename to all caps

* update build scripts

* added missing dots
2021-08-02 19:09:28 +02:00