Commit Graph

59 Commits

Author SHA1 Message Date
Kazuaki Matsuo 52a755a913 fix(docutils): docs versioning and update latest (#18804)
* fix: docs versioning and update latest

* fix lint
2023-06-27 21:13:12 -07:00
Jonathan Lipps 1a5b8cca2d fix(docutils): set mike version to major.minor by default (#18770)
* fix(docutils): set mike version to major.minor by default

* Update packages/docutils/lib/builder/deploy.ts

Co-authored-by: Christopher Hiller <boneskull@boneskull.com>

---------

Co-authored-by: Christopher Hiller <boneskull@boneskull.com>
2023-06-15 10:19:05 -07:00
Christopher Hiller e5254b5b45 fix(docutils): fixes some weirdness with default behavior and the "implies" keyword (#18751)
* fix(docutils): fixes some weirdness with default behavior and the "implies" keyword

- also squashes an errrant warning
- fix some diff logic when writing to `mkdocs.yml`

* fix(docutils): more robust mike-finding
2023-06-14 11:18:55 -07:00
Christopher Hiller 2766dcca4c feat(docutils): init: scafffold package.json
This makes `appium-docs init` add a needed prop (`typedoc.entryPoint`) to `package.json` of an extension. It will write to `package.json` _by default_, even if it exists--which is different than the default behavior of other scaffolding tasks.

Note that `appium-docs init` will now _fail_ if `--entry-point <some-file>` (or `-e`) is not provided; there's no way for us to guess what it is (this is the _source_ entry point; not necessarily the `main` file). I guess that's technically breaking, but `appium-docs init` should not be part of anyone's workflow.
2023-05-24 14:26:07 -07:00
Christopher Hiller 6aec50b074 chore(docutils): lint
- consolidate some eslint overrides
2023-05-19 13:42:08 -07:00
Christopher Hiller 426830d14a fix(docutils): exec mike/mkdocs via python -m
- also adds a "custom typedoc path" option
- consolidate the `whichPython*` functions into a single `findPython` fn
2023-05-19 13:42:08 -07:00
Christopher Hiller 5d24ea1ad2 fix(docutils): run mkdocs via python -m 2023-05-19 13:42:08 -07:00
Christopher Hiller 7b17754786 fix(docutils): try python3 if python not in PATH 2023-05-19 13:42:08 -07:00
Jonathan Lipps d891c9570a docs(appium): fix error in docs build script (#18639)
* docs(appium): fix error in docs build script
in the case where the gh-pages branch was out of sync with local
it would just fail. now we will attempt to rebase first.

* docs(appium): fix error in docs build argify

* test(typedoc-plugin-appium): fix failing test fixture
2023-05-14 23:43:26 -07:00
Jonathan Lipps cdfe7c3d82 fix(docutils): remove -t arg for mkdocs which prevents theme customizations (fix #18536) (#18617) 2023-05-08 10:31:09 -07:00
Christopher Hiller c85b89ecbe fix(docutils): do not bail when no site_dir found
Also fix a couple borked log messages
2023-04-19 14:03:03 -07:00
Christopher Hiller e9426fcfec fix(docutils): properly respects log levels
The resulting solution keeps a bunch of weak refs to `Consola` objects and sets the log level on all of them if it ever changes.

This is--at minimum--easier to understand than the broken `Proxy` implementation.
2023-04-10 15:58:58 -07:00
Christopher Hiller 4974403661 fix: backwards-compatible fixes for TS v5.x
These will be issues when we upgrade
2023-03-27 17:07:51 -07:00
Christopher Hiller ad11fbf97b fix(docutils): inherit stdio in long-running processes
This change ensures when running `mkdocs` or `mike` with the `--serve` flag, the output is unbuffered and stdio is inherited from the parent process.

This will show helpful things like _the URL at which the development server is running_.
2023-03-09 10:12:53 -08:00
Christopher Hiller 4cfad004db feat(docutils): add --upgrade flag to init
users can run `appium-docs init --upgrade` to upgrade python deps (e.g., mkdocs, mkdocs-material)
2023-03-07 14:27:16 -08:00
Christopher Hiller 58b4790b1d chore: lint all the typescript 2023-03-06 15:21:58 -08:00
Christopher Hiller cce27fcf88 chore(docutils): review updates
- Use `util.pluralize()` from `@appium/support` instead of `pluralize` directly
- Write some more docstrings
2023-03-03 11:36:00 -08:00
Christopher Hiller b30b2cfb84 feat(docutils): better path validation
This adds up-front checking of user-provided custom paths to avoid doing a bunch of work and then failing later ("fail fast")
2023-03-03 11:36:00 -08:00
Christopher Hiller 189e39d03c fix(docutils): use material theme 2023-03-02 15:00:50 -08:00
Christopher Hiller f80f4cb2bc feat(docutils): allow "%s" as version number in commit msg arg 2023-03-01 16:32:00 -08:00
Christopher Hiller 18c0b4b230 chore(docutils): remove monkeypatching of typedoc 2023-03-01 13:19:39 -08:00
Christopher Hiller 3b82c9f1a1 chore(docutils): smol type upgrade
`type-fest`@3.6.0 has a `TsConfigJson` type which no longer contains `unknown` (courtesy of yours truly), so we can use it directly instead of wrapping it in `Jsonify`.
2023-02-20 10:05:13 -08:00
Christopher Hiller 74800cdf61 chore(docutils): tweaky refactors for new ts 2023-02-14 14:31:38 -08:00
Christopher Hiller 70c98ea12f chore(typedoc-plugin-appium): isolate e2e tests due to memory pressure in CI 2023-02-14 14:31:38 -08:00
Christopher Hiller ab366f3a1f fix(docutils): fix bad offset in nav updates
Also warn if no TypeDoc output files found
2023-02-09 14:48:20 -08:00
Christopher Hiller 5446e5c7a7 fix(docutils): fix bad option name and ignore most falsy args
- in type `DeployOpts`, `mkDocsYml` should have been `mkdocsYml`
- arguments were only being omitted from being passed to `mike` if they were `false`, but it needed to also consider `undefined` values and empty string values.  `0` is falsy, but we should not disallow this.  thus... "most" falsy values get ignored.
2023-02-09 14:48:20 -08:00
Christopher Hiller 2271f34d9b chore(docutils): improve logging output 2023-02-09 11:39:54 -08:00
Christopher Hiller f5ec354e3d fix(docutils): fix various problems in deploy pipeline
- Do not send boolean flags to `mike`
- Do not send `mike serve`-specific args to `mike deploy`
- Derive version from `package.json` if no version present (like the CLI docs say it should)
- `version` and `alias` are positional args to `mike deploy`/`mike serve`, not options
- Fix update nav logic
- Fix monkeypatching of TypeDoc if `typedoc` is not installed in the `node_modules` of a workspace
- Fix parsing of `typedoc.json`
- Fix finding of `typedoc.json`
2023-02-07 17:09:29 -08:00
Christopher Hiller 65c6ca528b chore(docutils): split huge updateNav into smaller functions
per peer review by @mykola-mokhnach
2023-02-07 15:50:11 -08:00
Christopher Hiller 42dd6785c3 fix(docutils): better parsing/updating of nav tree in mkdocs.yml
After we build the reference docs, we need to update the `nav` prop of the given `mkdocs.yml` before building the site.  This was only _sorta_ working before; it did not take into account the myriad ways in which the data structure could be expressed (particularly, it did not understand "custom names").

I think I've done this in such a way that if a custom name is provided (they must be provided manually by hand-editing `mkdocs.yml`), it retains them _unless_ the file in question disappears.  Or that's the idea. Can't really be too sure; needs tests.

This change makes an attempt to parse the `nav` prop into something "normalized", then the data is processed and recomplexified before writing out to `mkdocs.yml`.  However, I've disabled the ability to define a custom header for command docs and/or omit the header entirely, as the latter especially was causing extra complexity and it's already bad enough.  I think we can re-enable "custom header" somehow, if needed.

Also added an `--all` flag which causes the nav to be updated with _all_ the TypeDoc-generated content--not just command docs.
2023-02-07 15:50:11 -08:00
Christopher Hiller c9a82926a8 feat(docutils): add support for deploying with mike
This is enabled via `appium-docs build --deploy`.  Instead of invoking `mkdocs` directly, `mike` will be invoked.

Implementation is in `lib/builder/deploy.ts`.  It's very similar to the MkDocs implementation in `lib/builder/site.ts`; just with new/different options.

I marked the `Mike` class as deprecated, since the new one is fancy
2023-02-06 15:28:36 -08:00
Christopher Hiller 5326cb1840 chore(docutils): reorganize some build-related modules into a 'builder' subdir
Also rename a few things.  `typedoc` module is now `reference` and `mkdocs` module is now `site`.

Moved a couple things into `util` as well

The `nav` module will be in stacked PR
2023-02-06 15:28:06 -08:00
Christopher Hiller cd72da3b3f fix(docutils): fix the docutils logger
Proxy wasn't working properly. Now it is
2023-02-06 15:27:21 -08:00
Christopher Hiller 258860f377 fix(docutils): fix --mkdocs-yml arg for validate command 2023-02-06 15:26:25 -08:00
Christopher Hiller fd98351a47 feat(docutils): better mkdocs validation
When validating `mkdocs.yml`, `appium-docs` is now aware of the `INHERITS` property, and expands this property (by loading more `mkdocs.yml` files).

Also:

- Updated the types for `mkdocs.yml`
- Squelch warnings from `YAML.parse()`
- Change YAML indentation back to 2, since that seems to be correct and I was confused
2023-02-06 15:26:25 -08:00
Christopher Hiller 71e91107f9 feat(docutils): add config file support
e.g., `appium-docs.config.js` and the its ilk. Not strictly necessary, but can be useful if there are a bunch of custom paths or multiple builds.
2023-02-06 15:11:43 -08:00
Christopher Hiller abfeb21be6 feat(docutils): implement mkdocs validation
- Better grouping of `validate` command options in `--help`
- Move some more constants into the module
- Removed the "guess" functions and replaced them with functions which use `which` to actually find the necessary executables
- Moved `isStringArray()` to `util`
- Fixed some error messages and added more
- Simplified use of `DocutilsValidator#fail()`
- Removed option for custom path to `requirements.txt`
2023-02-03 11:54:02 -08:00
Christopher Hiller f16e6c8a16 chore(docutils): tweak some logging 2023-02-02 16:25:45 -08:00
Christopher Hiller d9304d8212 chore(docutils): when complete, build command mentions the site dir 2023-02-02 16:25:45 -08:00
Christopher Hiller 21eb6b59f8 fix(docutils): disallow both --no-reference and --no-site
also add a final "done" message
2023-02-02 16:25:45 -08:00
Christopher Hiller 3872d40291 docs(docutils): more docstrings dogg 2023-02-02 16:25:45 -08:00
Christopher Hiller f96eb8652f chore(docutils): remove cruft from mkdocs module and refactor 2023-02-02 16:25:45 -08:00
Christopher Hiller 73ff1b8f3c fix(docutils): fix logic for 'include' prop of tsconfig.json 2023-02-02 16:25:45 -08:00
Christopher Hiller 53b60bc3bb feat(docutils): add a --no-reference-header option 2023-02-02 16:25:45 -08:00
Christopher Hiller 5960cc89ac chore(docutils): break out fs-related functions in util into their own module 2023-02-02 16:25:45 -08:00
Christopher Hiller 4f457468bb feat(docutils): do not fail on first validation error
This modifies the validator to collect all of the errors from validation (except those that are "unexpected" though not _so_ unexpected that I did not account for them; stuff like "unparseable output from `pip list --json`") and display them as they happen without aborting the entire validation process.
2023-02-02 16:25:45 -08:00
Christopher Hiller 8fbbdb93a2 fix(docutils): lint 2023-02-02 16:25:45 -08:00
Christopher Hiller 8a1ed8921f chore(docutils): simpler implementation for global log level control 2023-02-02 16:25:45 -08:00
Christopher Hiller 082197bd2b feat(docutils): enable updating of mkdocs nav based on commands
- also fix bad arg names
2023-02-02 16:25:45 -08:00
Christopher Hiller 93b5831e3a feat(docutils): add mkdocs output to build command
`build` now executes both `typedoc` and `mkdocs` unless options to one run or the other are passed.

- renamed `init-task` to `scaffold`
- renamed `build` to `typedoc`
- fix JSON5 stringification
- use typedoc's facilities for reading its own config files, which absolves us from having to expand the `extends` prop in `typedoc.json` (if any)
2023-02-02 16:25:45 -08:00