shipit-cli 0.11.0__tar.gz → 0.11.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/PKG-INFO +1 -1
  2. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/pyproject.toml +1 -1
  3. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/assets/wordpress/install.sh +2 -0
  4. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/assets/wordpress/wp-config.php +4 -2
  5. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/cli.py +10 -1
  6. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/generator.py +6 -2
  7. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/base.py +0 -13
  8. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/php.py +8 -2
  9. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/python.py +1 -1
  10. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/registry.py +0 -2
  11. shipit_cli-0.11.2/src/shipit/version.py +5 -0
  12. shipit_cli-0.11.0/src/shipit/providers/gatsby.py +0 -90
  13. shipit_cli-0.11.0/src/shipit/version.py +0 -5
  14. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/.gitignore +0 -0
  15. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/README.md +0 -0
  16. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/__init__.py +0 -0
  17. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/assets/php/php.ini +0 -0
  18. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/procfile.py +0 -0
  19. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/hugo.py +0 -0
  20. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/laravel.py +0 -0
  21. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/mkdocs.py +0 -0
  22. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/node_static.py +0 -0
  23. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/staticfile.py +0 -0
  24. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/src/shipit/providers/wordpress.py +0 -0
  25. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/tests/test_e2e.py +0 -0
  26. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/tests/test_generate_shipit_examples.py +0 -0
  27. {shipit_cli-0.11.0 → shipit_cli-0.11.2}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shipit-cli
3
- Version: 0.11.0
3
+ Version: 0.11.2
4
4
  Summary: Shipit CLI is the best way to build, serve and deploy your projects anywhere.
5
5
  Project-URL: homepage, https://wasmer.io
6
6
  Project-URL: repository, https://github.com/wasmerio/shipit
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "shipit-cli"
3
- version = "0.11.0"
3
+ version = "0.11.2"
4
4
  description = "Shipit CLI is the best way to build, serve and deploy your projects anywhere."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -4,6 +4,8 @@ IFS=$'\n\t'
4
4
  export COLUMNS=80 # Prevent WP-CLI from asking for TTY size
5
5
  export PAGER="cat"
6
6
 
7
+ alias wp="php /opt/assets/wp-cli.phar --allow-root --path=/app"
8
+
7
9
  echo "🚀 Starting WordPress setup..."
8
10
 
9
11
  echo "Creating required directories..."
@@ -21,10 +21,12 @@ define( 'WP_AUTO_UPDATE_CORE', false); // Disable automatic aupdates and checks
21
21
  * @package WordPress
22
22
  */
23
23
 
24
+
24
25
  function get_env_var(string $name, string $default = ''): string
25
26
  {
26
- if (isset($_ENV[$name])) {
27
- return $_ENV[$name];
27
+ $value = getenv($name);
28
+ if ($value !== false) {
29
+ return $value;
28
30
  }
29
31
 
30
32
  if ($default === '') {
@@ -1491,6 +1491,10 @@ def auto(
1491
1491
  None,
1492
1492
  help="The environment to use (defaults to `.env`, it will use .env.<env_name> if provided)",
1493
1493
  ),
1494
+ use_provider: Optional[str] = typer.Option(
1495
+ None,
1496
+ help="Use a specific provider to build the project.",
1497
+ ),
1494
1498
  ):
1495
1499
  if not path.exists():
1496
1500
  raise Exception(f"The path {path} does not exist")
@@ -1503,6 +1507,7 @@ def auto(
1503
1507
  install_command=install_command,
1504
1508
  build_command=build_command,
1505
1509
  start_command=start_command,
1510
+ use_provider=use_provider,
1506
1511
  )
1507
1512
 
1508
1513
  build(
@@ -1561,6 +1566,10 @@ def generate(
1561
1566
  None,
1562
1567
  help="The start command to use (overwrites the default)",
1563
1568
  ),
1569
+ use_provider: Optional[str] = typer.Option(
1570
+ None,
1571
+ help="Use a specific provider to build the project.",
1572
+ ),
1564
1573
  ):
1565
1574
  if not path.exists():
1566
1575
  raise Exception(f"The path {path} does not exist")
@@ -1591,7 +1600,7 @@ def generate(
1591
1600
  custom_commands.install = install_command
1592
1601
  if build_command:
1593
1602
  custom_commands.build = build_command
1594
- content = generate_shipit(path, custom_commands)
1603
+ content = generate_shipit(path, custom_commands, use_provider=use_provider)
1595
1604
  out.write_text(content)
1596
1605
  console.print(f"[bold]Generated Shipit[/bold] at {out.absolute()}")
1597
1606
 
@@ -84,8 +84,12 @@ def _emit_dependencies_declarations(
84
84
  return "\n".join(lines), serve_vars, build_vars
85
85
 
86
86
 
87
- def generate_shipit(path: Path, custom_commands: CustomCommands) -> str:
88
- provider_cls = detect_provider(path, custom_commands)
87
+ def generate_shipit(path: Path, custom_commands: CustomCommands, use_provider: Optional[str] = None) -> str:
88
+ provider_cls = None
89
+ if use_provider:
90
+ provider_cls = next((p for p in _providers() if p.name().lower() == use_provider.lower()), None)
91
+ if not provider_cls:
92
+ provider_cls = detect_provider(path, custom_commands)
89
93
  provider = provider_cls(path, custom_commands)
90
94
 
91
95
  # Collect parts
@@ -92,16 +92,3 @@ class ProviderPlan:
92
92
 
93
93
  def _exists(path: Path, *candidates: str) -> bool:
94
94
  return any((path / c).exists() for c in candidates)
95
-
96
-
97
- def _has_dependency(pkg_json: Path, dep: str) -> bool:
98
- try:
99
- import json
100
-
101
- data = json.loads(pkg_json.read_text())
102
- for section in ("dependencies", "devDependencies", "peerDependencies"):
103
- if dep in data.get(section, {}):
104
- return True
105
- except Exception:
106
- return False
107
- return False
@@ -20,7 +20,9 @@ class PhpProvider:
20
20
  def __init__(self, path: Path, custom_commands: CustomCommands):
21
21
  self.path = path
22
22
  self.custom_commands = custom_commands
23
- self.has_composer = _exists(self.path, "composer.json", "composer.lock")
23
+ self.has_composer = _exists(self.path, "composer.json", "composer.lock") or (
24
+ custom_commands.install and custom_commands.install.startswith("composer ")
25
+ )
24
26
 
25
27
  @classmethod
26
28
  def name(cls) -> str:
@@ -40,6 +42,8 @@ class PhpProvider:
40
42
  return DetectResult(cls.name(), 10)
41
43
  if custom_commands.start and custom_commands.start.startswith("php "):
42
44
  return DetectResult(cls.name(), 70)
45
+ if custom_commands.install and custom_commands.install.startswith("composer "):
46
+ return DetectResult(cls.name(), 30)
43
47
  return None
44
48
 
45
49
  def initialize(self) -> None:
@@ -115,7 +119,9 @@ class PhpProvider:
115
119
  }
116
120
  elif _exists(self.path, "index.php"):
117
121
  return {"start": '"php -S localhost:{} -t {}".format(PORT, app["serve"])'}
118
- return {}
122
+ return {
123
+ "start": '"php -S localhost:{} -t {}".format(PORT, app["serve"])',
124
+ }
119
125
 
120
126
  def mounts(self) -> list[MountSpec]:
121
127
  return [
@@ -216,7 +216,7 @@ class PythonProvider:
216
216
  return DetectResult(cls.name(), 70)
217
217
  return DetectResult(cls.name(), 50)
218
218
  if custom_commands.start:
219
- if custom_commands.start.startswith("python ") or custom_commands.start.startswith("uv ") or custom_commands.start.startswith("uvicorn "):
219
+ if custom_commands.start.startswith("python ") or custom_commands.start.startswith("uv ") or custom_commands.start.startswith("uvicorn ") or custom_commands.start.startswith("gunicorn "):
220
220
  return DetectResult(cls.name(), 80)
221
221
  return None
222
222
 
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from .base import Provider
4
- from .gatsby import GatsbyProvider
5
4
  from .hugo import HugoProvider
6
5
  from .laravel import LaravelProvider
7
6
  from .mkdocs import MkdocsProvider
@@ -16,7 +15,6 @@ def providers() -> list[type[Provider]]:
16
15
  # Order matters: more specific providers first
17
16
  return [
18
17
  LaravelProvider,
19
- # GatsbyProvider,
20
18
  HugoProvider,
21
19
  MkdocsProvider,
22
20
  PythonProvider,
@@ -0,0 +1,5 @@
1
+ __all__ = ["version", "version_info"]
2
+
3
+
4
+ version = "0.11.2"
5
+ version_info = (0, 11, 2, "final", 0)
@@ -1,90 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from pathlib import Path
4
- from typing import Dict, Optional
5
-
6
- from .base import (
7
- DetectResult,
8
- DependencySpec,
9
- Provider,
10
- _exists,
11
- _has_dependency,
12
- MountSpec,
13
- ServiceSpec,
14
- VolumeSpec,
15
- CustomCommands,
16
- )
17
-
18
-
19
- class GatsbyProvider:
20
- def __init__(self, path: Path, custom_commands: CustomCommands):
21
- self.path = path
22
- self.custom_commands = custom_commands
23
-
24
- @classmethod
25
- def name(cls) -> str:
26
- return "gatsby"
27
-
28
- @classmethod
29
- def detect(cls, path: Path, custom_commands: CustomCommands) -> Optional[DetectResult]:
30
- pkg = path / "package.json"
31
- if not pkg.exists():
32
- return None
33
- if _exists(path, "gatsby-config.js", "gatsby-config.ts") or _has_dependency(
34
- pkg, "gatsby"
35
- ):
36
- return DetectResult(cls.name(), 90)
37
- return None
38
-
39
- def initialize(self) -> None:
40
- pass
41
-
42
- def serve_name(self) -> str:
43
- return self.path.name
44
-
45
- def provider_kind(self) -> str:
46
- return "staticsite"
47
-
48
- def platform(self) -> Optional[str]:
49
- return "gatsby"
50
-
51
- def declarations(self) -> Optional[str]:
52
- return None
53
-
54
- def dependencies(self) -> list[DependencySpec]:
55
- return [
56
- DependencySpec(
57
- "node",
58
- env_var="SHIPIT_NODE_VERSION",
59
- default_version="22",
60
- use_in_build=True,
61
- ),
62
- DependencySpec("npm", use_in_build=True),
63
- DependencySpec("static-web-server", env_var="SHIPIT_SWS_VERSION", use_in_serve=True),
64
- ]
65
-
66
- def build_steps(self) -> list[str]:
67
- return [
68
- "run(\"npm install\", inputs=[\"package.json\", \"package-lock.json\"], group=\"install\")",
69
- "copy(\".\", \".\", ignore=[\"node_modules\", \".git\"])",
70
- "run(\"npm run build\", outputs=[\"public\"], group=\"build\")",
71
- "run(\"cp -R public/* {}/\".format(app[\"build\"]))",
72
- ]
73
-
74
- def prepare_steps(self) -> Optional[list[str]]:
75
- return None
76
-
77
- def commands(self) -> Dict[str, str]:
78
- return {"start": '"static-web-server --root /app"'}
79
-
80
- def mounts(self) -> list[MountSpec]:
81
- return [MountSpec("app")]
82
-
83
- def volumes(self) -> list[VolumeSpec]:
84
- return []
85
-
86
- def env(self) -> Optional[Dict[str, str]]:
87
- return None
88
-
89
- def services(self) -> list[ServiceSpec]:
90
- return []
@@ -1,5 +0,0 @@
1
- __all__ = ["version", "version_info"]
2
-
3
-
4
- version = "0.11.0"
5
- version_info = (0, 11, 0, "final", 0)
File without changes
File without changes