Compare commits

...
Author SHA1 Message Date
Christopher Hiller 29a5bdac9a chore: publish
- appium@2.0.0-beta.55
 - @appium/docutils@0.2.1
2023-02-09 14:49:28 -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
8 changed files with 67 additions and 32 deletions
+3 -3
View File
@@ -17004,13 +17004,13 @@
}
},
"packages/appium": {
"version": "2.0.0-beta.54",
"version": "2.0.0-beta.55",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@appium/base-driver": "^9.3.1",
"@appium/base-plugin": "^2.2.1",
"@appium/docutils": "^0.2.0",
"@appium/docutils": "^0.2.1",
"@appium/schema": "^0.2.4",
"@appium/support": "^3.1.5",
"@appium/types": "^0.9.1",
@@ -17268,7 +17268,7 @@
},
"packages/docutils": {
"name": "@appium/docutils",
"version": "0.2.0",
"version": "0.2.1",
"license": "Apache-2.0",
"dependencies": {
"@appium/support": "^3.1.5",
+11
View File
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.55](https://github.com/appium/appium/compare/appium@2.0.0-beta.54...appium@2.0.0-beta.55) (2023-02-09)
### Bug Fixes
* **docutils:** fix bad option name and ignore most falsy args ([5446e5c](https://github.com/appium/appium/commit/5446e5c7a755be081f46f1ed1ca8c13665d9a772))
# [2.0.0-beta.54](https://github.com/appium/appium/compare/appium@2.0.0-beta.53...appium@2.0.0-beta.54) (2023-02-09)
+1 -1
View File
@@ -52,7 +52,7 @@ async function main() {
log.info(`Building docs for language '${lang}' and version ${majMinVer}`);
const configFile = path.join(DOCS_DIR, `mkdocs-${lang}.yml`);
await deploy({
mkDocsYml: configFile,
mkdocsYml: configFile,
branch,
prefix: path.join(basePrefix, lang),
remote,
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "appium",
"version": "2.0.0-beta.54",
"version": "2.0.0-beta.55",
"description": "Automation for Apps.",
"keywords": [
"automation",
@@ -61,7 +61,7 @@
"dependencies": {
"@appium/base-driver": "^9.3.1",
"@appium/base-plugin": "^2.2.1",
"@appium/docutils": "^0.2.0",
"@appium/docutils": "^0.2.1",
"@appium/schema": "^0.2.4",
"@appium/support": "^3.1.5",
"@appium/types": "^0.9.1",
+12
View File
@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.2.1](https://github.com/appium/appium/compare/@appium/docutils@0.2.0...@appium/docutils@0.2.1) (2023-02-09)
### Bug Fixes
* **docutils:** fix bad offset in nav updates ([ab366f3](https://github.com/appium/appium/commit/ab366f3a1f9109f7bd75ae5ac32b862d5e6dd1bf))
* **docutils:** fix bad option name and ignore most falsy args ([5446e5c](https://github.com/appium/appium/commit/5446e5c7a755be081f46f1ed1ca8c13665d9a772))
# [0.2.0](https://github.com/appium/appium/compare/@appium/docutils@0.1.6...@appium/docutils@0.2.0) (2023-02-09)
+10 -4
View File
@@ -74,7 +74,7 @@ async function findDeployVersion(packageJsonPath?: string, cwd = process.cwd()):
* @param opts Options
*/
export async function deploy({
mkDocsYml: mkDocsYmlPath,
mkdocsYml: mkDocsYmlPath,
packageJson: packageJsonPath,
deployVersion: version,
cwd = process.cwd(),
@@ -111,7 +111,10 @@ export async function deploy({
host,
};
if (serve) {
const mikeArgs = [...argify(_.pickBy(mikeOpts, Boolean)), version];
const mikeArgs = [
...argify(_.pickBy(mikeOpts, (value) => _.isNumber(value) || Boolean(value))),
version,
];
if (alias) {
mikeArgs.push(alias);
}
@@ -120,7 +123,10 @@ export async function deploy({
} else {
const mikeArgs = [
...argify(
_.omitBy(mikeOpts, (value, key) => _.includes(['port', 'host'], key) || value === false)
_.omitBy(
mikeOpts,
(value, key) => _.includes(['port', 'host'], key) || (!_.isNumber(value) && !value)
)
),
version,
];
@@ -140,7 +146,7 @@ export interface DeployOpts {
/**
* Path to `mike.yml`
*/
mkDocsYml?: string;
mkdocsYml?: string;
/**
* Current working directory
+27 -21
View File
@@ -170,7 +170,6 @@ function getRootHeaderKeypath(headerItems: ParsedNavData[], header: string) {
* @param mkDocsDocsDir Configured `docs_dir` or via options
* @param navData Nav data parsed by {@linkcode parseNav}
* @param all If `true`, process all markdown files, not just commands
* @returns
*/
async function getNavItemsForDir(
dir: string,
@@ -180,45 +179,52 @@ async function getNavItemsForDir(
all = false
) {
let dataChanged = false;
const newHeaderItems: Omit<ParsedNavData, 'name'>[] = [];
const newNavHeaderItems: Omit<ParsedNavData, 'name'>[] = [];
const referenceOutputFilepaths = await findRelativeMarkdownFiles(dir, mkDocsDocsDir);
if (!referenceOutputFilepaths.length) {
log.warn('No markdown files found in %s; did TypeDoc run?', dir);
return {data: [], changed: false};
}
const newRefFilepaths = await findRelativeMarkdownFiles(dir, mkDocsDocsDir);
const header = all ? _.startCase(path.basename(dir)) : DEFAULT_NAV_HEADER;
const headerItems = filterHeaderItems(navData, header);
const navHeader = all ? _.startCase(path.basename(dir)) : DEFAULT_NAV_HEADER;
const navHeaderItems = filterHeaderItems(navData, navHeader);
// if we found items with this header already, we are going
// to replace them all wholesale
if (headerItems.length) {
if (navHeaderItems.length) {
log.debug('Found %d item(s) in header %s', navHeaderItems.length, navHeader);
// we append indices or names to this keypath
const rootHeaderKeypath = getRootHeaderKeypath(headerItems, header);
const rootHeaderKeypath = getRootHeaderKeypath(navHeaderItems, navHeader);
for (const [offset, fileOrUrl] of newRefFilepaths.entries()) {
const data = headerItems.find((item) => item.fileOrUrl === fileOrUrl);
const keypath = getKeypathForHeaderItem(rootHeaderKeypath, offset, data);
newHeaderItems.push({keypath, fileOrUrl});
for (const fileOrUrl of referenceOutputFilepaths) {
let offset = navHeaderItems.findIndex((item) => item.fileOrUrl === fileOrUrl);
const newOffset = offset >= 0 ? offset : navHeaderItems.length;
const data = navHeaderItems[offset];
log.warn(rootHeaderKeypath, newOffset, data);
const keypath = getKeypathForHeaderItem(rootHeaderKeypath, newOffset, data);
newNavHeaderItems.push({keypath, fileOrUrl});
}
// look for any differences between what we have and what's in the file
if (navDataDidChange(newHeaderItems, headerItems)) {
log.debug('Will write new nav data for header %s', header);
if (navDataDidChange(newNavHeaderItems, navHeaderItems)) {
log.debug('Will write new nav data for header %s: %O', navHeader, newNavHeaderItems);
dataChanged = true;
} else {
log.debug('No changes for header %s', header);
log.debug('No changes for header %s', navHeader);
}
} else {
log.debug('No items found in header %s', navHeader);
let navOffset = nav.length;
for (const [idx, newRefFilepath] of newRefFilepaths.entries()) {
newHeaderItems.push({
keypath: `${navOffset}.${header}.${idx}`,
for (const [idx, newRefFilepath] of referenceOutputFilepaths.entries()) {
newNavHeaderItems.push({
keypath: `${navOffset}.${navHeader}.${idx}`,
fileOrUrl: newRefFilepath,
});
}
log.debug('Will create nav data for header %s', header);
log.debug('Will create nav data for header %s', navHeader);
dataChanged = true;
}
return {data: newHeaderItems, changed: dataChanged};
return {data: newNavHeaderItems, changed: dataChanged};
}
/**
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@appium/docutils",
"version": "0.2.0",
"version": "0.2.1",
"description": "Documentation generation utilities for Appium and related projects",
"keywords": [
"automation",