1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Merge frontend with backend (#1962)

* fix: use the frontend dir from the backend

* Build is now working

* Fix workflows

* Fix workflows

* Fix build PRs

* Test coverage workflow

* Test coverage

* Test coverage run

* Fix jest report

* refactor: add missing frontend build

* refactor: ignore frontend dir for coverage

* refactor: run frontend build in PRs

* refactor: run backend tests in PRs

* Revert "refactor: run backend tests in PRs"

This reverts commit 22cabddfd1.

* refactor: remove unused frontend build file

* refactor: test workflows in PR

* refactor: use a prepare script for the frontend

* refactor: simplify yarn build scripts

* refactor: fix check-release script

* Revert "refactor: test workflows in PR"

This reverts commit 496ae19404.

* refactor: remove unused gitignore lines

* refactor: remove renovate config from the frontend repo

* refactor: remove frontend repo license

* refactor: remove frontend repo changelog

* refactor: update frontend repo readme

* refactor: add frontend node_modules to dockerignore

* refactor: update the docker yarn.lock snapshot

Co-authored-by: olav <mail@olav.io>
This commit is contained in:
sjaanus 2022-08-26 07:25:31 +00:00 committed by GitHub
parent 5c129cf1fa
commit a1ce89bedc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 451 additions and 1465 deletions

View File

@ -9,3 +9,5 @@
!CHANGELOG.md
!LICENSE
!README.md
!frontend
frontend/node_modules

View File

@ -10,3 +10,4 @@ website/core
website/pages
website
setupJest.js
frontend

View File

@ -6,6 +6,7 @@ on:
- main
paths-ignore:
- website/**
- frontend/**
- coverage/**
jobs:

View File

@ -1,14 +1,16 @@
name: Node.js CI
name: PR -> Frontend Build & Test
on:
push:
branches: [ main ]
pull_request:
paths:
- frontend/**
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
strategy:
matrix:
node-version: [14.x]
@ -18,6 +20,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn --frozen-lockfile
- run: yarn run test
- run: yarn run fmt:check

View File

@ -17,6 +17,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn
- run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn lint
- run: yarn build

View File

@ -28,3 +28,14 @@ jobs:
npm publish --tag ${TAG:-latest}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Publish static assets to S3
run: |
aws s3 cp frontend/build s3://getunleash-static/unleash/${{ steps.get_version.outputs.VERSION }} --recursive

4
.gitignore vendored
View File

@ -23,10 +23,6 @@ coverage/lcov-report
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# webpack output
packages/unleash-frontend/public/bundle.js
packages/unleash-frontend/public/bundle.js.map
# liquibase stuff
/sql
unleash-db.jar

View File

@ -7,7 +7,7 @@ WORKDIR /unleash
COPY . /unleash
RUN yarn install --frozen-lockfile --ignore-scripts && yarn run build && yarn run local:package
RUN yarn install --frozen-lockfile && yarn run local:package
WORKDIR /unleash/docker

View File

@ -17,7 +17,7 @@
"@passport-next/passport-google-oauth2": "^1.0.0",
"basic-auth": "^2.0.1",
"passport": "^0.6.0",
"unleash-server": "file:./../build/"
"unleash-server": "file:../build"
},
"resolutions": {
"async": "^3.2.3",

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
_extends: .github

View File

@ -1,14 +0,0 @@
name: Add new item to project board
on:
issues:
types:
- opened
pull_request_target:
types:
- opened
jobs:
add-to-project:
uses: unleash/.github/.github/workflows/add-item-to-project.yml@main
secrets: inherit

View File

@ -1,40 +0,0 @@
name: 'Release unleash-frontend'
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v3
- name: Publish to npm
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- run: |
yarn install --frozen-lockfile
- run: |
TAG=$(echo $GITHUB_REF_NAME | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
npm publish --tag ${TAG:-latest}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Publish static assets to S3
run: |
aws s3 cp build/ s3://getunleash-static/unleash/${{ steps.get_version.outputs.VERSION }} --recursive

View File

@ -1,27 +0,0 @@
name: 'Release changelog'
on:
push:
tags:
- 'v*'
jobs:
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build changelog
id: github_release
uses: metcalfc/changelog-generator@v3.0.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.github_release.outputs.changelog }}
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}

View File

@ -1,670 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
The latest version of this document is always available in
[releases](https://github.com/Unleash/unleash-frontend/releases).
# 4.2.13
- fix: mobile percentagecircle (#502)
- fix: status chip (#501)
- Feat/new toggle overview (#497)
- chore(deps): update dependency @types/node to v14.17.33
- chore(deps): pin dependencies
- fix: support new event format with diff will be done in th
e UI (#496)
- Merge pull request #495 from Unleash/fix/revive-archived-f
eature
- update snapshots
- fix: disable revive feature when project is deleted
- use useProjects to check if project deleted or not
- fix: add correct path for create first toggle button
- fix: remove typo from UI
- fix: rename isProject
Deleted to projectExists and add PermissionIconButton
# 4.2.2
- fix: toast text
- Fix/strategy sidepanel (#479)
- fix: guard for disabling envs (#4
92)
- fix: handle undefined project wit
h default (#486)
- chore(deps): update dependency cs
s-loader to v6.5.1
- chore(deps): update dependency @types/react-dom to v17.0.11
- chore(deps): update dependency @types/react to v17.0.34
- Merge pull request #483 from Unleash/fix/add-highlight-row
# 4.2.1
- Feat/toggle view (#389)
- feat: created project header (#388)
- feat: e2e tests and mobile views (#348)
- fix: missing-toggle link should include name-param once
- feat: project environments configuration (#365)
- fix: use renovater github config
- fix: renovate should be allowed to automerge all packages
- fix: allow renovate bot to auto-merge
- task: remove display name from environment (#367)
# 4.2.0
- Feat/environment strategies (#339)
- fix: not set env if undefined
- Add renovate.json (#340)
- Add project and environment scoping to API keys (#336)
- Fix/strategy permissions (#337)
- fix: header zIndex
- Feat/environment crud (#335)
# 4.1.1
- fix: header zindex
# 4.1.0
- fix: sync (#334)
- Fix/create feature (#332)
- Fix/texture (#330)
- fix: update constraint text field
- Fix/minor 41 bugs (#329)
- fix: clean up footer a bit
- fix: content-wrapper should not take 100%
- fix: should not show deprecated strategies
- fix: do not filter parent routes for main nav
- fix: add feature toggles and projects to mobile navigation (#328)
- fix: change prepublish to prepare
# 4.1.0-beta.4
- Feat/feature routes
- add enableSingleSignOut for OIDC
- (feat/tests) feat: SSO auto-create users with default role
# 4.1.0-beta.3
- Fix/routing
# 4.1.0-beta.2
- Fix/frontend projects changes
- chore(deps): bump path-parse from 1.0.6 to 1.0.7
- Add switch for deciding whether to send email.
- Fix/make sure stickiness exists
- Load name from url
- chore(deps): bump dns-packet from 1.3.1 to 1.3.4
- chore(deps): bump ws from 6.2.1 to 6.2.2
- chore(deps): bump tar from 6.1.0 to 6.1.5
- fix: variant stickiness should not revert to default when updating
- fix: add logout as an explicit call
- Feat/new navigation
# 4.0.5 fix: run use effect when value changes, not object (#315)
- fix: run use effect when value changes, not object (#315)
- fix: add flex wrap
# 4.0.5-beta.2
- fix/pagination
# 4.0.5-beta.1
- Feat/group by projects
- fix: add missing icons
- Offline mode
# 4.0.4
- fix: update feedback url
# 4.0.3
- fix: add null check for dueDate
# 4.0.2
- chore/update-changelog
- feat/pnps
- fix/customer journey patches (#304)
- fix: add check for obscure error (#305)
- fix: passwordchecker
# 4.0.1
- fix: Project actions need to checkAccess based on projectId
- fix: INLINE_RUNTIME_CHUNK
# 4.0.0
- feat: update color scheme and logo (#301)
- feat: Add admin-invoice section (#299)
- fix: reset border radius on mobile
- fix: standalone pages (#300)
# 4.0.0-beta.5
- chore(deps): bump hosted-git-info from 2.8.8 to 2.8.9 (#291)
- fix: remove unused components
- Fix/customer journey (#297)
- feat: simple project view (#295)
- fix: use router match util (#298)
- fix: typo
- fix: import correct component container (#296)
# 4.0.0-beta.4
- fix: footer
# 4.0.0-beta.3
- fix: include invite link in email (#294)
- fix: add link to manage access to edit project
- fix: hosted auth should not need to load initial data
# 4.0.0-beta.2
- Fix: feedback on create (#292)
- fix: proper error handling for auth-settings being stored (#293)
- fix: api path for auth-config
- fix: improve password auth extra options
# 4.0.0-beta.1
- fix: support custom stickiness for flexible strategies
- fix: add members to project use correct uri
- Fix/console warn (#290)
- Fix/strategy constraints (#289)
- Set .nvmrc to 14 to reflect new requirement of node
# 4.0.0-beta.0
- feat: upgrade to node.js v14
- fix: tiny margin for feature toggle list item
- fix: should be allowed to create toggles without errors
- Fix: jumping screen (#288)
- Fix/minor changes (#285)
- Fix/v4 corrections (#287)
- fix: use correct baseUriPath with localStorage
- fix: link to docs for empty apps
# 4.0.0-alpha.14
- fix: all global event log requires admin
- fix: constraints array can be undefined
# 4.0.0-alpha.13
- feat: bootstrap endpoint for initial data (#281)
- fix: allow permissions to be checked without project being defined (#282)
- fix/strategy constraints (#283)
- fix: logout should only be called once
- fix: handle generic errors better
# 4.0.0-alpha.12
- fix: add datadog logo for addons
# 4.0.0-alpha.11
- Feat/auth hosted section (#280)
- fix: only get legalValues if definition exists
- Fix/variants (#278)
- Fix/bugfixes (#279)
- fix/locale (#277)
- fix: added teams logo
- Fix/cleanup (#276)
- fix: password
# 4.0.0-alpha.10
- fix: password
# 4.0.0-alpha.9
- fix: optimizations
- feat: user profile
# 4.0.0-alpha.8
- chore(deps): bump ssri from 6.0.1 to 6.0.2 (#270)
- fix: lint
- fix: minor tuning on auth
- feat: add new user (#273)
# 4.0.0-alpha.7
- feat: add support for demo sign-in
# 4.0.0-alpha.5
- fix: require ADMIN role to manage users
- fix: add permissions for tag-types and project
# 4.0.0-alpha.4
- fix: overall bugs
- feat: user flow
- fix: small description for toggles
- fix: make admin pages fork for OSS and enterprise
# 4.0.0-alpha.3
- fix: logout redirect logic
- fix: redirect from login page if authorized
- fix: material UI cleanup (#264)
# 4.0.0-alpha.2
- feat: admin users (#266)
- fix: remove editableStrategies from useEffect deps
- fix: Migrate to create-react-app and react-scripts (#263)
# 4.0.0-alpha.1
- fix: delete strategy
# 4.0.0-alpha.0
- feat: Switch to material-ui
# 3.15.0
- feat: Adapt API keys to new endpoint (#259)
- chore(deps): bump elliptic from 6.5.3 to 6.5.4 (#253)
- chore(deps): bump yargs-parser from 5.0.0 to 5.0.1 (#256)
- chore(deps): bump y18n from 3.2.1 to 3.2.2 (#261)
- fix: add ascending sorting (#260)
- chore: changelog
- fix: encode URI value when deleting tag
- Merge pull request #257 from Unleash/fix/encode-tag-values
- fix: encode tag value
# 3.14.1
- fix: uriencode tag.value when deleting a tag
# 3.14.0
- fix: should fetch projects once to make sure we know about projects
- feat/rbac: edit access for projects. (#251)
# 3.13.5
- fix: check that strategies exists before calling includes
# 3.13.4
- fix: metrics invalid date
# 3.13.3
- fix: content-min-height
# 3.13.2
- feat: stale dashboard
# 3.13.1
- fix: fix update-variant-test
- fix: unsecure => insecure
- fix: upgrade uglifyjs-webpack-plugin to version 2.2.0
- fix: one and only one front (#244)
# 3.13.0
- fix: minor visual for dropdowns
- feat: add oss/enterprise version to footer (#245)
# 3.12.0
- feat: allow custom context fields to define stickiness. (#241)
- fix: filter duplicates
# 3.11.4
- fix: should not register duplicate HTML5 backends
# 3.11.3
- fix: use findIndex when using predicate.
# 3.11.2
- fix: Add UI for showing 'create tag' errors
- fix: UX should not eagerly store strategy updates! (#240)
- fix: upgraded jest to version 26.6.3
# 3.11.1
- fix: make sure we also bundle SVG in public
# 3.11.0
- feat: Addon support from UI (#236)
- fix: Use type and value from action to remove tag (#238)
- fix: add missing space (#239)
- fix: error in snapshot
# 3.10.0
- feat: Can now deprecate and reactivate strategies (#235)
# 3.9.1
- fix: Tags viewable on archived features (#233)
# 3.9.0
- feat: Tags for feature toggles (#232)
- feat: Tag-types (#232)
# 3.8.4
- fix: update canisue-lite
- fix: move all api calls to store folders
- fix: move feature-metrics store to its own folder
- fix: move history to folder
- fix: move feature-toggle store into folder
- fix: move error store into folder
- fix: remove unused client-instance concept
- fix: archive store in folder
- fix: remove use of input stores
# 3.8.3
- feat: Add last seen at timestamp
- fix: add last seen as sort option
# 3.8.2
- fix: new feature toggle gets default strategy
# 3.8.1
- fix: minor CSS improvement for strategy configs
- fix: minor strategy configure update
# 3.8.0
- feat: Should update activation strategies immediately (#229)
# 3.7.0
- fix: remove deprecated badges
- fix: filter for projects
- chore(deps-dev): bump node-fetch from 2.6.0 to 2.6.1
- feat: add technical support for projects in UI
# 3.6.5
- fix: should be possible to remove all variants.
# 3.6.4
- fix: minur ux tweaks
# 3.6.3
- fix: hide content if showing authentication modal
- fix: add security wanring to the console
- fix: typo description => descriptionn
# 3.6.2
- fix: show notification when app updates
- fix: add created date for applications
# 3.6.1
- fix: minor css tweaks for mobile
- fix: should support 409 responses as well
# 3.6.0
- feat: add search for applications
- feat: Should be possible to remove applications
- fix: make sure application is updated on edit
- fix: list parameters should be trimmed
- fix: cleanup edit application a bit
- fix: use https url for local->heroku proxy
- fix: upgrade whatwg-fetch to version 3.4.1
# 3.5.1
- fix: add link to all client SDKs
- fix: use Rect.memo to increase performance
# [3.5.0]
- feat: added time-ago to toggle-list
- feat: Add stale marking of feature toggles
- feat: add support for toggle type (#220)
- feat: sort by stale
- fix: improve type-chip color
- fix: some ux cleanup for toggle types
# [3.4.0]
- Feat: (VariantCustomization) Allow user to customize variant weights (#216)
- bump elliptic from 6.5.2 to 6.5.3 (#218)
- chore(deps): bump websocket-extensions from 0.1.3 to 0.1.4 (#217)
- chore(deps-dev): bump lodash from 4.17.15 to 4.17.19 (#214)
- fix: upgrade react-dnd to version 11.1.3
- fix: Update react-dnd to the latest version 🚀 (#213)
- fix: read unleash version from ui-config (#219)
- fix: flag initial context fields
# [3.3.5]
- fix: should handle zero variants
- fix: modal for variants
## [3.3.4]
- fix: allow overflow for strategy card
- fix: add common component input-list-field
## [3.3.3]
- fix: improve on variant ui
- fix: should not clear all stores on update user profile
- fix: convert variant-view-component to function
- fix: tune css a little
## [3.3.2]
- fix: reset stores on login/logout (#212)
- fix: password login should prefer login options
- fix: Transform username/password login response to json (#211)
## [3.3.1]
- feat: add support for username/password login
- feat: locale select should be dropdown menu
- feat: support internal routes
- fix: adjust colors of dialog
## [3.2.21]
- fix: upgrade fetch-mock to version 9.4.0
- fix: upgrade redux to version 4.0.5
- fix: upgrade babel dependencies
- fix: upgrade react-router to version 5.1.2
- fix: upgrade react to version 16.13.1
- fix: rename use of legacy react lifecyle methods
- fix: upgrade react-dnd to version 10.0.2"
## [3.2.20]
- fix: logout should be real request and not just XHR
## [3.2.19]
- fix: default groupId never set for strategies (only in ui)
## [3.2.18]
- fix: clean up history view a bit
## [3.2.17]
- fix: feature search should use debounce
- fix: footer should be on bottom
## [3.2.16]
- fix: minor improvement on context UI
## [3.2.15]
- fix: strategy config not maintainted in create toggle
- fix: missing feature toggle should pre-fill name
## [3.2.14]
- fix: upgrade react-mdl to version 2.1.0
## [3.2.13]
- fix: Should be possible to clone even if strategy does not have groupId
## [3.2.12]
- feat: clone feature toggle configuration (#201)
## [3.2.11]
- fix: clean up variants view
- fix: Cannot remove all variants in Admin UI
- fix: update fetch-mock to version 8.0.0 (#199)
- fix: update mini-css-extract-plugin to version 0.9.0
## [3.2.10]
- fix: missing strategy makes the toggle-configure crash
## [3.2.9]
- fix: Update feature toggle description. (#198)
- fix: Update feature toggle description. (#196)
- feat: Filter on all values in toogle data
- feat: Add option for custom ui links (#195)
- fix: Ensure chips are wrapped (#194)
## [3.2.8]
- fix: auto-fill groupId paramters
- feat: Add support for flexible rollout strategy. (#193)
## [3.2.7]
- fix: upgrade react to 16.10.2
- fix: upgrade eslint to version 6.5.1
- fix: upgrade style-loader to version 1.0.0
- fix: Build with node-10
- chore: update yarn.lock
- fix: babel-preset-env (#190)
- fix: Added plugin to remove dist folder automatically (#191)
- fix: Prevent text highlighting overlap between chips (#188)
- chore: Added official sdk in the footer (#189)
## [3.2.6]
- fix: Add new locales: cz, de
## [3.2.5]
- feat: boolean strategy paramters
## [3.2.4]
- fix: Clean up the UI with empty states
- feat: Support a few more locales
## [3.2.3]
- fix: Cleanup logut flow
- chore: remove unleash.beta.variants flag
## [3.2.2]
- fix: Use toggle/on/off endoints to ensure correct state
- feat: Customisable UI via config
- chore: Update css-loader to version 2.1.1
- chore: Update debug to version 4.1.1
- chore: Update enzyme to latest versions
- chore: Update redux\* to latest versions
## [3.2.1]
- fix: Fixed bug in history view preventing toggle-view.
- feat: Add all official client SDKs to footer
## [3.2.0]
- feat: Initial beta support for variants
- feature: Show tooltips and featuretoggle names in event view
## [3.1.4]
- feat: Add UI support for permission.
## [3.1.3]
- fix(webpack): Strip all comments in css/js bundles.
## [3.1.2]
- chore(package): update webpack to version 4.17.1
- chore(package): move all dependencies to devDependencies as they are not used outside this module.
## [3.1.1]
- fix(strategy-create): Should be able to open the create strategy view.
- chore(package): Upgrade redux to version 4.0.0
## [3.1.0]
- fix(react-router): Upgrade to react-router v4.
- fix(feature-create): Default strategy should be chosen if strategy list is empty.
- fix(feature-update): Do not change route after feature toggle update.
## [3.0.1]
- fix(feature): Create feature form inside a Card to align UI
- feat(archive): Improve archive view, UI, search, toggle details
- fix(navigation): signout more visible
- fix(signout): make signout works with proxy
- chore(package): Upgrade react to version 16.2.0
- chore(package): update sass-loader to version 7.0.1
## [3.0.0]
- Nothing new, just locking down the version.
## [3.0.0-alpha.8]
- feat(timestamps): Make formatting of timestamps configurable.
- fix(package): Update react-mdl to version 1.11.0
- fix(package): update normalize.css to version 8.0.0
## [3.0.0-alpha.7]
- Move metrics poller to seperate class
- Bugfix: CreatedAt set when creating new toggle
- chore(lint): Added propTypes to all components
## [3.0.0-alpha.6]
- Bugfix: actions should always throw errors
- Bugfix: filter regex should never throw.
## [3.0.0-alpha.5]
- Add support for simple builtin authentication provider
- Add support for custom authentication provider (aka Oauth2, etc)
## [3.0.0-alpha.4]
- Added unleash-version details in footer.
- Some house-keeping
## [3.0.0-alpha.2]
- show sdk version as part of instances details.
- Bugfix: multiple strategies with list-inputs should work.
## [3.0.0-alpha.1] - 2017-06-28
- updated paths to use new admin api paths
## [2.2.0] - 2017-01-20
- clean filter/sorting and fabbutton #61
- nicer fallback image for metric progress
- fix switch width issue
## [2.1.0] - 2017-01-20
- Adjust header #51 #52

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2020 Bricks Software AS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,14 +1,14 @@
# unleash-frontend
# frontend
This repo contains the Unleash Admin UI frontend app.
This directory contains the Unleash Admin UI frontend app.
## Run with a local instance of the unleash-api
First, start the unleash-api backend on port 4242.
Then, start the unleash-frontend dev server:
Then, start the frontend dev server:
```
cd ~/unleash-frontend
cd ~/frontend
yarn install
yarn run start
```
@ -18,7 +18,7 @@ yarn run start
Alternatively, instead of running unleash-api on localhost, use a remote instance:
```
cd ~/unleash-frontend
cd ~/frontend
yarn install
yarn run start:heroku
```

View File

@ -1,28 +1,14 @@
{
"name": "unleash-frontend",
"description": "unleash your features",
"version": "4.14.8",
"keywords": [
"unleash",
"feature toggle",
"feature",
"toggle"
],
"name": "unleash-frontend-local",
"version": "0.0.0",
"private": true,
"files": [
"index.js",
"build/"
],
"repository": {
"type": "git",
"url": "ssh://git@github.com:Unleash/unleash-frontend.git"
},
"bugs": {
"url": "https://github.com/Unleash/unleash-frontend"
},
"engines": {
"node": ">=14"
},
"license": "Apache-2.0",
"scripts": {
"build": "tsc && vite build",
"lint": "eslint src --max-warnings 0",
@ -30,13 +16,13 @@
"start:heroku": "UNLEASH_API=https://unleash.herokuapp.com yarn run start",
"start:enterprise": "UNLEASH_API=https://unleash4.herokuapp.com yarn run start",
"start:demo": "UNLEASH_BASE_PATH=/demo/ yarn start",
"test": "vitest",
"prepare": "yarn run build",
"test": "vitest run",
"test:watch": "vitest watch",
"fmt": "prettier src --write --loglevel warn",
"fmt:check": "prettier src --check",
"e2e": "yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
"e2e:heroku": "yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=example@example.com",
"isready": "yarn lint && yarn fmt && yarn prepare"
"prepare": "yarn run build"
},
"devDependencies": {
"@codemirror/lang-json": "6.0.0",

View File

@ -1,10 +0,0 @@
{
"extends": ["config:base"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"matchPackagePatterns": ["*"],
"automerge": true
}
]
}

View File

@ -10,7 +10,8 @@
],
"files": [
"dist",
"docs"
"docs",
"frontend/build"
],
"repository": {
"type": "git",
@ -32,12 +33,12 @@
"copy-templates": "copyfiles -u 1 src/mailtemplates/**/*.mustache dist/",
"db-migrate": "db-migrate --migrations-dir ./src/migrations",
"lint": "eslint ./src",
"local:package": "del-cli --force build && mkdir build && cp -r dist docs CHANGELOG.md LICENSE README.md package.json build",
"local:package": "del-cli --force build && mkdir build && cp -r dist docs CHANGELOG.md LICENSE README.md package.json build && mkdir -p build/frontend && cp -r frontend/build build/frontend",
"prebuild:watch": "yarn run clean",
"build:watch": "tsc -w",
"prebuild": "yarn run clean",
"build": "yarn run copy-templates && tsc --pretty",
"prepare": "node scripts/husky-install && yarn run build",
"prepare": "node scripts/husky-install && cd frontend && yarn && cd .. && yarn run build",
"test": "NODE_ENV=test PORT=4243 jest",
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e/**",
"test:docker": "./scripts/docker-postgres.sh",
@ -48,7 +49,7 @@
"seed:setup": "ts-node src/test/e2e/seed/segment.seed.ts",
"seed:serve": "UNLEASH_DATABASE_NAME=unleash_test UNLEASH_DATABASE_SCHEMA=seed yarn run start:dev",
"clean": "del-cli --force dist",
"preversion": "./scripts/check-release.sh $npm_new_version"
"preversion": "./scripts/check-release.sh"
},
"jest": {
"automock": false,
@ -60,7 +61,8 @@
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"testPathIgnorePatterns": [
"/dist/",
"/node_modules/"
"/node_modules/",
"/frontend/"
],
"moduleFileExtensions": [
"ts",
@ -125,7 +127,6 @@
"ts-toolbelt": "^9.6.0",
"type-is": "^1.6.18",
"unleash-client": "3.15.0",
"unleash-frontend": "4.15.0-beta.1",
"uuid": "^8.3.2"
},
"devDependencies": {

View File

@ -1,29 +0,0 @@
const semver = require('semver');
// @ts-expect-error
const pck = require('../package.json');
const newUnleashVersion = process.argv[2];
const frontendVersion = pck.dependencies['unleash-frontend'];
function isPrerelease(version) {
const arr = semver.prerelease(version);
return arr && arr.length > 0;
}
if (!newUnleashVersion) {
console.error('You must provide the new Unleash version as argument');
process.exit(1);
}
if (!isPrerelease(newUnleashVersion)) {
if (isPrerelease(frontendVersion)) {
console.error(
`A latest version of unleash-server (${newUnleashVersion}) cannot depend on a pre-release of unleash-frontend (${frontendVersion})`,
);
process.exit(1);
}
}
console.log(
` Passed!\x1b[36m unleash-server v${newUnleashVersion}\x1b[0m can depend on\x1b[36m unleash-frontend v${frontendVersion}\x1b[0m`,
);

View File

@ -1,14 +1,11 @@
#!/bin/bash
set -e
echo -e "\n STEP 1. Check unleash-frontend version"
node scripts/check-release.js $1
echo -e "\n STEP 2. Lint"
yarn
yarn run lint
yarn run test
echo -e "\n STEP 3. Build"
yarn run build
echo -e "\n STEP 4. Test"
yarn run test
cd frontend
yarn run lint
yarn run test

View File

@ -1,4 +1,3 @@
import { publicFolder } from 'unleash-frontend';
import express, { Application, RequestHandler } from 'express';
import compression from 'compression';
import favicon from 'serve-favicon';
@ -22,6 +21,7 @@ import noAuthentication from './middleware/no-authentication';
import secureHeaders from './middleware/secure-headers';
import { loadIndexHTML } from './util/load-index-html';
import { findPublicFolder } from './util/findPublicFolder';
export default async function getApp(
config: IUnleashConfig,
@ -32,7 +32,7 @@ export default async function getApp(
const app = express();
const baseUriPath = config.server.baseUriPath || '';
const publicFolder = findPublicFolder();
let indexHTML = await loadIndexHTML(config, publicFolder);
app.set('trust proxy', true);

View File

@ -0,0 +1,5 @@
import path from 'path';
export const findPublicFolder = (): string => {
return path.join(__dirname, '..', '..', '..', 'frontend', 'build');
};

View File

@ -1,9 +1,11 @@
import fs from 'fs';
import path from 'path';
import { rewriteHTML } from './rewriteHTML';
import { publicFolder } from 'unleash-frontend';
import { findPublicFolder } from './findPublicFolder';
const input = fs.readFileSync(path.join(publicFolder, 'index.html')).toString();
const input = fs
.readFileSync(path.join(findPublicFolder(), 'index.html'))
.toString();
test('rewriteHTML substitutes meta tag with existing rewrite value', () => {
const result = rewriteHTML(input, '/hosted');

View File

@ -77,6 +77,7 @@
"snapshots",
"coverage",
"website",
"scripts"
"scripts",
"frontend"
]
}

View File

@ -7243,11 +7243,6 @@ unleash-client@3.15.0:
murmurhash3js "^3.0.1"
semver "^7.3.5"
unleash-frontend@4.15.0-beta.1:
version "4.15.0-beta.1"
resolved "https://registry.yarnpkg.com/unleash-frontend/-/unleash-frontend-4.15.0-beta.1.tgz#c98255af5408c7cce3aa5f3a38fe2c634813a93b"
integrity sha512-6kHYetlytLVibTfi+QAweve7YWFmXdWzl6aDcYg2XMYj2Ago0gMHwTqtkG7JfZonG1vU5dkfk/KwBKTFKLJn/g==
unpipe@1.0.0, unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz"