@lumeland/core 1.0.1 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
+ ## 1.0.2 - 2026-11-01
9
+
10
+ ### Fixed
11
+
12
+ - Archetypes: Download URLs as binary files.
13
+ - Archetypes: Allow to run unregistered archetypes.
14
+ - Archetypes: Print relative paths of the created files.
15
+
8
16
  ## 1.0.1 - 2026-10-31
9
17
 
10
18
  ### Fixed
@@ -8,7 +8,7 @@ export default class Archetypes {
8
8
  root: string;
9
9
  constructor(options: Options);
10
10
  register(name: string, archetype: string | Archetype): void;
11
- run(name: string, args?: string[]): Promise<void>;
11
+ run(name: string | Archetype, args?: string[]): Promise<void>;
12
12
  save(file: ArchetypeFile | ArchetypeRemote): Promise<void>;
13
13
  load(name: string): Promise<Archetype>;
14
14
  }
@@ -9,7 +9,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
9
9
  import { parse, stringify } from "../deps/yaml.js";
10
10
  import { extract, test } from "../deps/front-matter.js";
11
11
  import { ensureDir } from "./utils/fs.js";
12
- import { dirname, join, toFileUrl } from "../deps/path.js";
12
+ import { dirname, join, toFileUrl, relative } from "../deps/path.js";
13
13
  import { isGenerator } from "./utils/generator.js";
14
14
  import { log } from "./utils/log.js";
15
15
  import { isUrl } from "./utils/path.js";
@@ -30,16 +30,21 @@ export default class Archetypes {
30
30
  }
31
31
  async run(name, args = []) {
32
32
  let archetype;
33
- try {
34
- archetype = await this.load(name);
35
- }
36
- catch (cause) {
37
- log.fatal(`[archetype] Archetype "${name}" not found or is errored.: ${cause.message}`);
38
- return;
33
+ if (typeof name === "string") {
34
+ try {
35
+ archetype = await this.load(name);
36
+ }
37
+ catch (cause) {
38
+ log.fatal(`[archetype] Archetype "${name}" not found or is errored.: ${cause.message}`);
39
+ return;
40
+ }
41
+ if (typeof archetype !== "function") {
42
+ log.fatal(`[archetype] Archetype "${name}" is not a valid function.`);
43
+ return;
44
+ }
39
45
  }
40
- if (typeof archetype !== "function") {
41
- log.fatal(`[archetype] Archetype "${name}" is not a valid function.`);
42
- return;
46
+ else {
47
+ archetype = name;
43
48
  }
44
49
  if (isGenerator(archetype)) {
45
50
  for await (const file of archetype(...args)) {
@@ -70,7 +75,7 @@ export default class Archetypes {
70
75
  }
71
76
  const fullPath = join(base === "root" ? this.root : this.src, path);
72
77
  if (content instanceof URL) {
73
- return await saveFile(fullPath, await read(content.href), overwrite);
78
+ return await saveFile(fullPath, await read(content.href, true), overwrite);
74
79
  }
75
80
  if (typeof content === "string" || content instanceof Uint8Array) {
76
81
  return await saveFile(fullPath, content, overwrite);
@@ -121,11 +126,12 @@ async function saveFile(path, content, overwrite = false) {
121
126
  else {
122
127
  await writeTextFile(path, content, !overwrite);
123
128
  }
129
+ const relPath = relative(cwd(), path);
124
130
  if (overwrite) {
125
- log.info(`✔️ Updated file: <gray>${path}</gray>`);
131
+ log.info(`✔️ Updated file: <gray>${relPath}</gray>`);
126
132
  }
127
133
  else {
128
- log.info(`✔️ Created file: <gray>${path}</gray>`);
134
+ log.info(`✔️ Created file: <gray>${relPath}</gray>`);
129
135
  }
130
136
  }
131
137
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumeland/core",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "The core of Lume SSG",
5
5
  "license": "MIT",
6
6
  "author": "Óscar Otero",