Skip to content

Commit

Permalink
Update publishing (#616)
Browse files Browse the repository at this point in the history
* Update publish syntax
* Update publishing instructions
* version bump
  • Loading branch information
acalcutt authored Sep 28, 2022
1 parent b2bd5ea commit 7f6d6bc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
9 changes: 8 additions & 1 deletion PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
- Update version in `package.json`
- `git tag vx.x.x`
- `git push --tags`
- `node publish.js` (publishes packages to npm)
- `docker buildx build --platform linux/amd64 -t maptiler/tileserver-gl:latest -t maptiler/tileserver-gl:[version] .`
- `docker push maptiler/tileserver-gl --all-tags`
- `npm publish --access public` or `node publish.js`
- `node publish.js --no-publish`
- `cd light`
- `docker buildx build --platform linux/amd64 -t maptiler/tileserver-gl-light:latest -t maptiler/tileserver-gl-light:[version] .`
- `docker push maptiler/tileserver-gl-light --all-tags`
- `npm publish --access public`
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tileserver-gl",
"version": "4.1.0",
"version": "4.1.1",
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
"main": "src/main.js",
"bin": "src/main.js",
Expand Down
18 changes: 12 additions & 6 deletions publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@
/* CREATE tileserver-gl-light */

// SYNC THE `light` FOLDER
require('child_process').execSync('rsync -av --exclude="light" --exclude=".git" --exclude="node_modules" --delete . light', {

import child_process from 'child_process'
child_process.execSync('rsync -av --exclude="light" --exclude=".git" --exclude="node_modules" --delete . light', {
stdio: 'inherit'
});

// PATCH `package.json`
const fs = require('fs');
const packageJson = require('./package');
import fs from 'fs';
import path from 'path';
import {fileURLToPath} from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const packageJson = JSON.parse(fs.readFileSync(__dirname + '/package.json', 'utf8'))

packageJson.name += '-light';
packageJson.description = 'Map tile server for JSON GL styles - serving vector tiles';
Expand All @@ -28,7 +34,7 @@ delete packageJson.dependencies['sharp'];
delete packageJson.optionalDependencies;
delete packageJson.devDependencies;

packageJson.engines.node = '>= 10';
packageJson.engines.node = '>= 14.15.0';

const str = JSON.stringify(packageJson, undefined, 2);
fs.writeFileSync('light/package.json', str);
Expand All @@ -44,11 +50,11 @@ if (process.argv.length > 2 && process.argv[2] == '--no-publish') {
/* PUBLISH */

// tileserver-gl
require('child_process').execSync('npm publish .', {
child_process.execSync('npm publish . --access public', {
stdio: 'inherit'
});

// tileserver-gl-light
require('child_process').execSync('npm publish light', {
child_process.execSync('npm publish ./light --access public', {
stdio: 'inherit'
});

0 comments on commit 7f6d6bc

Please sign in to comment.