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

[WIP] Update pageflow-react build stack #20

Closed
wants to merge 11 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ spec/dummy/*
/app/assets/javascripts/pageflow/dist
.localeapp

/node_modules
/packages/*/node_modules
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ before_script:
- bin/rake pageflow:dummy
- bin/rake app:assets:precompile

- bin/yarn install
- bin/yarn run build

- bin/npm ci
- bin/npm run build
- yarn install
- bin/build-packages

script:
- bin/rspec
- (cd packages/pageflow; yarn test)
- (cd packages/pageflow-react; yarn test)
- bin/teaspoon
- bin/npm test

after_success:
- bundle exec publish-pageflow-theme-doc
Expand Down
7 changes: 2 additions & 5 deletions bin/build-edge
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

set -ex

bin/yarn install --frozen-lockfile
bin/yarn run build

bin/npm ci
bin/npm run build
yarn install --frozen-lockfile
./build-packages

git add -f app/assets/javascripts/pageflow/dist/{react-*,editor}.js
git commit app/assets/javascripts/pageflow/dist/{react-*,editor}.js -m "Build"
6 changes: 6 additions & 0 deletions bin/build-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -ex

(cd ./packages/pageflow; yarn run build)
(cd ./packages/pageflow-react; yarn run build)
3 changes: 0 additions & 3 deletions bin/npm

This file was deleted.

3 changes: 0 additions & 3 deletions bin/yarn

This file was deleted.

65 changes: 19 additions & 46 deletions doc/contributing/node_package_development.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,42 @@
# Node Package Development

## pageflow Package

The repository contains bin stubs to run `yarn` commands inside the
`packages/pageflow` directory.

### Installing Dependencies

Ensure the development machine meets the requirements listed in the
readme. From the repository root run:

$ bin/yarn install

### Running the Test Suite

A Jest test suite lives in inside `packages/pageflow/spec`. It can run
from the repository root:

$ bin/yarn test

### Running Development Watchers

To invoke the Rollup build when changing files, run the following
command from the repository root:

$ bin/yarn start

### Building for Release

To output a production ready build, run:

$ bin/yarn run build

## pageflow-react Package

The repository contains bin stubs to run `npm` commands inside the
`packages/pageflow-react` directory.
$ yarn install

### Installing Dependencies
### Running the Test Suites

Ensure the development machine meets the requirements listed in the
readme. From the repository root run:
The Jest test suites need to be run from the respective package
roots. To run the specs from `packages/pageflow/spec`:

$ bin/npm install
$ cd packages/pageflow
$ yarn test

### Running the Test Suite
The `pageflow-react` contains co-located tests inside
`packages/pageflow-react/src/**/__spec__` directories:

The node package contains co-located tests inside
`packages/pageflow-react/src/**/__spec__` directories. Those can run from the
repository root:

$ bin/npm test
$ cd packages/pageflow-react
$ yarn test

### Running Development Watchers

To invoke the Webpack build and the test suite when changing files,
run the following command from the repository root:
To invoke the Rollup/Webpack build when changing files, run the following
command from the respective package roots:

$ cd packages/pageflow-react
$ yarn start

$ bin/npm start
$ cd packages/pageflow
$ yarn start

### Building for Release

To output a production ready build, run:
To output a production ready build, run from the repository run:

$ bin/npm run build
$ bin/build-packages

## See Also

Expand Down
13 changes: 3 additions & 10 deletions doc/contributing/rails_engine_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
Ensure the development machine meets the requirements listed in the
readme. From the repository root run:

$ gem install bundler
$ bundle install
$ bin/npm install
$ bin/yarn install
$ yarn install

Build node packages to `assets` directory:

$ bin/yarn run build
$ bin/npm run build
$ bin/build-packages

## Running the Test Suite

Expand All @@ -24,14 +21,10 @@ different host, you can specify a MySQL host in the environment
variable `$PAGEFLOW_DB_HOST` and a port in `$PAGEFLOW_DB_PORT`
(default: 3306).

Use the binstubs to invoke the Ruby test suite
Use the binstub to invoke the Ruby test suite

$ bin/rspec

or the headless browser based Javascript test suite

$ bin/teaspoon

Chrome 59 or newer has to be installed on the same computer you're running
the tests on.

Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"private": true,
"workspaces": [
"packages/pageflow",
"packages/pageflow-react"
]
}
4 changes: 0 additions & 4 deletions packages/pageflow-react/.babelrc

This file was deleted.

49 changes: 42 additions & 7 deletions packages/pageflow-react/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
},
"settings": {
"import/resolver": {
"webpack": {
"config": "./webpack.karma.config.js"
"jest": {
"jestConfigFile": "./jest.config.js"
}
},
"react": {
"version": "0.14",
}
},
"extends": [
Expand All @@ -32,19 +35,51 @@
"plugin:import/errors",
"plugin:import/warnings"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true,
"modules": true
"jsx": true
}
},
"plugins": ["react", "import"],
"plugins": ["react", "import", "jest"],
"globals": {
"React": true,
"pageflow": true,
"PAGEFLOW_EDITOR": true,
"I18n": true
}
},
"overrides": [
{
"files": ['*.config.js'],
"env": {
"node": true
}
},
{
"files": ["spec/**/*.js", "**/__spec__/*"],
"env": {
'jest/globals': true
},
"rules": {
'jest/expect-expect': 'warn',
'jest/no-commented-out-tests': 'warn',
'jest/no-disabled-tests': 'warn',
'jest/no-export': 'error',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/no-jest-import': 'error',
'jest/no-mocks-import': 'error',
'jest/no-jasmine-globals': 'warn',
'jest/no-standalone-expect': 'error',
'jest/no-test-callback': 'error',
'jest/no-test-prefixes': 'error',
'jest/no-try-expect': 'error',
'jest/valid-describe': 'error',
'jest/valid-expect': 'error',
'jest/valid-expect-in-promise': 'error'
}
}
]
}
18 changes: 18 additions & 0 deletions packages/pageflow-react/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const presets = [
[
'@babel/env',
{
'corejs': 3,
'useBuiltIns': 'usage'
}
],
'@babel/preset-react'
];

module.exports = {
presets,
exclude: [
'../../node_modules/**',
'node_modules/**'
]
};
16 changes: 16 additions & 0 deletions packages/pageflow-react/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
'testEnvironment': 'enzyme',
'testEnvironmentOptions': {
'enzymeAdapter': 'react14'
},
testMatch: ['<rootDir>/src/**/__spec__/*-spec.js?(x)'],
globals: {
pageflow: {},
},
setupFiles: ['<rootDir>/spec/support/reactGlobal.js'],
setupFilesAfterEnv: ['jest-enzyme', 'jest-sinon', '<rootDir>/spec/support/matchers/descendants.js'],
modulePaths: ['<rootDir>/src', '<rootDir>/spec'],
transform: {
'^.+\\.jsx?$': 'babel-jest'
}
};
44 changes: 0 additions & 44 deletions packages/pageflow-react/karma.conf.js

This file was deleted.

Loading