chore(release): releasing with latest updates (#11)

This commit is contained in:
mrugesh mohapatra
2018-06-13 19:19:37 +05:30
committed by GitHub
parent 4d8a91375d
commit a5399361ee
5 changed files with 1922 additions and 715 deletions

View File

@ -5,8 +5,27 @@ node_js:
cache: cache:
directories: directories:
- ~/.npm
- node_modules - node_modules
notifications:
email:
on_success: change
on_failure: always
script: script:
- npm run lint - npm run lint
- npm run test - npm run test
- npm run build
deploy:
provider: script
skip_cleanup: true
script:
- npx semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
sudo: false sudo: false

View File

@ -1,10 +1,10 @@
## freeCodeCamp Curriculum # freeCodeCamp Curriculum
[![Build Status](https://travis-ci.org/freeCodeCamp/curriculum.svg?branch=master)](https://travis-ci.org/freeCodeCamp/curriculum) [![Build Status](https://travis-ci.org/freeCodeCamp/curriculum.svg?branch=master)](https://travis-ci.org/freeCodeCamp/curriculum) [![npm (scoped)](https://img.shields.io/npm/v/@freecodecamp/curriculum.svg)](https://www.npmjs.com/package/@freecodecamp/curriculum)
This package contains the "seed" files used in the freeCodeCamp Curriculum. > This package contains the "seed" files used in the freeCodeCamp Curriculum.
### Installation ## Installation
```sh ```sh
npm i @freecodecamp/curriculum npm i @freecodecamp/curriculum
@ -12,15 +12,17 @@ npm i @freecodecamp/curriculum
yarn add @freecodecamp/curriculum yarn add @freecodecamp/curriculum
``` ```
### Usage ## Usage
```js ```js
import { getChallenges } from '@freecodecamp/curriculum'; import { getChallenges } from '@freecodecamp/curriculum';
getChallenges() // will provide an array of blocks i.e. basic CSS, functional programming // fetch an array of blocks
// i.e. basic CSS, functional programming, etc.
getChallenges()
``` ```
#### `block` Structure
### `block` Structure
```js ```js
{ {
@ -35,7 +37,7 @@ getChallenges() // will provide an array of blocks i.e. basic CSS, functional pr
} }
``` ```
#### `challenge` Structure ### `challenge` Structure
```js ```js
{ {

2474
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,12 @@
"homepage": "https://github.com/freeCodeCamp/curriculum#readme", "homepage": "https://github.com/freeCodeCamp/curriculum#readme",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/freeCodeCamp/curriculum.git" "url": "https://github.com/freeCodeCamp/curriculum.git"
}, },
"bugs": { "bugs": {
"url": "https://github.com/freeCodeCamp/curriculum/issues" "url": "https://github.com/freeCodeCamp/curriculum/issues"
}, },
"version": "1.1.1", "version": "0.0.0-development",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"build": "npm run build:js && npm run build:json", "build": "npm run build:js && npm run build:json",
@ -23,8 +23,8 @@
"format": "prettier --write es5 './**/*.{js,json}' && npm run lint", "format": "prettier --write es5 './**/*.{js,json}' && npm run lint",
"lint": "eslint ./**/*.js --fix", "lint": "eslint ./**/*.js --fix",
"prepack": "npm run build", "prepack": "npm run build",
"release": "np",
"repack": "babel-node ./repack.js", "repack": "babel-node ./repack.js",
"semantic-release": "semantic-release",
"test": "babel-node ./test-challenges.js | tap-spec", "test": "babel-node ./test-challenges.js | tap-spec",
"unpack": "babel-node ./unpack.js" "unpack": "babel-node ./unpack.js"
}, },
@ -70,10 +70,10 @@
"jquery": "^3.3.1", "jquery": "^3.3.1",
"lint-staged": "^7.2.0", "lint-staged": "^7.2.0",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"np": "*",
"prettier": "^1.13.5", "prettier": "^1.13.5",
"prettier-package-json": "^1.6.0", "prettier-package-json": "^1.6.0",
"rx": "^4.1.0", "rx": "^4.1.0",
"semantic-release": "^15.5.2",
"tap-spec": "^4.1.1", "tap-spec": "^4.1.1",
"tape": "^4.9.0", "tape": "^4.9.0",
"validator": "^10.2.0" "validator": "^10.2.0"

View File

@ -1,6 +1,6 @@
/* eslint-disable no-eval, no-process-exit, no-unused-vars */ /* eslint-disable no-eval, no-process-exit, no-unused-vars */
import {Observable} from 'rx'; import { Observable } from 'rx';
import tape from 'tape'; import tape from 'tape';
import getChallenges from './getChallenges'; import getChallenges from './getChallenges';
@ -27,36 +27,27 @@ function evaluateTest(
test, test,
tapTest tapTest
) { ) {
let code = solution; let code = solution;
/* NOTE: Provide dependencies for React/Redux challenges /* NOTE: Provide dependencies for React/Redux challenges
* and configure testing environment * and configure testing environment
*/ */
let React, let React, ReactDOM, Redux, ReduxThunk, ReactRedux, Enzyme, document;
ReactDOM,
Redux,
ReduxThunk,
ReactRedux,
Enzyme,
document;
// Fake Deep Equal dependency // Fake Deep Equal dependency
const DeepEqual = (a, b) => const DeepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
JSON.stringify(a) === JSON.stringify(b);
// Hardcode Deep Freeze dependency // Hardcode Deep Freeze dependency
const DeepFreeze = (o) => { const DeepFreeze = o => {
Object.freeze(o); Object.freeze(o);
Object.getOwnPropertyNames(o).forEach(function(prop) { Object.getOwnPropertyNames(o).forEach(function(prop) {
if (o.hasOwnProperty(prop) if (
&& o[ prop ] !== null o.hasOwnProperty(prop) &&
&& ( o[prop] !== null &&
typeof o[ prop ] === 'object' || (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
typeof o[ prop ] === 'function' !Object.isFrozen(o[prop])
) ) {
&& !Object.isFrozen(o[ prop ])) { DeepFreeze(o[prop]);
DeepFreeze(o[ prop ]);
} }
}); });
return o; return o;
@ -76,7 +67,7 @@ function evaluateTest(
/* Transpile ALL the code /* Transpile ALL the code
* (we may use JSX in head or tail or tests, too): */ * (we may use JSX in head or tail or tests, too): */
const transform = require('babel-standalone').transform; const transform = require('babel-standalone').transform;
const options = { presets: [ 'es2015', 'react' ] }; const options = { presets: ['es2015', 'react'] };
head = transform(head, options).code; head = transform(head, options).code;
solution = transform(solution, options).code; solution = transform(solution, options).code;
@ -98,26 +89,17 @@ function evaluateTest(
document = window.document; document = window.document;
global.window = window; global.window = window;
global.document = window.document; global.document = window.document;
} }
/* eslint-enable no-unused-vars */ /* eslint-enable no-unused-vars */
try { try {
(() => { (() => {
return eval( return eval(
head + '\n' + head + '\n' + solution + '\n' + tail + '\n' + test.testString
solution + '\n' +
tail + '\n' +
test.testString
); );
})(); })();
} catch (e) { } catch (e) {
console.log( console.log(head + '\n' + solution + '\n' + tail + '\n' + test.testString);
head + '\n' +
solution + '\n' +
tail + '\n' +
test.testString
);
console.log(e); console.log(e);
tapTest.fail(e); tapTest.fail(e);
process.exit(1); process.exit(1);
@ -144,10 +126,12 @@ function createTest({
const isAsync = s => s.includes('(async () => '); const isAsync = s => s.includes('(async () => ');
if (isAsync(tests.join(''))) { if (isAsync(tests.join(''))) {
console.log(`Replacing Async Tests for Challenge ${title}`); console.log(`Replacing Async Tests for Challenge ${title}`);
tests = tests.map(challengeTestSource => tests = tests.map(
isAsync(challengeTestSource) ? challengeTestSource =>
"assert(true, 'message: great');" : isAsync(challengeTestSource)
challengeTestSource); ? "assert(true, 'message: great');"
: challengeTestSource
);
} }
const { head, tail } = Object.keys(files) const { head, tail } = Object.keys(files)
.map(key => files[key]) .map(key => files[key])
@ -167,18 +151,19 @@ function createTest({
} }
return Observable.fromCallback(tape)(title) return Observable.fromCallback(tape)(title)
.doOnNext(tapTest => .doOnNext(
solutions.length ? tapTest.plan(plan) : tapTest.end()) tapTest => (solutions.length ? tapTest.plan(plan) : tapTest.end())
)
.flatMap(tapTest => { .flatMap(tapTest => {
if (solutions.length <= 0) { if (solutions.length <= 0) {
tapTest.comment('No solutions for ' + title);
return Observable.just({ return Observable.just({
title, title,
type: 'missing' type: 'missing'
}); });
} }
return Observable.just(tapTest) return (
Observable.just(tapTest)
.map(addAssertsToTapTest) .map(addAssertsToTapTest)
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
// assert and code used within the eval // assert and code used within the eval
@ -199,7 +184,8 @@ function createTest({
}); });
}); });
}) })
.map(() => ({ title })); .map(() => ({ title }))
);
}); });
} }
@ -229,7 +215,7 @@ Observable.from(getChallenges())
.filter(title => !!title) .filter(title => !!title)
.toArray() .toArray()
.subscribe( .subscribe(
(noSolutions) => { noSolutions => {
if (noSolutions) { if (noSolutions) {
console.log( console.log(
'# These challenges have no solutions\n- [ ] ' + '# These challenges have no solutions\n- [ ] ' +