@quilted/create 0.1.0

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.
Files changed (35) hide show
  1. package/bin/create-quilt.mjs +2 -0
  2. package/build/cjs/index.cjs +6578 -0
  3. package/build/esm/index.mjs +6549 -0
  4. package/build/tsconfig.tsbuildinfo +1 -0
  5. package/build/typescript/create.d.ts +2 -0
  6. package/build/typescript/create.d.ts.map +1 -0
  7. package/build/typescript/index.d.ts +2 -0
  8. package/build/typescript/index.d.ts.map +1 -0
  9. package/package.json +31 -0
  10. package/quilt.project.ts +7 -0
  11. package/src/create.ts +373 -0
  12. package/src/index.ts +1 -0
  13. package/templates/app/App.tsx +15 -0
  14. package/templates/app/features/Start/Start.module.css +3 -0
  15. package/templates/app/features/Start/Start.tsx +5 -0
  16. package/templates/app/features/Start/index.ts +1 -0
  17. package/templates/app/foundation/Head.tsx +32 -0
  18. package/templates/app/foundation/Http.tsx +104 -0
  19. package/templates/app/foundation/Routes.tsx +7 -0
  20. package/templates/app/package.json +21 -0
  21. package/templates/app/quilt.project.ts +6 -0
  22. package/templates/app/shared/types.ts +1 -0
  23. package/templates/app/tsconfig.json +10 -0
  24. package/templates/package/build/cjs/index.cjs +2 -0
  25. package/templates/package/build/esm/index.mjs +1 -0
  26. package/templates/package/build/esnext/index.esnext +1 -0
  27. package/templates/package/package.json +40 -0
  28. package/templates/package/quilt.project.ts +6 -0
  29. package/templates/package/source/index.ts +1 -0
  30. package/templates/package/tsconfig.json +9 -0
  31. package/templates/workspace/_gitignore +13 -0
  32. package/templates/workspace/_prettierignore +7 -0
  33. package/templates/workspace/package.json +30 -0
  34. package/templates/workspace/quilt.workspace.ts +5 -0
  35. package/tsconfig.json +10 -0
@@ -0,0 +1,104 @@
1
+ import {useCurrentUrl} from '@quilted/quilt';
2
+ import {
3
+ CacheControl,
4
+ ResponseHeader,
5
+ ContentSecurityPolicy,
6
+ PermissionsPolicy,
7
+ StrictTransportSecurity,
8
+ } from '@quilted/quilt/http';
9
+
10
+ export function Http() {
11
+ const isHttps = useCurrentUrl().protocol === 'https:';
12
+
13
+ return (
14
+ <>
15
+ {/**
16
+ * Disables the cache for this page, which is generally the best option
17
+ * when dealing with authenticated content. If your site doesn’t have
18
+ * authentication, or you have a better cache policy that works for your
19
+ * app or deployment, make sure to update this component accordingly!
20
+ *
21
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
22
+ */}
23
+ <CacheControl cache={false} />
24
+
25
+ {/**
26
+ * Sets a strict content security policy for this page. If you load
27
+ * assets from other origins, or want to allow some more dangerous
28
+ * resource loading techniques like `eval`, you can change the
29
+ * `defaultSources` to be less restrictive, or add additional items
30
+ * to the allowlist for more specific directives.
31
+ *
32
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
33
+ */}
34
+ <ContentSecurityPolicy
35
+ // By default, only allow sources from the page’s origin.
36
+ defaultSources={["'self'"]}
37
+ // Includes `'unsafe-inline'` because CSS is often necessary in development,
38
+ // and can be difficult to avoid in production.
39
+ styleSources={["'self'", "'unsafe-inline'"]}
40
+ // Includes `data:` so that an inline image can be used for the favicon.
41
+ // If you do not use the `emoji` or `blank` favicons in your app, and you
42
+ // do not load any other images as data URIs, you can remove this directive.
43
+ imageSources={["'self'", 'data:']}
44
+ // Don’t allow this page to be rendered as a frame from a different origin.
45
+ frameAncestors={false}
46
+ // Ensure that all requests made by this page are made over https, unless
47
+ // it is being served over http (typically, during local development)
48
+ upgradeInsecureRequests={isHttps}
49
+ />
50
+
51
+ {/**
52
+ * Sets a strict permissions policy for this page, which limits access
53
+ * to some native browser features.
54
+ *
55
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
56
+ */}
57
+ <PermissionsPolicy
58
+ // Disables Google’s Federated Learning of Cohorts (“FLoC”) tracking initiative.
59
+ // @see https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea
60
+ interestCohort={false}
61
+ // Don’t use synchronous XHRs!
62
+ // @see https://featurepolicy.info/policies/sync-xhr
63
+ syncXhr={false}
64
+ // Disables access to a few device APIs that are infrequently used
65
+ // and prone to abuse. If your application uses these APIs intentionally,
66
+ // feel free to remove the prop, or pass an array containing the origins
67
+ // that should be allowed to use this feature (e.g., `['self']` to allow
68
+ // only the main page’s origin).
69
+ camera={false}
70
+ microphone={false}
71
+ geolocation={false}
72
+ />
73
+
74
+ {/**
75
+ * Instructs browsers to only load this page over HTTPS using the
76
+ * `Strict-Transport-Security` header.
77
+ *
78
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
79
+ */}
80
+ {isHttps && <StrictTransportSecurity />}
81
+
82
+ {/**
83
+ * Controls how much information about the current page is included in
84
+ * requests (through the `Referer` header). The default value
85
+ * (strict-origin-when-cross-origin) means that only the origin is included
86
+ * for cross-origin requests, while the origin, path, and querystring
87
+ * are included for same-origin requests.
88
+ *
89
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
90
+ */}
91
+ <ResponseHeader
92
+ name="Referrer-Policy"
93
+ value="strict-origin-when-cross-origin"
94
+ />
95
+
96
+ {/**
97
+ * Instructs browsers to respect the MIME type in the `Content-Type` header.
98
+ *
99
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
100
+ */}
101
+ <ResponseHeader name="X-Content-Type-Options" value="nosniff" />
102
+ </>
103
+ );
104
+ }
@@ -0,0 +1,7 @@
1
+ import {useRoutes} from '@quilted/quilt';
2
+
3
+ import {Start} from '../features/Start';
4
+
5
+ export function Routes() {
6
+ return useRoutes([{match: '/', render: () => <Start />}]);
7
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "template-app",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "private": true,
6
+ "dependencies": {},
7
+ "eslintConfig": {
8
+ "extends": "@quilted/eslint-config/app"
9
+ },
10
+ "browserslist": {
11
+ "defaults": [
12
+ "extends @quilted/browserslist-config/defaults"
13
+ ],
14
+ "modules": [
15
+ "extends @quilted/browserslist-config/modules"
16
+ ],
17
+ "evergreen": [
18
+ "extends @quilted/browserslist-config/evergreen"
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,6 @@
1
+ import {createApp, quiltApp} from '@quilted/craft';
2
+
3
+ export default createApp((app) => {
4
+ app.entry('./App');
5
+ app.use(quiltApp());
6
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "@quilted/typescript/app.json",
3
+ "compilerOptions": {
4
+ "outDir": "build/typescript",
5
+ "paths": {
6
+ "~/shared/*": ["./shared/*"]
7
+ }
8
+ },
9
+ "include": ["**/*"]
10
+ }
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "template-package",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": ">=14.0.0"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/<USER>/<REPOSITORY>"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "@quilted:registry": "https://registry.npmjs.org"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "quilt:esnext": "./build/esnext/index.esnext",
20
+ "import": "./build/esm/index.mjs",
21
+ "require": "./build/cjs/index.cjs"
22
+ }
23
+ },
24
+ "types": "./build/typescript/index.d.ts",
25
+ "sideEffects": false,
26
+ "dependencies": {},
27
+ "peerDependencies": {
28
+ "@babel/runtime": ">=7.0.0 <8.0.0"
29
+ },
30
+ "peerDependenciesMeta": {
31
+ "@babel/runtime": {
32
+ "optional": true
33
+ }
34
+ },
35
+ "eslintConfig": {
36
+ "extends": [
37
+ "@quilted/eslint-config/package"
38
+ ]
39
+ }
40
+ }
@@ -0,0 +1,6 @@
1
+ import {createPackage, quiltPackage} from '@quilted/craft';
2
+
3
+ export default createPackage((pkg) => {
4
+ pkg.entry({source: './source/index.ts'});
5
+ pkg.use(quiltPackage());
6
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@quilted/typescript/pkg.json",
3
+ "compilerOptions": {
4
+ "outDir": "build/typescript"
5
+ },
6
+ "include": ["source"],
7
+ "exclude": ["quilt.project.ts", "*.test.ts", "*.test.tsx"],
8
+ "references": []
9
+ }
@@ -0,0 +1,13 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Quilt build outputs
5
+ .quilt/
6
+ build/
7
+
8
+ # Special operating system files
9
+ .DS_STORE
10
+
11
+ # Temporary files
12
+ *.log
13
+
@@ -0,0 +1,7 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Quilt build outputs
5
+ .quilt/
6
+ build/
7
+ packages/*/bin/
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "template-base",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "private": true,
6
+ "scripts": {
7
+ "lint": "quilt lint",
8
+ "test": "quilt test",
9
+ "type-check": "quilt type-check",
10
+ "develop": "quilt develop",
11
+ "build": "quilt build"
12
+ },
13
+ "dependencies": {
14
+ "@quilted/quilt": "^0.5.0",
15
+ "react": "npm:@quilted/react@^0.1.0",
16
+ "react-dom": "npm:@quilted/react@^0.1.0"
17
+ },
18
+ "devDependencies": {
19
+ "@quilted/browserslist-config": "^0.1.0",
20
+ "@quilted/craft": "^0.1.0",
21
+ "@quilted/eslint-config": "^0.1.0",
22
+ "@quilted/prettier": "^0.2.0",
23
+ "@quilted/typescript": "^0.2.0",
24
+ "typescript": "^4.6.0"
25
+ },
26
+ "prettier": "@quilted/prettier",
27
+ "eslintConfig": {
28
+ "extends": "@quilted/eslint-config/workspace"
29
+ }
30
+ }
@@ -0,0 +1,5 @@
1
+ import {createWorkspace, quiltWorkspace} from '@quilted/craft';
2
+
3
+ export default createWorkspace((workspace) => {
4
+ workspace.use(quiltWorkspace());
5
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "@quilted/typescript/pkg.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "build/typescript"
6
+ },
7
+ "include": ["src"],
8
+ "exclude": ["quilt.project.ts", "**/*.test.ts", "**/*.test.tsx"],
9
+ "references": [{"path": "../quilt"}, {"path": "../craft"}]
10
+ }