Skip to content

Commit

Permalink
WIP: use json schema to validate config
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Feb 15, 2017
1 parent 38339b9 commit f5e735d
Show file tree
Hide file tree
Showing 16 changed files with 191 additions and 174 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ dist/
/test/out/**/*.map
/test/test-report.xml

/packages/electron-builder/README.md
/packages/electron-builder/README.md
/packages/electron-builder/scheme.json
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ Or you can create Node.js run configuration manually:

### Run Test using CLI
```sh
TEST_APP_TMP_DIR=/tmp/electron-builder-test ./node_modules/.bin/jest --env jest-environment-node-debug -t 'boring' '/TestFileName\.\w+$'
TEST_APP_TMP_DIR=/tmp/electron-builder-test ./node_modules/.bin/jest --env jest-environment-node-debug -t 'boring' '/oneClickInstallerTest\.\w+$'
```

where `TEST_APP_TMP_DIR` is specified to easily inspect and use test build, `boring` is the test name and `test/out/nsisTest.js` is the path to test file.
where `TEST_APP_TMP_DIR` is specified to easily inspect and use test build, `boring` is the test name and `/oneClickInstallerTest\.\w+$` is the path to test file.

Do not forget to execute `yarn compile` before run.

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cache:
- '%USERPROFILE%\.electron'

environment:
TEST_FILES: BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,nsisTest
TEST_FILES: BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest

install:
- ps: Install-Product node 6 x64
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"license": "MIT",
"scripts": {
"compile": "ts-babel packages/electron-builder-http packages/electron-builder-core packages/electron-builder-util packages/electron-builder-publisher packages/electron-builder packages/electron-builder-squirrel-windows packages/electron-updater packages/electron-publisher-s3 test",
"compile": "ts-babel packages/electron-builder-http packages/electron-builder-core packages/electron-builder-util packages/electron-builder-publisher packages/electron-builder packages/electron-builder-squirrel-windows packages/electron-updater packages/electron-publisher-s3 test && node ./test/vendor/yarn.js scheme",
"lint": "node test/out/helpers/lint.js",
"pretest": "node ./test/vendor/yarn.js compile && node ./test/vendor/yarn.js lint && node ./test/vendor/yarn.js lint-deps",
"lint-deps": "node ./test/out/helpers/checkDeps.js",
Expand All @@ -17,7 +17,8 @@
"test-deps-mac": "brew install rpm dpkg mono lzip gnu-tar graphicsmagick xz && brew install wine --without-x11",
"update-deps": "lerna exec -- npm-check-updates --reject 'electron-builder-http,electron-builder-util,electron-builder-core,electron-builder-publisher' -a",
"set-versions": "node test/out/helpers/setVersions.js",
"npm-publish": "yarn compile && ./packages/npm-publish.sh && conventional-changelog -p angular -i CHANGELOG.md -s"
"npm-publish": "yarn compile && ./packages/npm-publish.sh && conventional-changelog -p angular -i CHANGELOG.md -s",
"scheme": "typescript-json-schema packages/electron-builder/tsconfig.json Config --out packages/electron-builder/scheme.json"
},
"//": "repository must be specified otherwise conventional-changelog will use forked repo (currently cloned)",
"repository": "electron-userland/electron-builder",
Expand Down Expand Up @@ -82,6 +83,7 @@
"ts-babel": "^1.3.6",
"tslint": "^4.4.2",
"typescript": "^2.2.0",
"typescript-json-schema": "^0.9.0",
"whitespace": "^2.1.0",
"xml2js": "^0.4.17"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export abstract class Target {
}

export interface TargetSpecificOptions {
/*
/**
The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern).
*/
readonly artifactName?: string | null
Expand Down
36 changes: 18 additions & 18 deletions packages/electron-builder-http/src/publishOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export type PublishProvider = "github" | "bintray" | "s3" | "generic"

export type Publish = string | Array<string> | PublishConfiguration | GithubOptions | S3Options | BintrayOptions | GenericServerOptions | Array<PublishConfiguration> | Array<GithubOptions> | Array<S3Options> | Array<GenericServerOptions> | Array<BintrayOptions> | null

/*
/**
### `publish`
Can be specified in the [config](https://github.com/electron-userland/electron-builder/wiki/Options#configuration-options) or any platform- or target- specific options.
Expand All @@ -16,24 +16,24 @@ Array of option objects. Order is important — first item will be used as a def
Amazon S3 — `https` must be used, so, if you use direct Amazon S3 endpoints, format `https://s3.amazonaws.com/bucket_name` [must be used](http://stackoverflow.com/a/11203685/1910191). And do not forget to make files/directories public.
*/
export interface PublishConfiguration {
/*
/**
The provider, one of `github`, `s3`, `bintray`, `generic`.
*/
provider: PublishProvider

/*
/**
The owner.
*/
owner?: string | null

token?: string | null
}

/*
/**
### `publish` Generic (any HTTP(S) server)
*/
export interface GenericServerOptions extends PublishConfiguration {
/*
/**
The base url. e.g. `https://bucket_name.s3.amazonaws.com`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.
*/
url: string
Expand All @@ -44,18 +44,18 @@ export interface GenericServerOptions extends PublishConfiguration {
channel?: string | null
}

/*
/**
### `publish` Amazon S3
[Getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).
*/
export interface S3Options extends PublishConfiguration {
/*
/**
The bucket name.
*/
bucket: string

/*
/**
The directory path. Defaults to `/`.
*/
path?: string | null
Expand All @@ -70,7 +70,7 @@ export interface S3Options extends PublishConfiguration {
*/
acl?: "private" | "public-read" | null

/*
/**
The type of storage to use for the object. One of `STANDARD`, `REDUCED_REDUNDANCY`, `STANDARD_IA`. Defaults to `STANDARD`.
*/
storageClass?: "STANDARD" | "REDUCED_REDUNDANCY" | "STANDARD_IA" | null
Expand Down Expand Up @@ -100,26 +100,26 @@ export interface UpdateInfo extends VersionInfo {
readonly releaseDate: string
}

/*
/**
### `publish` GitHub
*/
export interface GithubOptions extends PublishConfiguration {
/*
/**
The repository name. [Detected automatically](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#github-repository).
*/
repo?: string | null

/*
/**
Whether to use `v`-prefixed tag name. Defaults to `true`.
*/
vPrefixedTagName?: boolean

/*
/**
The host (including the port if need). Defaults to `github.com`.
*/
host?: string | null

/*
/**
The protocol, one of `https` or `http`. Defaults to `https`.
GitHub Publisher supports only `https`.
Expand All @@ -131,21 +131,21 @@ export function githubUrl(options: GithubOptions) {
return `${options.protocol || "https"}://${options.host || "github.com"}`
}

/*
/**
### `publish` Bintray
*/
export interface BintrayOptions extends PublishConfiguration {
/*
/**
The Bintray package name.
*/
package?: string | null

/*
/**
The Bintray repository name. Defaults to `generic`.
*/
repo?: string | null

/*
/**
The Bintray user account. Used in cases where the owner is an organization.
*/
user?: string | null
Expand Down
Loading

0 comments on commit f5e735d

Please sign in to comment.