Skip to content

Commit

Permalink
Merge pull request #15 from yakisova41/create-type-of-config-for-conf…
Browse files Browse the repository at this point in the history
…igfile

🏷️ Add type of CrxMonkeyConfig for configfile
  • Loading branch information
yakisova41 authored Mar 30, 2024
2 parents d4fd291 + 5a8ceb2 commit 9ec7f7b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
3 changes: 3 additions & 0 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ npx crx-monkey build
###

```js
// @ts-check

/** @type {import('crx-monkey').NonLoadedCrxMonkeyConfig} */
const config = {
manifestJsonPath: './manifest.json',
chromeOutputDir: './dist/chrome',
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,28 @@ Export objects by default in the configuration file.
### Example

```js
// @ts-check

/** @type {import('crx-monkey').NonLoadedCrxMonkeyConfig} */
const config = {
manifestJsonPath: "./manifest.json",
chromeOutputDir: "./dist/chrome",
userscriptOutput: "./dist/userscript.user.js",
manifestJsonPath: './manifest.json',
chromeOutputDir: './dist/chrome',
userscriptOutput: './dist/userscript.user.js',
importIconToUsercript: true,
esBuildOptions: {
// ESbuild options
minify: true
minify: true,
},
devServer: {
port: 3000,
host: "localhost",
host: 'localhost',
websocket: 3001,
},
publicDir: "./public",
publicDir: './public',
userScriptHeader: [
["@author", "me"],
["@grant", "unsageWindow"]
]
['@author', 'me'],
['@grant', 'unsageWindow'],
],
};

export default config;
Expand Down
2 changes: 1 addition & 1 deletion dev/crx-monkey.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

/** @type {import('../packages/crx-monkey/dist/node/main').CrxMonkeyConfig} */
/** @type {import('../packages/crx-monkey/dist/node/main').NonLoadedCrxMonkeyConfig} */
const config = { importIconToUsercript: true };

export default config;
4 changes: 4 additions & 0 deletions packages/crx-monkey/src/node/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export interface CrxMonkeyConfig {
importIconToUsercript: boolean;
}

export type NonLoadedCrxMonkeyConfig = {
[key in keyof CrxMonkeyConfig]?: CrxMonkeyConfig[key];
};

export type UserScriptHeader = Array<[keyof UserScriptHeaderProps, string]>;

export interface UserScriptHeaderProps {
Expand Down

0 comments on commit 9ec7f7b

Please sign in to comment.