@archlast/cli 0.1.7 → 0.1.9
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.
- package/README.md +3 -1
- package/dist/cli.js +24 -5
- package/dist/docker/config.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,7 +75,6 @@ export default {
|
|
|
75
75
|
image: "algochad/archlast-server",
|
|
76
76
|
tag: "latest",
|
|
77
77
|
containerName: "archlast-server",
|
|
78
|
-
volumeName: "archlast-data",
|
|
79
78
|
},
|
|
80
79
|
server: { port: 4000 },
|
|
81
80
|
paths: {
|
|
@@ -93,6 +92,9 @@ export default {
|
|
|
93
92
|
Environment variables starting with `ARCHLAST_`, `S3_`, `AWS_`, and `STORAGE_`
|
|
94
93
|
are forwarded into the container.
|
|
95
94
|
|
|
95
|
+
If `volumeName` is not set, the CLI generates a unique Docker volume name per
|
|
96
|
+
project to keep data isolated.
|
|
97
|
+
|
|
96
98
|
## Dev and deploy flow
|
|
97
99
|
|
|
98
100
|
The server receives deployments at `POST /_archlast/deploy` with payload:
|
package/dist/cli.js
CHANGED
|
@@ -320850,7 +320850,7 @@ class DockerManager {
|
|
|
320850
320850
|
const expectedBinds = [
|
|
320851
320851
|
`${config.dataVolumeName}:/data`,
|
|
320852
320852
|
`${formatBindPath(config.configDir)}:/config:ro`,
|
|
320853
|
-
`${formatBindPath(config.deployDir)}:/app/server/.archlast-deploy:
|
|
320853
|
+
`${formatBindPath(config.deployDir)}:/app/server/.archlast-deploy:rw`
|
|
320854
320854
|
];
|
|
320855
320855
|
const bindsMatch = expectedBinds.every((bind) => bindSources.includes(bind));
|
|
320856
320856
|
if (!imageMatches || !envMatches || !portMatches || !bindsMatch) {
|
|
@@ -320878,7 +320878,7 @@ class DockerManager {
|
|
|
320878
320878
|
Binds: [
|
|
320879
320879
|
`${config.dataVolumeName}:/data`,
|
|
320880
320880
|
`${formatBindPath(config.configDir)}:/config:ro`,
|
|
320881
|
-
`${formatBindPath(config.deployDir)}:/app/server/.archlast-deploy:
|
|
320881
|
+
`${formatBindPath(config.deployDir)}:/app/server/.archlast-deploy:rw`
|
|
320882
320882
|
],
|
|
320883
320883
|
PortBindings: {
|
|
320884
320884
|
[`${config.port}/tcp`]: [{ HostPort: String(config.port) }]
|
|
@@ -321116,6 +321116,24 @@ function resolveNumber(value, fallback) {
|
|
|
321116
321116
|
const parsed = typeof value === "number" ? value : parseInt(String(value), 10);
|
|
321117
321117
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
321118
321118
|
}
|
|
321119
|
+
function hashString2(value) {
|
|
321120
|
+
let hash = 0;
|
|
321121
|
+
for (let i = 0;i < value.length; i++) {
|
|
321122
|
+
hash = (hash << 5) - hash + value.charCodeAt(i);
|
|
321123
|
+
hash |= 0;
|
|
321124
|
+
}
|
|
321125
|
+
return Math.abs(hash).toString(36);
|
|
321126
|
+
}
|
|
321127
|
+
function normalizeProjectSlug(projectPath) {
|
|
321128
|
+
const base = path10.basename(projectPath);
|
|
321129
|
+
const slug = base.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
321130
|
+
return slug || "archlast";
|
|
321131
|
+
}
|
|
321132
|
+
function deriveVolumeName(projectPath) {
|
|
321133
|
+
const slug = normalizeProjectSlug(projectPath);
|
|
321134
|
+
const suffix = hashString2(path10.resolve(projectPath)).slice(0, 6);
|
|
321135
|
+
return `${DEFAULTS.docker.volumeName}-${slug}-${suffix}`;
|
|
321136
|
+
}
|
|
321119
321137
|
function loadDockerConfig(options) {
|
|
321120
321138
|
const projectPath = path10.resolve(options.path || ".");
|
|
321121
321139
|
const configFilePath = options.configFile ? resolvePath(projectPath, options.configFile) : path10.join(projectPath, "archlast.config.js");
|
|
@@ -321132,7 +321150,8 @@ function loadDockerConfig(options) {
|
|
|
321132
321150
|
const image = options.image ?? process.env.ARCHLAST_DOCKER_IMAGE ?? process.env.ARCHLAST_IMAGE ?? configDocker.image ?? envFileVars.ARCHLAST_DOCKER_IMAGE ?? envFileVars.ARCHLAST_IMAGE ?? DEFAULTS.docker.image;
|
|
321133
321151
|
const tag = options.tag ?? process.env.ARCHLAST_VERSION ?? configDocker.tag ?? envFileVars.ARCHLAST_VERSION ?? DEFAULTS.docker.tag;
|
|
321134
321152
|
const containerName = options.containerName ?? process.env.ARCHLAST_CONTAINER_NAME ?? configDocker.containerName ?? envFileVars.ARCHLAST_CONTAINER_NAME ?? DEFAULTS.docker.containerName;
|
|
321135
|
-
const
|
|
321153
|
+
const defaultVolumeName = deriveVolumeName(projectPath);
|
|
321154
|
+
const dataVolumeName = process.env.ARCHLAST_DATA_VOLUME ?? configDocker.volumeName ?? envFileVars.ARCHLAST_DATA_VOLUME ?? defaultVolumeName;
|
|
321136
321155
|
const configDir = resolvePath(projectPath, process.env.ARCHLAST_CONFIG_DIR ?? configPaths.config ?? envFileVars.ARCHLAST_CONFIG_DIR ?? DEFAULTS.paths.config);
|
|
321137
321156
|
const deployDir = resolvePath(projectPath, process.env.ARCHLAST_DEPLOY_DIR ?? configPaths.deploy ?? envFileVars.ARCHLAST_DEPLOY_DIR ?? DEFAULTS.paths.deploy);
|
|
321138
321157
|
const envFromDefaults = { ...DEFAULTS.env };
|
|
@@ -321988,7 +322007,7 @@ function generateComposeFile(config) {
|
|
|
321988
322007
|
volumes: [
|
|
321989
322008
|
`${config.dataVolumeName}:/data`,
|
|
321990
322009
|
`${normalizeDockerPath(config.configDir)}:/config:ro`,
|
|
321991
|
-
`${normalizeDockerPath(config.deployDir)}:/app/server/.archlast-deploy:
|
|
322010
|
+
`${normalizeDockerPath(config.deployDir)}:/app/server/.archlast-deploy:rw`
|
|
321992
322011
|
],
|
|
321993
322012
|
environment,
|
|
321994
322013
|
healthcheck: {
|
|
@@ -322351,7 +322370,7 @@ async function configCommand(options) {
|
|
|
322351
322370
|
|
|
322352
322371
|
// src/cli.ts
|
|
322353
322372
|
var program2 = new Command;
|
|
322354
|
-
program2.name("archlast").description("Archlast CLI for development and deployment").version("0.1.
|
|
322373
|
+
program2.name("archlast").description("Archlast CLI for development and deployment").version("0.1.9");
|
|
322355
322374
|
program2.command("build").description("Generate types without deploying").option("--path <path>", "Path to archlast folder", ".").action(buildCommand);
|
|
322356
322375
|
program2.command("dev").description("Start development mode with file watching").option("-p, --port <port>", "Server port", "3001").option("--path <path>", "Path to archlast folder", ".").option("--server <url>", "Server URL for code upload", "http://localhost:4000").option("--max-poll <number>", "Maximum server polling retries", "30").action(devCommand);
|
|
322357
322376
|
program2.command("deploy").description("Deploy to production").option("--path <path>", "Path to archlast folder", ".").option("--server <url>", "Server URL for code upload", "http://localhost:4000").option("--max-poll <number>", "Maximum server polling retries", "30").action(deployCommand);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/docker/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/docker/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AA0JD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CA4G3E"}
|