Browse Source

Updated the project design

pull/27/head
Navneet Sharma 11 months ago
parent
commit
8d24139629
  1. 7
      .env.example
  2. 4
      .eslintrc.cjs
  3. 38
      .github/ISSUE_TEMPLATE/bug_report.md
  4. 10
      .github/ISSUE_TEMPLATE/custom.md
  5. 20
      .github/ISSUE_TEMPLATE/feature_request.md
  6. 8
      .gitignore
  7. 3
      .husky/pre-commit
  8. 7
      .lintstagedrc.cjs
  9. 2
      .nvmrc
  10. 5
      .storybook/main.cjs
  11. 1
      .storybook/preview.cjs
  12. 22
      README.md
  13. 1
      index.d.ts
  14. 1
      jest-setup.ts
  15. 14
      jest.config.cjs
  16. 11
      netlify.toml
  17. 247
      package.json
  18. 24
      postcss.config.cjs
  19. 0
      scripts/.gitkeep
  20. 32
      scripts/js/add-css-imports.ts
  21. 2
      scripts/js/environment.setup.ts
  22. 23
      scripts/js/remove-css-imports.ts
  23. 99
      scripts/js/sitemap.ts
  24. 20
      src/app.html
  25. 24
      src/environments/environment.dev.ts
  26. 24
      src/environments/environment.local.ts
  27. 21
      src/environments/environment.prod.ts
  28. 24
      src/environments/environment.qa.ts
  29. 24
      src/environments/environment.ts
  30. 13
      src/global.d.ts
  31. 24
      src/hooks/index.ts
  32. 6
      src/lib/core/services/environment/environment.facade.ts
  33. 2
      src/lib/core/services/environment/index.ts
  34. 2
      src/lib/data/data.ts
  35. 4
      src/lib/models/interfaces/iblog-post-summary.interface.ts
  36. 3
      src/lib/models/interfaces/icompiled-css.interface.ts
  37. 2
      src/lib/models/interfaces/iconfig.interface.ts
  38. 6
      src/lib/models/interfaces/igithub-config.interface.ts
  39. 1
      src/lib/models/interfaces/imeta-tag-properties.interface.ts
  40. 1
      src/lib/models/interfaces/index.ts
  41. 6
      src/lib/models/interfaces/iproject-card.interface.ts
  42. 3
      src/lib/models/interfaces/isession-config.interface.ts
  43. 4
      src/lib/models/interfaces/isnippet.interface.ts
  44. 3
      src/lib/models/interfaces/istatistics.interface.ts
  45. 2
      src/lib/models/interfaces/isveltekit-core-config.interface.ts
  46. 6
      src/lib/models/interfaces/isveltekit-strater-environment.interface.ts
  47. 9
      src/lib/models/interfaces/itweet.interface.ts
  48. 5
      src/lib/models/interfaces/itwitter-config.interface.ts
  49. 4
      src/lib/models/interfaces/itwitter-meta-tag-properties.interface.ts
  50. 2
      src/lib/shared/components/application-titles/ApplicationTitles.svelte
  51. 27
      src/lib/shared/components/blog-post/BlogPost.svelte
  52. 1
      src/lib/shared/components/blog-post/index.ts
  53. 23
      src/lib/shared/components/compiled-styles/CompiledStyles.svelte
  54. 1
      src/lib/shared/components/compiled-styles/index.ts
  55. 39
      src/lib/shared/components/counter/Counter.spec.ts
  56. 41
      src/lib/shared/components/counter/Counter.svelte
  57. 1
      src/lib/shared/components/counter/index.ts
  58. 5
      src/lib/shared/components/index.ts
  59. 45
      src/lib/shared/components/project-card/ProjectCard.svelte
  60. 1
      src/lib/shared/components/project-card/index.ts
  61. 49
      src/lib/shared/components/seo/SEO.svelte
  62. 14
      src/lib/shared/components/title/Title.spec.ts
  63. 14
      src/lib/shared/ui/components/button/Button.spec.ts
  64. 1
      src/lib/shared/ui/components/button/Button.svelte
  65. 14
      src/lib/shared/ui/components/card/Card.spec.ts
  66. 2
      src/lib/shared/ui/components/card/Card.stories.svelte
  67. 19
      src/lib/shared/ui/components/error-message/ErrorMessage.stories.svelte
  68. 9
      src/lib/shared/ui/components/error-message/ErrorMessage.svelte
  69. 1
      src/lib/shared/ui/components/error-message/index.ts
  70. 18
      src/lib/shared/ui/components/external-link/ExternalLink.stories.svelte
  71. 33
      src/lib/shared/ui/components/external-link/ExternalLink.svelte
  72. 1
      src/lib/shared/ui/components/external-link/index.ts
  73. 14
      src/lib/shared/ui/components/footer/Footer.spec.ts
  74. 53
      src/lib/shared/ui/components/footer/Footer.svelte
  75. 14
      src/lib/shared/ui/components/header/Header.spec.ts
  76. 48
      src/lib/shared/ui/components/header/Header.svelte
  77. 14
      src/lib/shared/ui/components/loading-spinner/LoadingSpinner.stories.svelte
  78. 13
      src/lib/shared/ui/components/loading-spinner/LoadingSpinner.svelte
  79. 1
      src/lib/shared/ui/components/loading-spinner/index.ts
  80. 84
      src/lib/shared/ui/components/navigation-bar/NavigationBar.svelte
  81. 1
      src/lib/shared/ui/components/navigation-bar/index.ts
  82. 99
      src/lib/shared/ui/components/navigation-progress-bar/NavigationProgressBar.svelte
  83. 1
      src/lib/shared/ui/components/navigation-progress-bar/index.ts
  84. 30
      src/lib/shared/ui/components/pros-card/ProsCard.svelte
  85. 1
      src/lib/shared/ui/components/pros-card/index.ts
  86. 18
      src/lib/shared/ui/components/success-message/SuccessMessage.stories.svelte
  87. 9
      src/lib/shared/ui/components/success-message/SuccessMessage.svelte
  88. 1
      src/lib/shared/ui/components/success-message/index.ts
  89. 60
      src/lib/shared/ui/components/summary/Summary.svelte
  90. 1
      src/lib/shared/ui/components/summary/index.ts
  91. 1
      src/lib/shared/ui/index.ts
  92. 2
      src/lib/utils/convert-to-sentence.ts
  93. 5
      src/lib/utils/convert-to-slug.ts
  94. 63
      src/lib/utils/form.ts
  95. 1
      src/lib/utils/logger/logger.ts
  96. 13
      src/lib/utils/session.ts
  97. 1
      src/lib/utils/slug-from-path.ts
  98. 11
      src/routes/__error.svelte
  99. 70
      src/routes/__layout.svelte
  100. 44
      src/routes/about/index.svelte
  101. Some files were not shown because too many files have changed in this diff Show More

7
.env.example

@ -3,4 +3,9 @@ VITE_BASE_URL=http://localhost:3000 @@ -3,4 +3,9 @@ VITE_BASE_URL=http://localhost:3000
VITE_CHUCK_NORRIS_API_URL=https://api.chucknorris.io/jokes
VITE_CHUCK_NORRIS_API_LANG=en-US
VITE_GITHUB_API_URL=https://api.chucknorris.io/jokes
VITE_SESSION_KEY=
VITE_TWITTER_API_KEY=
VITE_TWITTER_TWEETS_ENDPOINT=https://api.twitter.com/2/tweets
VITE_TWITTER_SEARCH_URL=https://mobile.twitter.com/search
VITE_GITHUB_API_URL=https://api.github.com

4
.eslintrc.cjs

@ -4,8 +4,8 @@ const typescript = require('typescript'); @@ -4,8 +4,8 @@ const typescript = require('typescript');
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:jest-dom/recommended'],
plugins: ['svelte3', '@typescript-eslint', 'jest-dom'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {

38
.github/ISSUE_TEMPLATE/bug_report.md

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

10
.github/ISSUE_TEMPLATE/custom.md

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

20
.github/ISSUE_TEMPLATE/feature_request.md

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

8
.gitignore vendored

@ -6,11 +6,19 @@ node_modules @@ -6,11 +6,19 @@ node_modules
/build
/functions
/.vercel_build_output
/.netlify
/workers-site
*.log
# Ignore the build css
static/*.css
# Ignore the xml
static/sitemap.xml
static/feed.xml
static/images/blogs
static/images/snippets
# Storybook files #
###################

3
.husky/pre-commit

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"
yarn lint-staged
npm run pre-commit

7
.lintstagedrc.cjs

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
/* jshint esversion: 9 */
module.exports = {
'*.{js,ts,json,svelte}': ['npm run format', 'git add'],
'./src/**/*.{svelte,ts}': ['npm run lint:fix'],
'./.{ts,cjs,js}': ['npm run lint:fix'],
};

2
.nvmrc

@ -1 +1 @@ @@ -1 +1 @@
14.16.1
14.17.5

5
.storybook/main.cjs

@ -23,13 +23,12 @@ module.exports = { @@ -23,13 +23,12 @@ module.exports = {
svelteOptions: {
preprocess: [
sveltePreprocess({
defaults: {
style: 'scss',
},
postcss: true,
scss: {
prependData: `@import 'src/styles/variables/index.scss';`,
outputStyle: 'compressed',
},
preserve: ['ld+json'],
}),
],
},

1
.storybook/preview.cjs

@ -5,7 +5,6 @@ const { withInfo } = require('@storybook/addon-info'); @@ -5,7 +5,6 @@ const { withInfo } = require('@storybook/addon-info');
// Global CSS Imports
import '../static/tailwind.css';
import '../static/global.css';
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },

22
README.md

@ -2,6 +2,10 @@ @@ -2,6 +2,10 @@
[![Powered By Sveltekit](https://img.shields.io/badge/powered%20by-svelte-FF3C02.svg?style=flat&logo=svelte)](https://kit.svelte.dev/) [![Language: TypeScript](https://img.shields.io/badge/language-typescript-blue.svg?style=flat&logo=typescript)](https://www.typescriptlang.org/) [![ECMAScript: 2019](https://img.shields.io/badge/ES-9-F7DF1E.svg?style=flat&logo=javascript)](https://github.com/tc39/ecma262) [![Tailwindcss](https://img.shields.io/badge/Tailwindcss-CSS--Framework-%2338B2AC?logo=tailwindcss)](https://tailwindcss.com) [![Postcss](https://img.shields.io/badge/Postcss-style-%23DD3A0A?style=flat&logo=postcss)](https://postcss.org) [![SCSS](https://img.shields.io/badge/SCSS-Style-%23CC6699?style=flat&logo=sass)](https://sass-lang.com/) [![StorybookJS](https://img.shields.io/badge/Storybook-UI--Webcomponent--tool-%23FF4785?style=flat&logo=storybook)](https://storybook.js.org/) [![Jest](https://img.shields.io/badge/Jest-Unit--Testing--Framework-%23C21325?style=flat&logo=jest)](https://jestjs.io/) [![Prettier](https://img.shields.io/badge/Prettier-code--formatter-%23F7B93E?style=flat&logo=prettier)](https://prettier.io/) [![Eslint](https://img.shields.io/badge/Eslint-linter-%234B32C3?style=flat&logo=eslint)](https://eslint.org/) [![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat&logo=license)](https://github.com/navneetsharmaui/sveltekit-starter/blob/main/LICENSE)
## [Svektekit Blog](https://github.com/navneetsharmaui/sveltekit-blog)
Use the above link if you want to use the sveltekit blog template.
![sveltekit](https://user-images.githubusercontent.com/11630812/114088279-7cd7be80-98d2-11eb-883c-66c3bf48f293.png)
Sveltekit starter project created with Sveltekit, Typescript, Tailwindcss, Postcss, SCSS, Husky, ESLint, Prettier, Storybook, and Jest.
@ -30,25 +34,17 @@ The project has the ***SSR (Server Side Rendering)*** setup. These template is e @@ -30,25 +34,17 @@ The project has the ***SSR (Server Side Rendering)*** setup. These template is e
- [:heavy_check_mark:] Typescript + TSPaths (absolute for imports in component) preconfigured.
- [:heavy_check_mark:] Prettiers, ESLint, and Husky preconfigured.
- [:heavy_check_mark:] Github and Vscode dotfiles preconfigured.
- [:heavy_check_mark:] JEST Test configuration.
### :pushpin: TODO
- [:heavy_multiplication_x:] Images LazyLoad.
- [:heavy_multiplication_x:] Route Transition animation.
- [:heavy_multiplication_x:] E2E Test configuration using Cypress.
- [:heavy_multiplication_x:] Internationalization (i18n).
- [:heavy_multiplication_x:] More examples of Storybook Stories for the UI Components.
- [:heavy_multiplication_x:] State management Setup.
## :hammer: Project Setup
1. `npx degit navneetsharmaui/sveltekit-starter my-app` or Clone this repository.
2. `yarn install`.
3. `yarn dev`.
2. `npm install` or `yarn install` or `pnpm install`.
3. `npm run dev` or `yarn run dev` or `pnpm run dev`.
4. `npm run build:static:ssr` or `yarn run build:static:ssr` or `pnpm run build:static:ssr`.
5. `npm run preview` or `yarn run preview` or `pnpm run preview`.
## 💫 License
- Code and Contributions have **MIT License**
*Copyright (c) 2021 [Navneet Sharma](https://navneetsharma.tech) ([@asnavneetsharma](https://twitter.com/asnavneetsharma))*
*Copyright (c) 2021 [Navneet Sharma](http://github.com/navneetsharmaui) ([@asnavneetsharma](https://twitter.com/asnavneetsharma))*

1
index.d.ts vendored

@ -0,0 +1 @@ @@ -0,0 +1 @@
declare module '@squoosh/lib';

1
jest-setup.ts

@ -1 +0,0 @@ @@ -1 +0,0 @@
import '@testing-library/jest-dom';

14
jest.config.cjs

@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
module.exports = {
transform: {
'^.+\\.svelte$': [
'svelte-jester',
{
preprocess: true,
compilerOptions: {},
},
],
'^.+\\.ts$': 'ts-jest',
},
moduleFileExtensions: ['js', 'ts', 'svelte'],
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect', '<rootDir>/jest-setup.ts'],
};

11
netlify.toml

@ -1,4 +1,11 @@ @@ -1,4 +1,11 @@
[[headers]]
for = "/*"
[headers.values]
X-Content-Type-Options = "nosniff"
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
[build]
command = "yarn run build:netlify:ssr"
command = "npm run build:static:ssr"
publish = "build/"
functions = "functions/"

247
package.json

@ -1,10 +1,11 @@ @@ -1,10 +1,11 @@
{
"name": "sveltkit-starter",
"name": "sveltekit-starter",
"description": "A sveltekit starter project with typescript, tailwindcss, postcss, scss, husky, and storybook setup",
"version": "1.0.0",
"author": {
"name": "Navneet Sharma",
"url": "https://navneetsharma.tech"
"url": "https://github.com/navneetsharmaui",
"email": "navneetsharma.tech@gmail.com"
},
"license": "MIT",
"keywords": [
@ -38,161 +39,155 @@ @@ -38,161 +39,155 @@
"url": "git+https://github.com/navneetsharmaui/sveltekit-starter.git"
},
"scripts": {
"check-env": "yarn node --loader ts-node/esm scripts/js/check-env.ts",
"prepare": "husky install",
"prebuild": "rimraf .svelte-kit && rimraf build && rimraf .vercel_build_output && rimraf .netlify",
"pre-commit": "lint-staged",
"check-env": "node --loader ts-node/esm scripts/js/check-env.ts",
"remove-css": "node --loader ts-node/esm scripts/js/remove-css-imports.ts",
"add-css": "node --loader ts-node/esm scripts/js/add-css-imports.ts",
"dev:postcss": "cross-env TAILWIND_MODE=build postcss src/styles/global.scss -o static/global.css -w",
"dev:postcss:tailwindcss": "cross-env STYLE_TYPE=TAILWIND TAILWIND_MODE=build postcss src/styles/tailwind.postcss -o static/tailwind.css",
"dev:sveltekit": "svelte-kit dev --port=3535",
"dev": "run-p check-env dev:postcss:tailwindcss dev:postcss dev:sveltekit",
"dev:open": "yarn run dev --open",
"dev:host": "yarn run dev --host",
"dev:host:open": "yarn run dev --open --host",
"build:sitemap:qa": "yarn node --loader ts-node/esm scripts/js/sitemap.ts --env-file=qa --project=sveltekit-starter",
"build:sitemap:dev": "yarn node --loader ts-node/esm scripts/js/sitemap.ts --env-file=dev --project=sveltekit-starter",
"build:sitemap:prod": "yarn node --loader ts-node/esm scripts/js/sitemap.ts --env-file=prod --project=sveltekit-starter",
"build:sitemap:local": "yarn node --loader ts-node/esm scripts/js/sitemap.ts --env-file=local --project=sveltekit-starter",
"build:env:prod": "yarn node --loader ts-node/esm scripts/js/environment.setup.ts --mode=prod --project=sveltekit-starter --arhitect-type=build --configurations=prod",
"build:env:dev": "yarn node --loader ts-node/esm scripts/js/environment.setup.ts --mode=dev --project=sveltekit-starter --arhitect-type=build --configurations=dev",
"build:env:qa": "yarn node --loader ts-node/esm scripts/js/environment.setup.ts --mode=qa --project=sveltekit-starter --arhitect-type=build --configurations=qa",
"build:env:local": "yarn node --loader ts-node/esm scripts/js/environment.setup.ts --mode=local --project=sveltekit-starter --arhitect-type=build --configurations=local",
"dev:postcss:tailwindcss": "cross-env STYLE_TYPE=TAILWIND TAILWIND_MODE=build postcss src/styles/tailwind.postcss -o static/tailwind.css -w",
"dev:sveltekit": "svelte-kit dev",
"dev:sveltekit:host": "svelte-kit dev --host=0.0.0.0",
"dev:withcompiledcss": "run-p check-env dev:postcss:tailwindcss dev:postcss dev:sveltekit",
"dev": "npm run check-env && npm run add-css && npm run dev:sveltekit",
"dev:host": "npm run check-env && npm run add-css && npm run dev:sveltekit:host",
"dev:open": "npm run dev --open",
"dev:host:open": "npm run dev --open --host",
"build:env:prod": "node --loader ts-node/esm scripts/js/environment.setup.ts --mode=prod --project=sveltekit-starter --arhitect-type=build --configurations=prod",
"build:env:dev": "node --loader ts-node/esm scripts/js/environment.setup.ts --mode=dev --project=sveltekit-starter --arhitect-type=build --configurations=dev",
"build:env:qa": "node --loader ts-node/esm scripts/js/environment.setup.ts --mode=qa --project=sveltekit-starter --arhitect-type=build --configurations=qa",
"build:env:local": "node --loader ts-node/esm scripts/js/environment.setup.ts --mode=local --project=sveltekit-starter --arhitect-type=build --configurations=local",
"build:scss": "sass --no-source-map src/styles/global.scss static/global.css",
"build:postcss": "cross-env TAILWIND_MODE=build NODE_ENV=production cross-env-shell postcss static/global.css -o static/global.css",
"build:postcss:taildwindcss": "cross-env TAILWIND_MODE=build NODE_ENV=production STYLE_TYPE=TAILWIND postcss src/styles/tailwind.postcss -o static/tailwind.css",
"build:sveltekit": "cross-env-shell svelte-kit build",
"build": "run-s check-env build:sitemap:prod build:env:prod build:scss build:postcss build:postcss:taildwindcss build:sveltekit build:env:local",
"build": "run-s remove-css build:env:prod build:scss build:postcss build:postcss:taildwindcss build:sveltekit build:env:local",
"build:verbose:sveltekit": "cross-env-shell svelte-kit build --verbose",
"build:verbose": "run-s check-env build:scss build:postcss build:postcss:taildwindcss build:verbose:sveltekit",
"build:static": "cross-env ADAPTER=static OPTIONS='{}' yarn build",
"build:node": "cross-env ADAPTER=node OPTIONS='{}' yarn build",
"build:netlify": "cross-env ADAPTER=netlify OPTIONS='{}' yarn build",
"build:vercel": "cross-env ADAPTER=vercel OPTIONS='{}' yarn build",
"build:static:verbose": "cross-env ADAPTER=static OPTIONS='{}' yarn build:verbose",
"build:node:verbose": "cross-env ADAPTER=node OPTIONS='{}' yarn build:verbose",
"build:netlify:verbose": "cross-env ADAPTER=netlify OPTIONS='{}' yarn build:verbose",
"build:vercel:verbose": "cross-env ADAPTER=vercel OPTIONS='{}' yarn build:verbose",
"build:static:ssr": "cross-env ADAPTER=static OPTIONS='{}' SSR=true yarn build",
"build:node:ssr": "cross-env ADAPTER=node OPTIONS='{}' SSR=true yarn build",
"build:netlify:ssr": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true yarn build",
"build:vercel:ssr": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true yarn build",
"build:static:verbose:ssr": "cross-env ADAPTER=static OPTIONS='{}' SSR=true yarn build:verbose",
"build:node:verbose:ssr": "cross-env ADAPTER=node OPTIONS='{}' SSR=true yarn build:verbose",
"build:netlify:verbose:ssr": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true yarn build:verbose",
"build:vercel:verbose:ssr": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true yarn build:verbose",
"build:static:amp": "cross-env ADAPTER=static OPTIONS='{}' AMP=true yarn build",
"build:node:amp": "cross-env ADAPTER=node OPTIONS='{}' AMP=true yarn build",
"build:netlify:amp": "cross-env ADAPTER=netlify OPTIONS='{}' AMP=true yarn build",
"build:vercel:amp": "cross-env ADAPTER=vercel OPTIONS='{}' AMP=true yarn build",
"build:static:verbose:amp": "cross-env ADAPTER=static OPTIONS='{}' AMP=true yarn build:verbose",
"build:node:verbose:amp": "cross-env ADAPTER=node OPTIONS='{}' AMP=true yarn build:verbose",
"build:netlify:verbose:amp": "cross-env ADAPTER=netlify OPTIONS='{}' AMP=true yarn build:verbose",
"build:vercel:verbose:amp": "cross-env ADAPTER=vercel OPTIONS='{}' AMP=true yarn build:verbose",
"build:static:ssr:amp": "cross-env ADAPTER=static OPTIONS='{}' SSR=true AMP=true yarn build",
"build:node:ssr:amp": "cross-env ADAPTER=node OPTIONS='{}' SSR=true AMP=true yarn build",
"build:netlify:ssr:amp": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true AMP=true yarn build",
"build:vercel:ssr:amp": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true AMP=true yarn build",
"build:static:verbose:ssr:amp": "cross-env ADAPTER=static OPTIONS='{}' SSR=true AMP=true yarn build:verbose",
"build:node:verbose:ssr:amp": "cross-env ADAPTER=node OPTIONS='{}' SSR=true AMP=true yarn build:verbose",
"build:netlify:verbose:ssr:amp": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true AMP=true yarn build:verbose",
"build:vercel:verbose:ssr:amp": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true AMP=true yarn build:verbose",
"build:verbose": "run-s build:scss build:postcss build:postcss:taildwindcss build:verbose:sveltekit",
"build:static": "cross-env ADAPTER=static OPTIONS='{}' npm run build",
"build:node": "cross-env ADAPTER=node OPTIONS='{}' npm run build",
"build:netlify": "cross-env ADAPTER=netlify OPTIONS='{}' npm run build",
"build:vercel": "cross-env ADAPTER=vercel OPTIONS='{}' npm run build",
"build:static:verbose": "cross-env ADAPTER=static OPTIONS='{}' npm run build:verbose",
"build:node:verbose": "cross-env ADAPTER=node OPTIONS='{}' npm run build:verbose",
"build:netlify:verbose": "cross-env ADAPTER=netlify OPTIONS='{}' npm run build:verbose",
"build:vercel:verbose": "cross-env ADAPTER=vercel OPTIONS='{}' npm run build:verbose",
"build:static:ssr": "cross-env ADAPTER=static OPTIONS='{}' SSR=true npm run build",
"build:node:ssr": "cross-env ADAPTER=node OPTIONS='{}' SSR=true npm run build",
"build:netlify:ssr": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true npm run build",
"build:vercel:ssr": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true npm run build",
"build:static:verbose:ssr": "cross-env ADAPTER=static OPTIONS='{}' SSR=true npm run build:verbose",
"build:node:verbose:ssr": "cross-env ADAPTER=node OPTIONS='{}' SSR=true npm run build:verbose",
"build:netlify:verbose:ssr": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true npm run build:verbose",
"build:vercel:verbose:ssr": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true npm run build:verbose",
"build:static:amp": "cross-env ADAPTER=static OPTIONS='{}' AMP=true npm run build",
"build:node:amp": "cross-env ADAPTER=node OPTIONS='{}' AMP=true npm run build",
"build:netlify:amp": "cross-env ADAPTER=netlify OPTIONS='{}' AMP=true npm run build",
"build:vercel:amp": "cross-env ADAPTER=vercel OPTIONS='{}' AMP=true npm run build",
"build:static:verbose:amp": "cross-env ADAPTER=static OPTIONS='{}' AMP=true npm run build:verbose",
"build:node:verbose:amp": "cross-env ADAPTER=node OPTIONS='{}' AMP=true npm run build:verbose",
"build:netlify:verbose:amp": "cross-env ADAPTER=netlify OPTIONS='{}' AMP=true npm run build:verbose",
"build:vercel:verbose:amp": "cross-env ADAPTER=vercel OPTIONS='{}' AMP=true npm run build:verbose",
"build:static:ssr:amp": "cross-env ADAPTER=static OPTIONS='{}' SSR=true AMP=true npm run build",
"build:node:ssr:amp": "cross-env ADAPTER=node OPTIONS='{}' SSR=true AMP=true npm run build",
"build:netlify:ssr:amp": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true AMP=true npm run build",
"build:vercel:ssr:amp": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true AMP=true npm run build",
"build:static:verbose:ssr:amp": "cross-env ADAPTER=static OPTIONS='{}' SSR=true AMP=true npm run build:verbose",
"build:node:verbose:ssr:amp": "cross-env ADAPTER=node OPTIONS='{}' SSR=true AMP=true npm run build:verbose",
"build:netlify:verbose:ssr:amp": "cross-env ADAPTER=netlify OPTIONS='{}' SSR=true AMP=true npm run build:verbose",
"build:vercel:verbose:ssr:amp": "cross-env ADAPTER=vercel OPTIONS='{}' SSR=true AMP=true npm run build:verbose",
"preview": "svelte-kit preview",
"preview:open": "yarn run preview --open",
"preview:host": "yarn run preview --host",
"preview:host:open": "yarn run preview --open --host",
"lint": "prettier --check ./src/**/*.{js,svelte,ts} ./*.{ts,cjs,js} && eslint ./src/**/*.{js,svelte,ts} --ignore-path .gitignore .",
"preview:open": "npm run run preview --open",
"preview:host": "npm run run preview --host",
"preview:host:open": "npm run run preview --open --host",
"lint": "prettier --ignore-path .gitignore --check ./src/**/*.{js,svelte,ts} ./*.{ts,cjs,js} && eslint ./src/**/*.{js,svelte,ts} --ignore-path .gitignore .",
"lint:fix": "prettier --check ./src/**/*.{js,svelte,ts} ./*.{ts,cjs,js} && eslint ./src/**/*.{js,svelte,ts} --ignore-path .gitignore .",
"format": "prettier --write ./src/**/*.{js,svelte,ts} ./*.{ts,cjs,js}",
"format": "prettier --ignore-path .gitignore --write ./src/**/*.{js,svelte,ts} ./*.{ts,cjs,js}",
"eslint": "eslint ./src/**/*.{js,svelte,ts} --ignore-path .gitignore .",
"eslint:fix": "eslint ./src/**/*.{js,svelte,ts} --ignore-path .gitignore . --fix",
"postinstall": "husky install",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"test": "cross-env TAILWIND_MODE=build jest src --coverage --runInBand",
"test:watch": "yarn test -- --watch"
},
"lint-staged": {
"./src/**/*.{svelte,ts}": [
"yarn lint:fix"
],
"./.{ts,cjs,js}": [
"yarn lint:fix"
]
"build-storybook": "build-storybook"
},
"dependencies": {
"@fontsource/fira-mono": "^4.2.2",
"@lukeed/uuid": "^2.0.0",
"@sveltestack/svelte-query": "^1.4.1",
"cookie": "^0.4.1",
"node-fetch": "^2.6.1"
"micro-cookie-session": "^2.0.0-beta.1"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.5",
"@fullhuman/postcss-purgecss": "^4.0.3",
"@mdx-js/react": "^1.6.22",
"@storybook/addon-actions": "^6.3.2",
"@babel/core": "^7.15.0",
"@fortawesome/fontawesome-free": "^5.15.4",
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@squoosh/lib": "^0.4.0",
"@storybook/addon-actions": "^6.3.8",
"@storybook/addon-cssresources": "^6.2.9",
"@storybook/addon-essentials": "^6.3.2",
"@storybook/addon-essentials": "^6.3.8",
"@storybook/addon-info": "^5.3.21",
"@storybook/addon-links": "^6.3.2",
"@storybook/addon-links": "^6.3.8",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/addon-svelte-csf": "^1.1.0",
"@storybook/preset-scss": "^1.0.3",
"@storybook/svelte": "^6.3.2",
"@sveltejs/adapter-netlify": "^1.0.0-next.17",
"@sveltejs/adapter-node": "^1.0.0-next.26",
"@sveltejs/adapter-static": "^1.0.0-next.13",
"@sveltejs/adapter-vercel": "^1.0.0-next.22",
"@sveltejs/kit": "^1.0.0-next.115",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/svelte": "^3.0.3",
"@types/cookie": "^0.4.0",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.2",
"@types/node-fetch": "^2.5.10",
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.27.0",
"@typescript-eslint/parser": "^4.27.0",
"autoprefixer": "^10.2.6",
"babel-jest": "^27.0.2",
"babel-loader": "^8.2.2",
"@storybook/svelte": "^6.3.8",
"@sveltejs/adapter-netlify": "^1.0.0-next.30",
"@sveltejs/adapter-node": "^1.0.0-next.43",
"@sveltejs/adapter-static": "^1.0.0-next.17",
"@sveltejs/adapter-vercel": "^1.0.0-next.27",
"@sveltejs/kit": "^1.0.0-next.142",
"@tailwindcss/typography": "^0.4.1",
"@types/cookie": "^0.4.1",
"@types/node": "^16.7.2",
"@types/node-fetch": "^2.5.12",
"@types/nprogress": "^0.2.0",
"@types/yargs": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"autoprefixer": "^10.3.3",
"cross-env": "^7.0.3",
"css-loader": "^5.2.6",
"cssnano": "^5.0.6",
"cssnano-preset-advanced": "^5.1.3",
"eslint": "^7.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest-dom": "^3.9.0",
"cssnano-preset-advanced": "^5.1.4",
"date-fns": "^2.23.0",
"dotenv": "^10.0.0",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-svelte3": "^3.2.0",
"husky": "^6.0.0",
"jest": "26.6.3",
"lint-staged": "^11.0.0",
"marked": "^2.1.1",
"gray-matter": "^4.0.3",
"husky": "^7.0.2",
"image-size": "^1.0.0",
"lint-staged": "^11.1.2",
"node-fetch": "^2.6.1",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.4",
"postcss-at-rules-variables": "^0.3.0",
"nprogress": "^0.2.0",
"postcss": "^8.3.5",
"postcss-cli": "^8.3.1",
"postcss-html": "^0.36.0",
"postcss-import": "^14.0.2",
"postcss-load-config": "^3.1.0",
"postcss-mixins": "^8.1.0",
"postcss-nested": "^5.0.5",
"postcss-nested": "^5.0.6",
"postcss-scss": "^4.0.0",
"postcss-simple-vars": "^6.0.3",
"postcss-syntax": "^0.36.2",
"prettier": "~2.3.1",
"prettier-plugin-svelte": "^2.3.0",
"sass": "^1.35.1",
"prettier": "~2.2.1",
"prettier-plugin-svelte": "^2.2.0",
"rimraf": "^3.0.2",
"sass": "^1.38.1",
"sass-loader": "^12.1.0",
"style-loader": "^2.0.0",
"svelte": "^3.38.3",
"svelte-jester": "^1.7.0",
"svelte": "^3.42.3",
"svelte-awesome": "^2.3.2",
"svelte-check": "^2.2.5",
"svelte-loader": "^3.1.2",
"svelte-preprocess": "^4.7.3",
"tailwindcss": "^2.1.4",
"ts-jest": "26.5.6",
"ts-node": "^10.0.0",
"tslib": "^2.3.0",
"typescript": "^4.2.4",
"vite": "^2.3.7",
"yargs": "^17.0.1"
"svelte-preprocess": "^4.7.4",
"tailwindcss": "^2.2.4",
"ts-node": "^10.2.1",
"tslib": "^2.0.0",
"typescript": "^4.0.0",
"vite-imagetools": "^3.6.8",
"yargs": "^17.1.1"
},
"type": "module"
"type": "module",
"engines": {
"node": ">= 14.16.1"
}
}

24
postcss.config.cjs

@ -1,46 +1,28 @@ @@ -1,46 +1,28 @@
/* jshint esversion: 9 */
const postcssMixins = require('postcss-mixins');
const postcssAtRulesVariables = require('postcss-at-rules-variables');
const postcssSimpleVars = require('postcss-simple-vars');
const postcssImport = require('postcss-import');
const tailwindcss = require('tailwindcss');
const postcssNested = require('postcss-nested');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const purgeCSS = require('@fullhuman/postcss-purgecss');
const postcssSyntax = require('postcss-syntax');
/**
* If You are using the only postcss for the whole application,
* you will need to create a separate js file where you define the global variables.
*/
// const variables = require('./config/postcss/variables.cjs');
const mode = process.env.NODE_ENV;
const dev = mode === 'development';
module.exports = {
const config = {
syntax: 'postcss-scss',
plugins: [
postcssMixins(),
postcssAtRulesVariables(),
postcssImport(),
postcssSimpleVars(),
postcssNested(),
tailwindcss(),
autoprefixer({
cascade: true,
}),
!dev &&
purgeCSS({
content: ['./src/**/*.{svelte,html}'],
defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [],
safelist: ['html', 'body'],
}),
!dev &&
cssnano({
preset: 'advanced',
}),
],
};
module.exports = config;

0
scripts/.gitkeep

32
scripts/js/add-css-imports.ts

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
/* eslint-disable no-console */
import fs from 'fs';
const folderfiles = fs.readdirSync('./src/routes');
const rootLayout = folderfiles.filter((file) => file.includes('__layout.svelte'));
const pathToRootLayout = './src/routes/__layout.svelte';
try {
if (rootLayout.length === 0) {
throw new Error(`
No Root Layout Found.
`);
} else {
const layout = fs.readFileSync(pathToRootLayout, {
encoding: 'utf8',
});
const writeToFile = (filePath: string, data): void => fs.writeFileSync(filePath, data);
const isImportPresent = layout.includes("import '../styles/tailwind.postcss';");
if (isImportPresent) {
console.log('Import already present');
} else {
const updatedLayout = layout.replace(
'// Start: External Imports',
`// Start: External Imports
import '../styles/tailwind.postcss';`,
);
writeToFile(pathToRootLayout, updatedLayout);
}
}
} catch (error) {
console.error(error);
}

2
scripts/js/environment.setup.ts

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
/* eslint-disable no-console */
import fs from 'fs';
const pathToWorkspaceJSON = './workspace.json';
const pathToWorkspaceJSON = './sveltekit-space.json';
// const pathToEnvironmentPorpertiesFolder = './src/environments';

23
scripts/js/remove-css-imports.ts

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
/* eslint-disable no-console */
import fs from 'fs';
const folderfiles = fs.readdirSync('./src/routes');
const rootLayout = folderfiles.filter((file) => file.includes('__layout.svelte'));
const pathToRootLayout = './src/routes/__layout.svelte';
try {
if (rootLayout.length === 0) {
throw new Error(`
No Root Layout Found.
`);
} else {
const layout = fs.readFileSync(pathToRootLayout, {
encoding: 'utf8',
});
const writeToFile = (filePath: string, data): void => fs.writeFileSync(filePath, data);
const updatedLayout = layout.replace("import '../styles/tailwind.postcss';", '');
writeToFile(pathToRootLayout, updatedLayout);
}
} catch (error) {
console.error(error);
}

99
scripts/js/sitemap.ts

@ -1,99 +0,0 @@ @@ -1,99 +0,0 @@
/* eslint-disable no-console */
import fs from 'fs';
import dotenv from 'dotenv';
const pathToWorkspaceJSON = './workspace.json';
const filterArguments = (argv: string[], flag: string): string[] =>
argv.filter((value) => value.includes(flag)).map((value) => value.split('=')[1]);
const getArguments = (argv: string[], flag: string): string =>
filterArguments(argv, flag) ? filterArguments(argv, flag).reduce((value) => value) : '';
const writeToFile = (filePath: string, data): void => fs.writeFileSync(filePath, data);
const processArguments = process.argv;
const env = getArguments(processArguments, '--env-file');
const envFile = env
? env === 'local'
? fs.existsSync('.env.local')
? '.env.local'
: fs.existsSync(`.env.${env}.local`)
? `.env.${env}.local`
: fs.existsSync(`.env.${env}`)
? `.env.${env}`
: '.env'
: '.env'
: '.env';
try {
if (!fs.existsSync(envFile)) {
throw new Error(`
Environment files are not there in the workspace.
Create the .env file with required properties defined in it.
Create .env.local for local environment properties.
Create .env.{development | qa | production }.local to check application with environment specific properties.
If you create a new environment specific .env file add it in the .gitignore and do not commit that file.
`);
}
} catch (error) {
console.error(error);
}
dotenv.config({
path: envFile,
});
const project = getArguments(processArguments, '--project');
const workspace = JSON.parse(
fs.readFileSync(pathToWorkspaceJSON, {
encoding: 'utf8',
}),
);
const root = workspace['projects'][project]['root'];
const routes = workspace['projects'][project]['routes'];
const assets = workspace['projects'][project]['assets'];
const URL = process.env.VITE_BASE_URL;
const baseURL = URL ? URL : 'https://localhost:3000';
const pages = [''];
fs.readdirSync(`${root}/${routes}`).forEach((file) => {
file = file.split('.')[0];
if (
file.charAt(0) !== '_' &&
file !== 'sitemap' &&
file !== 'index' &&
file !== '$layout' &&
file !== '$error' &&
file !== 'rss'
) {
pages.push(file);
}
});
const render = (pages: string[]) => `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
${pages
.map(
(page: string) => `
<url>
<loc>
${baseURL}/${page ? `${page}/` : ''}
</loc>
<priority>0.85</priority>
</url>
`,
)
.join('\n')}
</urlset>
`;
const sitemap = render(pages);
writeToFile(`${root}/${assets}/sitemap.xml`, sitemap);

20
src/app.html

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html class="light" lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1" />
@ -8,11 +8,11 @@ @@ -8,11 +8,11 @@
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="apple-touch-icon" type="image/x-icon" href="/favicon.ico" />
<meta name="theme-color" content="#ff6600" />
<meta name="theme-color" content="#fff" />
<link rel="manifest" href="/manifest.json" />
<link
rel="preload"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&amp;display=swap"
href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
as="style"
onload="this.onload=null;this.rel='stylesheet'"
/>
@ -23,15 +23,21 @@ @@ -23,15 +23,21 @@
onload="this.onload=null;this.rel='stylesheet'"
/>
<noscript>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&amp;display=swap" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
/>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
</noscript>
<link rel="stylesheet" href="/tailwind.css" />
<link rel="stylesheet" href="/global.css" />
%svelte.head%
</head>
<body>
<div id="starter">%svelte.body%</div>
<noscript> Please enable JavaScript to continue using this application. </noscript>
</body>
<noscript>
<div class="flex flex-col max-h-full min-h-full h-full w-full min-w-full max-w-full">
<p> Please enable JavaScript to continue using this application. </p>
</div>
</noscript>
</html>

24
src/environments/environment.dev.ts

@ -1,10 +1,7 @@ @@ -1,10 +1,7 @@
import {
EnvironmentName,
EnvironmentType,
SVELTEKIT_DATA_ENPOINTS_DEV,
SVELTEKIT_STARTER_ENPOINT_CONFIG,
SVELTEKIT_SEARCH_ENPOINTS_DEV,
} from '$lib/models';
import { EnvironmentName } from '$models/enums/environment-name.enum';
import { EnvironmentType } from '$models/enums/environment-type.enum';
import { SVELTEKIT_DATA_ENPOINTS_DEV, SVELTEKIT_SEARCH_ENPOINTS_DEV } from '$models/enums/sveltekit-endpoint.dev.enum';
import type { SVELTEKIT_STARTER_ENPOINT_CONFIG } from '$models/types/sveltekit-endpoits.type';
import type { ISveltekitStarterEnvironmentConfig } from '$models/interfaces/isveltekit-strater-environment.interface';
export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG> = {
@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
environmentType: EnvironmentType.DEV,
production: true,
isDebugMode: false,
lauchURL: import.meta.env.VITE_BASE_URL,
launchURL: import.meta.env.VITE_BASE_URL,
apiUrls: {
CHUCK_NORRIS: import.meta.env.VITE_CHUCK_NORRIS_API_URL,
IN_MEMORY: '',
@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
SERVICE: SVELTEKIT_DATA_ENPOINTS_DEV.SERVICE,
},
},
sessionConfig: {
SESSION_KEY: import.meta.env.VITE_SESSION_KEY,
},
twitterConfig: {
TWITTER_API_KEY: import.meta.env.VITE_TWITTER_API_KEY,
TWITTER_TWEETS_ENDPOINT: import.meta.env.VITE_TWITTER_TWEETS_ENDPOINT,
TWITTER_SEARCH_URL: import.meta.env.VITE_TWITTER_SEARCH_URL,
},
gitHubConfig: {
GITHUB_API_URL: import.meta.env.VITE_GITHUB_API_URL,
},
};

24
src/environments/environment.local.ts

@ -1,10 +1,7 @@ @@ -1,10 +1,7 @@
import {
EnvironmentName,
EnvironmentType,
SVELTEKIT_DATA_ENPOINTS,
SVELTEKIT_STARTER_ENPOINT_CONFIG,
SVELTEKIT_SEARCH_ENPOINTS,
} from '$lib/models';
import { EnvironmentName } from '$models/enums/environment-name.enum';
import { EnvironmentType } from '$models/enums/environment-type.enum';
import { SVELTEKIT_DATA_ENPOINTS, SVELTEKIT_SEARCH_ENPOINTS } from '$models/enums/sveltekit-endpoint.enum';
import type { SVELTEKIT_STARTER_ENPOINT_CONFIG } from '$models/types/sveltekit-endpoits.type';
import type { ISveltekitStarterEnvironmentConfig } from '$models/interfaces/isveltekit-strater-environment.interface';
export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG> = {
@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
environmentType: EnvironmentType.LOCAL,
production: false,
isDebugMode: true,
lauchURL: import.meta.env.VITE_BASE_URL,
launchURL: import.meta.env.VITE_BASE_URL,
apiUrls: {
CHUCK_NORRIS: import.meta.env.VITE_CHUCK_NORRIS_API_URL,
IN_MEMORY: '',
@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
SERVICE: SVELTEKIT_DATA_ENPOINTS.SERVICE,
},
},
sessionConfig: {
SESSION_KEY: import.meta.env.VITE_SESSION_KEY,
},
twitterConfig: {
TWITTER_API_KEY: import.meta.env.VITE_TWITTER_API_KEY,
TWITTER_TWEETS_ENDPOINT: import.meta.env.VITE_TWITTER_TWEETS_ENDPOINT,
TWITTER_SEARCH_URL: import.meta.env.VITE_TWITTER_SEARCH_URL,
},
gitHubConfig: {
GITHUB_API_URL: import.meta.env.VITE_GITHUB_API_URL,
},
};

21
src/environments/environment.prod.ts

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
import { EnvironmentName } from '$models/enums/environment-name.enum';
import { EnvironmentType } from '$models/enums/environment-type.enum';
import {
EnvironmentName,
EnvironmentType,
SVELTEKIT_DATA_ENPOINTS_PROD,
SVELTEKIT_STARTER_ENPOINT_CONFIG,
SVELTEKIT_SEARCH_ENPOINTS_PROD,
} from '$lib/models';
} from '$models/enums/sveltekit-endpoint.prod.enum';
import type { SVELTEKIT_STARTER_ENPOINT_CONFIG } from '$models/types/sveltekit-endpoits.type';
import type { ISveltekitStarterEnvironmentConfig } from '$models/interfaces/isveltekit-strater-environment.interface';
export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG> = {
@ -12,7 +12,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -12,7 +12,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
environmentType: EnvironmentType.PROD,
production: true,
isDebugMode: false,
lauchURL: import.meta.env.VITE_BASE_URL,
launchURL: import.meta.env.VITE_BASE_URL,
apiUrls: {
CHUCK_NORRIS: import.meta.env.VITE_CHUCK_NORRIS_API_URL,
IN_MEMORY: '',
@ -27,4 +27,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -27,4 +27,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
SERVICE: SVELTEKIT_DATA_ENPOINTS_PROD.SERVICE,
},
},
sessionConfig: {
SESSION_KEY: import.meta.env.VITE_SESSION_KEY,
},
twitterConfig: {
TWITTER_API_KEY: import.meta.env.VITE_TWITTER_API_KEY,
TWITTER_TWEETS_ENDPOINT: import.meta.env.VITE_TWITTER_TWEETS_ENDPOINT,
TWITTER_SEARCH_URL: import.meta.env.VITE_TWITTER_SEARCH_URL,
},
gitHubConfig: {
GITHUB_API_URL: import.meta.env.VITE_GITHUB_API_URL,
},
};

24
src/environments/environment.qa.ts

@ -1,10 +1,7 @@ @@ -1,10 +1,7 @@
import {
EnvironmentName,
EnvironmentType,
SVELTEKIT_DATA_ENPOINTS_QA,
SVELTEKIT_STARTER_ENPOINT_CONFIG,
SVELTEKIT_SEARCH_ENPOINTS_QA,
} from '$lib/models';
import { EnvironmentName } from '$models/enums/environment-name.enum';
import { EnvironmentType } from '$models/enums/environment-type.enum';
import { SVELTEKIT_DATA_ENPOINTS_QA, SVELTEKIT_SEARCH_ENPOINTS_QA } from '$models/enums/sveltekit-endpoint.qa.enum';
import type { SVELTEKIT_STARTER_ENPOINT_CONFIG } from '$models/types/sveltekit-endpoits.type';
import type { ISveltekitStarterEnvironmentConfig } from '$models/interfaces/isveltekit-strater-environment.interface';
export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG> = {
@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
environmentType: EnvironmentType.QA,
production: true,
isDebugMode: false,
lauchURL: import.meta.env.VITE_BASE_URL,
launchURL: import.meta.env.VITE_BASE_URL,
apiUrls: {
CHUCK_NORRIS: import.meta.env.VITE_CHUCK_NORRIS_API_URL,
IN_MEMORY: '',
@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
SERVICE: SVELTEKIT_DATA_ENPOINTS_QA.SERVICE,
},
},
sessionConfig: {
SESSION_KEY: import.meta.env.VITE_SESSION_KEY,
},
twitterConfig: {
TWITTER_API_KEY: import.meta.env.VITE_TWITTER_API_KEY,
TWITTER_TWEETS_ENDPOINT: import.meta.env.VITE_TWITTER_TWEETS_ENDPOINT,
TWITTER_SEARCH_URL: import.meta.env.VITE_TWITTER_SEARCH_URL,
},
gitHubConfig: {
GITHUB_API_URL: import.meta.env.VITE_GITHUB_API_URL,
},
};

24
src/environments/environment.ts

@ -1,10 +1,7 @@ @@ -1,10 +1,7 @@
import {
EnvironmentName,
EnvironmentType,
SVELTEKIT_DATA_ENPOINTS,
SVELTEKIT_STARTER_ENPOINT_CONFIG,
SVELTEKIT_SEARCH_ENPOINTS,
} from '$lib/models';
import { EnvironmentName } from '$models/enums/environment-name.enum';
import { EnvironmentType } from '$models/enums/environment-type.enum';
import { SVELTEKIT_DATA_ENPOINTS, SVELTEKIT_SEARCH_ENPOINTS } from '$models/enums/sveltekit-endpoint.enum';
import type { SVELTEKIT_STARTER_ENPOINT_CONFIG } from '$models/types/sveltekit-endpoits.type';
import type { ISveltekitStarterEnvironmentConfig } from '$models/interfaces/isveltekit-strater-environment.interface';
export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG> = {
@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -12,7 +9,7 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
environmentType: EnvironmentType.LOCAL,
production: false,
isDebugMode: true,
lauchURL: import.meta.env.VITE_BASE_URL,
launchURL: import.meta.env.VITE_BASE_URL,
apiUrls: {
CHUCK_NORRIS: import.meta.env.VITE_CHUCK_NORRIS_API_URL,
IN_MEMORY: '',
@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E @@ -27,4 +24,15 @@ export const environment: ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_E
SERVICE: SVELTEKIT_DATA_ENPOINTS.SERVICE,
},
},
sessionConfig: {
SESSION_KEY: import.meta.env.VITE_SESSION_KEY,
},
twitterConfig: {
TWITTER_API_KEY: import.meta.env.VITE_TWITTER_API_KEY,
TWITTER_TWEETS_ENDPOINT: import.meta.env.VITE_TWITTER_TWEETS_ENDPOINT,
TWITTER_SEARCH_URL: import.meta.env.VITE_TWITTER_SEARCH_URL,
},
gitHubConfig: {
GITHUB_API_URL: import.meta.env.VITE_GITHUB_API_URL,
},
};

13
src/global.d.ts vendored

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
declare module '@storybook/addon-svelte-csf';
/**
* Wiht these declarations images can be imported in the components.
* With these declarations images can be imported in the components.
*
* @example
* ```svelte
@ -64,11 +64,22 @@ declare module '*.wbep' { @@ -64,11 +64,22 @@ declare module '*.wbep' {
export = value;
}
declare module 'micro-cookie-session';
declare module 'svelte-awesome';
// Start: Interfaces
interface Locals {
userid: string;
}
interface ImportMetaEnv {
VITE_BASE_URL: string;
VITE_CHUCK_NORRIS_API_URL: string;
VITE_CHUCK_NORRIS_API_LANG: string;
VITE_SESSION_KEY: string;
VITE_TWITTER_API_KEY: string;
VITE_TWITTER_TWEETS_ENDPOINT: string;
VITE_TWITTER_SEARCH_URL: string;
VITE_GITHUB_API_URL: string;
}

24
src/hooks/index.ts

@ -1,3 +1,23 @@ @@ -1,3 +1,23 @@
console.log('Hooks');
import cookie from 'cookie';
import { v4 as uuid } from '@lukeed/uuid';
import type { Handle } from '@sveltejs/kit';
export {};
export const handle: Handle = async ({ request, resolve }) => {
const cookies = cookie.parse(request.headers.cookie || '');
request.locals.userid = cookies.userid || uuid();
// TODO https://github.com/sveltejs/kit/issues/1046
if (request.query.has('_method')) {
request.method = request.query.get('_method').toUpperCase();
}
const response = await resolve(request);
if (!cookies.userid) {
// if this is the first time the user has visited this app,
// set a cookie so that we recognise them when they return
response.headers['set-cookie'] = `userid=${request.locals.userid}; Path=/; HttpOnly`;
}
return response;
};

6
src/lib/core/services/environment/environment.facade.ts

@ -15,8 +15,8 @@ import type { ISveltekitStarterEnvironmentConfig } from '$models/interfaces/isve @@ -15,8 +15,8 @@ import type { ISveltekitStarterEnvironmentConfig } from '$models/interfaces/isve
* @alpha
* @public
*/
export class SveltekitStarterEnvironmentFacade<
T extends ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG> = ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG>,
class SveltekitStarterEnvironmentFacade<
T extends ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG> = ISveltekitStarterEnvironmentConfig<SVELTEKIT_STARTER_ENPOINT_CONFIG>
> {
constructor(private readonly coreConfig: ISveltekitStarterCoreConfig<T>) {}
@ -33,7 +33,7 @@ export class SveltekitStarterEnvironmentFacade< @@ -33,7 +33,7 @@ export class SveltekitStarterEnvironmentFacade<
}
public get launchURL(): string {
return this.coreConfig.environment.lauchURL;
return this.coreConfig.environment.launchURL;
}
public get isProd(): boolean {

2
src/lib/core/services/environment/index.ts

@ -1 +1 @@ @@ -1 +1 @@
export * from './environment.facade';
export { sveltekitStarterEnvironmentFacade } from './environment.facade';

2
src/lib/data/data.ts

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
import { UserModel } from '$lib/models/classes';
import { UserModel } from '$models/classes/user.model';
export const userData: UserModel[] = [
{

4
src/lib/models/interfaces/iblog-post-summary.interface.ts

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
export interface IBlogPostSummary {
title: string;
summary: string;
}

3
src/lib/models/interfaces/icompiled-css.interface.ts

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
export interface ICompiledCSS {
url: string;
}

2
src/lib/models/interfaces/iconfig.interface.ts

@ -2,7 +2,7 @@ import type { EnvironmentName, EnvironmentType } from '../enums'; @@ -2,7 +2,7 @@ import type { EnvironmentName, EnvironmentType } from '../enums';
import type { APIConfig } from '../types/api-config.type';
export interface IConfig {
lauchURL: string;
launchURL: string;
environmentType: EnvironmentType;
production: boolean;
isDebugMode: boolean;

6
src/lib/models/interfaces/igithub-config.interface.ts

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
export interface IGitHubConfig {
GITHUB_BLOG_EDIT_URL: string;
GITHUB_API_URL: string;
GITHUB_USER_ENDPOINT: string;
GITHUB_USER_REPO_ENDPOINT: string;
}

1
src/lib/models/interfaces/imeta-tag-properties.interface.ts

@ -13,7 +13,6 @@ export interface IMetaTagProperties { @@ -13,7 +13,6 @@ export interface IMetaTagProperties {
searchUrl: string;
sitemapUrl: string;
rss: string;
atom: string;
twitter: Partial<ITwitterMetaTagProperties>;

1
src/lib/models/interfaces/index.ts

@ -7,6 +7,7 @@ export * from './iimage-meta-tag-properties.interface'; @@ -7,6 +7,7 @@ export * from './iimage-meta-tag-properties.interface';
export * from './imeta-tag-properties.interface';
export * from './iopen-graph-meta-tag-properties.interface';
export * from './itwitter-meta-tag-properties.interface';
export * from './itweet.interface';
export * from './iheader-nav-link.interface';
export * from './iconfig.interface';
export * from './icore-config.interface';

6
src/lib/models/interfaces/iproject-card.interface.ts

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
export interface IProjectCard {
title: string;
description: string;
slug: string;
icon: string;
}

3
src/lib/models/interfaces/isession-config.interface.ts

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
export interface ISessionConfig {
SESSION_KEY: string;
}

4
src/lib/models/interfaces/isnippet.interface.ts

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
export interface ISnippet {
title: string;
description: string;
}

3
src/lib/models/interfaces/istatistics.interface.ts

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
export interface IStatistics {
viewCount: number;
}

2
src/lib/models/interfaces/isveltekit-core-config.interface.ts

@ -3,7 +3,7 @@ import type { ISveltekitStarterEnvironmentConfig } from './isveltekit-strater-en @@ -3,7 +3,7 @@ import type { ISveltekitStarterEnvironmentConfig } from './isveltekit-strater-en
export interface ISveltekitStarterCoreConfig<
T extends ISveltekitStarterEnvironmentConfig<K>,
K = SVELTEKIT_DATA_ENPOINT_CONFIG,
K = SVELTEKIT_DATA_ENPOINT_CONFIG
> {
environment: T;
}

6
src/lib/models/interfaces/isveltekit-strater-environment.interface.ts

@ -1,8 +1,14 @@ @@ -1,8 +1,14 @@
import type { SVELTEKIT_STARTER_API_CONFIG, SVELTEKIT_DATA_ENPOINT_CONFIG } from '../types';
import type { IEnvironmentConfig } from './ienvironment.interface';
import type { ISveltekitDBConfig } from './isveltekit-db-config.interface';
import type { ITwitterConfig } from './itwitter-config.interface';
import type { ISessionConfig } from './isession-config.interface';
import type { IGitHubConfig } from './igithub-config.interface';
export interface ISveltekitStarterEnvironmentConfig<T = SVELTEKIT_DATA_ENPOINT_CONFIG> extends IEnvironmentConfig {
apiUrls: SVELTEKIT_STARTER_API_CONFIG;
chuckNorriesAPIConfig: Partial<ISveltekitDBConfig<T>>;
sessionConfig: Partial<ISessionConfig>;
twitterConfig: Partial<ITwitterConfig>;
gitHubConfig: Partial<IGitHubConfig>;
}

9
src/lib/models/interfaces/itweet.interface.ts

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
export interface ITweet {
text: string;
id: string;
author: string;
media: string;
created_at: string;
public_metrics: string;
referenced_tweets: string;
}

5
src/lib/models/interfaces/itwitter-config.interface.ts

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
export interface ITwitterConfig {
TWITTER_API_KEY: string;
TWITTER_TWEETS_ENDPOINT: string;
TWITTER_SEARCH_URL: string;
}

4
src/lib/models/interfaces/itwitter-meta-tag-properties.interface.ts

@ -21,4 +21,8 @@ export interface ITwitterMetaTagProperties { @@ -21,4 +21,8 @@ export interface ITwitterMetaTagProperties {
'app:name:googleplay': string;
'app:id:googleplay': string;
'app:url:googleplay': string;
label1: string;
data1: string;
label2: string;
data2: string;
}

2
src/lib/shared/components/application-titles/ApplicationTitles.svelte

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<script lang="ts">
import type { IApplicationRouteTitle } from '$lib/models';
import type { IApplicationRouteTitle } from '$models/interfaces/iapplication-route-title.interface';
import { onMount } from 'svelte';
import Title from '../title/Title.svelte';

27
src/lib/shared/components/blog-post/BlogPost.svelte

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
<script lang="ts">
// Start: Local Imports
// Models
import type { IBlogPostSummary } from '$models/interfaces/iblog-post-summary.interface';
// End: Local Imports
// Start: Exported Properties
/**
* @type {IBlogPostSummary}
*/
export let blog!: IBlogPostSummary;
// End: Exported Properties
</script>
{#if blog}
<div class="mb-8 w-full border-b border-gray-100 dark:border-gray-800 pb-5">
<div class="flex flex-col md:flex-row justify-between">
<h3 class="text-lg md:text-xl font-medium mb-2 w-full text-gray-900 dark:text-gray-100">
{blog.title}
</h3>
</div>
<p class="text-gray-600 dark:text-gray-400">{blog.summary}</p>
</div>
<!-- <hr class="w-full border-1 border-gray-200 dark:border-gray-800 mb-8" /> -->
{/if}

1
src/lib/shared/components/blog-post/index.ts

@ -0,0 +1 @@ @@ -0,0 +1 @@
export { default as BlogPost } from './BlogPost.svelte';

23
src/lib/shared/components/compiled-styles/CompiledStyles.svelte

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
<script lang="ts">
// Start: Local Imports
// Models
import type { ICompiledCSS } from '$models/interfaces/icompiled-css.interface';
// Data
import { environment } from '$environment/environment';
// End: Local Imports
// Start: Exported Properties
export let cssFiles: ICompiledCSS[] = [];
// End: Exported Properties
const isProd = environment.production;
</script>
<svelte:head>
{#if cssFiles.length > 0 && isProd}
{#each cssFiles as cssFile}
<link rel="stylesheet" href="{cssFile.url}" />
{/each}
{/if}
</svelte:head>

1
src/lib/shared/components/compiled-styles/index.ts

@ -0,0 +1 @@ @@ -0,0 +1 @@
export { default as CompiledStyles } from './CompiledStyles.svelte';

39
src/lib/shared/components/counter/Counter.spec.ts

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
/**
* @jest-environment jsdom
*/
import Counter from './Counter.svelte';
import { render, fireEvent } from '@testing-library/svelte';
describe('Counter Component', () => {
it('Should create', async () => {
const { container } = render(Counter);
expect(container).toBeTruthy();
});
it('Test Case One', async () => {
const { getByText, getByTestId } = render(Counter);