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
 | 
			
		||||
 | 
			
		||||
before_script:
 | 
			
		||||
  - apk add make
 | 
			
		||||
  - npm install
 | 
			
		||||
 | 
			
		||||
test:
 | 
			
		||||
  stage: test
 | 
			
		||||
  script:
 | 
			
		||||
    - npm test
 | 
			
		||||
    - make test
 | 
			
		||||
 | 
			
		||||
lint:
 | 
			
		||||
  stage: test
 | 
			
		||||
  script:
 | 
			
		||||
    - npm run lint
 | 
			
		||||
    - make lint
 | 
			
		||||
 | 
			
		||||
build:
 | 
			
		||||
  stage: build
 | 
			
		||||
  script:
 | 
			
		||||
    - npm pack
 | 
			
		||||
    - make pack
 | 
			
		||||
  artifacts:
 | 
			
		||||
    paths:
 | 
			
		||||
      - foris-*.tgz
 | 
			
		||||
      - dist/foris-*.tgz
 | 
			
		||||
 | 
			
		||||
publish_beta:
 | 
			
		||||
  stage: publish
 | 
			
		||||
@@ -32,7 +33,7 @@ publish_beta:
 | 
			
		||||
    refs:
 | 
			
		||||
      - dev
 | 
			
		||||
  script:
 | 
			
		||||
    - sh scripts/publish.sh beta
 | 
			
		||||
    - make publish-beta
 | 
			
		||||
 | 
			
		||||
publish_latest:
 | 
			
		||||
  stage: publish
 | 
			
		||||
@@ -40,4 +41,4 @@ publish_latest:
 | 
			
		||||
    refs:
 | 
			
		||||
      - master
 | 
			
		||||
  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:
 | 
			
		||||
	@echo "make install-js"
 | 
			
		||||
@@ -30,6 +30,15 @@ watch-js:
 | 
			
		||||
build-js:
 | 
			
		||||
	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:
 | 
			
		||||
	npm run lint
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -16,10 +16,10 @@ module.exports = {
 | 
			
		||||
    ],
 | 
			
		||||
    env: {
 | 
			
		||||
        development: {
 | 
			
		||||
            ignore: ["**/__tests__", "./scripts"],
 | 
			
		||||
            ignore: ["**/__tests__/**", "**/__mocks__/**"],
 | 
			
		||||
        },
 | 
			
		||||
        test: {
 | 
			
		||||
            ignore: ["./scripts"],
 | 
			
		||||
            ignore: [],
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
    "reforis"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "GPL-3.0",
 | 
			
		||||
  "main": "./dist/index.js",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "axios": "^0.19.0",
 | 
			
		||||
    "immutability-helper": "^3.0.0",
 | 
			
		||||
@@ -68,16 +68,11 @@
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "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",
 | 
			
		||||
    "prepare": "rm -rf ./dist && npm run build",
 | 
			
		||||
    "lint": "eslint src",
 | 
			
		||||
    "test": "jest",
 | 
			
		||||
    "test:watch": "jest --watch",
 | 
			
		||||
    "test:coverage": "jest --coverage --colors",
 | 
			
		||||
    "docs": "npx styleguidist build ",
 | 
			
		||||
    "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
 | 
			
		||||
        BETA_VERSION=$(npx -c 'echo "$npm_package_version"')-beta.$CI_COMMIT_SHORT_SHA
 | 
			
		||||
        npm version "$BETA_VERSION" --git-tag-version false
 | 
			
		||||
        npm publish --tag beta
 | 
			
		||||
        cd dist && npm publish --tag beta
 | 
			
		||||
    elif test "$1" = "latest"
 | 
			
		||||
    then
 | 
			
		||||
        npm publish
 | 
			
		||||
        cd dist && npm publish
 | 
			
		||||
    else
 | 
			
		||||
        echo "Usage: publish.sh [ beta | latest ]"
 | 
			
		||||
        exit 1
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,3 @@ export {
 | 
			
		||||
 | 
			
		||||
// Alert context
 | 
			
		||||
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 PropTypes from "prop-types";
 | 
			
		||||
 | 
			
		||||
import { AlertContextMock } from "alertContextMock";
 | 
			
		||||
import { AlertContextMock } from "./alertContextMock";
 | 
			
		||||
 | 
			
		||||
Wrapper.propTypes = {
 | 
			
		||||
    children: PropTypes.oneOfType([
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user