Skip to content

Commit

Permalink
Merge pull request #239 from zowe/fix-typedoc-build
Browse files Browse the repository at this point in the history
Fix typedoc build for Node.js SDK in 2.13.0
  • Loading branch information
t1m0thyj authored Dec 8, 2023
2 parents baa04dd + 7bddd66 commit c1d5c04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/zowe-cli-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ jobs:
npm pack @zowe/zosmf-for-zowe-sdk@${{ steps.versions.outputs.packages_zosmf-for-zowe-sdk }}
bash ../scripts/repackage_bundle.sh *.tgz
mv zowe-cli-package.zip ../zowe-nodejs-sdk-${{ env.BUNDLE_VERSION }}.zip
bash ../scripts/generate_typedoc.sh ${{ env.BUNDLE_VERSION_SHORT }} \
${{ steps.versions.outputs.packages_imperative }} ${{ steps.versions.outputs.packages_cli }}
bash ../scripts/generate_typedoc.sh ${{ env.BUNDLE_VERSION_SHORT }} ${{ steps.versions.outputs.packages_cli }}
mv zowe-node-sdk-typedoc.zip ../zowe-nodejs-sdk-typedoc-${{ env.BUNDLE_VERSION }}.zip
rm -rf *
Expand Down
29 changes: 7 additions & 22 deletions scripts/generate_typedoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,52 +13,37 @@ set -e

# Define Zowe bundle version and Git branches/tags for Imperative/CLI
# $zoweVersion is used in the typedoc page header
# $imperativeBranch is used to build Imperative doc and link to its Git repo
# $cliBranch is used to build Zowe SDK doc and link to their Git repo
if [[ $1 != "next"* ]]; then
zoweVersion=v$1
if [[ $zoweVersion != *"SNAPSHOT" ]]; then
imperativeBranch=v$2
cliBranch=v$3
cliBranch=v$2
else
imperativeBranch=$(echo "$2" | sed 's/zowe-v2-lts/master/')
cliBranch=$(echo "$3" | sed 's/zowe-v2-lts/master/')
cliBranch=$(echo "$2" | sed 's/zowe-v2-lts/master/')
fi
else
zoweVersion=vNext
imperativeBranch=next
cliBranch=next
fi

mkdir -p node-sdk
cd node-sdk

# Clone Imperative and Zowe CLI repos to get the TypeScript source
git clone -b ${imperativeBranch} --depth 1 https://github.com/zowe/imperative.git
# Clone Zowe CLI repo to get the TypeScript source
git clone -b ${cliBranch} --depth 1 https://github.com/zowe/zowe-cli.git

# Install typedoc along with dependencies and plugins
npm init -y
npm install -D --legacy-peer-deps @types/node typescript@^3.8.0 typedoc@^0.19.0 \
@strictsoftware/typedoc-plugin-monorepo typedoc-plugin-sourcefile-url

# Transform relative URLs to absolute URLs in Imperative and CLI readmes
sed -i "s [(]\(CONTRIBUTING\|LICENSE\) (https://github.com/zowe/imperative/blob/$imperativeBranch/\1 " imperative/README.md
# Transform relative URLs to absolute URLs in CLI readme
sed -i "s \./ https://github.com/zowe/zowe-cli/blob/$cliBranch/ " zowe-cli/README.md
echo -e "[\n]" > sourcefile-map.json

# Create directory structure for Imperative and SDK packages
# Also generate config for typedoc sourcefile-url plugin
mkdir -p node_modules/@zowe/imperative
mv imperative/{packages,README.md} node_modules/@zowe/imperative/
cat > sourcefile-map.json << EOF
[
{
"pattern": "^@zowe/imperative",
"replace": "https://github.com/zowe/imperative/blob/$imperativeBranch"
}
]
EOF

mkdir -p node_modules/@zowe
for pkgDir in zowe-cli/packages/*; do
if [[ $pkgDir != *"cli" ]]; then
pkgName=$(node -p "require('jsonfile').readFileSync('$pkgDir/package.json').name")
Expand Down Expand Up @@ -90,4 +75,4 @@ EOF
npx typedoc ./node_modules/@zowe
TZ=UTC find typedoc/ -exec touch -t 197001010000.00 {} +
TZ=UTC touch -t 197001010000.00 typedoc
TZ=UTC zip -roX ../zowe-node-sdk-typedoc.zip typedoc
TZ=UTC zip -roX ../zowe-node-sdk-typedoc.zip typedoc
2 changes: 1 addition & 1 deletion zowe-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ tags:
rc: 1
zowe-v2-lts:
version: 2.13.0
rc: 1
rc: 2
# next:
# version: 2.0.0
# snapshot: '2022-04-15'

0 comments on commit c1d5c04

Please sign in to comment.