mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Merge branch 'alert-context-fix' into 'dev'
Flat structure of published package See merge request turris/reforis/foris-js!30
This commit is contained in:
		@@ -6,25 +6,26 @@ stages:
 | 
				
			|||||||
  - publish
 | 
					  - publish
 | 
				
			||||||
 | 
					
 | 
				
			||||||
before_script:
 | 
					before_script:
 | 
				
			||||||
 | 
					  - apk add make
 | 
				
			||||||
  - npm install
 | 
					  - npm install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test:
 | 
					test:
 | 
				
			||||||
  stage: test
 | 
					  stage: test
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npm test
 | 
					    - make test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lint:
 | 
					lint:
 | 
				
			||||||
  stage: test
 | 
					  stage: test
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npm run lint
 | 
					    - make lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
build:
 | 
					build:
 | 
				
			||||||
  stage: build
 | 
					  stage: build
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npm pack
 | 
					    - make pack
 | 
				
			||||||
  artifacts:
 | 
					  artifacts:
 | 
				
			||||||
    paths:
 | 
					    paths:
 | 
				
			||||||
      - foris-*.tgz
 | 
					      - dist/foris-*.tgz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
publish_beta:
 | 
					publish_beta:
 | 
				
			||||||
  stage: publish
 | 
					  stage: publish
 | 
				
			||||||
@@ -32,7 +33,7 @@ publish_beta:
 | 
				
			|||||||
    refs:
 | 
					    refs:
 | 
				
			||||||
      - dev
 | 
					      - dev
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - sh scripts/publish.sh beta
 | 
					    - make publish-beta
 | 
				
			||||||
 | 
					
 | 
				
			||||||
publish_latest:
 | 
					publish_latest:
 | 
				
			||||||
  stage: publish
 | 
					  stage: publish
 | 
				
			||||||
@@ -40,4 +41,4 @@ publish_latest:
 | 
				
			|||||||
    refs:
 | 
					    refs:
 | 
				
			||||||
      - master
 | 
					      - master
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - sh scripts/publish.sh latest
 | 
					    - make publish-latest
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
.PHONY: all install-js watch-js build-js lint-js test-js create-messages update-messages docs clean
 | 
					.PHONY: all install-js watch-js build-js collect-files pack publish-beta publish-latest lint test test-js-update-snapshots create-messages update-messages docs docs-watch clean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all:
 | 
					all:
 | 
				
			||||||
	@echo "make install-js"
 | 
						@echo "make install-js"
 | 
				
			||||||
@@ -30,6 +30,15 @@ watch-js:
 | 
				
			|||||||
build-js:
 | 
					build-js:
 | 
				
			||||||
	npm run build
 | 
						npm run build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					collect-files:
 | 
				
			||||||
 | 
						sh scripts/collect_files.sh
 | 
				
			||||||
 | 
					pack: collect-files
 | 
				
			||||||
 | 
						cd dist && npm pack
 | 
				
			||||||
 | 
					publish-beta: collect-files
 | 
				
			||||||
 | 
						sh scripts/publish.sh beta
 | 
				
			||||||
 | 
					publish-latest: collect-files
 | 
				
			||||||
 | 
						sh scripts/publish.sh latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lint:
 | 
					lint:
 | 
				
			||||||
	npm run lint
 | 
						npm run lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,10 +16,10 @@ module.exports = {
 | 
				
			|||||||
    ],
 | 
					    ],
 | 
				
			||||||
    env: {
 | 
					    env: {
 | 
				
			||||||
        development: {
 | 
					        development: {
 | 
				
			||||||
            ignore: ["**/__tests__", "./scripts"],
 | 
					            ignore: ["**/__tests__/**", "**/__mocks__/**"],
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        test: {
 | 
					        test: {
 | 
				
			||||||
            ignore: ["./scripts"],
 | 
					            ignore: [],
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@
 | 
				
			|||||||
    "reforis"
 | 
					    "reforis"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "license": "GPL-3.0",
 | 
					  "license": "GPL-3.0",
 | 
				
			||||||
  "main": "./dist/index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "axios": "^0.19.0",
 | 
					    "axios": "^0.19.0",
 | 
				
			||||||
    "immutability-helper": "^3.0.0",
 | 
					    "immutability-helper": "^3.0.0",
 | 
				
			||||||
@@ -68,16 +68,11 @@
 | 
				
			|||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "build": "rm -rf dist; babel src --out-dir dist --source-maps inline --copy-files",
 | 
					    "build": "rm -rf dist; babel src --out-dir dist --source-maps inline --copy-files",
 | 
				
			||||||
    "build:watch": "babel src --verbose --watch --out-dir dist --source-maps inline --copy-files",
 | 
					    "build:watch": "babel src --verbose --watch --out-dir dist --source-maps inline --copy-files",
 | 
				
			||||||
    "prepare": "rm -rf ./dist && npm run build",
 | 
					 | 
				
			||||||
    "lint": "eslint src",
 | 
					    "lint": "eslint src",
 | 
				
			||||||
    "test": "jest",
 | 
					    "test": "jest",
 | 
				
			||||||
    "test:watch": "jest --watch",
 | 
					    "test:watch": "jest --watch",
 | 
				
			||||||
    "test:coverage": "jest --coverage --colors",
 | 
					    "test:coverage": "jest --coverage --colors",
 | 
				
			||||||
    "docs": "npx styleguidist build ",
 | 
					    "docs": "npx styleguidist build ",
 | 
				
			||||||
    "docs:watch": "styleguidist server"
 | 
					    "docs:watch": "styleguidist server"
 | 
				
			||||||
  },
 | 
					  }
 | 
				
			||||||
  "files": [
 | 
					 | 
				
			||||||
    "dist/**",
 | 
					 | 
				
			||||||
    "translations"
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								scripts/collect_files.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								scripts/collect_files.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Collect files
 | 
				
			||||||
 | 
					npm run build
 | 
				
			||||||
 | 
					cp package.json dist
 | 
				
			||||||
 | 
					cp -rf translations dist
 | 
				
			||||||
 | 
					# Remove unwanted files
 | 
				
			||||||
 | 
					rm -rf dist/**/__tests__
 | 
				
			||||||
 | 
					rm -rf dist/__mocks__
 | 
				
			||||||
@@ -12,10 +12,10 @@ else
 | 
				
			|||||||
    then
 | 
					    then
 | 
				
			||||||
        BETA_VERSION=$(npx -c 'echo "$npm_package_version"')-beta.$CI_COMMIT_SHORT_SHA
 | 
					        BETA_VERSION=$(npx -c 'echo "$npm_package_version"')-beta.$CI_COMMIT_SHORT_SHA
 | 
				
			||||||
        npm version "$BETA_VERSION" --git-tag-version false
 | 
					        npm version "$BETA_VERSION" --git-tag-version false
 | 
				
			||||||
        npm publish --tag beta
 | 
					        cd dist && npm publish --tag beta
 | 
				
			||||||
    elif test "$1" = "latest"
 | 
					    elif test "$1" = "latest"
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
        npm publish
 | 
					        cd dist && npm publish
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        echo "Usage: publish.sh [ beta | latest ]"
 | 
					        echo "Usage: publish.sh [ beta | latest ]"
 | 
				
			||||||
        exit 1
 | 
					        exit 1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,7 +67,3 @@ export {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Alert context
 | 
					// Alert context
 | 
				
			||||||
export { AlertContext, AlertContextProvider, useAlert } from "alertContext/AlertContext";
 | 
					export { AlertContext, AlertContextProvider, useAlert } from "alertContext/AlertContext";
 | 
				
			||||||
 | 
					 | 
				
			||||||
// Testing utilities
 | 
					 | 
				
			||||||
export { mockJSONError } from "testUtils/network";
 | 
					 | 
				
			||||||
export { mockSetAlert, mockDismissAlert } from "testUtils/alertContextMock";
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import { StaticRouter } from "react-router";
 | 
				
			|||||||
import { render } from "@testing-library/react";
 | 
					import { render } from "@testing-library/react";
 | 
				
			||||||
import PropTypes from "prop-types";
 | 
					import PropTypes from "prop-types";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { AlertContextMock } from "alertContextMock";
 | 
					import { AlertContextMock } from "./alertContextMock";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Wrapper.propTypes = {
 | 
					Wrapper.propTypes = {
 | 
				
			||||||
    children: PropTypes.oneOfType([
 | 
					    children: PropTypes.oneOfType([
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user