Skip to content

Commit

Permalink
es6 riot compile fix, +eslint in tags
Browse files Browse the repository at this point in the history
pushtate server for check production
sass styl support
  • Loading branch information
alexstep committed Jun 4, 2017
1 parent 6e9da17 commit 63aa092
Show file tree
Hide file tree
Showing 27 changed files with 796 additions and 775 deletions.
7 changes: 5 additions & 2 deletions .babelrc
@@ -1,6 +1,9 @@
{
"presets": [
"es2015",
"es2015-riot"
]
],

"plugins": [
["transform-es2015-modules-commonjs", { "allowTopLevelThis": true }]
]
}
1 change: 1 addition & 0 deletions .eslintignore
@@ -0,0 +1 @@
build/*
60 changes: 31 additions & 29 deletions .eslintrc.js
@@ -1,41 +1,43 @@
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
'env': {
'browser': true,
'commonjs': true,
'es6': true
},

"parserOptions": {
"ecmaFeatures": {
"jsx": false
'parserOptions': {
'ecmaFeatures': {
'jsx': true
},
"sourceType": "module"
'sourceType': 'module'
},
"globals": {
"riot": true,
"__dirname": true,
"process": true,
"App": true,
"$": true

'globals': {
'riot': true,
'__dirname': true,
'process': true,
'App': true,
'$': true
},

"plugins": ["riot"],
"rules": {
"indent": [
"warn",
"tab"
'plugins': ['riot'],

'rules': {
'indent': [
'warn',
'tab'
],
"linebreak-style": [
"warn",
"unix"
'linebreak-style': [
'warn',
'unix'
],
"quotes": [
"warn",
"single"
'quotes': [
'warn',
'single'
],
"semi": [
"warn",
"never"
'semi': [
'warn',
'never'
]
}
};
}
11 changes: 9 additions & 2 deletions README.md
Expand Up @@ -2,9 +2,10 @@
[![Code Climate](https://codeclimate.com/github/alexstep/create-riot-app-ejected.png)](https://codeclimate.com/github/alexstep/create-riot-app-ejected)
[![Dependencies](https://david-dm.org/alexstep/create-riot-app-ejected/dev-status.svg)](https://david-dm.org/alexstep/create-riot-app-ejected?type=dev)

[RiotJS](https://github.com/riot/riot) startkit, based on [create-react-app](https://github.com/facebookincubator/create-react-app) and [custom-react-scripts](https://github.com/kitze/custom-react-scripts).
[RiotJS](https://github.com/riot/riot) startkit, based on [create-react-app](https://github.com/facebookincubator/create-react-app) and [react-scripts](https://github.com/facebookincubator/create-react-app/tree/master/packages/react-scripts).

Package included simple app example, webpack dev server with riot-loader and less,sass,stylus,css-components support. ES6 features available too.
Package included simple app example, webpack dev server with *riot hot reload* and less, sass, stylus support. ES6 features available too.
Jest with riot support for testing. ES6 and eslint in riot tag.

Just read https://github.com/facebookincubator/create-react-app but replace all "react" word to "riot" :)

Expand All @@ -26,6 +27,12 @@ go to http://localhost:9999
npm run build
```

Check build result
```
npm run check_build
```



### ✎ Configuration options
Expand Down
18 changes: 13 additions & 5 deletions package.json
Expand Up @@ -8,10 +8,12 @@
"homepage": "./",


"scripts": {
"start" : "node scripts/start.js",
"build" : "node scripts/build.js",
"test" : "node scripts/test.js --env=jsdom"
"scripts" : {
"start" : "node scripts/start.js",
"build" : "node scripts/build.js",
"eslint" : "eslint --ext=.js,.tag ./src",
"check_build" : "pushstate-server build 9000",
"test" : "node scripts/test.js --env=jsdom"
},


Expand All @@ -35,7 +37,7 @@
"^(?!.*\\.(js|tag|css|json)$)": "<rootDir>/scripts/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|tag)$"
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
]
},

Expand All @@ -62,6 +64,9 @@
"babel-preset-es2015" : "^6.24.1",
"babel-runtime" : "6.23.0",

"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",


"eslint" : "3.19.0",
"eslint-loader" : "1.7.1",
"eslint-plugin-flowtype" : "2.33.0",
Expand All @@ -70,6 +75,8 @@

"jest" : "20.0.3",

"pushstate-server" : "^3.0.0",

"webpack" : "2.6.1",
"webpack-dev-server" : "2.4.5",
"webpack-manifest-plugin" : "1.1.0",
Expand All @@ -79,6 +86,7 @@
"html-webpack-plugin" : "2.28.0",

"url-loader" : "0.5.8",
"svg-inline-loader" : "^0.7.1",
"style-loader" : "^0.18.1",
"css-loader" : "^0.28.4",
"less" : "^2.7.2",
Expand Down
101 changes: 55 additions & 46 deletions scripts/build.js
Expand Up @@ -38,54 +38,63 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
// This lets us display how much they changed later.
measureFileSizesBeforeBuild(paths.appBuild)
.then(previousFileSizes => {
// Remove all content but keep the directory so that
// if you're in it, you don't end up in Trash
// Remove all content but keep the directory so that
// if you're in it, you don't end up in Trash
fs.emptyDirSync(paths.appBuild)
// Merge with the public folder
// Merge with the public folder
copyPublicFolder()
// Start the webpack build
// Start the webpack build
return build(previousFileSizes)
})
.then(
({ stats, previousFileSizes, warnings }) => {
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'))
console.log(warnings.join('\n\n'))
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
)
console.log(
'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n'
)
} else {
console.log(chalk.green('Compiled successfully.\n'))
}
({ stats, previousFileSizes, warnings }) => {
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'))
console.log(warnings.join('\n\n'))
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
)
console.log(
'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n'
)
} else {
console.log(chalk.green('Compiled successfully.\n'))
}

console.log('File sizes after gzip:\n')
printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild)
console.log()
console.log('File sizes after gzip:\n')
printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild)
console.log()

const appPackage = require(paths.appPackageJson)
const publicUrl = paths.publicUrl
const publicPath = config.output.publicPath
const buildFolder = path.relative(process.cwd(), paths.appBuild)
printHostingInstructions(
appPackage,
publicUrl,
publicPath,
buildFolder,
useYarn
)
},
err => {
console.log(chalk.red('Failed to compile.\n'))
console.log((err.message || err) + '\n')
process.exit(1)
}
const appPackage = require(paths.appPackageJson)
const publicUrl = paths.publicUrl
const publicPath = config.output.publicPath
const buildFolder = path.relative(process.cwd(), paths.appBuild)
printHostingInstructions(
appPackage,
publicUrl,
publicPath,
buildFolder,
useYarn
)

console.log('You may also serve it locally with a static server:')
if (useYarn) {
console.log(' Run ' + chalk.cyan('yarnpkg check_build') + '')
} else {
console.log(' Run ' + chalk.cyan('npm run check_build') + '')
}
console.log(' And open in browser http://localhost:9000')
console.log()
},
err => {
console.log(chalk.red('Failed to compile.\n'))
console.log((err.message || err) + '\n')
process.exit(1)
}
)

// Create the production build and print the deployment instructions.
Expand All @@ -104,11 +113,11 @@ function build(previousFileSizes) {
}
if (process.env.CI && messages.warnings.length) {
console.log(
chalk.yellow(
'\nTreating warnings as errors because process.env.CI = true.\n' +
'Most CI servers set it automatically.\n'
)
)
chalk.yellow(
'\nTreating warnings as errors because process.env.CI = true.\n' +
'Most CI servers set it automatically.\n'
)
)
return reject(new Error(messages.warnings.join('\n\n')))
}
return resolve({
Expand Down
70 changes: 0 additions & 70 deletions scripts/config/css_example.js

This file was deleted.

5 changes: 3 additions & 2 deletions scripts/config/env.js
@@ -1,5 +1,8 @@
'use strict'

// App env options prefix regex
const APP_ENV = /^APP_/i

const fs = require('fs')
const path = require('path')
const paths = require('./paths')
Expand Down Expand Up @@ -56,8 +59,6 @@ process.env.NODE_PATH = (process.env.NODE_PATH || '')

// Grab NODE_ENV and APP_ENV_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
const APP_ENV = /^APP_/i

function getClientEnvironment(publicUrl) {
const raw = Object.keys(process.env).filter(key => APP_ENV.test(key)).reduce((env, key) => {
env[key] = process.env[key]
Expand Down

0 comments on commit 63aa092

Please sign in to comment.