Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): v0.2.0-alpha #129

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 2 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
module.exports = {
root: true,
parser: "@babel/eslint-parser",
parserOptions: {
sourceType: "module",
requireConfigFile: false,
babelOptions: {
plugins: [
"@babel/plugin-transform-react-jsx",
"@babel/plugin-proposal-class-properties",
],
},
},
parser: "@typescript-eslint/parser",
env: {
browser: true,
},
Expand Down Expand Up @@ -79,15 +69,7 @@ module.exports = {
"generator-star-spacing": 0,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/react-in-jsx-scope": 0,
},
extends: [
"standard",
"plugin:jsx-a11y/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"next",
"prettier",
],
extends: ["standard", "plugin:prettier/recommended", "next", "prettier"],
plugins: ["jsx-a11y", "react"],
};
2 changes: 1 addition & 1 deletion .github/workflows/gae-master-with-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'reopened'
- 'closed'
branches:
- 'main'
- 'master'

jobs:
build-push-deploy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gae-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 'Deploy to Int'
on:
push:
branches:
- 'main'
- 'master'

jobs:
build-push-deploy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gae-release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

# gcloud CLI setup
- name: Login to GCP
uses: google-github-actions/setup-gcloud@v2
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.PIPELINE_EPO_PROD_PROJECT }}
project_id: edc-prod-eef0
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# misc
.DS_Store
*.pem
*.code-workspace

# debug
npm-debug.log*
Expand All @@ -33,8 +34,7 @@ yarn-error.log*
# vercel
.vercel

# Ignore generated token scss file
_tokens.scss

# Environment config
.env

certificates
40 changes: 40 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/
/public/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

# ide
.vscode

# storybook
/storybook-static/*
Empty file added .prettierrc.json
Empty file.
44 changes: 8 additions & 36 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
const projectName = "rubin";

module.exports = {
plugins: ["stylelint-scss"],
extends: ["stylelint-config-standard-scss", "stylelint-config-recess-order"],
ignoreFiles: ["theme/styles/base/_resets.scss"],
defaultSeverity: "error",
rules: {
"declaration-empty-line-before": "never",
"at-rule-empty-line-before": [
"always",
{
except: ["first-nested", "after-same-name", "blockless-after-same-name-blockless"],
ignore: ["after-comment"],
ignoreAtRules: ["mixin", "include", "use", "else"]
},
],
"string-quotes": "single",
"function-calc-no-unspaced-operator": true,
"shorthand-property-no-redundant-values": true,
"declaration-block-no-redundant-longhand-properties": true,
// SCSS compiler shouldn't allow this
// 'block-no-empty': true,
// "comment-no-empty": false,
"comment-no-empty": true,
"max-nesting-depth": 3,
// SCSS compiler shouldn't allow this
// 'no-extra-semicolons': true,
Expand All @@ -32,48 +19,32 @@ module.exports = {
"declaration-no-important": true,
"declaration-block-single-line-max-declarations": 1,
"selector-class-pattern": "[a-z][a-z0-9-]*",
"selector-id-pattern": "[A-z_][A-z0-9-_]*",
"custom-property-pattern": "[A-z][A-z0-9-]*",
// No id's allowed!! Unless accounted for
"selector-max-id": 0,
"selector-no-vendor-prefix": true,
"function-name-case": "lower",
"number-leading-zero": "always",
"number-no-trailing-zeros": true,
"unit-case": "lower",
// sometimes we need a unit for Sass
"length-zero-no-unit": null,
// Doesn't play nicely with Sass `rgb()` function
"color-function-notation": null,
"value-keyword-case": [
"lower",
{
ignoreKeywords: [],
},
],
"value-list-comma-space-after": "always-single-line",
"property-case": "lower",
"declaration-bang-space-before": "always",
"declaration-block-semicolon-newline-after": "always",
"declaration-block-trailing-semicolon": "always",
"block-closing-brace-newline-before": "always",
"block-opening-brace-newline-after": "always",
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-quotes": "always",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-colon-notation": "double",
"selector-type-case": "lower",
"selector-list-comma-space-after": "always-single-line",
"selector-list-comma-space-before": "never",
"rule-empty-line-before": [
"always",
{
except: ["first-nested"],
ignore: ["after-comment"],
},
],
"media-feature-name-case": "lower",
indentation: 2,
"max-empty-lines": 3,
"no-eol-whitespace": true,
// SCSS rules
"scss/at-else-closing-brace-newline-after": "always-last-in-chain",
"scss/at-function-pattern": "([a-z]+[0-9]*)([a-z0-9-]+)?",
Expand All @@ -87,5 +58,6 @@ module.exports = {
// Arbitrary media values can be used, but explicitly
"scss/media-feature-value-dollar-variable": "always",
"scss/selector-no-redundant-nesting-selector": true,
"order/properties-order": null,
},
};
34 changes: 11 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,33 @@
# This file is based on the official Next.js Docker example. https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile

# Install dependencies only when needed
FROM node:20-alpine as deps

RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:20-alpine AS builder
WORKDIR /app
COPY . /app
COPY --from=deps /app/node_modules ./node_modules

ARG NEXT_PUBLIC_API_URL=https://skyviewer-api-e3g4rcii3q-uc.a.run.app/api
ARG NEXT_PUBLIC_ASSETS_BASE_URL=https://skyviewer-api-e3g4rcii3q-uc.a.run.app/assets
ARG NEXT_PUBLIC_ASTRO_API_URL=https://us-central1-skyviewer.cloudfunctions.net/astro-objects-api
RUN apk add --no-cache libc6-compat git fontconfig
RUN yarn install --frozen-lockfile

ARG NEXT_PUBLIC_API_URL
ARG NEXT_PUBLIC_ASSETS_BASE_URL
ARG NEXT_PUBLIC_BASE_URL
ARG NEXT_PUBLIC_ASTRO_API_URL
ARG CRAFT_SECRET_TOKEN

RUN yarn tokens && yarn cloud-start:build
RUN npx browserslist@latest --update-db && yarn static:build

# Production image, copy all the files and run next
FROM node:20-alpine AS runner
WORKDIR /app

RUN apk add --no-cache fontconfig
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# COPY --from=builder /app/next.config.js ./
# COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/ ./
# COPY --from=builder /app/node_modules ./node_modules
# COPY --from=builder /app/package.json ./package.json

USER nextjs

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1

EXPOSE 8080

CMD ["yarn", "cloud-start:start"]
CMD ["yarn", "start"]
3 changes: 3 additions & 0 deletions app/[locale]/_styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Pages
@forward "tours/styles";
@forward "tours/[tour]/styles";
80 changes: 80 additions & 0 deletions app/[locale]/embed/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { FunctionComponent } from "react";
import { graphql } from "@/gql";
import { RootParams } from "../../layout";
import AladinTemplate from "@/components/templates/Aladin";
import EmbeddedExplorer from "@/components/organisms/Embedded";
import getSurveyImage from "@/lib/api/survey";
import { queryAPI } from "@/lib/api/urql";
import { siteFromLocale } from "@/lib/i18n/site";
import { notFound } from "next/navigation";
import CopyText from "@/components/organisms/CopyLink";
import { headers } from "next/headers";

type EmbedParams = {
slug: string;
};

export interface EmbeddedProps {
params: RootParams & EmbedParams;
searchParams?: Record<string, string | Array<string> | undefined>;
}

const Query = graphql(`
query EmbeddedPageQuery($site: [String], $slug: [String]) {
embeddedViewsEntries(slug: $slug, site: $site) {
... on embeddedViews_default_Entry {
title
fov
fovMax
fovMin
target
...EmbeddedExplorer
}
}
}
`);

const EmbeddedPage: FunctionComponent<EmbeddedProps> = async ({
params: { locale, slug },
}) => {
const site = siteFromLocale(locale);
const survey = await getSurveyImage();
const { data } = await queryAPI({
query: Query,
variables: {
site: [site],
slug: [slug],
},
});

if (!data || !data.embeddedViewsEntries || !survey) {
notFound();
}

const { embeddedViewsEntries } = data;
const view = embeddedViewsEntries[0];

if (!view) {
notFound();
}

const { fov, fovMin, fovMax, target, title } = view;
const { imgFormat, path } = survey;

const link = `${headers().get("host")}/${locale}/embed/${slug}`;
const textToCopy = `<iframe src="${link}" title=${title}></iframe>`;

return (
<AladinTemplate
fovRange={[fovMin, fovMax]}
hipsConfig={{ id: path, options: { imgFormat } }}
options={{ fov, target: target || undefined }}
embedded
footer={<CopyText {...{ textToCopy }} />}
>
<EmbeddedExplorer data={view} />
</AladinTemplate>
);
};

export default EmbeddedPage;
8 changes: 8 additions & 0 deletions app/[locale]/embed/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import LoadingSpinner from "@/components/primitives/LoadingSpinner";
import { FunctionComponent } from "react";

const EmbedLoading: FunctionComponent = () => {
return <LoadingSpinner />;
};

export default EmbedLoading;
7 changes: 7 additions & 0 deletions app/[locale]/embed/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { FunctionComponent } from "react";

const EmbedNotFound: FunctionComponent = () => {
return <h1>Not found</h1>;
};

export default EmbedNotFound;
Loading
Loading