Skip to content

Commit

Permalink
feat: create dhis2 cypress utility lib
Browse files Browse the repository at this point in the history
  • Loading branch information
varl committed Feb 10, 2020
0 parents commit c07e3a4
Show file tree
Hide file tree
Showing 31 changed files with 8,232 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
> 0.5%
last 2 versions
Firefox ESR
not ie 11
not dead
16 changes: 16 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 1

update_configs:
- package_manager: 'javascript'
directory: '/'
update_schedule: 'daily'
version_requirement_updates: 'increase_versions'
target_branch: 'master'
automerged_updates:
- match:
dependency_name: '@dhis2/*'
dependency_type: 'all'
update_type: 'semver:minor'
- match:
dependency_type: 'all'
update_type: 'security:patch'
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { config } = require('@dhis2/cli-style')

module.exports = {
extends: [config.eslint],
globals: {
cy: "readonly",
Cypress: "readonly",
}
}
4 changes: 4 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
titleOnly: false
commitsOnly: false
titleAndCommits: true
allowMergeCommits: false
1 change: 1 addition & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_extends: .github
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
14 changes: 14 additions & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { config } = require('@dhis2/cli-style')
const husky = require(config.husky)

const tasks = arr => arr.join(' && ')

module.exports = {
hooks: {
...husky.hooks,
'pre-commit': tasks([
'd2-style js check --staged',
'd2-style text check --staged',
]),
},
}
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { config } = require('@dhis2/cli-style')

module.exports = {
...require(config.prettier),
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cli-

> This package is part of the [@dhis2/cli](https://github.com/dhis2/cli)
> commandline interface.
8 changes: 8 additions & 0 deletions bin/d2-utils-cypress
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env node
const { makeEntryPoint, notifyOfUpdates } = require('@dhis2/cli-helpers-engine')

const pkgJson = require('../package.json')
const command = require('../src')

notifyOfUpdates(pkgJson)
makeEntryPoint(command)
3 changes: 3 additions & 0 deletions cucumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = cucumber
4 changes: 4 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [**Getting Started**](getting-started)
-  
- [API Reference](api)
- [Changelog](CHANGELOG)
46 changes: 46 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Install the tool

First up, add the tool as a development dependency in your project.

```
yarn add --dev @dhis2/cli-utils-cypress
```

From here, it is possible to use Yarn/npx to execute the tool:

```
yarn d2-utils-cypress
npx --no-install d2-utils-cypress
```

We are going to use `d2-utils-cypress` in this document, so prefix the
commands with your preference.

# Setup Cypress for your project

The CLI module provides an `install` command, that will set up some
prerequisites for Cypress, and guide you through generating a
configuration and a local environment configuration file.

```
d2-utils-cypress install
```

There are additional options to do more specific configuration as well,
check out all the options with the `--help` command.

E.g. to set up Cypress without the support scripts:

```
d2-utils-cypress install --no-support
```

And to install without the Cypress configuration, for example on a
developer machine:

```
d2-utils-cypress install \
--no-cypress-config \
--no-support
```
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
command = "yarn build"
publish = "dist"
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@dhis2/cli-utils-cypress",
"description": "DHIS2 Cypress configuration and utilities",
"repository": "[email protected]:dhis2/cli-utils-helper.git",
"bin": {
"d2-utils-cypress": "./bin/d2-utils-cypress"
},
"version": "1.0.0",
"author": "Viktor Varland <[email protected]>",
"license": "BSD-3-Clause",
"private": false,
"scripts": {
"lint": "yarn lint:js && yarn lint:text",
"lint:js": "d2-style js check",
"lint:text": "d2-style text check",
"lint:staged": "yarn lint:js --staged && yarn lint:text --staged",
"format": "yarn format:js && yarn format:text",
"format:js": "d2-style js apply",
"format:text": "d2-style text apply",
"format:staged": "yarn format:js --staged && yarn format:text --staged",
"build": "d2-utils-docsite build ./docs -o ./dist --jsdoc src/ --jsdocOutputFile api.md",
"start": "d2-utils-docsite serve ./docs -o ./dist --jsdoc src/ --jsdocOutputFile api.md"
},
"dependencies": {
"@dhis2/cli-helpers-engine": "^1.5.0",
"cross-spawn": "^7.0.1",
"cypress": "^4.0.1",
"cypress-cucumber-preprocessor": "^2.0.1",
"fs-extra": "^8.1.0",
"inquirer": "^7.0.4"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@dhis2/cli-style": "^6.0.0",
"@dhis2/cli-utils-docsite": "^1.3.0"
}
}
3 changes: 3 additions & 0 deletions plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const plugins = require('./src/cypress/plugins.js')

module.exports = plugins
Loading

0 comments on commit c07e3a4

Please sign in to comment.