Skip to content

Hoist ava to the root #276

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

Merged
merged 6 commits into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"scripts": {
"lint": "eslint \"**/*.js\"",
"format": "prettier \"**/*.{js,ts,tsx}\" --write --loglevel warn",
"test": "prettier \"**/*.{js,ts,tsx}\" --list-different && yarn lint && lerna run test"
"test": "prettier \"**/*.{js,ts,tsx}\" --list-different && yarn lint && ava"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, it's not exactly the scope of this PR, but:

How about moving yarn lint, for instance, into a posttest script? Might make the scripts easier readable. Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting is a lot faster than running tests but it often catches errors. I think it's good to fail early.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving it to pretest then? 😉

(Btw, this is just a minor nitpick. I just thought it might be a tiny improvement. Feel free to disagree.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
  "test": "prettier \"**/*.{js,ts,tsx}\" --list-different && yarn lint && ava"
}

vs

{
  "pretest": "prettier \"**/*.{js,ts,tsx}\" --list-different && yarn lint",
  "test": "ava"
}

It barely improves anything 😄 If you want to make it shorter I can replace --list-different with -l.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, keep it 😅

},
"devDependencies": {
"ava": "^0.22.0",
"eslint": "^5.0.0-alpha.2",
"ava": "1.0.0-beta.4",
"eslint": "5.0.0-alpha.2",
"lerna": "^2.10.2",
"prettier": "^1.12.1"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "lib/index",
"license": "MIT",
"author": "Andy Wermke <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still get tests prior to release?

Copy link
Collaborator Author

@vlad-zhukov vlad-zhukov May 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, manual only for now. I would like to tickle it in another PR.

  • Publishing single packages leads to version inconsistencies and bugs. For instance the uglify block was publish separately as 1.0.0 and later as 1.1.0, when other blocks used to be v1.0.0-beta. Then with the 1.0 release the uglify was republished and its version 1.0.0 was tagged as latest. What that means is if you run yarn add @webpack-blocks/uglify now, you will get 1.0.0 instead of 1.1.0. (I am sorry I haven't reported it before 😅)
  • Some blocks have no unit but instead have related e2e tests. I believe they are more important to have and we can focus on writing more of them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay. Then we should just create a small doc to refer to when publishing. Like that we only publish "whole monorepo", not standalone.

},
"engines": {
"node": ">= 6.0"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "lib/index",
"license": "MIT",
"author": "Andy Wermke <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"engines": {
"node": ">= 6.0"
},
Expand Down
26 changes: 0 additions & 26 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "lib/index",
"license": "MIT",
"author": "Andy Wermke <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"keywords": [
"webpack",
"webpack-blocks",
Expand All @@ -19,24 +15,6 @@
"engines": {
"node": ">= 6.0"
},
"ava": {
"babel": {
"plugins": [
[
"transform-object-rest-spread",
{
"useBuiltIns": true
}
]
],
"presets": [
"@ava/stage-4"
]
},
"require": [
"babel-register"
]
},
"repository": "andywer/webpack-blocks",
"bugs": "https://github.com/andywer/webpack-blocks/issues",
"dependencies": {
Expand All @@ -45,10 +23,6 @@
"webpack-merge": "^4.1.2"
},
"devDependencies": {
"@ava/babel-preset-stage-4": "^1.1.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"sinon": "^5.0.2",
"webpack": "^4.6.0"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "index.js",
"license": "MIT",
"author": "Dmytro Meleshko <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"engines": {
"node": ">= 6.0"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/extract-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "lib/index",
"license": "MIT",
"author": "Andy Wermke <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"engines": {
"node": ">= 6.0"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/postcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "lib/index",
"license": "MIT",
"author": "Andy Wermke <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"engines": {
"node": ">= 6.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Snapshot report for `__tests__/webpack-config.test.js`
# Snapshot report for `packages\sample-app\__tests__\webpack-config.test.js`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you running the tests from a windows machine? Wondering because (back)slashes keeps changing back & forth

Copy link
Collaborator Author

@vlad-zhukov vlad-zhukov May 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I've just regenerated snapshots from my Mac.


The actual snapshot is saved in `webpack-config.test.js.snap`.

Expand All @@ -9,33 +9,16 @@ Generated by [AVA](https://ava.li).
> Snapshot 1

{
devServer: {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that correct? ... 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It changed when I only updated ava from 0.22.0 to 0.25.0 before doing any other changes. I couldn't find any release notes related to it.

I'll have look on how to fix it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by setting NODE_ENV to development. This was broken because since 0.23.0 ava sets NODE_ENV to test.

clientLogLevel: 'error',
historyApiFallback: true,
hot: true,
hotOnly: true,
inline: true,
proxy: {
'/api/*': {
target: 'http://localhost:4000',
},
},
stats: 'errors-only',
},
devtool: 'cheap-module-source-map',
entry: {
main: [
'./src/index.dev.js',
],
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: [
{
loader: 'awesome-typescript-loader',
options: {},
options: {
configFileName: '<REPLACED>',
},
},
],
},
Expand Down Expand Up @@ -70,16 +53,11 @@ Generated by [AVA](https://ava.li).
},
],
},
performance: {
maxAssetSize: 1500000,
maxEntrypointSize: 1500000,
},
plugins: [
'CheckerPlugin',
'PathPlugin',
'HtmlWebpackPlugin',
'DefinePlugin',
'HotModuleReplacementPlugin',
],
resolve: {
extensions: [
Expand Down Expand Up @@ -114,7 +92,9 @@ Generated by [AVA](https://ava.li).
use: [
{
loader: 'awesome-typescript-loader',
options: {},
options: {
configFileName: '<REPLACED>',
},
},
],
},
Expand Down
Binary file not shown.
26 changes: 26 additions & 0 deletions packages/sample-app/__tests__/webpack-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@ const configFile = require.resolve('../webpack.config.babel')

test('it exports the development config', t => {
const originalConfig = requireConfig()
const module = Object.assign({}, originalConfig.module, {
Copy link
Owner

@andywer andywer May 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't really expect that change here. It's surely not wrong, but it there a background story why you added this just now? (Just curious :) )

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I made a change in packages/sample-app/webpack.config.babel.js:

-  typescript(),
+  typescript({ configFileName: path.resolve(__dirname, './tsconfig.json') }),

rules: originalConfig.module.rules.map(rule => {
if (rule.test.toString() === /\.(ts|tsx)$/.toString()) {
return Object.assign({}, rule, {
use: rule.use.map(use =>
Object.assign({}, use, {
options: { configFileName: '<REPLACED>' }
})
)
})
}

return rule
})
})
const config = Object.assign({}, originalConfig, {
module,
plugins: originalConfig.plugins.map(p => p.constructor.name)
})
t.snapshot(config)
Expand All @@ -32,6 +48,16 @@ test('it exports the production config', t => {
})
}

if (rule.test.toString() === /\.(ts|tsx)$/.toString()) {
return Object.assign({}, rule, {
use: rule.use.map(use =>
Object.assign({}, use, {
options: { configFileName: '<REPLACED>' }
})
)
})
}

return rule
})
})
Expand Down
1 change: 0 additions & 1 deletion packages/sample-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"private": true,
"version": "0.0.0",
"scripts": {
"test": "ava",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.babel.js",
"start": "cross-env NODE_ENV=development webpack-dev-server --config webpack.config.babel.js"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/sample-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"preserveConstEnums": true,
"sourceMap": true,
"target": "es5",
"jsx": "react"
"jsx": "react",
"typeRoots": ["../../node_modules/@types"]
},
"compileOnSave": false
}
3 changes: 2 additions & 1 deletion packages/sample-app/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const {

const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
const path = require('path')

const developmentConfig = () =>
group([
Expand Down Expand Up @@ -52,7 +53,7 @@ const productionConfig = () =>

module.exports = createConfig([
babel(),
typescript(),
typescript({ configFileName: path.resolve(__dirname, './tsconfig.json') }),
css.modules(),
addPlugins([
new HtmlWebpackPlugin({
Expand Down
4 changes: 0 additions & 4 deletions packages/sass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "lib/index",
"license": "MIT",
"author": "Andy Wermke <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"engines": {
"node": ">= 6.0"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/uglify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"main": "index",
"license": "MIT",
"author": "Artem Sapegin <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"engines": {
"node": ">= 6.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/webpack/__e2e-fixtures__/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"preserveConstEnums": true,
"sourceMap": true,
"target": "es5",
"jsx": "react"
"jsx": "react",
"typeRoots": ["../../../../node_modules/@types"]
},
"compileOnSave": false,
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const path = require('path')
module.exports = createConfig([
entryPoint(path.join(__dirname, 'app.ts')),
setOutput(path.join(__dirname, 'build/bundle.js')),
typescript({ configFileName: path.resolve('./tsconfig.json') }),
typescript({ configFileName: path.resolve(__dirname, './tsconfig.json') }),
tslint({
emitErrors: true,
configuration: {
Expand Down
4 changes: 0 additions & 4 deletions packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"description": "Webpack block for the webpack 2.x base configuration.",
"license": "MIT",
"author": "Andy Wermke <[email protected]>",
"scripts": {
"test": "ava",
"prepublishOnly": "yarn test"
},
"engines": {
"node": ">= 6.0"
},
Expand Down
Loading