1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-07-02 20:30:27 +00: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
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

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

View File

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

View File

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

View File

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

View File

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