Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
release: 0.3.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Nov 17, 2017
1 parent 20efaff commit 16ae1bc
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 57 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.3.0-alpha.2

- CLI: `react-tv init`
- CLI: `react-tv init <app-name>`
- add tests for CLI behavior
- add .npmignore
- add `jest:ci` job

# 0.3.0-alpha.1

- migrate to react-reconciler 0.6.0
Expand Down
90 changes: 46 additions & 44 deletions cli/__tests__/init-test.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,64 @@
const { spawnSync } = require('child_process')
const path = require('path')
const rimraf = require('rimraf')
const {spawnSync} = require('child_process');
const path = require('path');
const rimraf = require('rimraf');

const scriptPath = path.resolve(__dirname, '../index.js')
const packagePath = path.resolve(__dirname, '../__fixtures__/package')
const emptyPackagePath = path.resolve(__dirname, '../__fixtures__/emptyPackage')
const scriptPath = path.resolve(__dirname, '../index.js');
const packagePath = path.resolve(__dirname, '../__fixtures__/package');
const fixturesPath = path.resolve(__dirname, '../__fixtures__');

require('./to-run-successfully-matcher')
require('./to-run-successfully-matcher');

describe('[CLI] init', () => {
describe('react-tv init', () => {
let slug = 'react-tv'
let slug = 'react-tv';

beforeEach((done) => rimraf(path.resolve(packagePath, slug), done))
afterEach((done) => rimraf(path.resolve(packagePath, slug), done))
beforeEach(done => rimraf(path.resolve(packagePath, slug), done));
afterEach(done => rimraf(path.resolve(packagePath, slug), done));

it('should create react-tv folder', () => {
const subject = spawnSync('node', [
scriptPath,
'init'
], { cwd: packagePath })
const subject = spawnSync('node', [scriptPath, 'init'], {
cwd: packagePath,
});

const createdAppPath = path.resolve(packagePath, slug)
const appInfo = require(path.resolve(createdAppPath, 'webos/appinfo.json'))
const createdAppPath = path.resolve(packagePath, slug);
const appInfo = require(path.resolve(
createdAppPath,
'webos/appinfo.json'
));

expect(appInfo.id).toEqual('react.tv.app')
expect(appInfo.title).toEqual('package')
expect(subject).toRunSuccessfully()
})
expect(appInfo.id).toEqual('react.tv.app');
expect(appInfo.title).toEqual('package');
expect(subject).toRunSuccessfully();
});

it('should fail when package.json not exists', () => {
const subject = spawnSync('node', [
scriptPath,
'init'
], { cwd: emptyPackagePath })
const subject = spawnSync('node', [scriptPath, 'init'], {
cwd: fixturesPath,
});

expect(subject).not.toRunSuccessfully()
})
})
expect(subject).not.toRunSuccessfully();
});
});

describe('react-tv init <appName>', () => {
const appName = 'russell-crowe'
const appName = 'russell-crowe';

beforeEach((done) => rimraf(path.resolve(emptyPackagePath, appName), done))
afterEach((done) => rimraf(path.resolve(emptyPackagePath, appName), done))
beforeEach(done => rimraf(path.resolve(fixturesPath, appName), done));
afterEach(done => rimraf(path.resolve(fixturesPath, appName), done));

it('should create custom app', () => {
const subject = spawnSync('node', [
scriptPath,
'init',
appName
], { cwd: emptyPackagePath })

const createdAppPath = path.resolve(emptyPackagePath, appName)
const createdPackageJson = require(path.resolve(createdAppPath, 'package.json'))

expect(subject).toRunSuccessfully()
expect(createdPackageJson.name).toEqual('russell-crowe')
})
})
})
const subject = spawnSync('node', [scriptPath, 'init', appName], {
cwd: fixturesPath,
});

const createdAppPath = path.resolve(fixturesPath, appName);
const createdPackageJson = require(path.resolve(
createdAppPath,
'package.json'
));

expect(subject).toRunSuccessfully();
expect(createdPackageJson.name).toEqual('russell-crowe');
});
});
});
15 changes: 9 additions & 6 deletions cli/__tests__/to-run-successfully-matcher.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
expect.extend({
toRunSuccessfully(received) {
const pass = received.status === 0
const pass = received.status === 0;

if (pass) {
return {
message: () => `expected exit code not to be 0`,
pass: true,
}
};
} else {
return {
message: () => `expected exit code to be 0, was ${received.status} with error: \n${received.output}`,
message: () =>
`expected exit code to be 0, was ${received.status} with error: \n${
received.output
}`,
pass: false,
}
};
}
}
})
},
});
2 changes: 1 addition & 1 deletion cli/bootstrap/custom-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"react": "^16.0.0",
"react-tv": "^0.3.0-alpha.1"
"react-tv": "^0.3.0-alpha.2"
},
"devDependencies": {
"babel-core": "^6.4.5",
Expand Down
4 changes: 2 additions & 2 deletions cli/shared/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function createReactTVApp(appName) {
recursive: true,
silent: true,
});
} catch(e) {
} catch (e) {
return process.exit(1);
}

Expand Down Expand Up @@ -71,7 +71,7 @@ function createReactTVApp(appName) {
recursive: true,
silent: true,
});
} catch(e) {
} catch (e) {
return process.exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-tv": "0.3.0-alpha.1"
"react-tv": "0.3.0-alpha.2"
},
"devDependencies": {
"babel-core": "^6.4.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/clock-app-with-react-tv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"react": "^16.0.0",
"react-tv": "0.3.0-alpha.1"
"react-tv": "0.3.0-alpha.2"
},
"devDependencies": {
"babel-core": "^6.4.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/keyboard-navigation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"react": "^16.0.0",
"react-tv": "0.3.0-alpha.1"
"react-tv": "0.3.0-alpha.2"
},
"devDependencies": {
"babel-core": "^6.4.5",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-tv",
"version": "0.3.0-alpha.1",
"version": "0.3.0-alpha.2",
"description": "React renderer for low memory applications and Packager for TVs (WebOS, Tizen, Orsay)",
"main": "dist/react-tv.umd.js",
"bin": {
Expand Down

0 comments on commit 16ae1bc

Please sign in to comment.