Skip to content

Commit

Permalink
feat(target): Add target local (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
pohy authored Mar 23, 2023
1 parent db93147 commit 45b4c15
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ Verify the presence of the authentication parameters, which are set via environm

- `extensionId`: **REQUIRED** parameter. The `extension id` from the webstore. For example: If the url of your extension is [https://chrome.google.com/webstore/detail/webplayer-hotkeys-shortcu/ikmkicnmahfdilneilgibeppbnolgkaf](https://chrome.google.com/webstore/detail/webplayer-hotkeys-shortcu/ikmkicnmahfdilneilgibeppbnolgkaf), then the last portion, `ikmkicnmahfdilneilgibeppbnolgkaf`, will be the `extension id`. You can also take this ID on the [developers dashboard](https://chrome.google.com/webstore/developer/dashboard), under the name `Item ID` located inside the `More info` dialog. This is used so that we can confirm that the credentials are working for the extension you are trying to publish.

- `target`: Valid options are:
- `local`: Skips Chrome store credentials verification

### `prepare`

Writes the correct version to the `manifest.json` and creates a `zip` file with everything inside the `dist` folder.
Expand Down Expand Up @@ -79,6 +82,7 @@ If you decide to make the draft, make sure to fill all the required fields on th
- `default`: The extension will be publicly available to everyone. This is the default option if left blank.
- `draft`: Uploads the extension to the webstore, but skips the publishing step.
- `trustedTesters`: Releases the extension as a [private extension](https://support.google.com/chrome/a/answer/2663860). Defaults to `default`.
- `local`: Skips the publish step

The `asset` parameter is parsed with Lodash template. The following variables are available: `branch`, `lastRelease`, `nextRelease` and `commits`. Search on the [plugins](https://github.com/semantic-release/semantic-release/blob/master/docs/developer-guide/plugin.md) documentation to see the type of those objects.

Expand Down
2 changes: 1 addition & 1 deletion src/@types/pluginConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ interface PluginConfig {
distFolder: string
asset: string
extensionId: string
target: 'default' | 'trustedTesters' | 'draft'
target: 'default' | 'trustedTesters' | 'draft' | 'local'
}

export default PluginConfig
5 changes: 5 additions & 0 deletions src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const publish = async (
{ extensionId, target, asset }: PluginConfig,
{ logger, branch, lastRelease, nextRelease, commits }: Context,
) => {
if (target === 'local') {
logger.log('Target option is set to "local", skipping the publish step.')
return
}

const {
GOOGLE_CLIENT_ID: clientId,
GOOGLE_CLIENT_SECRET: clientSecret,
Expand Down
7 changes: 6 additions & 1 deletion src/verifyConditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ const createErrorEnvFile = (param: string, code: string) =>
)

const verifyConditions = async (
{ extensionId }: PluginConfig,
{ extensionId, target }: PluginConfig,
{ logger }: Context,
) => {
if (target === 'local') {
logger.log('Target option is set to "local". Skipping verification of Chrome store credentials.')
return
}

const { GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN } =
process.env
const errors: Error[] = []
Expand Down

0 comments on commit 45b4c15

Please sign in to comment.