@mediatool/frontend-tools 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: '@mediatool/eslint-config-mediatool',
3
+ }
package/lib/cli ADDED
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+
3
+ # arguments
4
+ cmd=${1}
5
+
6
+ # variables
7
+ mocharc_path="@mediatool/frontend-tools/lib/tests/mocha.js"
8
+
9
+ if [ "$cmd" = "test" ]; then
10
+ yarn mocha --config ${mocharc_path} "test/**/*-test.*"
11
+ elif [ "$cmd" = "test.unit" ]; then
12
+ yarn mocha --config ${mocharc_path} "test/unit/**/*-test.*"
13
+ elif [ "$cmd" = "test.unit.components" ]; then
14
+ yarn mocha --config ${mocharc_path} "test/unit/**/*-test.{jsx,tsx}"
15
+ elif [ "$cmd" = "test.unit.functions" ]; then
16
+ yarn mocha --config ${mocharc_path} "test/unit/**/*-test.{js,ts}"
17
+ elif [ "$cmd" = "test.it" ]; then
18
+ yarn mocha --config ${mocharc_path} "test/it/**/*-test.*"
19
+ fi
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ presets: [
3
+ '@babel/preset-env',
4
+ '@babel/preset-react',
5
+ '@babel/preset-typescript',
6
+ ],
7
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ require: [
3
+ '@mediatool/frontend-tools/lib/tests/setup',
4
+ ],
5
+ }
@@ -0,0 +1,9 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ const { default: babel } = require('@babel/register')
3
+ const jsdom = require('global-jsdom')
4
+
5
+ babel({
6
+ configFile: '@mediatool/frontend-tools/lib/tests/babel.config.js',
7
+ extensions: [ '.ts', '.tsx', '.js', '.jsx' ],
8
+ })
9
+ jsdom()
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@mediatool/frontend-tools",
3
+ "version": "0.0.1",
4
+ "description": "Common configs and tooling for bundling, testing, linting frontend modules",
5
+ "main": "index.js",
6
+ "license": "UNLICENSED",
7
+ "scripts": {
8
+ "test": "echo 'Testless'"
9
+ },
10
+ "bin": {
11
+ "frontend-tools": "./lib/cli"
12
+ },
13
+ "devDependencies": {
14
+ "@babel/core": "^7.18.9",
15
+ "@babel/preset-env": "^7.18.9",
16
+ "@babel/preset-react": "^7.18.6",
17
+ "@babel/preset-typescript": "^7.18.6",
18
+ "@babel/register": "^7.18.9",
19
+ "@mediatool/eslint-config-mediatool": "^1.1.5",
20
+ "@testing-library/react": "^13.3.0",
21
+ "@types/chai": "^4.3.1",
22
+ "@types/mocha": "^9.1.1",
23
+ "chai": "^4.3.6",
24
+ "global-jsdom": "^8.5.0",
25
+ "jsdom": "^20.0.0",
26
+ "mocha": "^10.0.0"
27
+ },
28
+ "peerDependencies": {
29
+ "react": "^18.2.0",
30
+ "react-dom": "^18.2.0"
31
+ }
32
+ }
package/readme.md ADDED
@@ -0,0 +1,35 @@
1
+ # @mediatool/frontend-tools
2
+
3
+ *Common configs and tooling for bundling, testing, linting frontend modules*
4
+
5
+ ### Linting
6
+ Required to create an .eslintrc.js file in the target module containing the following;
7
+ ```js
8
+ module.exports = {
9
+ extends: '@mediatool/eslint-config-mediatool',
10
+ }
11
+ ```
12
+
13
+ ### Testing
14
+ `yarn frontend-tools test`
15
+ Runs all tests
16
+
17
+ `yarn frontend-tools test.unit`
18
+ Runs all unit tests
19
+
20
+ `yarn frontend-tools test.unit.components`
21
+ Runs all component unit tests
22
+
23
+ `yarn frontend-tools test.unit.functions`
24
+ Runs all function unit tests
25
+
26
+ `yarn frontend-tools test.it`
27
+ Runs all integration tests
28
+
29
+ Cypress end to end tests are yet to be configured.
30
+
31
+ ### Development server
32
+ Yet to be configured.
33
+
34
+ ### Bundling
35
+ Yet to be configured.