Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #11 from healthgovau/395-support-subtheme-app-inte…
Browse files Browse the repository at this point in the history
…gration

395 support subtheme app integration
  • Loading branch information
Benjen authored Mar 25, 2021
2 parents e955766 + 82cffb4 commit 604f630
Show file tree
Hide file tree
Showing 12 changed files with 489 additions and 75 deletions.
3 changes: 2 additions & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ then
if [ $drupalfailed != 0 ]
then
echo "PHPCS failed, errors found not fixable automatically, git commit denied!"
exit 1
fi
fi

#### End of Code Sniffer

exit $commitfailed
exit 0
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
runs-on: ubuntu-latest
env:
THEME_PATH: 'themes/health'
HEALTH_CI_MODE: 1
steps:
-
name: Checkout codebase
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ This documentation assumes you are using MacOS or Linux as your host environment
- [Docker](https://docs.docker.com/install/)
- [Pygmy](https://pygmy.readthedocs.io/en/master/)
- [Ahoy](https://github.com/ahoy-cli/ahoy)
- [Yarn](https://yarnpkg.com/) (required if installing apps or tools built using Yarn)

## Create new project based on ASK

Expand Down Expand Up @@ -193,12 +194,14 @@ Add the app using Composer using the package name.
composer require healthgovau/out-of-pocket
```

During the installation process you will be asked the following:
During the installation process you will be asked one or more of the following questions:

| Question | Description |
| --- | --- |
| Is this a production build? | Respond `n` to enable app console logging or if you want to use local dev version of the app (e.g. you want to run the app dev environment using `npm run start`). |
| Remove static CSS links from project? | Will be asked when importing a React app. It is designed to support legacy apps which use the CSS stylesheets provided by the host site. Responding `y` will result in links to CSS files in `build/static/css` directory being removed from the app. This process effectively removes all CSS files compiled directly by the React app. The use of apps which are fully decoupled from the host site are strongly encouraged. In such case on would not remove static CSS links. Please consult with the app developer or app project manager if you are unclear whether or not these static CSS files should be included or not. |
| In which theme should the app or tool be installed? | Enter the number corresponding to the theme in which the app or tool should be installed. |
| Is this a production build? | Respond `n` to enable app console logging or if you want to use local dev version of the app (e.g. you want to run the app dev environment using `npm run start`). Default value is __yes__. |
| Remove static CSS links from project? | Will be asked when importing a React app. The default value is __no__. It is designed to support legacy apps which use the CSS stylesheets provided by the host site. Responding `y` will result in links to CSS files in `build/static/css` directory being removed from the app. This process effectively removes all CSS files compiled directly by the React app. The use of apps which are fully decoupled from the host site are strongly encouraged. In such case on would not remove static CSS links. Please consult with the app developer or app project manager if you are unclear whether or not these static CSS files should be included or not. |
| Which package manager would you like to use? | Enter the number of the package manager to use when building the app or tool project. The installer will attempt to detect whether npm or yarn is being used as the package manager. In the case that it detects configuration from both package managers it will ask you to confirm which one should be used. |

#### Update an app

Expand Down Expand Up @@ -473,7 +476,7 @@ To use:

The project makes use of [Cypress](https://www.cypress.io/) and [Percy](https://percy.io/) to implemented visual regression tests in Github workflow pipelines.

When creating or updating pull requests on `develop` or `master` branches snapshots of sample content type pages will be created and analysed by Percy. In case of a failure the results can be reviewed in Percy. Once approved in Percy one will be able to merge the pull request.
When creating or updating pull requests on the `v1.x` branch snapshots of sample content type pages will be created and analysed by Percy. In case of a failure the results can be reviewed in Percy. Once approved in Percy one will be able to merge the pull request.

Cypress test configuration can be found in the `cypress/integration/` directory.

Expand Down
3 changes: 3 additions & 0 deletions apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Temp directory

This directory is used for temporary file storage as part of the app integration process. Files in this dictory should not be commited to the project repository.
1 change: 1 addition & 0 deletions apps/apps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"app":"sample-react-app","theme":"health"}]
22 changes: 18 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
"type": "package",
"package": {
"name": "healthgovau/out-of-pocket",
"version": "1.2.1",
"type": "health-app-react",
"source": {
"type": "git",
"url": "[email protected]:healthgovau/out-of-pocket.git",
"reference": "v1.2.1"
}
}
},
{
"type": "package",
Expand All @@ -44,6 +53,10 @@
"reference": "1.0.1"
}
}
},
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"minimum-stability": "stable",
Expand All @@ -60,12 +73,13 @@
},
"scripts": {
"post-install-cmd": [
"cat .githooks/pre-commit >> .git/hooks/pre-commit && chmod a+x .git/hooks/pre-commit"
"cat .githooks/pre-commit > .git/hooks/pre-commit && chmod a+x .git/hooks/pre-commit"
],
"post-package-install": [
"Health\\Helper::postPackageInstall",
"Health\\App::postPackageInstall"
],
"post-package-uninstall": "Health\\App::postPackageUninstall",
"code-check": "./vendor/bin/phpcs",
"code-fix": "./vendor/bin/phpcbf"
},
Expand All @@ -81,7 +95,7 @@
"type:health-theme",
"type:drupal-theme"
],
"themes/health/apps/{$name}/": [
"apps/{$name}/": [
"type:health-app-default",
"type:health-app-react",
"type:health-app-angular"
Expand Down
12 changes: 3 additions & 9 deletions cypress/integration/modules/app_or_tool_hosted.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@
it("renders correctly", () => {
// Take a snapshot for visual diffing.
const percyOptions = {};
cy.visit(landingPageUri);
cy.get('.ButtonPanel_component-button-panel__3doTu button').contains('7').click();
cy.get('.ButtonPanel_component-button-panel__3doTu button').contains('x').click();
cy.get('.ButtonPanel_component-button-panel__3doTu button').contains('9').click();
cy.get('.ButtonPanel_component-button-panel__3doTu button').contains('=').click();
cy.get('.Display_component-display__T1qck div').should('contain', 63)
.then(() => {
cy.percySnapshot("health_starter_kit_sample_app_or_tool_content_page_hosted", percyOptions);
});
cy
.visit(landingPageUri)
.percySnapshot("health_starter_kit_sample_app_or_tool_content_page_hosted", percyOptions);
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<description>PHP CodeSniffer configuration for Drupal coding standards.</description>
<file>./dev_modules/custom</file>
<file>./themes/health</file>
<exclude-pattern>./themes/*/app/*</exclude-pattern>
<exclude-pattern>./themes/*/apps/*</exclude-pattern>
<exclude-pattern>./scripts/*</exclude-pattern>
<arg name="extensions" value="php,module,inc,install,test,profile,theme,yml" />
<config name="drupal_core_version" value="8" />
Expand Down
Loading

0 comments on commit 604f630

Please sign in to comment.