Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: missing overview files in docs-content #9100

Merged
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
117 changes: 56 additions & 61 deletions scripts/deploy/publish-docs-content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,82 +14,77 @@ if [ -z ${MATERIAL2_DOCS_CONTENT_TOKEN} ]; then
exit 1
fi

docsPath="./dist/docs"
packagePath="./dist/releases/material-examples"
repoPath="/tmp/material2-docs-content"
repoUrl="https://github.com/angular/material2-docs-content"
examplesSource="./dist/docs/examples"

if [[ ! ${*} == *--no-build* ]]; then
$(npm bin)/gulp material-examples:build-release:clean
$(npm bin)/gulp docs
fi

# Get git meta info for commit
commitSha="$(git rev-parse --short HEAD)"
commitAuthorName="$(git --no-pager show -s --format='%an' HEAD)"
commitAuthorEmail="$(git --no-pager show -s --format='%ae' HEAD)"
commitMessage="$(git log --oneline -n 1)"

# create directory and clone test repo
rm -rf $repoPath
mkdir -p $repoPath
git clone $repoUrl $repoPath --depth 1

# Clean out repo directory and copy contents of dist/docs into it
rm -rf $repoPath/*

# Create folders that will contain docs content files.
mkdir $repoPath/{overview,guides,api,examples,stackblitz,examples-package}

# Copy api files over to $repoPath/api
cp -r $docsPath/api/* $repoPath/api

# Copy the material-examples package to the docs content repository.
cp -r $packagePath/* $repoPath/examples-package

# Flatten the markdown docs structure and move it into $repoPath/overview
overviewFiles=$docsPath/markdown/
for filename in $overviewFiles*
do
if [ -d $filename ]; then
for _ in $filename/*
do
markdownFile=${filename#$overviewFiles}.html
# Filename should be same as folder name with .html extension
if [ -e $filename/$markdownFile ]; then
cp -r $filename/$markdownFile $repoPath/overview/
fi
done
fi
done
# Path to the directory that contains the generated docs output.
docsDistPath="./dist/docs"

# Copy guide files over to $repoPath/guides
for filename in $overviewFiles*
do
if [ -f $filename ]; then
cp -r $filename $repoPath/guides
fi
done
# Path to the release output of the @angular/material-examples package.
examplesPackagePath="./dist/releases/material-examples"

# Path to the cloned docs-content repository.
docsContentPath=./tmp/material2-docs-content

# Git clone URL for the material2-docs-content repository.
docsContentRepoUrl="https://github.com/angular/material2-docs-content"

# Current version of Angular Material from the package.json file
buildVersion=$(node -pe "require('./package.json').version")

# Additional information about the last commit for docs-content commits.
commitSha=$(git rev-parse --short HEAD)
commitAuthorName=$(git --no-pager show -s --format='%an' HEAD)
commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)
commitMessage=$(git log --oneline -n 1)
commitTag="${buildVersion}-${commitSha}"

# Remove the docs-content repository if the directory exists
rm -Rf ${docsContentPath}

# Copy highlighted examples into $repoPath
cp -r $examplesSource/* $repoPath/examples
# Clone the docs-content repository.
git clone ${docsContentRepoUrl} ${docsContentPath} --depth 1

# Copy example stackblitz assets
cp -r $docsPath/stackblitz/* $repoPath/stackblitz
# Remove everything inside of the docs-content repository.
rm -Rf ${docsContentPath}/*

# Create all folders that need to exist in the docs-content repository.
mkdir ${docsContentPath}/{overview,guides,api,examples,stackblitz,examples-package}

# Copy API and example files to the docs-content repository.
cp -R ${docsDistPath}/api/* ${docsContentPath}/api
cp -r ${docsDistPath}/examples/* ${docsContentPath}/examples
cp -r ${docsDistPath}/stackblitz/* ${docsContentPath}/stackblitz

# Copy the @angular/material-examples package to the docs-content repository.
cp -r ${examplesPackagePath}/* ${docsContentPath}/examples-package

# Copy the license file to the docs-content repository.
cp ./LICENSE ${docsContentPath}

# Copy all immediate children of the markdown output the guides/ directory.
for guidePath in $(find ${docsDistPath}/markdown/ -maxdepth 1 -type f); do
cp ${guidePath} ${docsContentPath}/guides
done

# All files that aren't immediate children of the markdown output are overview documents.
for overviewPath in $(find ${docsDistPath}/markdown/ -mindepth 2 -type f); do
cp ${overviewPath} ${docsContentPath}/overview
done

# Copies assets over to the docs-content repository.
cp LICENSE $repoPath/
# Go into the repository directory.
cd ${docsContentPath}

# Push content to repo
cd $repoPath
# Setup the Git configuration
git config user.name "$commitAuthorName"
git config user.email "$commitAuthorEmail"
git config credential.helper "store --file=.git/credentials"

echo "https://${MATERIAL2_DOCS_CONTENT_TOKEN}:@github.com" > .git/credentials

git add -A
git commit --allow-empty -m "$commitMessage"
git tag "$commitSha"
git commit --allow-empty -m "${commitMessage}"
git tag "${commitTag}"
git push origin master --tags
4 changes: 2 additions & 2 deletions src/material-examples/example-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {DialogContentExampleDialog,DialogContentExample} from './dialog-content/
import {DialogDataExampleDialog,DialogDataExample} from './dialog-data/dialog-data-example';
import {DialogElementsExampleDialog,DialogElementsExample} from './dialog-elements/dialog-elements-example';
import {DialogOverviewExampleDialog,DialogOverviewExample} from './dialog-overview/dialog-overview-example';
import {DividerOverviewExample} from './divider-overview/divider-overview-example';
import {ElevationOverviewExample} from './elevation-overview/elevation-overview-example';
import {ExpansionOverviewExample} from './expansion-overview/expansion-overview-example';
import {ExpansionStepsExample} from './expansion-steps/expansion-steps-example';
Expand Down Expand Up @@ -127,7 +128,6 @@ import {ToolbarMultirowExample} from './toolbar-multirow/toolbar-multirow-exampl
import {ToolbarOverviewExample} from './toolbar-overview/toolbar-overview-example';
import {TooltipOverviewExample} from './tooltip-overview/tooltip-overview-example';
import {TooltipPositionExample} from './tooltip-position/tooltip-position-example';
import {DividerOverviewExample} from './divider-overview/divider-overview-example';

export const EXAMPLE_COMPONENTS = {
'autocomplete-display': {
Expand Down Expand Up @@ -323,7 +323,7 @@ export const EXAMPLE_COMPONENTS = {
selectorName: 'DialogOverviewExample, DialogOverviewExampleDialog'
},
'divider-overview': {
title: 'Divider Overview',
title: 'Basic divider',
component: DividerOverviewExample,
additionalFiles: null,
selectorName: null
Expand Down
10 changes: 4 additions & 6 deletions tools/package-tools/build-bundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,10 @@ export class PackageBundler {
uglifyJsFile(config.umdDest, config.umdMinDest);

// Remaps the sourcemaps to be based on top of the original TypeScript source files.
await Promise.all([
remapSourcemap(config.esm2015Dest),
remapSourcemap(config.esm5Dest),
remapSourcemap(config.umdDest),
remapSourcemap(config.umdMinDest),
]);
await remapSourcemap(config.esm2015Dest);
await remapSourcemap(config.esm5Dest);
await remapSourcemap(config.umdDest);
await remapSourcemap(config.umdMinDest);
}

/** Creates a rollup bundle of a specified JavaScript file.*/
Expand Down