mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-07-27 19:57:02 +00:00
npm/images: new @pybricks/images package v1.0.0
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
name: Release @pybricks/images
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '@pybricks/images/**'
|
||||
|
||||
jobs:
|
||||
publish_ide_docs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: ./build.py
|
||||
working-directory: npm/images
|
||||
- run: yarn publish
|
||||
working-directory: npm/images/build
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||
@@ -0,0 +1,2 @@
|
||||
version-tag-prefix "@pybricks/images/v"
|
||||
version-git-message "@pybricks/images v%s"
|
||||
@@ -0,0 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||
|
||||
## 1.0.0 - 2022-10-28
|
||||
|
||||
### Added
|
||||
- Added new @pybricks/images package.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2022 The Pybricks Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,5 @@
|
||||
@pybricks/images
|
||||
================
|
||||
|
||||
Image resource for Pybricks Code.
|
||||
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
|
||||
BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
||||
IMAGE_DIR = (
|
||||
pathlib.Path(__file__).parent.parent.parent / "doc" / "main" / "cad" / "output"
|
||||
).resolve()
|
||||
HUBS = ["move", "city", "technic", "prime", "essential"]
|
||||
|
||||
package_json = {
|
||||
"name": "@pybricks/images",
|
||||
"version": "1.0.0",
|
||||
"description": "Distribution of Pybricks images.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pybricks/pybricks-api",
|
||||
"directory": "npm/images",
|
||||
},
|
||||
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
|
||||
}
|
||||
|
||||
# ensure empty build directory so we don't end up with stale files
|
||||
shutil.rmtree(BUILD_DIR, True)
|
||||
BUILD_DIR.mkdir()
|
||||
|
||||
# copy the hub images
|
||||
for h in HUBS:
|
||||
shutil.copyfile(IMAGE_DIR / f"hub-{h}.png", BUILD_DIR / f"hub-{h}.png")
|
||||
|
||||
# generate package.json file
|
||||
|
||||
# create "exports" item for hub images.
|
||||
package_json["exports"] = {f"./hub-{h}.png": f"./hub-{h}.png" for h in HUBS}
|
||||
|
||||
with open(BUILD_DIR / "package.json", "w") as f:
|
||||
json.dump(package_json, f, indent=2)
|
||||
|
||||
# copy additional files
|
||||
|
||||
ROOT_DIR = (pathlib.Path(__file__).parent).resolve()
|
||||
|
||||
for file in "README.md", "CHANGELOG.md", "LICENSE":
|
||||
shutil.copy(ROOT_DIR / file, BUILD_DIR / file)
|
||||
Reference in New Issue
Block a user