Skip to content

Commit 6e81233

Browse files
authored
Merge pull request #52 from typecode/swap-to-webpack
Audit fixes
2 parents 45ea8c4 + 65dc6fd commit 6e81233

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+15801
-12183
lines changed

.babelrc

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
{
2-
"presets": [
3-
[
4-
"es2015",
5-
{
6-
"modules": false
7-
}
8-
]
9-
],
10-
"plugins": [
11-
"external-helpers",
12-
"transform-object-rest-spread"
13-
]
2+
"presets": [["@babel/preset-env", { "modules": false }]],
3+
"plugins": ["add-module-exports"]
144
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ _notes_/
55
docs/site/
66
docs/src/
77

8+
test/integration/screenshots
9+
test/integration/videos
10+
811
yarn-error.log
912
npm-debug.log

README.md

+13-14
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ and submit your issue / feature request.
106106
3. Make sure all tests pass
107107
1. If you have added a new feature, make sure there is a test for it
108108
2. Run the following:
109-
`~> yarn test` (for unit tests) & `~>yarn test_e2e` (end-to-end tests)
109+
`~> yarn test_unit` (for unit tests) & `~>yarn test_e2e` (end-to-end tests)
110110
3. If you have changed the codebase in a way that requires the tests to be updated
111111
please do so.
112112
4. Update the documentation if you've added any publicly accessible methods or options.
@@ -115,11 +115,11 @@ and submit your issue / feature request.
115115
7. Create a new pull request.
116116

117117
### Setup local dev environment
118-
Install all the node moudles
118+
Install all the node modules
119119
```
120120
~> yarn
121-
~> cd test/e2e/test && yarn
122121
```
122+
123123
### Run build scripts
124124
For a one time build
125125
```
@@ -130,34 +130,33 @@ For a continuous reactive build that watches for changes
130130
~> yarn watch
131131
```
132132

133-
### Run the local server
134-
You will need to have [Docker](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) installed firstly.
135-
136-
Then:
133+
### Run the dev server
137134
```
138-
~> yarn local_server
135+
~> yarn dev-server
139136
```
140137
You should then be able to navigate your browser to:
141138
```
142-
http://localhost:4848
139+
http://localhost:9000
143140
```
144141

145142
### Run the tests
146143
**Make sure you build first**
147-
Once again, you will need to have [Docker](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) installed.
148-
149-
Then:
150144

151145
Unit tests (Karma & Jasmine)
152146
```
153-
~> yarn test
147+
~> yarn test_unit
154148
```
155149

156150
e2e tests (nightwatch)
157151
```
158152
~> yarn test_e2e
159153
```
160154

155+
all tests (unit & e2e)
156+
```
157+
~> yarn test
158+
```
159+
161160
### Build and read the developer docs
162161
For a once off build:
163162
```
@@ -176,5 +175,5 @@ Then, to read the docs:
176175

177176
And point you browser to:
178177
```
179-
http://localhost:4849
178+
http://localhost:9001
180179
```

cypress.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"fixturesFolder": "test/integration/fixtures",
3+
"integrationFolder": "test/integration/specs",
4+
"pluginsFile": "test/integration/plugins/index.js",
5+
"screenshotsFolder": "test/integration/screenshots",
6+
"supportFile": "test/integration/support/index.js",
7+
"videosFolder": "test/integration/videos"
8+
}

docs/docker-compose.yml

-8
This file was deleted.

docs/webpack.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*global require __dirname module*/
2+
3+
const path = require('path');
4+
console.log(path.resolve(__dirname, 'src/index.js'));
5+
module.exports = {
6+
entry: path.resolve(__dirname, 'src/index.js'),
7+
output: {
8+
path: path.resolve(__dirname, 'src/'),
9+
filename: 'build.js'
10+
},
11+
devServer: {
12+
contentBase: path.resolve(__dirname, 'site/'),
13+
host: '0.0.0.0',
14+
port: 9001,
15+
disableHostCheck: true,
16+
index: 'index.html'
17+
}
18+
};

karma.conf.js

+17-84
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,43 @@
11
// jshint strict: false
2+
const webpackConfig = require('./webpack.config');
3+
delete webpackConfig.entry;
4+
delete webpackConfig.output;
25

36
module.exports = function (config) {
47
config.set({
58
basePath: '',
69

7-
frameworks: ['jasmine-jquery', 'jasmine'],
10+
frameworks: ['jquery-2.0.0', 'jasmine'],
811

912
files: [
1013
'./test/unit/setup.js',
11-
// {pattern: './src/scripts/**/*.js', included: false},
1214
{pattern: './test/unit/fixtures/**/*.html', included: false, served: true},
13-
// {pattern: './test/helpers/**/*.js', included: false},
14-
'./test/unit/**/*.spec.js'
15+
'test/unit/**/*.spec.js'
1516
],
1617

1718
preprocessors: {
18-
'./test/unit/setup.js': ['rollup'],
19-
'./src/scripts/**/*.js': ['rollup', /*'sourcemap', 'coverage'*/],
20-
'./test/unit/**/*.spec.js': ['rollup', /*'sourcemap'*/]
19+
'./test/unit/setup.js': ['webpack'],
20+
'./src/scripts/**/*.js': ['webpack'],
21+
'test/unit/**/*.spec.js': ['webpack']
2122
},
2223

23-
rollupPreprocessor: {
24-
plugins: [
25-
require('rollup-plugin-node-resolve')({
26-
jsnext: true,
27-
main: true,
28-
browser: true
29-
}),
30-
require('rollup-plugin-sass')({
31-
output: false,
32-
processor(css) {
33-
return require('postcss')([require('autoprefixer')]).process(css)
34-
.then(result => result.css);
35-
}
24+
webpack: Object.assign({}, webpackConfig, {
25+
output: {
3626

37-
}),
38-
require('rollup-plugin-handlebars-plus')({
39-
templateExtension: '.html'
40-
}),
41-
require('rollup-plugin-commonjs')(),
42-
require('rollup-plugin-istanbul')({
43-
exclude: ['./test/unit/**/*.js', 'node_modules/**']
44-
}),
45-
require('rollup-plugin-babel')({
46-
exclude: 'node_modules/**'
47-
})
48-
],
49-
format: 'iife',
50-
moduleName: 'typester',
51-
sourceMap: 'inline'
27+
}
28+
}),
29+
30+
webpackMiddleware: {
31+
noInfo: true
5232
},
33+
5334
logLevel: config.LOG_DEBUG,
54-
plugins: [
55-
'karma-rollup-preprocessor',
56-
'karma-jasmine',
57-
'karma-jasmine-jquery',
58-
'karma-spec-reporter',
59-
'karma-sourcemap-loader',
60-
'karma-coverage',
61-
'karma-phantomjs-launcher'
62-
],
63-
reporters: ['spec'/*, 'coverage' */],
35+
reporters: ['spec'],
6436
coverageReporter: {
6537
type: 'html',
6638
dir: 'coverage/'
6739
},
6840
browsers: ['PhantomJS'],
6941
autoWatchBatchDelay: 3000
7042
});
71-
72-
73-
if (process.env.NODE_ENV === 'ci') {
74-
config.set({
75-
plugins: config.plugins.concat([
76-
'karma-junit-reporter',
77-
'karma-chrome-launcher',
78-
'karma-firefox-launcher'
79-
]),
80-
reporters: ['junit'],
81-
autoWatch: false,
82-
browserDisconnectTolerance: 2,
83-
concurrency: 1,
84-
singleRun: true,
85-
junitReporter: {
86-
outputDir: 'coverage',
87-
outputFile: 'report.xml',
88-
suite: '',
89-
useBrowserName: true
90-
},
91-
customLaunchers: {
92-
'chrome': {
93-
base: 'Chrome',
94-
flags: ['--headless', '--no-sandbox', '--disable-gpu', '--remote-debugging-port=9222'],
95-
displayName: 'Typester-Chrome'
96-
},
97-
'firefox': {
98-
base: 'Firefox',
99-
flags: ['-headless'],
100-
displayName: 'Typester-Firefox'
101-
},
102-
'phantom': {
103-
base: 'PhantomJS',
104-
displayName: 'Typester-PhantomJS'
105-
}
106-
},
107-
browsers: ['phantom', 'chrome', 'firefox']
108-
});
109-
}
11043
};

0 commit comments

Comments
 (0)