@kvihaugen/create-frontend-app 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -2
- package/.gitattributes +0 -2
- package/.github/workflows/build-and-publish.yaml +0 -35
- package/src/index.ts +0 -135
- package/template/next.config.ts +0 -21
- package/template/postcss.config.mjs +0 -18
- package/template/public/.well-known/app.webmanifest +0 -1
- package/template/public/.well-known/robots.txt +0 -7
- package/template/public/.well-known/security.txt +0 -29
- package/template/src/app/layout.tsx +0 -87
- package/template/src/app/page.tsx +0 -14
- package/template/src/components/common/Providers.tsx +0 -17
- package/template/src/css/globals.css +0 -4
- package/template/src/types/common/ParentProps.ts +0 -7
- package/template/src/utils/csp-policy.ts +0 -15
- package/template/src/utils/hooks/useColorScheme.ts +0 -30
- package/template/src/utils/hooks/usePrimaryColorShade.ts +0 -17
- package/template/src/utils/i18n/index.ts +0 -15
- package/template/src/utils/i18n/resources/en.json +0 -7
- package/tsconfig.json +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvihaugen/create-frontend-app",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,5 +27,8 @@
|
|
|
27
27
|
"repository": {
|
|
28
28
|
"url": "https://github.com/LarsSK06/create-frontend-app",
|
|
29
29
|
"type": "git"
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
]
|
|
31
34
|
}
|
package/.gitattributes
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
name: Build and publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
id-token: write
|
|
10
|
-
contents: read
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build-and-publish:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- name: Checkout repository
|
|
17
|
-
uses: actions/checkout@v4
|
|
18
|
-
|
|
19
|
-
- name: Install Node.js
|
|
20
|
-
uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: '20'
|
|
23
|
-
registry-url: 'https://registry.npmjs.org'
|
|
24
|
-
|
|
25
|
-
- name: Update NPM
|
|
26
|
-
run: npm install -g npm@latest
|
|
27
|
-
|
|
28
|
-
- name: Install dependencies
|
|
29
|
-
run: npm ci
|
|
30
|
-
|
|
31
|
-
- name: Build project
|
|
32
|
-
run: npm run build --if-present
|
|
33
|
-
|
|
34
|
-
- name: Publish artifact
|
|
35
|
-
run: npm publish
|
package/src/index.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
-
import degit from "degit";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
|
|
8
|
-
import { execSync } from "node:child_process";
|
|
9
|
-
|
|
10
|
-
const cwd = process.cwd();
|
|
11
|
-
|
|
12
|
-
(async () => {
|
|
13
|
-
|
|
14
|
-
console.log("🚀 Creating frontend app...\n");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const tempFolderPath = path.join(os.tmpdir(), `${Date.now()}-create-frontend-app`);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
console.log("\t- 🔃 Generating Next.js app...");
|
|
22
|
-
|
|
23
|
-
execSync("npx create-next-app . --yes --empty --skip-install");
|
|
24
|
-
|
|
25
|
-
console.log("\t ✅ Generated Next.js app!\n");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
console.log("\t- 🔃 Cloning files from template...");
|
|
31
|
-
|
|
32
|
-
const emitter = degit("LarsSK06/create-frontend-app/template");
|
|
33
|
-
|
|
34
|
-
await emitter.clone(tempFolderPath);
|
|
35
|
-
|
|
36
|
-
for (const objName of fs.readdirSync(tempFolderPath)) {
|
|
37
|
-
const absoluteCwdPath = path.join(cwd, objName);
|
|
38
|
-
const absoluteTempFolderPath = path.join(tempFolderPath, objName);
|
|
39
|
-
|
|
40
|
-
if (fs.existsSync(absoluteCwdPath)) {
|
|
41
|
-
const stat = fs.statSync(absoluteCwdPath);
|
|
42
|
-
|
|
43
|
-
if (stat.isFile()) fs.unlinkSync(absoluteCwdPath);
|
|
44
|
-
else fs.rmSync(absoluteCwdPath, { recursive: true, force: true });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
fs.cpSync(
|
|
48
|
-
absoluteTempFolderPath,
|
|
49
|
-
absoluteCwdPath,
|
|
50
|
-
{ recursive: true }
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log("\t ✅ Cloned files from template!\n");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
console.log("\t- 🔃 Formatting files...");
|
|
60
|
-
|
|
61
|
-
for (const fileName of [
|
|
62
|
-
"package.json",
|
|
63
|
-
"package-lock.json",
|
|
64
|
-
"tsconfig.json"
|
|
65
|
-
]) {
|
|
66
|
-
const absolutePath = path.join(cwd, fileName);
|
|
67
|
-
|
|
68
|
-
if (!fs.existsSync(absolutePath))
|
|
69
|
-
continue;
|
|
70
|
-
|
|
71
|
-
const fileContent = fs.readFileSync(absolutePath).toString();
|
|
72
|
-
|
|
73
|
-
fs.writeFileSync(
|
|
74
|
-
absolutePath,
|
|
75
|
-
JSON.stringify(JSON.parse(fileContent), null, 4)
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
console.log("\t ✅ Formatted files!\n");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
console.log("\t- 🔃 Deleting unnecessary files...");
|
|
85
|
-
|
|
86
|
-
for (const objName of [
|
|
87
|
-
"README.md"
|
|
88
|
-
]) {
|
|
89
|
-
const absolutePath = path.join(cwd, objName);
|
|
90
|
-
|
|
91
|
-
if (!fs.existsSync(absolutePath))
|
|
92
|
-
continue;
|
|
93
|
-
|
|
94
|
-
const stat = fs.statSync(absolutePath);
|
|
95
|
-
|
|
96
|
-
if (stat.isFile()) fs.unlinkSync(absolutePath);
|
|
97
|
-
else fs.rmSync(absolutePath, { recursive: true, force: true });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
console.log("\t ✅ Deleted unnecessary files!\n");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
console.log("\t- 🔃 Installing dependencies...");
|
|
106
|
-
|
|
107
|
-
const packageNames = [
|
|
108
|
-
"@mantine/core",
|
|
109
|
-
"@mantine/hooks",
|
|
110
|
-
"@tabler/icons-react",
|
|
111
|
-
"i18next",
|
|
112
|
-
"react-i18next"
|
|
113
|
-
];
|
|
114
|
-
|
|
115
|
-
execSync(`npm i ${packageNames.join(" ")}`);
|
|
116
|
-
|
|
117
|
-
console.log("\t ✅ Installed dependencies!\n");
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
console.log("\t- 🔃 Installing development dependencies...");
|
|
123
|
-
|
|
124
|
-
const packageNames = [
|
|
125
|
-
"postcss",
|
|
126
|
-
"postcss-preset-mantine",
|
|
127
|
-
"postcss-simple-vars"
|
|
128
|
-
];
|
|
129
|
-
|
|
130
|
-
execSync(`npm i --save-dev ${packageNames.join(" ")}`);
|
|
131
|
-
|
|
132
|
-
console.log("\t ✅ Installed development dependencies!");
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
})();
|
package/template/next.config.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import policy from "@/utils/csp-policy";
|
|
2
|
-
|
|
3
|
-
import { NextConfig } from "next";
|
|
4
|
-
|
|
5
|
-
const nextConfig: NextConfig = {
|
|
6
|
-
async headers() {
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
source: "/(.*)",
|
|
10
|
-
headers: [
|
|
11
|
-
{
|
|
12
|
-
key: "Content-Security-Policy",
|
|
13
|
-
value: policy
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
];
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default nextConfig;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
plugins: ["@tailwindcss/postcss"],
|
|
3
|
-
plugins: {
|
|
4
|
-
"@tailwindcss/postcss": {},
|
|
5
|
-
"postcss-preset-mantine": {},
|
|
6
|
-
"postcss-simple-vars": {
|
|
7
|
-
variables: {
|
|
8
|
-
"mantine-breakpoint-xs": "36em",
|
|
9
|
-
"mantine-breakpoint-sm": "48em",
|
|
10
|
-
"mantine-breakpoint-md": "62em",
|
|
11
|
-
"mantine-breakpoint-lg": "75em",
|
|
12
|
-
"mantine-breakpoint-xl": "88em"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default config;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# https://securitytxt.org/
|
|
2
|
-
# Fields marked with * are required
|
|
3
|
-
|
|
4
|
-
# Contact *
|
|
5
|
-
Contact: mailto:your.email@example.com
|
|
6
|
-
|
|
7
|
-
# Expires *(max 1)
|
|
8
|
-
Expires: YYYY-MM-DDThh:mm:ss.SSSZ
|
|
9
|
-
|
|
10
|
-
# Encryption
|
|
11
|
-
Encryption: https://example.com/encryption
|
|
12
|
-
|
|
13
|
-
# Acknowledgments
|
|
14
|
-
Acknowledgments: https://example.com/acknowledgments
|
|
15
|
-
|
|
16
|
-
# Preferred languages (max 1)
|
|
17
|
-
Preferred-Languages: en,no
|
|
18
|
-
|
|
19
|
-
# Canonical
|
|
20
|
-
Canonical: https://example.com/security.txt
|
|
21
|
-
|
|
22
|
-
# Policy
|
|
23
|
-
Policy: https://example.com/policy
|
|
24
|
-
|
|
25
|
-
# Hiring
|
|
26
|
-
Hiring: https://example.com/hiring
|
|
27
|
-
|
|
28
|
-
# CSAF
|
|
29
|
-
CSAF: https://example.com/csaf-provider-metadata.json
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Metadata } from "next";
|
|
2
|
-
import { ColorSchemeScript, mantineHtmlProps } from "@mantine/core";
|
|
3
|
-
|
|
4
|
-
import ParentProps from "@/types/common/ParentProps";
|
|
5
|
-
import Providers from "@/components/common/Providers";
|
|
6
|
-
|
|
7
|
-
import "@/css/globals.css";
|
|
8
|
-
|
|
9
|
-
// https://seostudio.tools/meta-tag-generator
|
|
10
|
-
// https://www.searchenginejournal.com/important-tags-seo/156440/
|
|
11
|
-
|
|
12
|
-
export const metadata = {
|
|
13
|
-
title: "Frontend template",
|
|
14
|
-
description: "My preferred template for frontend projects - tailored to my needs",
|
|
15
|
-
applicationName: "Frontend template",
|
|
16
|
-
authors: [{
|
|
17
|
-
url: "https://lars.kvihaugen.no",
|
|
18
|
-
name: "Lars Kvihaugen"
|
|
19
|
-
}],
|
|
20
|
-
generator: "Next.js",
|
|
21
|
-
keywords: [
|
|
22
|
-
"next.js",
|
|
23
|
-
"next",
|
|
24
|
-
"react",
|
|
25
|
-
"frontend",
|
|
26
|
-
"development",
|
|
27
|
-
"dev"
|
|
28
|
-
],
|
|
29
|
-
referrer: "origin",
|
|
30
|
-
creator: "Lars Kvihaugen",
|
|
31
|
-
publisher: "Lars Kvihaugen",
|
|
32
|
-
robots: {
|
|
33
|
-
index: true,
|
|
34
|
-
follow: true
|
|
35
|
-
},
|
|
36
|
-
alternates: {
|
|
37
|
-
canonical: "https://frontend-template.kvihaugen.no",
|
|
38
|
-
languages: {
|
|
39
|
-
en: "https://frontend-template.kvihaugen.no",
|
|
40
|
-
no: "https://no.frontend-template.kvihaugen.no"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
icons: {
|
|
44
|
-
icon: [{
|
|
45
|
-
url: "/icons/icon-128x128.png",
|
|
46
|
-
sizes: "128x128"
|
|
47
|
-
}],
|
|
48
|
-
apple: [{
|
|
49
|
-
url: "/icons/icon-apple/128x128.png",
|
|
50
|
-
sizes: "128x128"
|
|
51
|
-
}]
|
|
52
|
-
},
|
|
53
|
-
manifest: "/.well-known/app.webmanifest",
|
|
54
|
-
openGraph: {
|
|
55
|
-
type: "website",
|
|
56
|
-
title: "Frontend template",
|
|
57
|
-
description: "My preferred template for frontend projects - tailored to my needs",
|
|
58
|
-
emails: ["lars@kvihaugen.no"],
|
|
59
|
-
phoneNumbers: ["+00 000 00 000"],
|
|
60
|
-
siteName: "Frontend template",
|
|
61
|
-
locale: "en",
|
|
62
|
-
alternateLocale: ["no"],
|
|
63
|
-
images: [{
|
|
64
|
-
url: "/images/hero.png",
|
|
65
|
-
alt: "The page hero",
|
|
66
|
-
width: 1920,
|
|
67
|
-
height: 1080
|
|
68
|
-
}],
|
|
69
|
-
url: "https://frontend-template.kvihaugen.no"
|
|
70
|
-
},
|
|
71
|
-
metadataBase: new URL("https://frontend-template.kvihaugen.no")
|
|
72
|
-
} satisfies Metadata as Metadata;
|
|
73
|
-
|
|
74
|
-
const RootLayout = ({ children }: ParentProps) => (
|
|
75
|
-
<html {...mantineHtmlProps}>
|
|
76
|
-
<head>
|
|
77
|
-
<ColorSchemeScript />
|
|
78
|
-
</head>
|
|
79
|
-
<body className="antialiased">
|
|
80
|
-
<Providers>
|
|
81
|
-
{children}
|
|
82
|
-
</Providers>
|
|
83
|
-
</body>
|
|
84
|
-
</html>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
export default RootLayout;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import ParentProps from "@/types/common/ParentProps";
|
|
4
|
-
|
|
5
|
-
import { createTheme, MantineProvider } from "@mantine/core";
|
|
6
|
-
|
|
7
|
-
import "@/utils/i18n";
|
|
8
|
-
|
|
9
|
-
const theme = createTheme({});
|
|
10
|
-
|
|
11
|
-
const Providers = ({ children }: ParentProps) => (
|
|
12
|
-
<MantineProvider theme={theme}>
|
|
13
|
-
{children}
|
|
14
|
-
</MantineProvider>
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export default Providers;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#fetch_directives
|
|
2
|
-
// https://www.validbot.com/tools/csp-wizard.php
|
|
3
|
-
|
|
4
|
-
const policy = `
|
|
5
|
-
|
|
6
|
-
default-src 'self';
|
|
7
|
-
script-src 'self' 'unsafe-inline' 'unsafe-eval';
|
|
8
|
-
connect-src 'self';
|
|
9
|
-
img-src 'self' data: blob:;
|
|
10
|
-
style-src 'self' 'unsafe-inline';
|
|
11
|
-
frame-src;
|
|
12
|
-
|
|
13
|
-
`.replaceAll("\n", " ").trim();
|
|
14
|
-
|
|
15
|
-
export default policy;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useMantineColorScheme } from "@mantine/core";
|
|
2
|
-
import { useEffect, useMemo, useState } from "react";
|
|
3
|
-
|
|
4
|
-
const useColorScheme = () => {
|
|
5
|
-
const [isBrowserColorSchemeDark, setIsBrowserColorSchemeDark] = useState<boolean>(false);
|
|
6
|
-
|
|
7
|
-
const { colorScheme } = useMantineColorScheme();
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const handleSetAccordingColorScheme = () => setIsBrowserColorSchemeDark(window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
11
|
-
|
|
12
|
-
handleSetAccordingColorScheme();
|
|
13
|
-
|
|
14
|
-
window.addEventListener("change", handleSetAccordingColorScheme);
|
|
15
|
-
|
|
16
|
-
return () => window.removeEventListener("change", handleSetAccordingColorScheme);
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
const isColorSchemeDark = useMemo(() => (
|
|
20
|
-
(colorScheme === "auto" && isBrowserColorSchemeDark) ||
|
|
21
|
-
colorScheme === "dark"
|
|
22
|
-
), [isBrowserColorSchemeDark, colorScheme]);
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
isDark: isColorSchemeDark,
|
|
26
|
-
isLight: !isColorSchemeDark
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default useColorScheme;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useMantineTheme } from "@mantine/core";
|
|
2
|
-
|
|
3
|
-
import useColorScheme from "./useColorScheme";
|
|
4
|
-
|
|
5
|
-
const usePrimaryColorShade = () => {
|
|
6
|
-
const { primaryColor, primaryShade, colors } = useMantineTheme();
|
|
7
|
-
const { isDark: isColorSchemeDark } = useColorScheme();
|
|
8
|
-
|
|
9
|
-
const shadeIndexer =
|
|
10
|
-
typeof primaryShade === "object"
|
|
11
|
-
? primaryShade[isColorSchemeDark ? "dark" : "light"]
|
|
12
|
-
: primaryShade;
|
|
13
|
-
|
|
14
|
-
return colors[primaryColor][shadeIndexer];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default usePrimaryColorShade;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import i18next from "i18next";
|
|
2
|
-
import en from "./resources/en.json";
|
|
3
|
-
|
|
4
|
-
import { initReactI18next } from "react-i18next";
|
|
5
|
-
|
|
6
|
-
i18next
|
|
7
|
-
.use(initReactI18next)
|
|
8
|
-
.init({
|
|
9
|
-
resources: { en },
|
|
10
|
-
lng: "en",
|
|
11
|
-
fallbackLng: "en",
|
|
12
|
-
interpolation: {
|
|
13
|
-
escapeValue: false
|
|
14
|
-
}
|
|
15
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"rootDir": "./src",
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"module": "nodenext",
|
|
6
|
-
"target": "esnext",
|
|
7
|
-
"types": ["node"],
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"declarationMap": true,
|
|
11
|
-
"noUncheckedIndexedAccess": true,
|
|
12
|
-
"exactOptionalPropertyTypes": true,
|
|
13
|
-
// "noImplicitReturns": true,
|
|
14
|
-
// "noImplicitOverride": true,
|
|
15
|
-
// "noUnusedLocals": true,
|
|
16
|
-
// "noUnusedParameters": true,
|
|
17
|
-
// "noFallthroughCasesInSwitch": true,
|
|
18
|
-
// "noPropertyAccessFromIndexSignature": true,
|
|
19
|
-
"strict": true,
|
|
20
|
-
"jsx": "react-jsx",
|
|
21
|
-
"verbatimModuleSyntax": true,
|
|
22
|
-
"isolatedModules": true,
|
|
23
|
-
"noUncheckedSideEffectImports": true,
|
|
24
|
-
"moduleDetection": "force",
|
|
25
|
-
"skipLibCheck": true
|
|
26
|
-
},
|
|
27
|
-
"include": ["src/**/*"],
|
|
28
|
-
"exclude": ["node_modules", "dist"]
|
|
29
|
-
}
|