feat: Generate setup scripts from metadata.

This commit is contained in:
Peter Johanson 2021-07-26 00:25:34 -04:00 committed by Pete Johanson
parent 683991aa93
commit b82bbb5ba2
8 changed files with 559 additions and 387 deletions

View File

@ -1,3 +1,5 @@
node_modules
build
.docusaurus
.docusaurus
*.mustache
hardware-metadata.json

View File

@ -12,6 +12,7 @@ module.exports = {
path.resolve(__dirname, "src/docusaurus-tree-sitter-plugin"),
path.resolve(__dirname, "src/hardware-metadata-collection-plugin"),
path.resolve(__dirname, "src/hardware-schema-typescript-plugin"),
path.resolve(__dirname, "src/setup-script-generation-plugin"),
],
themeConfig: {
colorMode: {

352
docs/package-lock.json generated
View File

@ -24213,11 +24213,11 @@
}
},
"@babel/generator": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.8.tgz",
"integrity": "sha512-cYDUpvIzhBVnMzRoY1fkSEhK/HmwEVwlyULYgn/tMQYd6Obag3ylCjONle3gdErfXBW61SVTlR9QR7uWlgeIkg==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.5.tgz",
"integrity": "sha512-y3rlP+/G25OIX3mYKKIOlQRcqj7YgrvHxOLbVmyLJ9bPmi5ttvUmpydVjcFjZphOktWuA7ovbx91ECloWTfjIA==",
"requires": {
"@babel/types": "^7.14.8",
"@babel/types": "^7.14.5",
"jsesc": "^2.5.1",
"source-map": "^0.5.0"
}
@ -24265,18 +24265,18 @@
}
},
"@babel/helper-module-transforms": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.14.8.tgz",
"integrity": "sha512-RyE+NFOjXn5A9YU1dkpeBaduagTlZ0+fccnIcAGbv1KGUlReBj7utF7oEth8IdIBQPcux0DDgW5MFBH2xu9KcA==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.14.5.tgz",
"integrity": "sha512-iXpX4KW8LVODuAieD7MzhNjmM6dzYY5tfRqT+R9HDXWl0jPn/djKmA+G9s/2C2T9zggw5tK1QNqZ70USfedOwA==",
"requires": {
"@babel/helper-module-imports": "^7.14.5",
"@babel/helper-replace-supers": "^7.14.5",
"@babel/helper-simple-access": "^7.14.8",
"@babel/helper-simple-access": "^7.14.5",
"@babel/helper-split-export-declaration": "^7.14.5",
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"@babel/template": "^7.14.5",
"@babel/traverse": "^7.14.8",
"@babel/types": "^7.14.8"
"@babel/traverse": "^7.14.5",
"@babel/types": "^7.14.5"
}
},
"@babel/helper-optimise-call-expression": {
@ -24304,11 +24304,11 @@
}
},
"@babel/helper-simple-access": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz",
"integrity": "sha512-TrFN4RHh9gnWEU+s7JloIho2T76GPwRHhdzOWLqTrMnlas8T9O7ec+oEDNsRXndOmru9ymH9DFrEOxpzPoSbdg==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.5.tgz",
"integrity": "sha512-nfBN9xvmCt6nrMZjfhkl7i0oTV3yxR4/FztsbOASyTvVcoYd0TRHh7eMLdlEcCqobydC0LAF3LtC92Iwxo0wyw==",
"requires": {
"@babel/types": "^7.14.8"
"@babel/types": "^7.14.5"
}
},
"@babel/helper-split-export-declaration": {
@ -24320,9 +24320,15 @@
}
},
"@babel/helper-validator-identifier": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
"integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.14.5.tgz",
"integrity": "sha512-3i1Qe9/8x/hCHINujn+iuHy+mMRLoc77b2nI9TB0zjH1hvn9qGlXjWlggdwUcju36PkPCy/lpM7LLUdcTyH4Ow==",
"requires": {
"@babel/helper-member-expression-to-functions": "^7.14.5",
"@babel/helper-optimise-call-expression": "^7.14.5",
"@babel/traverse": "^7.14.5",
"@babel/types": "^7.14.5"
}
},
"@babel/highlight": {
"version": "7.14.5",
@ -24335,9 +24341,9 @@
}
},
"@babel/parser": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.8.tgz",
"integrity": "sha512-syoCQFOoo/fzkWDeM0dLEZi5xqurb5vuyzwIMNZRNun+N/9A4cUZeQaE7dTrB8jGaKuJRBtEOajtnmw0I5hvvA=="
"version": "7.14.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.7.tgz",
"integrity": "sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA=="
},
"@babel/template": {
"version": "7.14.5",
@ -24350,27 +24356,27 @@
}
},
"@babel/traverse": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.8.tgz",
"integrity": "sha512-kexHhzCljJcFNn1KYAQ6A5wxMRzq9ebYpEDV4+WdNyr3i7O44tanbDOR/xjiG2F3sllan+LgwK+7OMk0EmydHg==",
"version": "7.14.7",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.7.tgz",
"integrity": "sha512-9vDr5NzHu27wgwejuKL7kIOm4bwEtaPQ4Z6cpCmjSuaRqpH/7xc4qcGEscwMqlkwgcXl6MvqoAjZkQ24uSdIZQ==",
"requires": {
"@babel/code-frame": "^7.14.5",
"@babel/generator": "^7.14.8",
"@babel/generator": "^7.14.5",
"@babel/helper-function-name": "^7.14.5",
"@babel/helper-hoist-variables": "^7.14.5",
"@babel/helper-split-export-declaration": "^7.14.5",
"@babel/parser": "^7.14.8",
"@babel/types": "^7.14.8",
"@babel/parser": "^7.14.7",
"@babel/types": "^7.14.5",
"debug": "^4.1.0",
"globals": "^11.1.0"
}
},
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
},
@ -25150,16 +25156,16 @@
}
},
"@babel/helper-validator-identifier": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
"integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz",
"integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg=="
},
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
}
@ -25229,11 +25235,11 @@
}
},
"@babel/generator": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.8.tgz",
"integrity": "sha512-cYDUpvIzhBVnMzRoY1fkSEhK/HmwEVwlyULYgn/tMQYd6Obag3ylCjONle3gdErfXBW61SVTlR9QR7uWlgeIkg==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.5.tgz",
"integrity": "sha512-y3rlP+/G25OIX3mYKKIOlQRcqj7YgrvHxOLbVmyLJ9bPmi5ttvUmpydVjcFjZphOktWuA7ovbx91ECloWTfjIA==",
"requires": {
"@babel/types": "^7.14.8",
"@babel/types": "^7.14.5",
"jsesc": "^2.5.1",
"source-map": "^0.5.0"
}
@ -25247,13 +25253,13 @@
}
},
"@babel/helper-create-class-features-plugin": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.8.tgz",
"integrity": "sha512-bpYvH8zJBWzeqi1o+co8qOrw+EXzQ/0c74gVmY205AWXy9nifHrOg77y+1zwxX5lXE7Icq4sPlSQ4O2kWBrteQ==",
"version": "7.14.6",
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.6.tgz",
"integrity": "sha512-Z6gsfGofTxH/+LQXqYEK45kxmcensbzmk/oi8DmaQytlQCgqNZt9XQF8iqlI/SeXWVjaMNxvYvzaYw+kh42mDg==",
"requires": {
"@babel/helper-annotate-as-pure": "^7.14.5",
"@babel/helper-function-name": "^7.14.5",
"@babel/helper-member-expression-to-functions": "^7.14.7",
"@babel/helper-member-expression-to-functions": "^7.14.5",
"@babel/helper-optimise-call-expression": "^7.14.5",
"@babel/helper-replace-supers": "^7.14.5",
"@babel/helper-split-export-declaration": "^7.14.5"
@ -25326,9 +25332,9 @@
}
},
"@babel/helper-validator-identifier": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
"integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz",
"integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg=="
},
"@babel/highlight": {
"version": "7.14.5",
@ -25341,9 +25347,9 @@
}
},
"@babel/parser": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.8.tgz",
"integrity": "sha512-syoCQFOoo/fzkWDeM0dLEZi5xqurb5vuyzwIMNZRNun+N/9A4cUZeQaE7dTrB8jGaKuJRBtEOajtnmw0I5hvvA=="
"version": "7.14.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.7.tgz",
"integrity": "sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA=="
},
"@babel/plugin-syntax-typescript": {
"version": "7.14.5",
@ -25364,27 +25370,27 @@
}
},
"@babel/traverse": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.8.tgz",
"integrity": "sha512-kexHhzCljJcFNn1KYAQ6A5wxMRzq9ebYpEDV4+WdNyr3i7O44tanbDOR/xjiG2F3sllan+LgwK+7OMk0EmydHg==",
"version": "7.14.7",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.7.tgz",
"integrity": "sha512-9vDr5NzHu27wgwejuKL7kIOm4bwEtaPQ4Z6cpCmjSuaRqpH/7xc4qcGEscwMqlkwgcXl6MvqoAjZkQ24uSdIZQ==",
"requires": {
"@babel/code-frame": "^7.14.5",
"@babel/generator": "^7.14.8",
"@babel/generator": "^7.14.5",
"@babel/helper-function-name": "^7.14.5",
"@babel/helper-hoist-variables": "^7.14.5",
"@babel/helper-split-export-declaration": "^7.14.5",
"@babel/parser": "^7.14.8",
"@babel/types": "^7.14.8",
"@babel/parser": "^7.14.7",
"@babel/types": "^7.14.5",
"debug": "^4.1.0",
"globals": "^11.1.0"
}
},
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
},
@ -25473,16 +25479,16 @@
"integrity": "sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ=="
},
"@babel/helper-validator-identifier": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
"integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz",
"integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg=="
},
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
}
@ -25663,9 +25669,9 @@
}
},
"@babel/helper-validator-identifier": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
"integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz",
"integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg=="
},
"@babel/highlight": {
"version": "7.14.5",
@ -25678,9 +25684,9 @@
}
},
"@babel/parser": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.8.tgz",
"integrity": "sha512-syoCQFOoo/fzkWDeM0dLEZi5xqurb5vuyzwIMNZRNun+N/9A4cUZeQaE7dTrB8jGaKuJRBtEOajtnmw0I5hvvA=="
"version": "7.14.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.7.tgz",
"integrity": "sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA=="
},
"ansi-styles": {
"version": "3.2.1",
@ -25744,21 +25750,21 @@
}
},
"@babel/generator": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.8.tgz",
"integrity": "sha512-cYDUpvIzhBVnMzRoY1fkSEhK/HmwEVwlyULYgn/tMQYd6Obag3ylCjONle3gdErfXBW61SVTlR9QR7uWlgeIkg==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.5.tgz",
"integrity": "sha512-y3rlP+/G25OIX3mYKKIOlQRcqj7YgrvHxOLbVmyLJ9bPmi5ttvUmpydVjcFjZphOktWuA7ovbx91ECloWTfjIA==",
"requires": {
"@babel/types": "^7.14.8",
"@babel/types": "^7.14.5",
"jsesc": "^2.5.1",
"source-map": "^0.5.0"
},
"dependencies": {
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
}
@ -25775,11 +25781,11 @@
},
"dependencies": {
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
}
@ -25794,11 +25800,11 @@
},
"dependencies": {
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
}
@ -25813,20 +25819,20 @@
},
"dependencies": {
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
}
}
},
"@babel/helper-validator-identifier": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
"integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz",
"integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg=="
},
"@babel/highlight": {
"version": "7.14.5",
@ -25839,9 +25845,9 @@
}
},
"@babel/parser": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.8.tgz",
"integrity": "sha512-syoCQFOoo/fzkWDeM0dLEZi5xqurb5vuyzwIMNZRNun+N/9A4cUZeQaE7dTrB8jGaKuJRBtEOajtnmw0I5hvvA=="
"version": "7.14.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.7.tgz",
"integrity": "sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA=="
},
"@babel/template": {
"version": "7.14.5",
@ -25854,11 +25860,11 @@
},
"dependencies": {
"@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
"integrity": "sha512-iob4soQa7dZw8nodR/KlOQkPh9S4I8RwCxwRIFuiMRYjOzH/KJzdUfDgz6cGi5dDaclXF4P2PAhCdrBJNIg68Q==",
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz",
"integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==",
"requires": {
"@babel/helper-validator-identifier": "^7.14.8",
"@babel/helper-validator-identifier": "^7.14.5",
"to-fast-properties": "^2.0.0"
}
}
@ -25912,9 +25918,9 @@
},
"dependencies": {
"@babel/helper-validator-identifier": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
"integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
"version": "7.14.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz",
"integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg=="
}
}
},
@ -27345,9 +27351,9 @@
}
},
"@docusaurus/module-type-aliases": {
"version": "2.0.0-alpha.72",
"resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-2.0.0-alpha.72.tgz",
"integrity": "sha512-z8qGXvvyF8FYgnc0c7v5BqulrUJ0A01jsb2gT4miC6Gc/pKnpahZqBXcm1MrQiiUrlHMEjdOAxlHQVZuOwSSRQ==",
"version": "2.0.0-beta.3",
"resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-2.0.0-beta.3.tgz",
"integrity": "sha512-vciejziDBu39cyfmdvbpn865YlvugJMUOeD2m/7Kg4RLUPIZzQTWns0ZGIMc/iToiwebHwkoJtRsHaHzj8FpnA==",
"dev": true
},
"@docusaurus/plugin-content-blog": {
@ -28397,6 +28403,11 @@
}
}
},
"@mdx-js/react": {
"version": "1.6.22",
"resolved": "https://registry.npmjs.org/@mdx-js/react/-/react-1.6.22.tgz",
"integrity": "sha512-TDoPum4SHdfPiGSAaRBw7ECyI8VaHpK8GJugbJIJuqyh6kzw9ZLJZW3HGL3NNrJGxcAixUvqROm+YuQOo5eXtg=="
},
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -30556,9 +30567,9 @@
}
},
"electron-to-chromium": {
"version": "1.3.788",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.788.tgz",
"integrity": "sha512-dbMIpX4E4/Gk4gzOh1GYS7ls1vGsByWKpIqLviJi1mSmSt5BvrWLLtSqpFE5BaC7Ef4NnI0GMaiddNX2Brw6zA=="
"version": "1.3.779",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.779.tgz",
"integrity": "sha512-nreave0y/1Qhmo8XtO6C/LpawNyC6U26+q7d814/e+tIqUK073pM+4xW7WUXyqCRa5K4wdxHmNMBAi8ap9nEew=="
},
"semver": {
"version": "7.0.0",
@ -34767,6 +34778,12 @@
"resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz",
"integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE="
},
"mustache": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
"integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
"dev": true
},
"mz": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
@ -35916,9 +35933,9 @@
}
},
"electron-to-chromium": {
"version": "1.3.788",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.788.tgz",
"integrity": "sha512-dbMIpX4E4/Gk4gzOh1GYS7ls1vGsByWKpIqLviJi1mSmSt5BvrWLLtSqpFE5BaC7Ef4NnI0GMaiddNX2Brw6zA=="
"version": "1.3.779",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.779.tgz",
"integrity": "sha512-nreave0y/1Qhmo8XtO6C/LpawNyC6U26+q7d814/e+tIqUK073pM+4xW7WUXyqCRa5K4wdxHmNMBAi8ap9nEew=="
},
"postcss-value-parser": {
"version": "4.1.0",
@ -35989,9 +36006,9 @@
}
},
"electron-to-chromium": {
"version": "1.3.788",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.788.tgz",
"integrity": "sha512-dbMIpX4E4/Gk4gzOh1GYS7ls1vGsByWKpIqLviJi1mSmSt5BvrWLLtSqpFE5BaC7Ef4NnI0GMaiddNX2Brw6zA=="
"version": "1.3.779",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.779.tgz",
"integrity": "sha512-nreave0y/1Qhmo8XtO6C/LpawNyC6U26+q7d814/e+tIqUK073pM+4xW7WUXyqCRa5K4wdxHmNMBAi8ap9nEew=="
}
}
},
@ -38389,9 +38406,9 @@
}
},
"electron-to-chromium": {
"version": "1.3.788",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.788.tgz",
"integrity": "sha512-dbMIpX4E4/Gk4gzOh1GYS7ls1vGsByWKpIqLviJi1mSmSt5BvrWLLtSqpFE5BaC7Ef4NnI0GMaiddNX2Brw6zA=="
"version": "1.3.779",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.779.tgz",
"integrity": "sha512-nreave0y/1Qhmo8XtO6C/LpawNyC6U26+q7d814/e+tIqUK073pM+4xW7WUXyqCRa5K4wdxHmNMBAi8ap9nEew=="
},
"postcss-selector-parser": {
"version": "6.0.6",
@ -38514,6 +38531,12 @@
}
}
},
"tapable": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz",
"integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==",
"dev": true
},
"terser": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz",
@ -38536,6 +38559,28 @@
}
}
},
"terser-webpack-plugin": {
"version": "5.1.4",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.4.tgz",
"integrity": "sha512-C2WkFwstHDhVEmsmlCxrXUtVklS+Ir1A7twrYzrDrQQOIMOaVAYykaoo/Aq1K0QRkMoY2hhvDQY1cm4jnIMFwA==",
"dev": true,
"requires": {
"jest-worker": "^27.0.2",
"p-limit": "^3.1.0",
"schema-utils": "^3.0.0",
"serialize-javascript": "^6.0.0",
"source-map": "^0.6.1",
"terser": "^5.7.0"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"text-table": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -39203,6 +39248,61 @@
"resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.19.4.tgz",
"integrity": "sha512-8G0xBj05hqZybCqBtW7RPZ/hWEtP3DiLTauQzGJZuZYfVRgw7qj7iaZ+8djNqJ4VPrdOO+pS2dR1JsTbsLxdYg=="
},
"webpack": {
"version": "5.46.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.46.0.tgz",
"integrity": "sha512-qxD0t/KTedJbpcXUmvMxY5PUvXDbF8LsThCzqomeGaDlCA6k998D8yYVwZMvO8sSM3BTEOaD4uzFniwpHaTIJw==",
"dev": true,
"requires": {
"@types/eslint-scope": "^3.7.0",
"@types/estree": "^0.0.50",
"@webassemblyjs/ast": "1.11.1",
"@webassemblyjs/wasm-edit": "1.11.1",
"@webassemblyjs/wasm-parser": "1.11.1",
"acorn": "^8.4.1",
"browserslist": "^4.14.5",
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.8.0",
"es-module-lexer": "^0.7.1",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.4",
"json-parse-better-errors": "^1.0.2",
"loader-runner": "^4.2.0",
"mime-types": "^2.1.27",
"neo-async": "^2.6.2",
"schema-utils": "^3.1.0",
"tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.2.0",
"webpack-sources": "^2.3.1"
},
"dependencies": {
"acorn": {
"version": "8.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz",
"integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"webpack-sources": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.1.tgz",
"integrity": "sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==",
"dev": true,
"requires": {
"source-list-map": "^2.0.1",
"source-map": "^0.6.1"
}
}
}
},
"webpack-bundle-analyzer": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.4.2.tgz",
@ -39671,9 +39771,9 @@
}
},
"url-parse": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz",
"integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==",
"requires": {
"querystringify": "^2.1.1",
"requires-port": "^1.0.0"

View File

@ -26,7 +26,8 @@
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^17.0.2",
"react-toastify": "^7.0.4",
"web-tree-sitter": "^0.19.4"
"web-tree-sitter": "^0.19.4",
"@mdx-js/react": "^1.6.22"
},
"browserslist": {
"production": [
@ -46,12 +47,14 @@
"eslint-plugin-mdx": "^1.13.0",
"eslint-plugin-react": "^7.23.2",
"json-schema-to-typescript": "^10.1.3",
"mustache": "^4.2.0",
"null-loader": "^4.0.0",
"prebuild-webpack-plugin": "^1.1.1",
"prettier": "2.3.1",
"string-replace-loader": "^3.0.3",
"typescript": "^4.2.3",
"@docusaurus/module-type-aliases": "^2.0.0-alpha.72",
"webpack": "^5.46.0",
"@docusaurus/module-type-aliases": "^2.0.0-beta.3",
"@tsconfig/docusaurus": "^1.0.2",
"@types/react": "^17.0.3",
"@types/react-helmet": "^6.1.0",

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2021 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
var PrebuildPlugin = require("prebuild-webpack-plugin");
const fs = require("fs");
const glob = require("glob");
const yaml = require("js-yaml");
const Mustache = require("mustache");
function generateSetupScripts() {
return glob("../app/boards/**/*.zmk.yml", (error, files) => {
const aggregated = files.flatMap((f) =>
yaml.safeLoadAll(fs.readFileSync(f, "utf8"))
);
const data = aggregated.reduce(
(agg, item) => {
switch (item.type) {
case "shield":
item.compatible = true;
item.split = item.siblings?.length > 1;
agg.keyboards.push(item);
break;
case "board":
if (!item.features?.includes("keys")) {
agg.boards.push(item);
}
break;
}
return agg;
},
{ keyboards: [], boards: [] }
);
for (let script_ext of ["sh", "ps1"]) {
const templateBuffer = fs.readFileSync(
`src/templates/setup.${script_ext}.mustache`,
"utf8"
);
const script = Mustache.render(templateBuffer, data);
fs.writeFileSync(`static/setup.${script_ext}`, script);
}
});
}
module.exports = function () {
return {
name: "setup-script-generation-plugin",
configureWebpack() {
return {
plugins: [
new PrebuildPlugin({
build: generateSetupScripts,
}),
],
};
},
};
};

View File

@ -1,205 +1,205 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
$ErrorActionPreference = "Stop"
function Get-Choice-From-Options {
param(
[String[]] $Options,
[String] $Prompt
)
while ($true) {
for ($i = 0; $i -lt $Options.length; $i++) {
Write-Host "$($i + 1)) $($Options[$i])"
}
Write-Host "$($Options.length + 1)) Quit"
$selection = (Read-Host $Prompt) -as [int]
if ($selection -eq $Options.length + 1) {
Write-Host "Goodbye!"
exit 1
}
elseif ($selection -le $Options.length -and $selection -gt 0) {
$choice = $($selection - 1)
break
}
else {
Write-Host "Invalid Option. Try another one."
}
}
return $choice
}
function Test-Git-Config {
param(
[String] $Option,
[String] $ErrMsg
)
git config $Option | Out-Null
if ($lastExitCode -ne 0) {
Write-Host $ErrMsg
exit 1
}
}
try {
git | Out-Null
}
catch [System.Management.Automation.CommandNotFoundException] {
Write-Host "Git is not installed, and is required for this script!"
exit 1
}
Test-Git-Config -Option "user.name" -ErrMsg "Git username not set!`nRun: git config --global user.name 'My Name'"
Test-Git-Config -Option "user.email" -ErrMsg "Git email not set!`nRun: git config --global user.email 'example@myemail.com'"
$permission = (Get-Acl $pwd).Access |
?{$_.IdentityReference -match $env:UserName `
-and $_.FileSystemRights -match "FullControl" `
-or $_.FileSystemRights -match "Write" } |
Select IdentityReference,FileSystemRights
If (-Not $permission){
Write-Host "Sorry, you do not have write permissions in this directory."
Write-Host "Please try running this script again from a directory that you do have write permissions for."
exit 1
}
$repo_path = "https://github.com/zmkfirmware/zmk-config-split-template.git"
$title = "ZMK Config Setup:"
$prompt = "Pick an MCU board"
$options = "nice!nano v1", "nice!nano v2", "QMK Proton-C", "BlueMicro840 (v1)", "makerdiary nRF52840 M.2"
$boards = "nice_nano", "nice_nano_v2", "proton_c", "bluemicro840_v1", "nrf52840_m2"
Write-Host "$title"
Write-Host ""
Write-Host "MCU Board Selection:"
$choice = Get-Choice-From-Options -Options $options -Prompt $prompt
$board = $($boards[$choice])
Write-Host ""
Write-Host "Keyboard Shield Selection:"
$prompt = "Pick a keyboard"
# TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos.
$options = "Kyria", "Lily58", "Corne", "Splitreus62", "Sofle", "Iris", "Reviung41", "RoMac", "RoMac+", "makerdiary M60", "Microdox", "TG4X", "QAZ", "NIBBLE", "Jorne", "Jian", "CRBN", "Tidbit", "Eek!", "BFO-9000", "Helix"
$names = "kyria", "lily58", "corne", "splitreus62", "sofle", "iris", "reviung41", "romac", "romac_plus", "m60", "microdox", "tg4x", "qaz", "nibble", "jorne", "jian", "crbn", "tidbit", "eek", "bfo9000", "helix"
$splits = "y", "y", "y", "y", "y", "y", "n", "n", "n", "n", "y", "n", "n", "n", "y", "y", "n", "n", "n", "n", "y"
$choice = Get-Choice-From-Options -Options $options -Prompt $prompt
$shield_title = $($options[$choice])
$shield = $($names[$choice])
$split = $($splits[$choice])
if ($split -eq "n") {
$repo_path = "https://github.com/zmkfirmware/zmk-config-template.git"
}
$copy_keymap = Read-Host "Copy in the stock keymap for customisation? [Yn]"
if ($copy_keymap -eq "" -or $copy_keymap -eq "Y" -or $copy_keymap -eq "y") {
$copy_keymap = "yes"
}
$github_user = Read-Host "GitHub Username (leave empty to skip GitHub repo creation)"
if ($github_user -ne "") {
$repo_name = Read-Host "GitHub Repo Name [zmk-config]"
if ($repo_name -eq "") {
$repo_name = "zmk-config"
}
$github_repo = Read-Host "GitHub Repo [https://github.com/$github_user/$repo_name.git]"
if ($github_repo -eq "") {
$github_repo = "https://github.com/$github_user/$repo_name.git"
}
}
else {
$repo_name = "zmk-config"
$github_repo = ""
}
Write-Host ""
Write-Host "Preparing a user config for:"
Write-Host "* MCU Board: ${board}"
Write-Host "* Shield: ${shield}"
if ($copy_keymap -eq "yes") {
Write-Host "* Copy Keymap?: Yes"
}
else {
Write-Host "* Copy Keymap?: No"
}
if ($github_repo -ne "") {
Write-Host "* GitHub Repo to Push (please create this in GH first!): $github_repo"
}
Write-Host ""
$do_it = Read-Host "Continue? [Yn]"
if ($do_it -ne "" -and $do_it -ne "Y" -and $do_it -ne "y") {
Write-Host "Aborting..."
exit 1
}
git clone --single-branch "$repo_path" "$repo_name"
Set-Location "$repo_name"
Push-Location config
Invoke-RestMethod -Uri "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.conf" -OutFile "${shield}.conf"
if ($copy_keymap -eq "yes") {
Invoke-RestMethod -Uri "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.keymap" -OutFile "${shield}.keymap"
}
Pop-Location
$build_file = (Get-Content .github/workflows/build.yml).replace("BOARD_NAME", $board)
$build_file = $build_file.replace("SHIELD_NAME", $shield)
$build_file = $build_file.replace("KEYBOARD_TITLE", $shield_title)
if ($board -eq "proton_c") {
$build_file = $build_file.replace("uf2", "hex")
}
Set-Content -Path .github/workflows/build.yml -Value $build_file
Remove-Item -Recurse -Force .git
git init .
git add .
git commit -m "Initial User Config."
if ($github_repo -ne "") {
git remote add origin "$github_repo"
git push --set-upstream origin $(git symbolic-ref --short HEAD)
# If push failed, assume that the origin was incorrect and give instructions on fixing.
if ($lastExitCode -ne 0) {
Write-Host "Remote repository $github_repo not found..."
Write-Host "Check GitHub URL, and try adding again."
Write-Host "Run the following: "
Write-Host " git remote rm origin"
Write-Host " git remote add origin FIXED_URL"
Write-Host " git push --set-upstream origin $(git symbolic-ref --short HEAD)"
Write-Host "Once pushed, your firmware should be availalbe from GitHub Actions at: $actions"
exit 1
}
if ($github_repo -imatch "https") {
$actions = "$($github_repo.substring(0, $github_repo.length - 4))/actions"
Write-Host "Your firmware should be availalbe from GitHub Actions shortly: $actions"
}
}
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
$ErrorActionPreference = "Stop"
function Get-Choice-From-Options {
param(
[String[]] $Options,
[String] $Prompt
)
while ($true) {
for ($i = 0; $i -lt $Options.length; $i++) {
Write-Host "$($i + 1)) $($Options[$i])"
}
Write-Host "$($Options.length + 1)) Quit"
$selection = (Read-Host $Prompt) -as [int]
if ($selection -eq $Options.length + 1) {
Write-Host "Goodbye!"
exit 1
}
elseif ($selection -le $Options.length -and $selection -gt 0) {
$choice = $($selection - 1)
break
}
else {
Write-Host "Invalid Option. Try another one."
}
}
return $choice
}
function Test-Git-Config {
param(
[String] $Option,
[String] $ErrMsg
)
git config $Option | Out-Null
if ($lastExitCode -ne 0) {
Write-Host $ErrMsg
exit 1
}
}
try {
git | Out-Null
}
catch [System.Management.Automation.CommandNotFoundException] {
Write-Host "Git is not installed, and is required for this script!"
exit 1
}
Test-Git-Config -Option "user.name" -ErrMsg "Git username not set!`nRun: git config --global user.name 'My Name'"
Test-Git-Config -Option "user.email" -ErrMsg "Git email not set!`nRun: git config --global user.email 'example@myemail.com'"
$permission = (Get-Acl $pwd).Access |
?{$_.IdentityReference -match $env:UserName `
-and $_.FileSystemRights -match "FullControl" `
-or $_.FileSystemRights -match "Write" } |
Select IdentityReference,FileSystemRights
If (-Not $permission){
Write-Host "Sorry, you do not have write permissions in this directory."
Write-Host "Please try running this script again from a directory that you do have write permissions for."
exit 1
}
$repo_path = "https://github.com/zmkfirmware/zmk-config-split-template.git"
$title = "ZMK Config Setup:"
$prompt = "Pick an MCU board"
$options = {{#boards}}"{{{name}}}", {{/boards}} "" | Where-Object { $_ -ne "" }
$boards = {{#boards}}"{{id}}", {{/boards}} "" | Where-Object { $_ -ne "" }
Write-Host "$title"
Write-Host ""
Write-Host "MCU Board Selection:"
$choice = Get-Choice-From-Options -Options $options -Prompt $prompt
$board = $($boards[$choice])
Write-Host ""
Write-Host "Keyboard Shield Selection:"
$prompt = "Pick a keyboard"
# TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos.
$options = {{#keyboards}}"{{name}}", {{/keyboards}} "" | Where-Object { $_ -ne "" }
$names = {{#keyboards}}"{{id}}", {{/keyboards}} "" | Where-Object { $_ -ne "" }
$splits = {{#keyboards}}"{{#split}}y{{/split}}{{^split}}n{{/split}}", {{/keyboards}} "" | Where-Object { $_ -ne "" }
$choice = Get-Choice-From-Options -Options $options -Prompt $prompt
$shield_title = $($options[$choice])
$shield = $($names[$choice])
$split = $($splits[$choice])
if ($split -eq "n") {
$repo_path = "https://github.com/zmkfirmware/zmk-config-template.git"
}
$copy_keymap = Read-Host "Copy in the stock keymap for customisation? [Yn]"
if ($copy_keymap -eq "" -or $copy_keymap -eq "Y" -or $copy_keymap -eq "y") {
$copy_keymap = "yes"
}
$github_user = Read-Host "GitHub Username (leave empty to skip GitHub repo creation)"
if ($github_user -ne "") {
$repo_name = Read-Host "GitHub Repo Name [zmk-config]"
if ($repo_name -eq "") {
$repo_name = "zmk-config"
}
$github_repo = Read-Host "GitHub Repo [https://github.com/$github_user/$repo_name.git]"
if ($github_repo -eq "") {
$github_repo = "https://github.com/$github_user/$repo_name.git"
}
}
else {
$repo_name = "zmk-config"
$github_repo = ""
}
Write-Host ""
Write-Host "Preparing a user config for:"
Write-Host "* MCU Board: ${board}"
Write-Host "* Shield: ${shield}"
if ($copy_keymap -eq "yes") {
Write-Host "* Copy Keymap?: Yes"
}
else {
Write-Host "* Copy Keymap?: No"
}
if ($github_repo -ne "") {
Write-Host "* GitHub Repo to Push (please create this in GH first!): $github_repo"
}
Write-Host ""
$do_it = Read-Host "Continue? [Yn]"
if ($do_it -ne "" -and $do_it -ne "Y" -and $do_it -ne "y") {
Write-Host "Aborting..."
exit 1
}
git clone --single-branch "$repo_path" "$repo_name"
Set-Location "$repo_name"
Push-Location config
Invoke-RestMethod -Uri "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.conf" -OutFile "${shield}.conf"
if ($copy_keymap -eq "yes") {
Invoke-RestMethod -Uri "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.keymap" -OutFile "${shield}.keymap"
}
Pop-Location
$build_file = (Get-Content .github/workflows/build.yml).replace("BOARD_NAME", $board)
$build_file = $build_file.replace("SHIELD_NAME", $shield)
$build_file = $build_file.replace("KEYBOARD_TITLE", $shield_title)
if ($board -eq "proton_c") {
$build_file = $build_file.replace("uf2", "hex")
}
Set-Content -Path .github/workflows/build.yml -Value $build_file
Remove-Item -Recurse -Force .git
git init .
git add .
git commit -m "Initial User Config."
if ($github_repo -ne "") {
git remote add origin "$github_repo"
git push --set-upstream origin $(git symbolic-ref --short HEAD)
# If push failed, assume that the origin was incorrect and give instructions on fixing.
if ($lastExitCode -ne 0) {
Write-Host "Remote repository $github_repo not found..."
Write-Host "Check GitHub URL, and try adding again."
Write-Host "Run the following: "
Write-Host " git remote rm origin"
Write-Host " git remote add origin FIXED_URL"
Write-Host " git push --set-upstream origin $(git symbolic-ref --short HEAD)"
Write-Host "Once pushed, your firmware should be availalbe from GitHub Actions at: $actions"
exit 1
}
if ($github_repo -imatch "https") {
$actions = "$($github_repo.substring(0, $github_repo.length - 4))/actions"
Write-Host "Your firmware should be availalbe from GitHub Actions shortly: $actions"
}
}

View File

@ -65,71 +65,70 @@ fi
repo_path="https://github.com/zmkfirmware/zmk-config-split-template.git"
title="ZMK Config Setup:"
prompt="Pick an MCU board:"
options=("nice!nano v1" "nice!nano v2" "QMK Proton-C" "BlueMicro840 (v1)" "makerdiary nRF52840 M.2")
echo "$title"
echo ""
echo "MCU Board Selection:"
PS3="$prompt "
echo "Keyboard Selection:"
PS3="Pick a keyboard: "
options=({{#keyboards}}"{{{name}}}" {{/keyboards}})
keyboards_id=({{#keyboards}}"{{id}}" {{/keyboards}})
keyboards_type=({{#keyboards}}"{{type}}" {{/keyboards}})
keyboards_split=({{#keyboards}}"{{#split}}y{{/split}}{{^split}}n{{/split}}" {{/keyboards}})
keyboards_shield=({{#keyboards}}"{{#compatible}}y{{/compatible}}{{^compatible}}n{{/compatible}}" {{/keyboards}})
select opt in "${options[@]}" "Quit"; do
case "$REPLY" in
''|*[!0-9]*) echo "Invalid option. Try another one."; continue;;
1 ) board="nice_nano"; break;;
2 ) board="nice_nano_v2"; break;;
3 ) board="proton_c"; break;;
4 ) board="bluemicro840_v1"; break;;
5 ) board="nrf52840_m2"; break;;
$(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;;
*) echo "Invalid option. Try another one."; continue;;
$(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;;
*)
if [ $REPLY -gt $(( ${#options[@]}+1 )) ] || [ $REPLY -lt 0 ]; then
echo "Invalid option. Try another one."
continue
fi
keyboard_index=$(( $REPLY-1 ))
keyboard=${keyboards_id[$keyboard_index]}
keyboard_title=${options[$keyboard_index]}
split=${keyboards_split[$keyboard_index]}
type=${keyboards_type[$keyboard_index]}
keyboard_shield=${keyboards_shield[$keyboard_index]}
break
;;
esac
done
echo ""
echo "Keyboard Shield Selection:"
if [ "$keyboard_shield" == "y" ]; then
shield=${keyboard}
shield_title=${keyboard_title}
prompt="Pick an keyboard:"
options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "Reviung41" "RoMac" "RoMac+" "makerdiary M60" "Microdox" "TG4X" "QAZ" "NIBBLE" "Jorne" "Jian" "CRBN" "Tidbit" "Eek!" "BFO-9000" "Helix")
prompt="Pick an MCU board:"
options=({{#boards}}"{{{name}}}" {{/boards}})
board_ids=({{#boards}}"{{id}}" {{/boards}})
PS3="$prompt "
# TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos.
# select opt in "${options[@]}" "Other" "Quit"; do
select opt in "${options[@]}" "Quit"; do
echo ""
echo "MCU Board Selection:"
PS3="$prompt "
select opt in "${options[@]}" "Quit"; do
case "$REPLY" in
''|*[!0-9]*) echo "Invalid option. Try another one."; continue;;
case "$REPLY" in
$(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;;
*)
if [ $REPLY -gt $(( ${#options[@]}+1 )) ] || [ $REPLY -lt 0 ]; then
echo "Invalid option. Try another one."
continue
fi
board_index=$(( $REPLY-1 ))
board=${board_ids[$board_index]}
board_title=${options[$board_index]}
break
;;
1 ) shield_title="Kyria" shield="kyria"; split="y"; break;;
2 ) shield_title="Lily58" shield="lily58"; split="y"; break;;
3 ) shield_title="Corne" shield="corne"; split="y"; break;;
4 ) shield_title="Splitreus62" shield="splitreus62"; split="y"; break;;
5 ) shield_title="Sofle" shield="sofle"; split="y"; break;;
6 ) shield_title="Iris" shield="iris"; split="y"; break;;
7 ) shield_title="Reviung41" shield="reviung41"; split="n"; break;;
8 ) shield_title="RoMac" shield="romac"; split="n"; break;;
9 ) shield_title="RoMac+" shield="romac_plus"; split="n"; break;;
10 ) shield_title="M60" shield="m60"; split="n"; break;;
11 ) shield_title="Microdox" shield="microdox"; split="y"; break;;
12 ) shield_title="TG4X" shield="tg4x"; split="n"; break;;
13 ) shield_title="QAZ" shield="qaz"; split="n"; break;;
14 ) shield_title="NIBBLE" shield="nibble"; split="n"; break;;
15 ) shield_title="Jorne" shield="jorne"; split="y"; break;;
16 ) shield_title="Jian" shield="jian"; split="y"; break;;
17 ) shield_title="CRBN" shield="crbn"; split="n"; break;;
18 ) shield_title="Tidbit" shield="tidbit"; split="n"; break;;
19 ) shield_title="Eek!" shield="eek"; split="n"; break;;
20 ) shield_title="BFO-9000" shield="bfo9000"; split="y"; break;;
21 ) shield_title="Helix" shield="helix"; split="y"; break;;
# Add link to docs on adding your own custom shield in your ZMK config!
# $(( ${#options[@]}+1 )) ) echo "Other!"; break;;
$(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
esac
done
else
board=${keyboard}
echo "Support for onboard microcontroller keyboards is still a work in progress."
exit 1
fi
if [ "$split" == "n" ]; then
repo_path="https://github.com/zmkfirmware/zmk-config-template.git"

5
docs/static/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Ignore generated setup script
setup.ps1
setup.sh