1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-25 00:11:36 +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:
Maciej Lenartowicz 2019-11-01 09:28:28 +00:00
commit ca23b2d335
8 changed files with 33 additions and 23 deletions

View File

@ -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

View File

@ -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

View File

@ -16,10 +16,10 @@ module.exports = {
], ],
env: { env: {
development: { development: {
ignore: ["**/__tests__", "./scripts"], ignore: ["**/__tests__/**", "**/__mocks__/**"],
}, },
test: { test: {
ignore: ["./scripts"], ignore: [],
}, },
}, },
}; };

View File

@ -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
View 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__

View File

@ -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

View File

@ -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";

View File

@ -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([