not-node 6.1.0 → 6.1.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.
Files changed (51) hide show
  1. package/.env +12 -0
  2. package/bin/not-cli.mjs +59 -2
  3. package/package.json +1 -1
  4. package/playground/app/front/build/admin.css +2 -0
  5. package/playground/app/front/build/admin.js +52427 -0
  6. package/playground/app/front/build/client.css +2 -0
  7. package/playground/app/front/build/client.js +52427 -0
  8. package/playground/app/front/build/guest.css +2 -0
  9. package/playground/app/front/build/guest.js +50907 -0
  10. package/playground/app/front/build/root.css +2 -0
  11. package/playground/app/front/build/root.js +60023 -0
  12. package/playground/app/front/build/user.css +2 -0
  13. package/playground/app/front/build/user.js +52425 -0
  14. package/playground/app/front/build.env.js +15 -0
  15. package/playground/app/front/index.admin.js +160 -0
  16. package/playground/app/front/index.client.js +160 -0
  17. package/playground/app/front/index.guest.js +160 -0
  18. package/playground/app/front/index.root.js +224 -0
  19. package/playground/app/front/index.user.js +160 -0
  20. package/playground/app/front/rollup.admin.js +70 -0
  21. package/playground/app/front/rollup.client.js +70 -0
  22. package/playground/app/front/rollup.guest.js +70 -0
  23. package/playground/app/front/rollup.root.js +70 -0
  24. package/playground/app/front/rollup.user.js +70 -0
  25. package/playground/app/server/config/common.json +93 -47
  26. package/playground/app/server/config/development.json +31 -32
  27. package/playground/app/server/config/production.json +31 -32
  28. package/playground/app/server/config/stage.json +31 -32
  29. package/playground/app/server/routes/index.js +29 -31
  30. package/playground/app/server/views/parts/header.android.pug +6 -7
  31. package/playground/app/server/views/parts/header.ios.pug +5 -5
  32. package/playground/package.json +21 -2
  33. package/playground/project.manifest.json +3 -0
  34. package/src/cli/readers/db/mongoose.mjs +25 -5
  35. package/src/cli/readers/session.mjs +9 -2
  36. package/src/common.js +17 -3
  37. package/src/domain.js +1 -1
  38. package/src/headers.js +1 -3
  39. package/src/init/lib/db/mongoose.js +1 -0
  40. package/src/init/lib/sessions/index.js +14 -2
  41. package/src/metas.js +5 -6
  42. package/src/styler.js +10 -6
  43. package/tmpl/dirs/app.mjs +1 -1
  44. package/tmpl/dirs/front.mjs +4 -0
  45. package/tmpl/files/app/front/build.env.ejs +9 -1
  46. package/tmpl/files/app/package.ejs +7 -2
  47. package/tmpl/files/app/routes/index.ejs +29 -31
  48. package/tmpl/files/app/views/parts/header.android.ejs +6 -7
  49. package/tmpl/files/app/views/parts/header.ios.ejs +5 -5
  50. package/tmpl/files/app/views/parts/menu.ejs +1 -1
  51. package/tmpl/files/app/views/parts/overview.ejs +1 -1
package/.env ADDED
@@ -0,0 +1,12 @@
1
+ NOT_NODE_ERROR_KEY=2f721c40-30c5-4f35-9e45-cfea1be33f03
2
+ NOT_NODE_ERROR_URL_NODE=https://reporter.local/api/key/collect
3
+ NOT_NODE_ERROR_URL_BROWSER=https://reporter.local/api/key/collect
4
+ INIT_ROOT_USERNAME=root
5
+ INIT_ROOT_EMAIL=admin@appmon.ru
6
+ INIT_ROOT_PASSWORD=tester
7
+ db__mongoose__uri=mongodb://localhost/reporter?authSource=reporter
8
+ db__mongoose__options__user=reporter
9
+ db__mongoose__options__pass=developer
10
+ db__mongoose__options__db=reporter
11
+ db__mongoose__options__host=localhost
12
+ db__mongoose__options__authSource=reporter
package/bin/not-cli.mjs CHANGED
@@ -8,8 +8,9 @@ import { isAbsolute, resolve, join } from "node:path";
8
8
 
9
9
  import { copyFile, constants, mkdir, writeFile } from "node:fs/promises";
10
10
 
11
- import { cwd } from "node:process";
11
+ import { cwd, stdout, stderr } from "node:process";
12
12
  const CWD = cwd();
13
+ import { spawn } from "node:child_process";
13
14
 
14
15
  import * as url from "url";
15
16
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
@@ -36,6 +37,7 @@ import ApplicationModuleServerControllersCommonStructure from "../tmpl/dirs/modu
36
37
  import ApplicationModuleFrontStructure from "../tmpl/dirs/module.front.mjs";
37
38
 
38
39
  import { firstLetterToLower } from "../src/common.js";
40
+ import { rejects } from "node:assert";
39
41
 
40
42
  const ApplicationSubStructures = {
41
43
  server: ApplicationServerStructure,
@@ -325,12 +327,63 @@ async function createBootstrapFrontModule(modules_dir, config) {
325
327
  }
326
328
  }
327
329
 
330
+ function installPackages(opts) {
331
+ return new Promise((resolve, reject) => {
332
+ console.log("installing packages...");
333
+ let npmInstall = spawn(`npm`, ["i"], { cwd: opts.dir });
334
+ npmInstall.stdout.on("data", (data) => {
335
+ //console.log(data.toString());
336
+ });
337
+ npmInstall.stderr.on("data", (data) => {
338
+ console.error(data.toString());
339
+ });
340
+ npmInstall.on("exit", (code) => {
341
+ if (code == 0) {
342
+ resolve();
343
+ } else {
344
+ reject(`NPM install exited with code ${code}`);
345
+ }
346
+ });
347
+ });
348
+ }
349
+
350
+ function buildClientSideScripts(opts) {
351
+ return new Promise((resolve, reject) => {
352
+ console.log("building client side scripts...");
353
+ let npmInstall = spawn(`npm`, ["run", "build"], { cwd: opts.dir });
354
+ npmInstall.stdout.on("data", (data) => {
355
+ //console.log(data.toString());
356
+ });
357
+ npmInstall.stderr.on("data", (data) => {
358
+ console.error(data.toString());
359
+ });
360
+ npmInstall.on("exit", (code) => {
361
+ if (code == 0) {
362
+ resolve();
363
+ } else {
364
+ reject(`npm run build job exited with code ${code}`);
365
+ }
366
+ });
367
+ });
368
+ }
369
+
370
+ function postStartupInstructions(opts) {
371
+ console.log(
372
+ "Generation of source code, configurations and installation of packages successfully finished."
373
+ );
374
+ console.log(
375
+ `To start server navigate to directory '${opts.dir}' (cd '${opts.dir}') and run 'npm start'`
376
+ );
377
+ }
378
+
328
379
  program
329
380
  .command("create")
330
381
  .addOption(
331
382
  new Option("-d, --dir <dir>").default(CWD, "current working directory")
332
383
  )
333
- .description("create application in target directory")
384
+ .description(
385
+ "create application in target directory (create -d [pathToDir])"
386
+ )
334
387
  .action(async (opts) => {
335
388
  // console.log("create command called :" + opts.dir);
336
389
  if (!isAbsolute(opts.dir)) {
@@ -364,6 +417,10 @@ program
364
417
  if (await Readers.isUserNeedFrontModuleBootstrap(inquirer)) {
365
418
  await createBootstrapFrontModule(PATH_MODULES_FRONT, AppConfig);
366
419
  }
420
+ console.log(`cd '${opts.dir}' && npm i`);
421
+ await installPackages(opts);
422
+ await buildClientSideScripts(opts);
423
+ postStartupInstructions(opts);
367
424
  });
368
425
 
369
426
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "6.1.0",
3
+ "version": "6.1.2",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {