style: Move static_path into skyline_console

1. Move static_path into skyline_console to facilitate
   other modules to import.
2. Rename make build to make package

Change-Id: I7c9c5873f90b80de1203e9a38cf0ee5cc68fc42b
This commit is contained in:
Gao Hanxiang 2021-07-12 02:11:15 -04:00
parent 04e2a0004a
commit 5c09f43307
7 changed files with 23 additions and 24 deletions

View File

@ -1,13 +0,0 @@
npm-debug.log
yarn-error.log
node_modules
package-lock.json
.git/
.idea/
.vscode/
run/
.DS_Store
*.sw*
*.un~

View File

@ -22,6 +22,10 @@ GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
GIT_COMMIT ?= $(shell git rev-parse --verify HEAD)
.PHONY: all
all: install fmt lint test package
.PHONY: help
help:
@echo "Skyline console development makefile"
@ -31,7 +35,7 @@ help:
@echo "Target:"
@echo " git_config Initialize git configuration."
@echo " install Installs the project dependencies."
@echo " build Build source and wheel packages."
@echo " package Build package from source code."
@echo " lint Check JavaScript code."
@echo " test Run unit tests."
@echo
@ -66,18 +70,23 @@ install:
yarn install
.PHONY: build
build:
.PHONY: package
package: install
rm -rf $(ROOT_DIR)/skyline_console/static
yarn run build
poetry build
poetry build -f wheel
.PHONY: fmt
fmt:
# yarn run lint-staged
.PHONY: lint
lint:
yarn run lint
# yarn run lint
.PHONY: test
test:
yarn run test:unit
# yarn run test:unit

View File

@ -3,7 +3,7 @@
"version": "0.1.0",
"description": "",
"author": "OpenStack <openstack-discuss@lists.openstack.org>",
"license": "Apache 2.0",
"license": "Apache-2.0",
"scripts": {
"mock": "webpack-dev-server --open --config config/webpack.dev.js",
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --config config/webpack.dev.js --env.API=dev",

2
poetry.toml Normal file
View File

@ -0,0 +1,2 @@
[virtualenvs]
in-project = true

View File

@ -1 +1,5 @@
from pathlib import Path
__version__ = "0.1.0"
static_path = Path(__file__).parent.joinpath("static")

View File

@ -1,9 +1,6 @@
import sys
from pathlib import Path
import skyline_console
static_path = Path(skyline_console.__file__).parent.joinpath("static")
from skyline_console import static_path
if static_path.joinpath("index.html").exists():
print(f'Static resource directory of "skyline-console" is:\n{str(static_path)}')

0
skyline_console/py.typed Normal file
View File