Skip to content

Commit

Permalink
Provide a transpiled bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Dec 17, 2019
1 parent 2793af1 commit abc9c9d
Show file tree
Hide file tree
Showing 32 changed files with 45 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.circleci/
.git/
example/
examples/
test/
.editorconfig
.eslintrc
webpack.*.js
tsconfig.*.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ for rendering.
### stylefunction

```js
import stylefunction from 'ol-mapbox-style/stylefunction';
import stylefunction from 'ol-mapbox-style/dist/stylefunction';
```

Creates a style function from the `glStyle` object for all layers that use
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ol-mapbox-style",
"version": "5.0.2",
"description": "Create OpenLayers maps from Mapbox Style objects",
"main": "index.js",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git://github.com/openlayers/ol-mapbox-style.git"
Expand All @@ -17,37 +17,37 @@
],
"license": "BSD-2-Clause",
"scripts": {
"start": "webpack-dev-server --config ./webpack.config.js",
"start": "webpack-dev-server --config ./webpack.config.examples.js",
"prepare": "npm run doc && npm run build",
"build": "webpack-cli --mode=production --config ./webpack.config.olms.js && webpack-cli --mode=production",
"doc": "documentation readme -s API index.js stylefunction.js --document-exported true",
"build": "tsc --project tsconfig-build.json && webpack-cli --mode=production --config ./webpack.config.olms.js && webpack-cli --mode=production --config ./webpack.config.examples.js",
"doc": "documentation readme -s API src/index.js src/stylefunction.js --document-exported true",
"karma": "karma start test/karma.conf.js",
"lint": "eslint test example *.js",
"typecheck": "tsc --project tsconfig-typecheck.json",
"pretest": "npm run lint && npm run typecheck",
"test": "npm run karma -- --single-run --log-level error"
},
"dependencies": {
"@mapbox/mapbox-gl-style-spec": "^13.9.0",
"@mapbox/mapbox-gl-style-spec": "^13.10.1",
"mapbox-to-css-font": "^2.4.0",
"webfont-matcher": "^1.1.0"
},
"peerDependencies": {
"ol": "^6.1.0"
},
"devDependencies": {
"@types/node": "^12.7.12",
"@types/node": "^12.12.19",
"babel-loader": "^8.0.6",
"buble": "^0.19.8",
"buble-loader": "^0.5.1",
"copy-webpack-plugin": "^4.6.0",
"css-loader": "^1.0.1",
"css-loader": "^3.4.0",
"deep-freeze": "0.0.1",
"documentation": "^11.0.1",
"documentation": "^12.1.4",
"eslint": "^5.16.0",
"eslint-config-openlayers": "^11.0.0",
"html-webpack-plugin": "^3.2.0",
"karma": "^4.3.0",
"karma": "^4.4.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-mocha": "^1.3.0",
Expand All @@ -56,14 +56,14 @@
"mapbox-gl-styles": "^2.0.2",
"mini-css-extract-plugin": "^0.4.5",
"mocha": "^5.2.0",
"ol": "^6.0.1",
"ol": "^6.1.1",
"puppeteer": "^1.20.0",
"should": "^13.2.3",
"sinon": "^7.5.0",
"style-loader": "^0.23.1",
"typescript": "^3.6.3",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.2"
"typescript": "3.5.3",
"webpack": "^4.41.3",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.9.0"
}
}
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions stylefunction.js → src/stylefunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import Icon from 'ol/style/Icon';
import Text from 'ol/style/Text';
import Circle from 'ol/style/Circle';
import RenderFeature from 'ol/render/Feature';
import derefLayers from '@mapbox/mapbox-gl-style-spec/deref';
import {
derefLayers,
expression, Color,
function as fn,
latest as spec,
Expand Down Expand Up @@ -168,7 +168,7 @@ function fromTemplate(text, properties) {

/**
* ```js
* import stylefunction from 'ol-mapbox-style/stylefunction';
* import stylefunction from 'ol-mapbox-style/dist/stylefunction';
* ```
* Creates a style function from the `glStyle` object for all layers that use
* the specified `source`, which needs to be a `"type": "vector"` or
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"outDir": "./dist",
"target": "ES5",
"module": "es2015",
"sourceMap": true,
"allowJs": true,
"importHelpers": false,
},
"include": [
"./src/**/*.js"
],
"exclude": []
}
2 changes: 1 addition & 1 deletion tsconfig-typecheck.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
]
},
"include": [
"*.js"
"src/*.js"
]
}
17 changes: 9 additions & 8 deletions webpack.config.js → webpack.config.examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

/** Get the list of examples from the example directory.
/** Get the list of examples from the examples directory.
*
* @param {String} dirName - Name of the directory to read.
* @param {Function} callback - Function to execute for each example.
Expand Down Expand Up @@ -77,7 +77,7 @@ module.exports = (env, argv) => {
context: __dirname,
target: 'web',
mode: prod ? 'production' : 'development',
entry: getEntries(path.resolve(__dirname, './example')),
entry: getEntries(path.resolve(path.join(__dirname, 'examples'))),
optimization: {
runtimeChunk: {
name: 'common'
Expand All @@ -90,11 +90,11 @@ module.exports = (env, argv) => {
},
output: {
filename: '[name].js',
path: path.join(__dirname, 'dist')
path: path.join(__dirname, 'dist', 'examples')
},
resolve: {
alias: {
'ol-mapbox-style': path.join(__dirname, '.')
'ol-mapbox-style': path.join(__dirname, 'src')
}
},
devtool: 'source-map',
Expand All @@ -112,7 +112,7 @@ module.exports = (env, argv) => {
test: /\.js$/,
include: [
__dirname,
/node_modules\/(?!(ol|@mapbox\/mapbox-gl-style-spec)\/)/
/node_modules\/(?!(@mapbox\/mapbox-gl-style-spec)\/)/
],
use: {
loader: 'buble-loader'
Expand All @@ -129,16 +129,17 @@ module.exports = (env, argv) => {
}),
// ensure the data is copied over.
// currently the index.html is manually created.
// @ts-ignore
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, './example/data'),
from: path.resolve(__dirname, './examples/data'),
to: 'data'
},
{
from: path.resolve(__dirname, './example/index.html'),
from: path.resolve(__dirname, './examples/index.html'),
to: 'index.html'
}
])
].concat(getHtmlTemplates('./example'))
].concat(getHtmlTemplates('./examples'))
};
};
5 changes: 2 additions & 3 deletions webpack.config.olms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');

module.exports = {
entry: './olms.js',
entry: './src/olms.js',
devtool: 'source-map',
node: {fs: 'empty'},
mode: 'production',
Expand All @@ -10,8 +10,7 @@ module.exports = {
{
test: /\.js$/,
include: [
__dirname,
/node_modules\/(?!(ol|@mapbox\/mapbox-gl-style-spec)\/)/
__dirname
],
use: {
loader: 'buble-loader'
Expand Down

0 comments on commit abc9c9d

Please sign in to comment.