Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[major][feat] electrode-ignite modules #548

Merged
merged 59 commits into from
Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
7dbf5b1
electrode-ignite modules
didi0613 Aug 16, 2017
889a5e1
code review
didi0613 Aug 16, 2017
e7fb565
few fixes
didi0613 Aug 16, 2017
18c20d3
Few fixes
didi0613 Aug 17, 2017
2271516
Add unit tests for electrode ignite
didi0613 Aug 17, 2017
dab5ede
add unit tests to ignite-core(wip)
didi0613 Aug 18, 2017
816dd11
resolve travis error
didi0613 Aug 18, 2017
5735f52
adding unit tests(wip)
didi0613 Aug 18, 2017
36a0394
Using function to generate colorful menu, Option #1,2,6 back to main…
didi0613 Aug 19, 2017
8a835aa
Using yargs to show help messages
didi0613 Aug 19, 2017
1468013
Update package version to be beta 0.1.0 and update unit test with cha…
didi0613 Aug 22, 2017
9181480
Add return to promises and update unit test
didi0613 Aug 22, 2017
12c2391
Electrode ignite unit tests
didi0613 Aug 22, 2017
9ad6745
pre-release electrode-ignite 0.1.2 for beta testing
didi0613 Aug 22, 2017
96034c7
Color menu numbers and fix the number
didi0613 Aug 23, 2017
0602c8e
update internal iml electrode ignite generator names
didi0613 Aug 23, 2017
71451d5
Beautify ignite menu
didi0613 Aug 23, 2017
fc72853
release test ignite-core v0.1.4
didi0613 Aug 23, 2017
e5f3f47
Code review & adding visual spinner
didi0613 Aug 24, 2017
3066a4b
code review
didi0613 Aug 24, 2017
a901aaf
Add time stamp to the ignite-core
didi0613 Aug 24, 2017
71206da
ignite fixes & code reviews
didi0613 Aug 24, 2017
6c3ce38
small patch for adding spinner for electrode ignite self checking
didi0613 Aug 24, 2017
c8082fd
update timestamp
didi0613 Aug 24, 2017
a5e5f68
update time interval and small fixes
didi0613 Aug 24, 2017
b0a5c3e
Update logger message to match both internal and OSS
didi0613 Aug 25, 2017
f2c1917
Code review & Testing & Optimize code
didi0613 Aug 25, 2017
0517e38
Show proper hint for next task
didi0613 Aug 25, 2017
893cad4
Fix: Possible EventEmitter memory leak
didi0613 Aug 26, 2017
be70ead
minor fixes
didi0613 Aug 26, 2017
a98edb0
New release of electrode-ignite and ignite-core
didi0613 Aug 26, 2017
a4e22c8
fix + optimize electrode ignite update
didi0613 Aug 28, 2017
cd014b5
ignite-core v0.1.9
didi0613 Aug 28, 2017
4f7b3d3
Fixes electrode-ignite self update and other
didi0613 Aug 29, 2017
a41ca38
Check ignite daily instead of last 24 hours
didi0613 Aug 30, 2017
901b814
Fixes for check timestamp
didi0613 Aug 30, 2017
9724f3a
Save version to file as a cache, and optimize code
didi0613 Aug 31, 2017
88b860c
Manually check electrode-ignite when specifying the option
didi0613 Sep 1, 2017
31be8be
Fixes for ignite check-ignite task
didi0613 Sep 1, 2017
ca08817
few changes for iml internal
didi0613 Sep 1, 2017
aac11e3
electrode [email protected] & ignite-core 0.1.12
didi0613 Sep 1, 2017
e6dd9c4
Update ignite core unit test
didi0613 Sep 4, 2017
7fabcb1
Update unit test
didi0613 Sep 5, 2017
ac1449c
Update unit test
didi0613 Sep 5, 2017
0ed0826
Unit test
didi0613 Sep 5, 2017
411bade
Update the unit test
didi0613 Sep 5, 2017
3344a06
unit test updates
didi0613 Sep 6, 2017
7cc4069
Electrode Ignite add unit test
didi0613 Sep 6, 2017
9315f1e
update unit test
didi0613 Sep 6, 2017
90d8fc9
wip
didi0613 Sep 6, 2017
23db582
Bug fixes + Unit tests
didi0613 Sep 7, 2017
c9528ea
Fix bugs and update unit test
didi0613 Sep 8, 2017
c3d73e3
bug fixes + unit test
didi0613 Sep 8, 2017
e6e7a5b
add version verification
didi0613 Sep 8, 2017
05dcc2a
small fixes
didi0613 Sep 11, 2017
c7a6711
ignite-core v0.1.14
didi0613 Sep 11, 2017
df74506
electrode-ignite v0.1.8
didi0613 Sep 11, 2017
94511d2
electrode-ignite unit test
didi0613 Sep 13, 2017
b365283
ignite core unit test
didi0613 Sep 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/electrode-ignite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.git
138 changes: 138 additions & 0 deletions packages/electrode-ignite/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@

# Created by https://www.gitignore.io/api/gitbook,osx,webstorm,node

### GitBook ###
# Node rules:
## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

## Dependency directory
## Commenting this out is preferred by some people, see
## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
node_modules

# Book build output
_book

# eBook build output
*.epub
*.mobi
*.pdf


### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### WebStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# .idea/shelf

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties


### Node ###
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

.tmp
13 changes: 13 additions & 0 deletions packages/electrode-ignite/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2016 WalmartLabs

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
61 changes: 61 additions & 0 deletions packages/electrode-ignite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Electrode Ignite

A CLI tool for development with OSS Electrode React/NodeJS Platform.

## Installation

Install the `electrode-ignite` globally

```bash
$ npm install -g electrode-ignite
```

## Usage

Electrode Ignite provides developers a cli tool to develop on OSS Electrode React/NodeJS Platform. It offers a list of tasks that you can invoke functions on Electrode platform.

There are two ways to start the Electrode Ignite:

- Electrode Ignite Menu

To see the Electrode Ignite menu, simple run:

```bash
$ ignite
```

And you'll see the menu as below:

![alt text](./images/ignite-menu.png)

Select the option by inputting a valid number, and press enter to get your task executed.

- Electrode Ignite Single Task

An ignite task can be invoked with the command `ignite`:

```bash
$ ignite task1
```

For example,

```bash
$ ignite install
```

For help on usage:

```bash
$ ignite --help
```

You'll see the list of options that you can specify as a task, as below:

![alt text](./images/ignite-help.png)

## License

Apache-2.0 © WalmartLabs

Built with :heart: by [Team Electrode](https://github.com/orgs/electrode-io/people) @WalmartLabs.
4 changes: 4 additions & 0 deletions packages/electrode-ignite/bin/ignite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

const Path = require("path");
require("../cli/ignite")();
28 changes: 28 additions & 0 deletions packages/electrode-ignite/cli/ignite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use strict";

const chalk = require("chalk");
const igniteCore = require("ignite-core");
const logger = require("ignite-core/lib/logger");

const checkElectrodeIgnite = require("ignite-core/tasks/check-ignite");
const pkg = require("../package.json");

function ignite() {
if(/^\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(pkg.version)) {
const isCheckIgnite = process.argv[2] === "check-ignite";
logger.log(chalk.green(`Welcome to electrode-ignite version ${pkg.version}`));
return checkElectrodeIgnite(
"oss",
igniteCore,
"electrode-ignite",
!isCheckIgnite,
isCheckIgnite,
pkg.version
);
} else {
logger.log(chalk.red(`Your electrode-ignite version@${pkg.version} is invalid.`));
return process.exit(1);
}
}

module.exports = ignite;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions packages/electrode-ignite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "electrode-ignite",
"version": "0.1.8",
"description": "The CLI tool for development with OSS Electrode React/NodeJS Platform.",
"main": "bin/ignite.js",
"scripts": {
"test": "clap test"
},
"bin": {
"ignite": "bin/ignite.js"
},
"keywords": [
"npm",
"scripts",
"ignite",
"javascript",
"tool",
"electrode"
],
"repository": {
"type": "git",
"url": "https://github.com/electrode-io/electrode.git"
},
"author": {
"name": "Sheng Di",
"email": "[email protected]",
"url": "https://github.com/didi0613"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/electrode-io/electrode/issues"
},
"dependencies": {
"chalk": "^2.0.1",
"generator-electrode": "^3.2.0",
"ignite-core": "^0.1.0",
"yo": "^2.0.0"
},
"homepage": "http://www.electrode.io",
"devDependencies": {
"assert": "^1.4.1",
"electrode-archetype-njs-module-dev": "^2.3.0",
"sinon": "^3.2.1"
},
"nyc": {
"all": true,
"reporter": [
"lcov",
"text",
"text-summary"
],
"exclude": [
"coverage",
"*clap.js",
"gulpfile.js",
"dist",
"test"
]
}
}
2 changes: 2 additions & 0 deletions packages/electrode-ignite/test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require node_modules/electrode-archetype-njs-module-dev/config/test/setup.js
--recursive
63 changes: 63 additions & 0 deletions packages/electrode-ignite/test/spec/ignite.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"use strict";

const sinon = require("sinon");
const assert = require("assert");
const xsh = require("xsh");

const electrodeIgnite = require("../../cli/ignite");
const logger = require("ignite-core/lib/logger");
const chalk = require("chalk");
const pkg = require("../../package.json");

describe("electrode-ignite", function() {
let loggerStub = "";
let processStub = "";
let xshStub = "";

beforeEach(function() {
loggerStub = sinon.stub(logger, "log");
processStub = sinon.stub(process, "exit");
xshStub = sinon.stub(xsh, "exec").returns(Promise.resolve(pkg.version));
});

afterEach(function() {
loggerStub.restore();
processStub.restore();
xshStub.restore();
});

it("Exit if electrode-ignite version is invalid", () => {
const originalVersion = pkg.version;
pkg.version = "fake version";
electrodeIgnite();
assert.equal(
loggerStub.getCalls()[0].args.toString(),
chalk.red("Your electrode-ignite version@fake version is invalid.")
);
sinon.assert.calledOnce(processStub);
pkg.version = originalVersion;
});

it("Print welcome message for non-check-ignite tasks", function() {
electrodeIgnite();
sinon.assert.callCount(loggerStub, 1);
assert.equal(
loggerStub.getCalls()[0].args.toString(),
chalk.green(`Welcome to electrode-ignite version ${pkg.version}`)
);
});

it("Print welcome message for check-ignite tasks", function() {
process.argv[2] = "check-ignite";
electrodeIgnite();
sinon.assert.callCount(loggerStub, 2);
assert.equal(
loggerStub.getCalls()[0].args.toString(),
chalk.green(`Welcome to electrode-ignite version ${pkg.version}`)
);
assert.equal(
loggerStub.getCalls()[1].args.toString(),
chalk.green("Checking latest version available on npm ...")
);
});
});
1 change: 1 addition & 0 deletions packages/electrode-ignite/xclap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("electrode-archetype-njs-module-dev")();
4 changes: 4 additions & 0 deletions packages/ignite-core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.git
npm-debug.log*
timestamp*.txt
Loading