Skip to content

Introduce lerna #193

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

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ template/config/
# Desktop Services Store on macOS
.DS_Store

/test-app/
# Exclude test-app
test-app/
build/
17 changes: 15 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
language: node_js

sudo: required

node_js:
- '8'
- '7'
- '6'

addons:
apt:
packages:
- xvfb

cache:
yarn: true
directories:
- $HOME/.yarn-cachegi

before_install:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

install:
- yarn install
- npm link
- cd packages/create-elm-app
- yarn install
- yarn link
- cd ..

script: npm test

after_success:
- npm run semantic-release
- yarn run semantic-release

branches:
except:
- /^v\d+\.\d+\.\d+$/

notifications:
email: false
7 changes: 7 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"lerna": "2.4.0",
"packages": [
"packages/*"
],
"version": "independent"
}
94 changes: 19 additions & 75 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,100 +1,44 @@
{
"name": "create-elm-app",
"description": "Elm apps with zero configuration",
"version": "0.0.0-development",
"author": "Eduard Kyvenko <[email protected]>",
"bin": {
"elm-app": "./bin/elm-app-cli.js",
"create-elm-app": "./bin/create-elm-app-cli.js"
},
"bugs": {
"url": "https://github.com/halfzebra/create-elm-app/issues",
"email": "[email protected]"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
"path": "./node_modules/cz-lerna-changelog"
}
},
"dependencies": {
"assets-webpack-plugin": "^3.5.1",
"autoprefixer": "^7.1.6",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-runtime": "^6.26.0",
"chalk": "^2.3.0",
"clean-webpack-plugin": "^0.1.17",
"cli-table": "0.3.1",
"connect-history-api-fallback": "^1.5.0",
"cross-spawn": "^5.1.0",
"css-loader": "^0.28.7",
"dotenv": "^4.0.0",
"elm": "^0.18.0",
"elm-hot-loader": "0.5.4",
"elm-test": "^0.18.10",
"elm-webpack-loader": "^4.4.0",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.5",
"fs-extra": "^4.0.2",
"html-webpack-plugin": "^2.30.1",
"http-proxy-middleware": "^0.17.4",
"minimist": "1.2.0",
"postcss-loader": "^2.0.8",
"prompt": "1.0.0",
"react-dev-utils": "^4.2.1",
"react-error-overlay": "^3.0.0",
"string-replace-loader": "^1.3.0",
"style-loader": "^0.19.0",
"sw-precache-webpack-plugin": "^0.11.4",
"url-loader": "^0.6.2",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.4"
},
"devDependencies": {
"babel-eslint": "^8.0.2",
"commitizen": "^2.9.6",
"cz-conventional-changelog": "^2.1.0",
"cz-lerna-changelog": "^1.2.1",
"dir-compare": "^1.4.0",
"eslint": "^4.11.0",
"eslint-plugin-prettier": "^2.3.1",
"husky": "^0.14.3",
"lerna": "^2.4.0",
"lerna-semantic-release": "^9.1.0",
"lint-staged": "^4.2.3",
"mocha": "^4.0.1",
"nightmare": "^2.10.0",
"prettier": "^1.8.2",
"rimraf": "^2.6.2",
"semantic-release": "^8.2.0",
"unexpected": "^10.36.2"
},
"engines": {
"node": ">=6.0.0"
},
"files": [
"bin",
"config",
"scripts",
"template",
"README.md"
],
"keywords": [
"cli",
"elm",
"webpack"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/halfzebra/create-elm-app"
"unexpected": "^10.36.0"
},
"private": true,
"scripts": {
"cz": "git-cz",
"eslint": "eslint .",
"prettier": "prettier --write --single-quote '{bin,config,scripts,template/src,tests}/**/*.js'",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"semantic-release": "lerna-semantic-release pre && lerna-semantic-release post && lerna-semantic-release perform",
"test": "npm run test:cli && npm run test:functional",
"test:cli": "mocha tests/cliAccessibility.js --reporter spec --timeout 15000",
"test:functional": "mocha tests/*.spec.js --reporter spec --timeout 15000"
"test:functional": "mocha tests/*.spec.js --reporter spec --timeout 15000",
"precommit": "lint-staged"
},
"lint-staged": {
"*.js": [
"prettier --trailing-comma es5 --single-quote --write",
"git add"
],
"yarn.lock": [
"git rm --cached"
]
}
}
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const path = require('path');
const spawn = require('cross-spawn');
const argv = require('minimist')(process.argv.slice(2));
const version = require('../package.json').version;
const version = require('../../../package.json').version;
const elmPlatformVersion = require('elm/package.json').version;
const commands = argv._;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path');
const spawn = require('cross-spawn');
const argv = require('minimist')(process.argv.slice(2));
const executablePaths = require('elm/platform').executablePaths;
const version = require('../package.json').version;
const version = require('../../../package.json').version;
const elmPlatformVersion = require('elm/package.json').version;

const commands = argv._;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const getClientEnvironment = require('./env');
const paths = require('../config/paths');
const paths = require('./paths');

// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const AssetsPlugin = require('assets-webpack-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const getClientEnvironment = require('./env');
const paths = require('../config/paths');
const paths = require('./paths');

// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
Expand Down
69 changes: 69 additions & 0 deletions packages/create-elm-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "create-elm-app",
"description": "Elm apps with zero configuration",
"version": "1.8.0",
"author": "Eduard Kyvenko <[email protected]>",
"bin": {
"elm-app": "./bin/elm-app-cli.js",
"create-elm-app": "./bin/create-elm-app-cli.js"
},
"bugs": {
"url": "https://github.com/halfzebra/create-elm-app/issues",
"email": "[email protected]"
},
"dependencies": {
"assets-webpack-plugin": "^3.5.1",
"autoprefixer": "^7.1.4",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"chalk": "^2.1.0",
"clean-webpack-plugin": "^0.1.16",
"cli-table": "0.3.1",
"connect-history-api-fallback": "^1.3.0",
"cross-spawn": "^5.1.0",
"css-loader": "^0.28.7",
"dotenv": "^4.0.0",
"elm": "^0.18.0",
"elm-hot-loader": "0.5.4",
"elm-test": "^0.18.8",
"elm-webpack-loader": "^4.3.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"fs-extra": "^4.0.1",
"html-webpack-plugin": "^2.30.1",
"http-proxy-middleware": "^0.17.3",
"minimist": "1.2.0",
"postcss-loader": "^2.0.5",
"prompt": "1.0.0",
"react-dev-utils": "^4.0.1",
"react-error-overlay": "^2.0.1",
"string-replace-loader": "^1.3.0",
"style-loader": "^0.18.1",
"sw-precache-webpack-plugin": "^0.11.4",
"url-loader": "^0.5.9",
"webpack": "^3.5.6",
"webpack-dev-server": "^2.8.1"
},
"engines": {
"node": ">=6.0.0"
},
"files": [
"bin",
"config",
"scripts",
"template",
"README.md"
],
"keywords": [
"cli",
"elm",
"webpack"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/halfzebra/create-elm-app"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 11 additions & 6 deletions tests/build.spec.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
/* eslint-disable */
/* eslint-env mocha */
const fs = require('fs');
const path = require('path');
const spawn = require('cross-spawn');
const rimraf = require('rimraf');
const expect = require('unexpected');
const Nightmare = require('nightmare');

const root = path.resolve(__dirname, '..');
const testAppName = 'test-app';
const rootDir = path.resolve(__dirname, '..');
const testAppDir = path.join(rootDir, testAppName);
const createElmAppCmd = path.join(rootDir, 'bin/create-elm-app-cli.js');
const elmAppCmd = path.join(rootDir, 'bin/elm-app-cli.js');
const testAppDir = path.join(root, testAppName);
const createElmAppCmd = path.join(
root,
'./packages/create-elm-app/bin/create-elm-app-cli.js'
);
const elmAppCmd = path.join(
root,
'./packages/create-elm-app/bin/elm-app-cli.js'
);

describe('Creating and making a build of Elm application', function() {
this.timeout(30000);
Expand All @@ -21,7 +26,7 @@ describe('Creating and making a build of Elm application', function() {
spawn('node', [createElmAppCmd, testAppName]).on('close', status => {
if (status === 0) {
spawn('node', [elmAppCmd, 'build'], {
cwd: testAppDir
cwd: testAppDir,
}).on('close', status => {
if (status === 0) {
done();
Expand Down
13 changes: 8 additions & 5 deletions tests/create-elm-app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ const dircompare = require('dir-compare');
const fs = require('fs');
const rimraf = require('rimraf');

const root = path.resolve(__dirname, '..');
const testAppName = 'test-app';
const rootDir = path.resolve(__dirname, '..');
const testAppDir = path.join(rootDir, testAppName);
const createElmAppCmd = path.join(rootDir, 'bin/create-elm-app-cli.js');
const testAppDir = path.join(root, testAppName);
const createElmAppCmd = path.join(
root,
'./packages/create-elm-app/bin/create-elm-app-cli.js'
);

describe('Create Elm application with `create-elm-app` command', () => {
after(() => {
Expand All @@ -34,9 +37,9 @@ describe('Create Elm application with `create-elm-app` command', () => {
});

it(`'${testAppName}' should have the same file structure as template`, () => {
const templateDir = path.join(rootDir, 'template');
const templateDir = path.join(root, './packages/create-elm-app/template');
const options = {
excludeFilter: 'elm-stuff, elm-package.json, gitignore, .gitignore'
excludeFilter: 'elm-stuff, elm-package.json, gitignore, .gitignore',
};
const { same } = dircompare.compareSync(templateDir, testAppDir, options);
expect(same, 'to be', true);
Expand Down
18 changes: 12 additions & 6 deletions tests/elm-app.build.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ const spawn = require('cross-spawn');
const rimraf = require('rimraf');
const expect = require('unexpected');

const root = path.resolve(__dirname, '..');
const testAppName = 'test-app';
const rootDir = path.resolve(__dirname, '..');
const testAppDir = path.join(rootDir, testAppName);
const createElmAppCmd = path.join(rootDir, 'bin/create-elm-app-cli.js');
const elmAppCmd = path.join(rootDir, 'bin/elm-app-cli.js');
const testAppDir = path.join(root, testAppName);
const createElmAppCmd = path.join(
root,
'./packages/create-elm-app/bin/create-elm-app-cli.js'
);
const elmAppCmd = path.join(
root,
'./packages/create-elm-app/bin/elm-app-cli.js'
);

describe('Building Elm application with `elm-app build`', () => {
before(done => {
Expand All @@ -23,7 +29,7 @@ describe('Building Elm application with `elm-app build`', () => {
});

after(() => {
process.chdir(rootDir);
process.chdir(root);
rimraf.sync(testAppDir);
});

Expand All @@ -40,7 +46,7 @@ describe('Building Elm application with `elm-app build`', () => {

it('`elm-app build` should exit with non zero status code when build failed', () => {
const normalFile = path.join(testAppDir, 'src/Main.elm');
const malformedFile = path.join(rootDir, './tests/fixtures/Main.elm');
const malformedFile = path.join(root, './tests/fixtures/Main.elm');

copyFileSync(normalFile, 'Main.elm-normal');
copyFileSync(malformedFile, normalFile);
Expand Down
Loading