Skip to content

Commit 56dbeeb

Browse files
authored
Merge pull request #151 from akd-io/feature/142-refactor-architecture-to-use-declara
Refactor to declarative plugin architecture
2 parents e6cd7d0 + 5c55d41 commit 56dbeeb

File tree

90 files changed

+1975
-1850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1975
-1850
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"files.exclude": {}
3+
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@
4343
"scripts": {
4444
"prepare": "husky install",
4545
"prepack": "yarn build && oclif-dev readme",
46+
"check-types": "tsc --noEmit",
4647
"build": "rimraf lib && tsc --build",
4748
"test": "yarn build && yarn run test-only",
4849
"test-only": "node lib/tests/e2e/test.js",
4950
"test:manual": "yarn build && node lib/tests/e2e/manual-test.js --debug",
5051
"test:small": "yarn build && node lib/tests/e2e/manual-test.js --debug --package-manager=npm --styling=css-modules",
5152
"test:large": "yarn build && node lib/tests/e2e/manual-test.js --debug --package-manager=yarn --styling=emotion --react-hook-form --formik --prettier --formatting-pre-commit-hook --chakra --framer-motion --github-actions",
53+
"test:cna": "yarn build && node lib/tests/e2e/test-cna.js",
5254
"version": "oclif-dev readme && git add README.md",
5355
"format": "prettier --write --ignore-path=.prettierignore .",
5456
"format:check": "prettier --check --ignore-path=.prettierignore .",
@@ -83,9 +85,10 @@
8385
"eslint-config-prettier": "^8.3.0",
8486
"husky": "^7.0.1",
8587
"lint-staged": "^11.0.0",
88+
"next": "^13.2.4",
8689
"prettier": "^2.3.2",
8790
"ts-node": "^10.0.0",
88-
"typescript": "^4.3.5",
91+
"typescript": "^4.9.0",
8992
"uuid": "^8.3.2"
9093
}
9194
}

prod-assets/templates/LandingPage/LandingPageTemplate.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,23 @@ const LandingPageTemplate = () => {
5656
strategy="afterInteractive"
5757
onLoad={onConfettiLoad}
5858
/>
59+
<style>
60+
{`
61+
* {
62+
box-sizing: border-box;
63+
}
64+
65+
html,
66+
body {
67+
padding: 0;
68+
margin: 0;
69+
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
70+
Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue,
71+
sans-serif;
72+
line-height: 1.5;
73+
}
74+
`}
75+
</style>
5976
<main>
6077
<Section>
6178
<Container center className={styles.headerSection}>

prod-assets/templates/LandingPage/components/InlineCode.module.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
border-radius: 0.5em;
33
padding: 0.5em;
44

5+
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
6+
Bitstream Vera Sans Mono, Courier New, monospace;
57
font-size: 0.8em;
68
background-color: hsl(0, 0%, 95%);
79
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.link {
22
color: #319bff;
3+
text-decoration: none;
4+
font-weight: bold;
35
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const commandInstance: CommandInstance = {
1515
if (commandInstance._instance != null) {
1616
return commandInstance._instance
1717
} else {
18-
throw new Error("commandInstance.get() called before it was set.")
18+
throw new Error("commandInstance accessed before it was set.")
1919
}
2020
},
2121
}

src/main/helpers/constrain.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2+
3+
/**
4+
* Generic constrained identity function (CIF) by Kent C. Dodds
5+
*
6+
* For a lesson on constrained identity functions and this generic version, see the blog post linked below.
7+
*
8+
* When TypeScript 4.9.0 is supported, we'll be able to use `satisfies` instead of this generic CIF.
9+
*
10+
* @see https://kentcdodds.com/blog/how-to-write-a-constrained-identity-function-in-typescript#a-generic-cif
11+
*/
12+
export const constrain =
13+
<Given extends unknown>() =>
14+
<Inferred extends Given>(item: Inferred) =>
15+
item

src/main/helpers/copy-directory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { promises as fs } from "fs"
1+
import fs from "fs/promises"
22
import path from "path"
3+
import { makeDirectory } from "./io"
34

45
export const copyDirectory = async (
56
src: string,
67
dest: string
78
): Promise<void> => {
89
const [entries] = await Promise.all([
910
fs.readdir(src, { withFileTypes: true }),
10-
fs.mkdir(dest, { recursive: true }),
11+
makeDirectory(dest),
1112
])
1213

1314
await Promise.all(
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export type DeeplyReadonly<T> = T extends unknown[]
2+
? DeeplyReadonlyArray<T[number]>
3+
: T extends Record<string, unknown>
4+
? DeeplyReadonlyObject<T>
5+
: T
6+
7+
export type DeeplyReadonlyArray<T> = ReadonlyArray<DeeplyReadonly<T>>
8+
9+
export type DeeplyReadonlyObject<T> = {
10+
readonly [P in keyof T]: DeeplyReadonly<T[P]>
11+
}

src/main/helpers/diff-string.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const getDiffString = (diffInMillis: number): string => {
2+
return new Date(diffInMillis).toISOString().slice(11, 19)
3+
}

0 commit comments

Comments
 (0)