Skip to content

Commit

Permalink
feat: move to component
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Feb 21, 2024
1 parent c28b4d7 commit 8c0ed2d
Show file tree
Hide file tree
Showing 17 changed files with 1,368 additions and 1,062 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/deploy-dev.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/deploy-prod.yml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/deploy-stage.yml

This file was deleted.

30 changes: 9 additions & 21 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: release-please

on:
push:
branches:
- 'main'
- main

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
Expand All @@ -15,29 +14,18 @@ jobs:
release-type: node

- uses: actions/checkout@v4

# put created tag in an env variable to be sent to the dispatch
- name: Set tag
if: ${{ steps.release.outputs.releases_created == 'true' }}
id: set-tag
run: |
REPOSITORY=$(echo '${{ github.repository }}')
TAG=$(echo '${{ steps.release.outputs.tag_name }}')
JSON=$(jq -c --null-input --arg repository "$REPOSITORY" --arg tag "$TAG" '{"repository": $repository, "tag": $tag}')
echo "json=$JSON" >> $GITHUB_OUTPUT
# Trigger an 'on: repository_dispatch' workflow to run in graasp-deploy repository
- name: Push tag to Graasp Deploy (Staging)
if: ${{ steps.release.outputs.releases_created == 'true' }}
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: graasp/graasp-deploy
event-type: update-staging-version
client-payload: ${{steps.set-tag.outputs.json}}
ref: ${{ steps.release.outputs.tag_name }}

- name: Auto Tag
uses: graasp/graasp-deploy/.github/actions/auto-tag-after-release@v1
with:
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs.tag_name }}

- name: Publish to NPM
uses: graasp/graasp-deploy/.github/actions/publish-to-npm@v1
with:
npm-token: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.releases_created == 'true' }}
27 changes: 0 additions & 27 deletions .github/workflows/sentry.yml

This file was deleted.

File renamed without changes.
6 changes: 3 additions & 3 deletions src/App.tsx → example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import 'leaflet-easybutton/src/easy-button.css';
import 'leaflet-geosearch/assets/css/leaflet.css';
import 'leaflet/dist/leaflet.css';

import Map from '../src/components/Map';
import i18n from '../src/config/i18n';
import { QueryClientProvider, queryClient } from '../src/config/queryClient';
import './App.css';
import Map from './components/map/Map';
import i18n from './config/i18n';
import { QueryClientProvider, queryClient } from './config/queryClient';

const App = (): JSX.Element => (
<BrowserRouter>
Expand Down
19 changes: 19 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/graasp.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="A map implementation for Graasp" />
<!-- Load Roboto font from Google fonts -->
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<title>Graasp Map</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="index.tsx"></script>
</body>
</html>
File renamed without changes.
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/graasp.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="A map implementation for Graasp" />
<!-- Load Roboto font from Google fonts -->
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<title>Graasp Map</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script type="module" src="src/main.ts"></script>
</body>
</html>
34 changes: 28 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
{
"name": "graasp-map",
"name": "@graasp/map",
"private": true,
"version": "1.1.0",
"type": "module",
"license": "AGPL-3.0-only",
"repository": "[email protected]:graasp/graasp-map.git",
"author": "Graasp",
"contributors": [
"Kim Lan Phan Hoang"
],
"type": "module",
"sideEffects": false,
"files": [
"dist"
],
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"scripts": {
"dev": "vite",
"dev": "vite ./example",
"build": "tsc && vite build",
"start": "yarn dev",
"start:test": "vite --mode test",
Expand All @@ -18,12 +32,18 @@
"preview": "vite preview",
"preview:dev": "vite preview --mode development",
"preview:test": "vite preview --mode test",
"lint": "eslint .",
"pre-commit": "yarn prettier:check && yarn lint && yarn type-check",
"prettier:check": "prettier --check {src,cypress}/**/*.{js,ts,tsx,json}",
"prettier:write": "prettier --write {src,cypress}/**/*.{js,ts,tsx,json}",
"type-check": "tsc --noEmit",
"check": "yarn prettier:check && yarn lint && yarn type-check"
"check": "yarn prettier:check && yarn lint && yarn type-check",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"test": "yarn build && yarn cypress:ci",
"hooks:uninstall": "husky uninstall",
"hooks:install": "husky install",
"prepack": "yarn build",
"cypress:open": "cypress open",
"cypress:ci": "cypress run --component"
},
"dependencies": {
"@emotion/react": "11.11.3",
Expand Down Expand Up @@ -67,8 +87,10 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"prettier": "3.2.5",
"rollup-plugin-visualizer": "5.12.0",
"typescript": "^5.3.3",
"vite": "^4.5.1"
"vite": "^4.5.1",
"vite-plugin-dts": "3.7.3"
},
"packageManager": "[email protected]"
}
20 changes: 10 additions & 10 deletions src/components/map/Map.tsx → src/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import { DEFAULT_LANG } from '@graasp/translations';

import { LatLng } from 'leaflet';

import { legends } from '../../config/constants';
import i18n from '../../config/i18n';
import { hooks } from '../../config/queryClient';
import { MarkerProps } from '../../types';
import Search from '../search/Search';
import CurrentLocationMarker from './CurrentLocationMarker';
import CurrentMarker from './CurrentMarker';
import GeographicSearch from './GeographicSearch';
import ItemsMarkers from './ItemsMarkers';
import Legends from './Legends';
import { legends } from '../config/constants';
import i18n from '../config/i18n';
import { hooks } from '../config/queryClient';
import { MarkerProps } from '../types';
import CurrentLocationMarker from './map/CurrentLocationMarker';
import CurrentMarker from './map/CurrentMarker';
import GeographicSearch from './map/GeographicSearch';
import ItemsMarkers from './map/ItemsMarkers';
import Legends from './map/Legends';
import Search from './search/Search';

// const Component = () => {
// const map = useMap();
Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as Map } from './components/Map';

export * from './types';
Loading

0 comments on commit 8c0ed2d

Please sign in to comment.