Skip to content

Commit

Permalink
feat(initializer): add Travis/AppVeyor CI files to default template
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #30
  • Loading branch information
malept committed Aug 27, 2017
1 parent 6275d2b commit 296bdde
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/init/init-starter-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async (dir, lintStyle) => {

d('creating directory:', path.resolve(dir, 'src'));
await fs.mkdirs(path.resolve(dir, 'src'));
const rootFiles = ['_gitignore', '_compilerc'];
const rootFiles = ['_gitignore', '_compilerc', '_travis.yml', '_appveyor.yml'];
if (lintStyle === 'airbnb') rootFiles.push('_eslintrc');
const srcFiles = ['index.js', 'index.html'];

Expand Down
4 changes: 3 additions & 1 deletion test/slow/api_spec_slow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ describe(`electron-forge API (with installer=${installer.substr(12)})`, () => {

it('should create a new folder with a npm module inside', async () => {
expect(await fs.pathExists(dir), 'the target dir should have been created').to.equal(true);
expect(await fs.pathExists(path.resolve(dir, 'package.json')), 'the package.json file should exist').to.equal(true);
for (const filename of ['package.json', '.travis.yml', '.appveyor.yml']) {
expect(await fs.pathExists(path.resolve(dir, filename)), `the ${filename} file should exist`).to.equal(true);
}
});

it('should have initialized a git repository', async () => {
Expand Down
26 changes: 26 additions & 0 deletions tmpl/_appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
platform:
- x64
environment:
nodejs_version: "6"
cache:
- '%APPDATA%\npm-cache'
- '%USERPROFILE%\.electron'
- node_modules
branches:
only:
- master
- /^v\d+\.\d+\.\d+/
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- set PATH=%APPDATA%\npm;%PATH%
- npm install
- npm update

test_script:
- node --version
- npm --version
- npm run lint
- if %APPVEYOR_REPO_TAG% EQU false npm run make

build_script:
- IF %APPVEYOR_REPO_TAG% EQU true npm run publish
33 changes: 33 additions & 0 deletions tmpl/_travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: node_js
node_js: "6"
os:
- linux
- osx
dist: trusty
osx_image: xcode8.3
sudo: false

cache:
directories:
- node_modules
- $HOME/.cache/electron

addons:
apt:
packages:
- fakeroot
- rpm

branches:
only:
- master
- /^v\d+\.\d+\.\d+/

install:
- npm install
- npm update

script:
- npm run lint
- if test -z "$TRAVIS_TAG"; then npm run make; fi
after_success: if test -n "$TRAVIS_TAG"; then npm run publish; fi
3 changes: 2 additions & 1 deletion tmpl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
"make": "electron-forge make",
"publish": "electron-forge publish"
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit 296bdde

Please sign in to comment.