Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed Feb 5, 2022
0 parents commit 572532d
Show file tree
Hide file tree
Showing 26 changed files with 11,553 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Add enviroment vars for dev mode here:
#
# FOO=1
#
# To expose variable to frontend, prefix them with SNOWPACK_PUBLIC_*
# They are accessible via `import.meta.SNOWPACK_PUBLIC_FOO`.
#
# Example:
#
# SNOWPACK_PUBLIC_FOO=1
35 changes: 35 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
env:
browser: true
es6: true
node: true
jest/globals: true
plugins:
- jest
- svelte3
ignorePatterns:
- node_modules
- public
- build
extends: eslint:recommended
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2020
sourceType: module
overrides:
- files: "*.svelte"
processor: svelte3/svelte3
rules:
indent:
- error
- tab
quotes:
- error
- single
semi:
- error
- never
linebreak-style:
- error
- unix
28 changes: 28 additions & 0 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and deploy
on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Build
run: |
yarn install --frozen-lockfile
yarn build
cd build
touch .nojekyll
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: build
single-commit: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
node_modules

*.sublime-workspace
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn format:check
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
4 changes: 4 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
useTabs: true
semi: false
singleQuote: true
bracketSameLine: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Mandelbrot set
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
...require('@snowpack/app-scripts-svelte/jest.config.js')(),
}

config.testMatch.push('<rootDir>/test/**/*.{spec,test}.{js,jsx,ts,tsx}')

module.exports = config
5 changes: 5 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect'
8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src/*": ["./src/*"]
}
}
}
8 changes: 8 additions & 0 deletions mandelbrot.sublime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders":
[
{
"path": "."
}
]
}
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"public": false,
"scripts": {
"dev": "snowpack dev",
"build": "snowpack build",
"test": "jest",
"prepare": "husky install .husky",
"format": "redrun format:eslint format:prettier",
"format:eslint": "eslint --fix --ext .js --ext .mjs --ext .svelte .",
"format:prettier": "prettier --write --plugin-search-dir=. './**/*.{js,mjs,svelte}'",
"format:check": "redrun format:check:eslint format:check:prettier",
"format:check:eslint": "eslint --ext .js --ext .svelte .",
"format:check:prettier": "prettier --check --plugin-search-dir=. './**/*.{js,mjs,svelte}'"
},
"devDependencies": {
"@snowpack/app-scripts-svelte": "^2.0.1",
"@snowpack/plugin-dotenv": "^2.2.0",
"@snowpack/plugin-postcss": "^1.4.3",
"@snowpack/plugin-run-script": "^2.3.0",
"@snowpack/plugin-svelte": "^3.7.0",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/svelte": "^3.0.3",
"autoprefixer": "^10.4.2",
"cssnano": "^5.0.16",
"eslint": "^8.8.0",
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-svelte3": "^3.4.0",
"husky": "^7.0.4",
"jest": "^26.4.7",
"postcss": "^8.4.5",
"postcss-cli": "^9.1.0",
"prettier": "^2.5.1",
"prettier-plugin-svelte": "^2.6.0",
"redrun": "^9.0.1",
"snowpack": "^3.8.8",
"snowpack-plugin-rollup-bundle": "^0.4.4",
"svelte": "^3.46.3",
"svelte-check": "^2.3.0",
"tailwindcss": "^3.0.18"
}
}
10 changes: 10 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const tailwind = require('tailwindcss')
const autoprefixer = require('autoprefixer')
const cssnano = require('cssnano')

const plugins =
process.env.NODE_ENV === 'production'
? [tailwind, autoprefixer, cssnano]
: [tailwind, autoprefixer]

module.exports = { plugins }
Binary file added public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions public/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* place global styles here */
17 changes: 17 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<title>Mandelbrot</title>
<meta name="description" content="Mandelbrot set with canvas" />

<link rel="icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="global.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="dist/index.js"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
36 changes: 36 additions & 0 deletions snowpack.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/** @type {import("snowpack").SnowpackUserConfig } */
export default {
alias: {
src: './src',
},
mount: {
public: {
url: '/',
static: true,
resolve: false,
},
src: '/dist',
},
plugins: [
'@snowpack/plugin-svelte',
'@snowpack/plugin-postcss',
'@snowpack/plugin-dotenv',
],
routes: [
/* Enable an SPA Fallback in development: */
// { match: 'routes', src: '.*', dest: '/index.html' },
],
optimize: {
// bundle: true,
minify: true,
sourcemap: false,
},
devOptions: {
open: 'none',
},
buildOptions: {
htmlFragments: true,
// baseUrl: '/',
metaUrlPath: 'snowpack',
},
}
5 changes: 5 additions & 0 deletions src/components/App.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
</script>

<canvas></canvas>
17 changes: 17 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'src/tailwind.svelte'
import App from 'src/components/App.svelte'

const app = new App({
target: document.body,
})

export default app

// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
// Learn more: https://www.snowpack.dev/#hot-module-replacement
if (import.meta.hot) {
import.meta.hot.accept()
import.meta.hot.dispose(() => {
app.$destroy()
})
}
5 changes: 5 additions & 0 deletions src/tailwind.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<style global>
@tailwind base;
@tailwind components;
@tailwind utilities;
</style>
8 changes: 8 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
content: ['./src/**/*.svelte', './public/*.html'],
theme: {
extend: {},
},
variants: {},
plugins: [],
}
8 changes: 8 additions & 0 deletions test/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { render } from '@testing-library/svelte'
import App from '../src/components/App'

test('renders learn svelte link', () => {
const { getByText } = render(App)
const linkElement = getByText(/learn svelte/i)
expect(linkElement).toBeInTheDocument()
})
Loading

0 comments on commit 572532d

Please sign in to comment.