@lakutata/cli 3.0.0-beta.4 → 3.0.0-beta.6

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 CHANGED
@@ -210,15 +210,31 @@ holds the files loaded at run time: the packages of the addons and of the shared
210
210
  other packages the JavaScript they load (traced) and their other files (the data they read), the packages loading their
211
211
  files by paths which cannot be followed (`require(path.join(__dirname, name))`) all their files; the types, the source
212
212
  maps, the TypeScript sources and the documentation of the packages are left out. The addons of
213
- the application itself (`require('./x.node')`, `createRequire(import.meta.url)('./x.node')`) are there too.
213
+ the application itself (`require('./x.node')`, `createRequire(import.meta.url)('./x.node')`) are there too. The
214
+ packages of the framework, and the ones built on it, are bundled with the application whatever they depend on (one copy
215
+ of the framework, its classes and its container): their native dependencies are in the tree. The optional dependencies
216
+ of a package which are not installed (the drivers of the stores the application does not use: `peerDependenciesMeta`
217
+ optional, `optionalDependencies`) are left out: loading one throws at run time, as without the bundle.
218
+
219
+ The files the application reads by their paths are not followed by the bundler: the scripts it runs on their own (its
220
+ workers, `new Worker()`, the pools of workers given a file; its child processes, `fork()`; the modules it loads by their
221
+ paths, `require(path.join(__dirname, 'x.js'))`), its data (`fs.readFileSync(path.join(__dirname, 'defaults.json'))`, a
222
+ directory of schemas). And the bundle is not where its modules were: `path.resolve(__dirname, '../../schema')` of a
223
+ module of `build/config/` is the `schema/` of the project, not once bundled in `dist/`. A path to a file given from its
224
+ module is found wherever it is written, in the modules of the application and in the ones of its packages, and the
225
+ expression rewritten to the file in the native tree (`dist/<name>.native/.lakutata/files/`, the directories as in the
226
+ project, the packages linked from outside of it under `node_modules/`):
227
+
228
+ | The path names | |
229
+ |---|---|
230
+ | a script (`.js`, `.cjs`) | bundled on its own with what it loads (a CommonJS file, whatever the type of the project) |
231
+ | another file | copied (a `package.json` its type CommonJS, as the scripts next to it) |
232
+ | a directory of data | its files copied |
233
+ | a directory holding the module (`path.join(__dirname, '..')`: the application, its packages) | not shipped, warned of: its files are declared as resources (`lakutata.resources`, below) |
234
+ | a directory holding scripts or packages (`package.json`, `node_modules`) | not shipped, warned of: its scripts need their packages at run time |
235
+ | nothing yet (a directory the application creates) | left as it is |
214
236
 
215
- The scripts the application runs on their own by their paths are not followed by the bundler: the scripts of its
216
- workers (`new Worker()`, the pools of workers given a file), of its child processes (`fork()`), the modules it loads by
217
- their paths (`require(path.join(__dirname, 'x.js'))`). A path to a script (a `.js` or `.cjs` file) given from its module
218
- is found wherever it is written, in the modules of the application and in the ones of its packages (the scripts of the
219
- pools of workers): the script is bundled on its own with what it loads (a CommonJS file, whatever the type of the
220
- project) into the native tree (`dist/<name>.native/.lakutata/workers/`, its directories as in the project, the packages
221
- linked from outside of it under `node_modules/`), and the expression rewritten to it. The paths followed:
237
+ The paths followed:
222
238
 
223
239
  | Path | |
224
240
  |---|---|
@@ -227,17 +243,16 @@ linked from outside of it under `node_modules/`), and the expression rewritten t
227
243
  | `path.join(__dirname, 'worker.js')`, `path.resolve(__dirname, …)` | `import.meta.dirname`, `path.dirname(fileURLToPath(import.meta.url))` too |
228
244
  | `__dirname + '/worker.js'`, `` `${__dirname}/worker.js` `` | |
229
245
  | `require.resolve('./worker')`, `require.resolve(path.resolve(__dirname, '../lib/worker'))` | the extension found as node finds it |
230
- | `` path.join(__dirname, 'jobs', `${name}.js`) ``, `` new URL(`./jobs/${name}.js`, import.meta.url) `` | known in part: every script of the directory its pattern matches (an expression matches a part of a name), its expression kept |
231
-
232
- The code of tsc (`(0, node_path_1.join)(__dirname, 'worker.js')`) is followed. The paths to other files (a directory, a
233
- data file) are left as they are: they are resources (below). A script also imported by the application is warned of:
234
- it is bundled twice, its module apart in each (its state, its classes). The workers of node (`worker_threads`) whose
235
- scripts cannot be followed are warned of with their file and line, in the modules of the application (the packages start
236
- workers from the paths their users give): a path known at run time only (`new Worker(file)`, a variable or a property of
237
- a class holding one of the paths above is followed), or a path relative to the current directory of the process
238
- (`new Worker('./worker.js')`, which node reads from there, not from the module); their scripts are given from the
239
- directory of their module, or shipped as resources (`lakutata.resources`). The workers running a source (`eval: true`)
240
- need nothing.
246
+ | `` path.join(__dirname, 'locales', `${lang}.json`) ``, `` new URL(`./jobs/${name}.js`, import.meta.url) `` | known in part: every file and directory its pattern matches (an expression matches a part of a name), its expression kept |
247
+
248
+ The code of tsc (`(0, node_path_1.join)(__dirname, 'worker.js')`) is followed. A script also imported by the application
249
+ is warned of: it is bundled twice, its module apart in each (its state, its classes). The workers of node
250
+ (`worker_threads`) whose scripts cannot be followed are warned of with their file and line, in the modules of the
251
+ application (the packages start workers from the paths their users give): a path known at run time only
252
+ (`new Worker(file)`, a variable or a property of a class holding one of the paths above is followed), or a path relative
253
+ to the current directory of the process (`new Worker('./worker.js')`, which node reads from there, not from the module);
254
+ their scripts are given from the directory of their module, or shipped as resources. The workers running a source
255
+ (`eval: true`) need nothing. The warnings name the modules of the application only, with their file and line.
241
256
 
242
257
  The resources of the application, the files it reads at run time (the built pages of a web application, templates,
243
258
  data), are declared by the `lakutata.resources` of its `package.json`, as the `extraResources` of electron-builder:
@@ -277,7 +292,7 @@ linux/arm64`, as the cross builds of the templates).
277
292
  | `--layout <file\|directory>` | one file (by default), or a directory: `dist/<name>/` holding the executable, its native addons (`native/`) and its resources (`resources/`), loaded from there without extraction (the installers, the images) |
278
293
  | `--entry`, `--no-minify`, `--external` | as `lakutata package bundle` |
279
294
 
280
- The native addons, the scripts of the workers and the resources are embedded in the executable (`--layout file`): at its
295
+ The native addons, the files read by their paths and the resources are embedded in the executable (`--layout file`): at its
281
296
  first run, it extracts them into its cache directory (`~/.cache/<name>`, `~/Library/Caches/<name>` on macOS,
282
297
  `%LOCALAPPDATA%\<name>\Cache` on Windows, or `LAKUTATA_NATIVE_DIR`; the temporary directory when it cannot be written),
283
298
  in a directory named after their content:
@@ -34,7 +34,11 @@ export class PackController extends Controller {
34
34
  //The native addons and the scripts of the workers are next to the bundle, which is distributed with them
35
35
  if (result.nativeDirectory) {
36
36
  const addons = !!result.native.modules.length || result.native.files.some((file) => file.path.endsWith('.node'));
37
- const contents = [...addons ? [`the native addons (${result.native.modules.join(', ') || 'of the application'})`] : [], ...result.workers.length ? [`the scripts of the workers (${result.workers.join(', ')})`] : []];
37
+ const contents = [
38
+ ...addons ? [`the native addons (${result.native.modules.join(', ') || 'of the application'})`] : [],
39
+ ...result.workers.length ? [`the scripts run on their own (${result.workers.join(', ')})`] : [],
40
+ ...result.files.length ? [`the files read by their paths (${result.files.join(', ')})`] : []
41
+ ];
38
42
  done(`${path.relative(process.cwd(), result.nativeDirectory)}: ${contents.join(' and ')}, distributed with the bundle`);
39
43
  }
40
44
  if (result.resourcesDirectory)
@@ -52,7 +56,9 @@ export class PackController extends Controller {
52
56
  if (result.resources.length)
53
57
  step(result.directory ? `Resources next to the executable: ${result.resources.join(', ')}` : `Resources embedded, extracted at the first run: ${result.resources.join(', ')}`);
54
58
  if (result.workers.length)
55
- step(result.directory ? `Scripts of the workers next to the executable: ${result.workers.join(', ')}` : `Scripts of the workers embedded, extracted at the first run: ${result.workers.join(', ')}`);
59
+ step(result.directory ? `Scripts run on their own next to the executable: ${result.workers.join(', ')}` : `Scripts run on their own embedded, extracted at the first run: ${result.workers.join(', ')}`);
60
+ if (result.files.length)
61
+ step(result.directory ? `Files read by their paths next to the executable: ${result.files.join(', ')}` : `Files read by their paths embedded, extracted at the first run: ${result.files.join(', ')}`);
56
62
  for (const warning of result.warnings)
57
63
  warn(warning);
58
64
  if (result.directory)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lakutata/cli",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.6",
4
4
  "description": "The command line tool of the lakutata framework: create the projects from the templates, run and version the packages of the workspaces, bundle the applications and make their executables (with @lakutata/builder).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,10 +16,10 @@
16
16
  "dependencies": {
17
17
  "@inquirer/prompts": "^8.7.2",
18
18
  "commander": "^15.0.0",
19
- "lakutata": "3.0.0-beta.4"
19
+ "lakutata": "3.0.0-beta.6"
20
20
  },
21
21
  "peerDependencies": {
22
- "@lakutata/builder": "3.0.0-beta.4"
22
+ "@lakutata/builder": "3.0.0-beta.6"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "@lakutata/builder": {
@@ -27,7 +27,7 @@
27
27
  }
28
28
  },
29
29
  "devDependencies": {
30
- "@lakutata/builder": "3.0.0-beta.4"
30
+ "@lakutata/builder": "3.0.0-beta.6"
31
31
  },
32
32
  "engines": {
33
33
  "node": ">=22.12"