diff --git a/.babelrc b/.babelrc index 9a79ca61..2fdda153 100644 --- a/.babelrc +++ b/.babelrc @@ -1,8 +1,4 @@ { - "presets": [["env", { "modules": false }]], - "env": { - "test": { - "presets": [["env", { "targets": { "node": "current" } }]] - } - } + "presets": ["@babel/preset-env"], + "plugins": ["@babel/plugin-transform-runtime"] } diff --git a/.dockerignore b/.dockerignore index f18e3290..c5de532f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,8 @@ node_modules .cache .idea +.github dist .git -static -integration -demo.gif \ No newline at end of file +e2e + diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7d4ccc27..3b7598f7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,9 +39,9 @@ jobs: - name: Checkout code uses: actions/checkout@v2.4.0 - name: Build images - run: docker-compose -f integration/docker-compose.test.yml build + run: docker-compose -f e2e/docker-compose.yml build - name: Run tests - run: docker-compose -f integration/docker-compose.test.yml run integration + run: docker-compose -f e2e/docker-compose.yml up --build --force-recreate --exit-code-from cypress buildx: needs: [go-test, npm-test, int-test] name: Release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f3a6c4c..81a331a3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,6 @@ jobs: - name: Checkout code uses: actions/checkout@v2.4.0 - name: Build images - run: docker-compose -f integration/docker-compose.test.yml build + run: docker-compose -f e2e/docker-compose.yml build - name: Run tests - run: docker-compose -f integration/docker-compose.test.yml run integration + run: docker-compose -f e2e/docker-compose.yml up --build --force-recreate --exit-code-from cypress diff --git a/Dockerfile b/Dockerfile index e3eb8cc4..e8cce879 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ COPY pnpm-lock.yaml ./ RUN pnpm fetch --prod # Copy files -COPY package.json .* webpack*.js ./ +COPY package.json .* vite.config.ts index.html ./ # Copy assets to build COPY assets ./assets @@ -32,10 +32,13 @@ COPY go.* ./ RUN go mod download # Copy assets built with node -COPY --from=node /build/static ./static +COPY --from=node /build/dist ./dist # Copy all other files -COPY . . +COPY analytics ./analytics +COPY docker ./docker +COPY web ./web +COPY main.go ./ # Args ARG TAG=dev diff --git a/Makefile b/Makefile index 363769f7..6a9ee2ee 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,24 @@ .PHONY: clean clean: - @rm -rf static + @rm -rf dist @go clean -i -.PHONY: static -static: +.PHONY: dist +dist: @pnpm build -.PHONY: fake_static -fake_static: +.PHONY: fake_assets +fake_assets: @echo 'Skipping asset build' - @mkdir -p static - @echo "assets build was skipped" > static/index.html + @mkdir -p dist + @echo "assets build was skipped" > dist/index.html .PHONY: test -test: fake_static +test: fake_assets go test -cover ./... .PHONY: build -build: static +build: dist CGO_ENABLED=0 go build -ldflags "-s -w" .PHONY: docker @@ -31,4 +31,4 @@ dev: .PHONY: int int: - docker-compose -f integration/docker-compose.test.yml up --build --force-recreate --exit-code-from integration + docker-compose -f e2e/docker-compose.yml up --build --force-recreate --exit-code-from cypress diff --git a/assets/App.spec.js b/assets/App.spec.js deleted file mode 100644 index 7e520055..00000000 --- a/assets/App.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -import EventSource from "eventsourcemock"; -import { shallowMount, RouterLinkStub, createLocalVue } from "@vue/test-utils"; -import Vuex from "vuex"; -import App from "./App"; - -jest.mock("./store/config.js", () => ({ base: "" })); - -jest.mock("~icons/octicon/download-24", () => {}, { virtual: true }); -jest.mock("~icons/octicon/trash-24", () => {}, { virtual: true }); -jest.mock("~icons/mdi-light/chevron-double-down", () => {}, { virtual: true }); -jest.mock("~icons/mdi-light/chevron-left", () => {}, { virtual: true }); -jest.mock("~icons/mdi-light/chevron-right", () => {}, { virtual: true }); -jest.mock("~icons/mdi-light/magnify", () => {}, { virtual: true }); -jest.mock("~icons/cil/columns", () => {}, { virtual: true }); -jest.mock("~icons/octicon/container-24", () => {}, { virtual: true }); -jest.mock("~icons/mdi-light/cog", () => {}, { virtual: true }); - -const localVue = createLocalVue(); - -localVue.use(Vuex); - -describe("", () => { - const stubs = { RouterLink: RouterLinkStub, "router-view": true, "chevron-left-icon": true }; - let store; - - beforeEach(() => { - global.EventSource = EventSource; - const state = { - settings: { menuWidth: 15 }, - containers: [{ id: "abc", name: "Test 1" }], - }; - - const getters = { - visibleContainers(store) { - return store.containers; - }, - activeContainers() { - return []; - }, - }; - - store = new Vuex.Store({ - state, - getters, - }); - }); - - test("has right title", async () => { - const wrapper = shallowMount(App, { stubs, store, localVue }); - wrapper.vm.$store.state.containers = [ - { id: "abc", name: "Test 1" }, - { id: "xyz", name: "Test 2" }, - ]; - await wrapper.vm.$nextTick(); - - expect(wrapper.vm.title).toContain("2 containers"); - }); - - test("renders correctly", async () => { - const wrapper = shallowMount(App, { stubs, store, localVue }); - await wrapper.vm.$nextTick(); - expect(wrapper.element).toMatchSnapshot(); - }); -}); diff --git a/assets/App.vue b/assets/App.vue index 1f950f38..94d7c671 100644 --- a/assets/App.vue +++ b/assets/App.vue @@ -3,7 +3,7 @@ - + @@ -18,7 +18,7 @@ show-title scrollable closable - @close="removeActiveContainer(other)" + @close="store.dispatch('REMOVE_ACTIVE_CONTAINER', other)" > @@ -27,128 +27,96 @@ - + diff --git a/assets/components/ContainerTitle.vue b/assets/components/ContainerTitle.vue index fc341915..c4a50582 100644 --- a/assets/components/ContainerTitle.vue +++ b/assets/components/ContainerTitle.vue @@ -7,13 +7,10 @@ - diff --git a/assets/components/FuzzySearchModal.vue b/assets/components/FuzzySearchModal.vue index a1964137..13090da1 100644 --- a/assets/components/FuzzySearchModal.vue +++ b/assets/components/FuzzySearchModal.vue @@ -1,9 +1,9 @@