diff --git a/.gitignore b/.gitignore
index 73741658..b99f7a4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,8 @@
/build/
/node_modules/
-/bower_components/
/vendor/
/examples/build.js
+/examples/build.js.map
.tern-port
.npm-debug.log
.DS_Store
diff --git a/.tern-project b/.tern-project
index d04e1c5c..f758c0c5 100644
--- a/.tern-project
+++ b/.tern-project
@@ -3,8 +3,8 @@
"requirejs": {
"baseURL": "./src",
"paths": {
- "html-janitor": "./bower_components/html-janitor/src/html-janitor",
- "lodash-amd": "../bower_components/lodash-amd"
+ "html-janitor": "./node_modules/html-janitor/src/html-janitor",
+ "lodash-amd": "../node_modules/lodash-amd"
}
},
"node": {}
diff --git a/.travis.yml b/.travis.yml
index 16de9713..7fba92c5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,16 +1,14 @@
language: node_js
node_js:
- - "5.11"
+ - "6.11"
sudo: false
cache:
directories:
- node_modules
- - bower_components
before_script:
- - npm install -g bower
- - bower install
+ - npm install
script: TEST_SERVER_PORT=8090 npm test
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e94f8591..f47b17bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+# 4.0.0
+
+- Builds using [webpack](https://webpack.js.org/)
+- Switches to [npm](https://npmjs.com)-only dependency management and publishing, removing [bower](https://bower.io/) support.
+- Updates dependencies
+
+These changes are the first in a wide-ranging modernisation process that scribe will be going through.
+
# 3.3.0
Merges a range of bug fixes including removing the dependency on lodash, use of ES6 `const` not inserting `
` tags into custom elements and a sanity check to ensure a `listElement` exists before inserting a list.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index be3ac8c5..f44d6ddd 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -21,7 +21,18 @@ Please see the [wiki](https://github.com/guardian/scribe/wiki/Testing) for detai
## Releasing
+### npm
+* `git checkout master`.
+* Update `CHANGELOG.md`
+* Update the version number in `package.json`
+* Commit with message of `v`
+* `git push`
+* Run `npm publish`
+
### Bower
+
+** NOTE: as of version 4.0.0, Scribe is no longer distributed via Bower. **
+
* `git checkout master`
* Run `./release.sh [ | major | minor | patch | build ]` (we use
[mversion](https://github.com/mikaelbr/mversion#usage-cli)). (If releasing a
@@ -30,15 +41,10 @@ Please see the [wiki](https://github.com/guardian/scribe/wiki/Testing) for detai
If you are, run `git push; git push --tags`. (The `dist` tree is for
distribution via Bower).
-### npm
-* `git checkout master`.
-* Update `CHANGELOG.md`
-* Update the version number in `package.json`
-* Commit with message of `v`
-* `git push`
-* Run `npm publish`
-
### Update example
+
+** NOTE: as of version 4.0.0, Scribe is no longer distributed via Bower. **
+
* `git checkout gh-pages`
* `git pull`
* Update necessary dependency versions in `bower.json`. Check `bower ls` to see
diff --git a/Gruntfile.js b/Gruntfile.js
deleted file mode 100644
index 8b0942e4..00000000
--- a/Gruntfile.js
+++ /dev/null
@@ -1,50 +0,0 @@
-module.exports = function(grunt) {
-
- // Add the grunt-mocha-test tasks.
- grunt.loadNpmTasks('grunt-mocha-test');
- grunt.loadNpmTasks('grunt-contrib-requirejs');
-
- grunt.initConfig({
- // Configure a mochaTest task
- mochaTest: {
- test: {
- options: {
- reporter: 'spec',
- },
- src: ['test/**/*.spec.js']
- }
- },
- });
-
- function requireConfiguration(optimize, outputFilename) {
- return {
- compile: {
- options: {
- baseUrl: "src",
- name: "scribe",
- paths: {
- 'lodash-amd': '../bower_components/lodash-amd',
- 'immutable': '../bower_components/immutable/dist/immutable'
- },
- optimize: optimize,
- preserveLicenseComments: false,
- generateSourceMaps: true,
- out: "build/" + outputFilename
- }
- }
- }
- }
-
- grunt.registerTask('build', 'Build output files', function() {
- grunt.config('requirejs', requireConfiguration('uglify2', 'scribe.min.js'));
- grunt.task.run('requirejs');
-
- grunt.config('requirejs', requireConfiguration('none', 'scribe.js'));
- grunt.task.run('requirejs');
- });
-
- grunt.registerTask('test', ['mochaTest']);
-
- grunt.registerTask('default', 'test');
-
-};
diff --git a/Plumbing.js b/Plumbing.js
deleted file mode 100644
index ee29e43c..00000000
--- a/Plumbing.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Warning: shameless self-plug!
- * Plumber is the Guardian’s tool of choice for build systems.
- * https://github.com/plumberjs/plumber
- */
-
-var all = require('plumber-all');
-// var bower = require('plumber-bower');
-var glob = require('plumber-glob');
-var requireJS = require('plumber-requirejs');
-var uglifyJS = require('plumber-uglifyjs')();
-var write = require('plumber-write');
-
-module.exports = function (pipelines) {
- var mainRequireJS = requireJS({
- // FIXME: auto?
- preserveLicenseComments: false,
- paths: {
- 'lodash-amd': '../bower_components/lodash-amd',
- 'immutable': '../bower_components/immutable/dist/immutable'
- }
- });
-
- var toBuildDir = write('./build');
- var writeBoth = all(
- [uglifyJS, toBuildDir],
- toBuildDir
- );
-
- /* jshint -W069 */
-
- pipelines['build'] = [
- // TODO: use bower operation to find main of this component?
- // As per: https://github.com/bower/bower/issues/1090
- // bower('scribe'),
- glob('./src/scribe.js'),
- mainRequireJS,
- // Send the resource along these branches
- writeBoth
- ];
-};
diff --git a/README.md b/README.md
index 7241cc4c..2cacf901 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Scribe patches [many browser inconsistencies][browser inconsistencies] in the [n
## Installation
```
-bower install scribe
+npm install scribe-editor
```
Alternatively, you can [access the distribution files through GitHub releases](https://github.com/guardian/scribe/releases).
@@ -58,7 +58,7 @@ require(['scribe', 'scribe-plugin-blockquote-command', 'scribe-plugin-toolbar'],
You can [see a live example here][example], or [view the code here](https://github.com/guardian/scribe).
Also be sure to check the [`examples`](./examples) directory for an
-AMD syntax example as well as a CommonJS (browserify) example.
+AMD syntax example as well as a CommonJS example.
## Options
diff --git a/bower.json b/bower.json
deleted file mode 100644
index ae79ab7d..00000000
--- a/bower.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "scribe",
- "dependencies": {
- "immutable" : "3.8.1"
- },
- "devDependencies": {
- "requirejs": "~2.1.9",
- "scribe-plugin-blockquote-command": "guardian/scribe-plugin-blockquote-command#master",
- "scribe-plugin-formatter-plain-text-convert-new-lines-to-html": "guardian/scribe-plugin-formatter-plain-text-convert-new-lines-to-html#master",
- "scribe-plugin-heading-command": "guardian/scribe-plugin-heading-command#master",
- "scribe-plugin-link-prompt-command": "guardian/scribe-plugin-link-prompt-command#master",
- "scribe-plugin-sanitizer": "guardian/scribe-plugin-sanitizer#master",
- "scribe-plugin-toolbar": "guardian/scribe-plugin-toolbar#master",
- "scribe-plugin-inline-styles-to-elements": "guardian/scribe-plugin-inline-styles-to-elements#master"
- }
-}
diff --git a/circle.yml b/circle.yml
index 1c28ba73..5e955074 100644
--- a/circle.yml
+++ b/circle.yml
@@ -1,9 +1,8 @@
machine:
node:
- version: 5
+ version: 6
dependencies:
pre:
- - npm install -g bower
- - bower install
+ - npm install
- ./setup.sh
diff --git a/examples/amd-inline.html b/examples/amd-inline.html
index 3348d285..6e24eb52 100644
--- a/examples/amd-inline.html
+++ b/examples/amd-inline.html
@@ -3,7 +3,7 @@
editor using RequireJS and the AMD module syntax.
Note that you'll need to install scribe's dependencies through
-`bower install`. See http://bower.io/ if you are unfamiliar.
+`npm install`. See http://npmjs.com if you are unfamiliar.
-->
-
+
+
+
+
+
+
+
+
diff --git a/test-old/block-mode.spec.js b/test-old/block-mode.spec.js
index 4c3abbfd..f2ac6858 100644
--- a/test-old/block-mode.spec.js
+++ b/test-old/block-mode.spec.js
@@ -66,7 +66,7 @@ describe('block mode', function () {
describe('blockquotes', function () {
beforeEach(function () {
return driver.executeAsyncScript(function (done) {
- require(['../../bower_components/scribe-plugin-blockquote-command/src/scribe-plugin-blockquote-command'], function (blockquoteCommand) {
+ require(['../../node_modules/scribe-plugin-blockquote-command/src/scribe-plugin-blockquote-command'], function (blockquoteCommand) {
window.scribe.use(blockquoteCommand());
done();
});
diff --git a/test-old/formatters.spec.js b/test-old/formatters.spec.js
index ff3abc25..3044316b 100644
--- a/test-old/formatters.spec.js
+++ b/test-old/formatters.spec.js
@@ -154,7 +154,7 @@ describe('formatters', function () {
describe('convert new lines to HTML', function () {
beforeEach(function () {
return driver.executeAsyncScript(function (done) {
- require(['../../bower_components/scribe-plugin-formatter-plain-text-convert-new-lines-to-html/src/scribe-plugin-formatter-plain-text-convert-new-lines-to-html'], function (convertNewLinesToHtmlFormatter) {
+ require(['../../node_modules/scribe-plugin-formatter-plain-text-convert-new-lines-to-html/src/scribe-plugin-formatter-plain-text-convert-new-lines-to-html'], function (convertNewLinesToHtmlFormatter) {
window.scribe.use(convertNewLinesToHtmlFormatter());
done();
});
@@ -242,7 +242,7 @@ describe('formatters', function () {
when('the sanitizer plugin is enabled', function () {
beforeEach(function () {
return driver.executeAsyncScript(function (done) {
- require(['../../bower_components/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
+ require(['../../node_modules/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
window.scribe.use(scribePluginSanitizer({ tags: { p: {} } }));
done();
});
@@ -281,7 +281,7 @@ describe('formatters', function () {
describe('normalization phase', function () {
beforeEach(function () {
return driver.executeAsyncScript(function (done) {
- require(['../../bower_components/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
+ require(['../../node_modules/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
window.scribe.use(scribePluginSanitizer({
tags: {
p: {}
@@ -310,7 +310,7 @@ describe('formatters', function () {
describe('trim whitespace', function () {
beforeEach(function () {
return driver.executeAsyncScript(function (done) {
- require(['../../bower_components/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
+ require(['../../node_modules/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
window.scribe.use(scribePluginSanitizer({
tags: {
p: {}
@@ -344,7 +344,7 @@ describe('formatters', function () {
* The file below contains the formatter which corrects invalid HTML,
* ideally it should live in core and we wouldn't need to require it
**/
- require(['../../bower_components/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
+ require(['../../node_modules/scribe-plugin-sanitizer/src/scribe-plugin-sanitizer'], function (scribePluginSanitizer) {
window.scribe.use(scribePluginSanitizer({
tags: { p: {}, b: {} }}));
done();
diff --git a/test-old/unit/children.spec.js b/test-old/unit/children.spec.js
index d56cdf60..3d859b58 100644
--- a/test-old/unit/children.spec.js
+++ b/test-old/unit/children.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test-old/unit/config.spec.js b/test-old/unit/config.spec.js
index bc1c2d82..91fe9d35 100644
--- a/test-old/unit/config.spec.js
+++ b/test-old/unit/config.spec.js
@@ -3,8 +3,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test-old/unit/event-emitter.spec.js b/test-old/unit/event-emitter.spec.js
index ca6f32fb..6a365514 100644
--- a/test-old/unit/event-emitter.spec.js
+++ b/test-old/unit/event-emitter.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test-old/unit/mutations.spec.js b/test-old/unit/mutations.spec.js
index 3dd046e5..37493657 100644
--- a/test-old/unit/mutations.spec.js
+++ b/test-old/unit/mutations.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test-old/unit/node.spec.js b/test-old/unit/node.spec.js
index d4faed75..77cc9856 100644
--- a/test-old/unit/node.spec.js
+++ b/test-old/unit/node.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test/children.spec.js b/test/children.spec.js
index 7293aad2..8722394d 100644
--- a/test/children.spec.js
+++ b/test/children.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test/config.spec.js b/test/config.spec.js
index 808b6d93..609a2b4d 100644
--- a/test/config.spec.js
+++ b/test/config.spec.js
@@ -3,8 +3,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test/event-emitter.spec.js b/test/event-emitter.spec.js
index 611c7a64..0fd86d52 100644
--- a/test/event-emitter.spec.js
+++ b/test/event-emitter.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test/keystrokes.spec.js b/test/keystrokes.spec.js
index a850b029..22aea4da 100644
--- a/test/keystrokes.spec.js
+++ b/test/keystrokes.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname + "/../../src",
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test/mutations.spec.js b/test/mutations.spec.js
index be6dc425..e7b73e20 100644
--- a/test/mutations.spec.js
+++ b/test/mutations.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname,
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
diff --git a/test/node.spec.js b/test/node.spec.js
index 7d347d10..bed06fa4 100644
--- a/test/node.spec.js
+++ b/test/node.spec.js
@@ -1,8 +1,8 @@
require('node-amd-require')({
baseUrl: __dirname + "/../../src",
paths: {
- 'lodash-amd': '../../bower_components/lodash-amd',
- 'immutable': '../../bower_components/immutable'
+ 'lodash-amd': '../../node_modules/lodash-amd',
+ 'immutable': '../../node_modules/immutable'
}
});
@@ -92,7 +92,7 @@ describe('Node type checking', function() {
});
describe('that have non-whitespace content', function() {
it('are correctly detected', function() {
- var fakeNode = {
+ var fakeNode = {
nodeValue: "hello world",
nodeType: 3
};
@@ -101,7 +101,7 @@ describe('Node type checking', function() {
});
it('but are actually empty', function() {
- var fakeNode = {
+ var fakeNode = {
nodeValue: "",
nodeType: 3
};
@@ -110,7 +110,7 @@ describe('Node type checking', function() {
});
it('but only whitespace', function() {
- var fakeNode = {
+ var fakeNode = {
nodeValue: " ",
nodeType: 3
};
diff --git a/webpack.conf.js b/webpack.conf.js
new file mode 100644
index 00000000..c687b4b1
--- /dev/null
+++ b/webpack.conf.js
@@ -0,0 +1,8 @@
+var webpack = require('webpack');
+
+module.exports = {
+
+ resolve: {
+ extensions: ['.js']
+ }
+};