diff --git a/examples/templates/example.html b/examples/templates/example.html index 510d0489e2..d1c315ee79 100644 --- a/examples/templates/example.html +++ b/examples/templates/example.html @@ -7,7 +7,7 @@ - + {{{ extraHead.local }}} {{{ css.tag }}} diff --git a/examples/webpack/config.js b/examples/webpack/config.js index 4b364697ae..56ec4351e0 100644 --- a/examples/webpack/config.js +++ b/examples/webpack/config.js @@ -34,7 +34,7 @@ module.exports = { common: 'common' }), new CopyPlugin([ - {from: '../css', to: 'css'}, + {from: '../src/ol/ol.css', to: 'css'}, {from: 'data', to: 'data'}, {from: 'resources', to: 'resources'}, {from: 'Jugl.js', to: 'Jugl.js'}, diff --git a/package.json b/package.json index 37de270949..230a938d37 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openlayers", - "version": "5.0.0-beta.12", + "version": "5.0.0-beta.14", "description": "Build tools and sources for developing OpenLayers based mapping applications", "keywords": [ "map", @@ -13,11 +13,13 @@ "pretest": "npm run lint", "test": "npm run karma -- --single-run", "karma": "karma start test/karma.config.js", - "serve-examples": "mkdir -p build/examples && webpack --config examples/webpack/config.js --mode development --watch & serve build/examples", + "serve-examples": "webpack-dev-server --config examples/webpack/config.js --mode development --watch", "build-examples": "webpack --config examples/webpack/config.js --mode production", "build-index": "node tasks/generate-index", - "prebuild": "npm run build-index", - "build": "rollup --config config/rollup.js", + "set-version": "node tasks/set-version", + "prebuild": "npm run set-version && npm run build-index", + "prepare": "npm run set-version", + "build": "rollup --config config/rollup.js && cleancss --source-map src/ol/ol.css -o build/ol.css", "presrc-closure": "npm run prebuild", "src-closure": "node tasks/transform-types", "pretypecheck": "npm run src-closure", @@ -80,13 +82,13 @@ "rollup-plugin-node-resolve": "3.3.0", "rollup-plugin-sourcemaps": "0.4.2", "rollup-plugin-uglify": "4.0.0", - "serve": "^9.0.0", "sinon": "^6.0.0", "uglifyjs-webpack-plugin": "^1.2.5", "url-polyfill": "^1.0.13", "walk": "^2.3.9", "webpack": "4.12.0", - "webpack-cli": "^3.0.3" + "webpack-cli": "^3.0.3", + "webpack-dev-server": "^3.1.4" }, "eslintConfig": { "extends": "openlayers" diff --git a/src/ol/AssertionError.js b/src/ol/AssertionError.js index ba70e8a492..1510800b98 100644 --- a/src/ol/AssertionError.js +++ b/src/ol/AssertionError.js @@ -13,7 +13,7 @@ import {VERSION, inherits} from './index.js'; */ const AssertionError = function(code) { - const path = VERSION ? VERSION.split('-')[0] : 'latest'; + const path = VERSION.split('-')[0]; /** * @type {string} diff --git a/src/ol/index.js b/src/ol/index.js index 0e289d3923..330e73fdf5 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -68,7 +68,7 @@ export {HAS_WEBGL, WEBGL_MAX_TEXTURE_SIZE, WEBGL_EXTENSIONS}; * OpenLayers version. * @type {string} */ -export const VERSION = 'v4.6.4'; +export const VERSION = '5.0.0-beta.14'; /** diff --git a/css/ol.css b/src/ol/ol.css similarity index 100% rename from css/ol.css rename to src/ol/ol.css diff --git a/src/ol/package.json b/src/ol/package.json new file mode 100644 index 0000000000..2ccdaa47b2 --- /dev/null +++ b/src/ol/package.json @@ -0,0 +1,13 @@ +{ + "name": "ol", + "version": "5.0.0-beta.14", + "description": "OpenLayers mapping library", + "main": "index.js", + "module": "index.js", + "license": "BSD-2-Clause", + "dependencies": { + "pbf": "3.1.0", + "pixelworks": "1.1.0", + "rbush": "2.0.2" + } +} \ No newline at end of file diff --git a/tasks/set-version.js b/tasks/set-version.js new file mode 100644 index 0000000000..004f8bb9ec --- /dev/null +++ b/tasks/set-version.js @@ -0,0 +1,23 @@ +const fs = require('fs'); +const pkg = require('../package.json'); + +const index = require.resolve('../src/ol/index'); +const lines = fs.readFileSync(index, 'utf-8').split('\n'); + +const versionRegEx = /const VERSION = '(.*)';$/; + +for (let i = 0, ii = lines.length; i < ii; ++i) { + const line = lines[i]; + if (versionRegEx.test(line)) { + lines[i] = line.replace(versionRegEx, `const VERSION = '${pkg.version}';`); + break; + } +} + +const packageJson = require.resolve('../src/ol/package.json'); +const packageJsonObj = JSON.parse(fs.readFileSync(packageJson, 'utf-8')); +packageJsonObj.version = pkg.version; +fs.writeFileSync(packageJson, JSON.stringify(packageJsonObj, null, 2), 'utf-8'); + + +fs.writeFileSync(index, lines.join('\n'), 'utf-8');