@deenruv/create 1.0.0

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 (85) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +52 -0
  3. package/assets/.env.hbs +14 -0
  4. package/assets/Dockerfile.hbs +9 -0
  5. package/assets/deenruv-config.hbs +109 -0
  6. package/assets/docker-compose.hbs +39 -0
  7. package/assets/environment.d.hbs +24 -0
  8. package/assets/gitignore.template +5 -0
  9. package/assets/images/abel-y-costa-716024-unsplash.jpg +0 -0
  10. package/assets/images/adam-birkett-239153-unsplash.jpg +0 -0
  11. package/assets/images/alex-rodriguez-santibanez-200278-unsplash.jpg +0 -0
  12. package/assets/images/alexander-andrews-260988-unsplash.jpg +0 -0
  13. package/assets/images/alexandru-acea-686569-unsplash.jpg +0 -0
  14. package/assets/images/andres-jasso-220776-unsplash.jpg +0 -0
  15. package/assets/images/annie-spratt-78044-unsplash.jpg +0 -0
  16. package/assets/images/ben-hershey-574483-unsplash.jpg +0 -0
  17. package/assets/images/benjamin-voros-310026-unsplash.jpg +0 -0
  18. package/assets/images/brandi-redd-104140-unsplash.jpg +0 -0
  19. package/assets/images/caleb-george-536388-unsplash.jpg +0 -0
  20. package/assets/images/charles-deluvio-695736-unsplash.jpg +0 -0
  21. package/assets/images/chuttersnap-324234-unsplash.jpg +0 -0
  22. package/assets/images/chuttersnap-584518-unsplash.jpg +0 -0
  23. package/assets/images/daniel-korpai-1302051-unsplash.jpg +0 -0
  24. package/assets/images/derick-david-409858-unsplash.jpg +0 -0
  25. package/assets/images/eniko-kis-663725-unsplash.jpg +0 -0
  26. package/assets/images/florian-klauer-14840-unsplash.jpg +0 -0
  27. package/assets/images/florian-olivo-1166419-unsplash.jpg +0 -0
  28. package/assets/images/imani-clovis-234736-unsplash.jpg +0 -0
  29. package/assets/images/jakob-owens-274337-unsplash.jpg +0 -0
  30. package/assets/images/jean-philippe-delberghe-1400011-unsplash.jpg +0 -0
  31. package/assets/images/jonathan-talbert-697262-unsplash.jpg +0 -0
  32. package/assets/images/juan-gomez-674574-unsplash.jpg +0 -0
  33. package/assets/images/kari-shea-398668-unsplash.jpg +0 -0
  34. package/assets/images/kelly-sikkema-685291-unsplash.jpg +0 -0
  35. package/assets/images/liam-briese-1128307-unsplash.jpg +0 -0
  36. package/assets/images/mark-tegethoff-667351-unsplash.jpg +0 -0
  37. package/assets/images/max-tarkhov-737999-unsplash.jpg +0 -0
  38. package/assets/images/michael-guite-571169-unsplash.jpg +0 -0
  39. package/assets/images/mikkel-bech-748940-unsplash.jpg +0 -0
  40. package/assets/images/mitch-lensink-256007-unsplash.jpg +0 -0
  41. package/assets/images/natalia-y-345738-unsplash.jpg +0 -0
  42. package/assets/images/nathan-fertig-249917-unsplash.jpg +0 -0
  43. package/assets/images/neonbrand-428982-unsplash.jpg +0 -0
  44. package/assets/images/neslihan-gunaydin-3493-unsplash.jpg +0 -0
  45. package/assets/images/nik-shuliahin-619349-unsplash.jpg +0 -0
  46. package/assets/images/nikolai-chernichenko-1299748-unsplash.jpg +0 -0
  47. package/assets/images/oscar-ivan-esquivel-arteaga-687447-unsplash.jpg +0 -0
  48. package/assets/images/patrick-brinksma-663044-unsplash.jpg +0 -0
  49. package/assets/images/paul-weaver-1120584-unsplash.jpg +0 -0
  50. package/assets/images/pierre-chatel-innocenti-483198-unsplash.jpg +0 -0
  51. package/assets/images/robert-shunev-528016-unsplash.jpg +0 -0
  52. package/assets/images/ruslan-bardash-351288-unsplash.jpg +0 -0
  53. package/assets/images/silvia-agrasar-227575-unsplash.jpg +0 -0
  54. package/assets/images/stoica-ionela-530966-unsplash.jpg +0 -0
  55. package/assets/images/thomas-q-1229169-unsplash.jpg +0 -0
  56. package/assets/images/thomas-serer-420833-unsplash.jpg +0 -0
  57. package/assets/images/tommy-bebo-600358-unsplash.jpg +0 -0
  58. package/assets/images/vincent-botta-736919-unsplash.jpg +0 -0
  59. package/assets/images/vincent-liu-525429-unsplash.jpg +0 -0
  60. package/assets/images/xavier-teo-469050-unsplash.jpg +0 -0
  61. package/assets/images/zoltan-kovacs-642412-unsplash.jpg +0 -0
  62. package/assets/images/zoltan-tasi-423051-unsplash.jpg +0 -0
  63. package/assets/index-worker.hbs +8 -0
  64. package/assets/index.hbs +8 -0
  65. package/assets/initial-data.json +1508 -0
  66. package/assets/products.csv +89 -0
  67. package/assets/readme.hbs +133 -0
  68. package/assets/tsconfig.template.json +20 -0
  69. package/index.js +2 -0
  70. package/lib/constants.d.ts +7 -0
  71. package/lib/constants.js +11 -0
  72. package/lib/constants.js.map +1 -0
  73. package/lib/create-deenruv-app.d.ts +2 -0
  74. package/lib/create-deenruv-app.js +269 -0
  75. package/lib/create-deenruv-app.js.map +1 -0
  76. package/lib/gather-user-responses.d.ts +10 -0
  77. package/lib/gather-user-responses.js +186 -0
  78. package/lib/gather-user-responses.js.map +1 -0
  79. package/lib/helpers.d.ts +29 -0
  80. package/lib/helpers.js +422 -0
  81. package/lib/helpers.js.map +1 -0
  82. package/lib/types.d.ts +19 -0
  83. package/lib/types.js +3 -0
  84. package/lib/types.js.map +1 -0
  85. package/package.json +51 -0
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ # License 1
2
+
3
+ The MIT License
4
+
5
+ Copyright (c) 2025-present Aexol
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+
13
+ # License 2
14
+
15
+ The MIT License
16
+
17
+ Copyright (c) 2018-2025 Michael Bromley
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Deenruv Create
2
+
3
+ A CLI tool for rapidly scaffolding a new Deenruv server application. Heavily inspired by [create-react-app](https://github.com/facebook/create-react-app).
4
+
5
+ ## Usage
6
+
7
+ Deenruv Create requires [Node.js](https://nodejs.org/en/) v8.9.0+ to be installed.
8
+
9
+ To create a new project, you may choose one of the following methods:
10
+
11
+ ### npx
12
+
13
+ ```sh
14
+ npx @deenruv/create my-app
15
+ ```
16
+
17
+ _[npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher._
18
+
19
+ ### npm
20
+
21
+ ```sh
22
+ npm init @deenruv my-app
23
+ ```
24
+
25
+ _`npm init <initializer>` is available in npm 6+_
26
+
27
+ ### Yarn
28
+
29
+ ```sh
30
+ yarn create @deenruv my-app
31
+ ```
32
+
33
+ _`yarn create` is available in Yarn 0.25+_
34
+
35
+ It will create a directory called `my-app` inside the current folder.
36
+
37
+ ## Options
38
+
39
+ ### `--use-npm`
40
+
41
+ By default, Deenruv Create will detect whether a compatible version of Yarn is installed, and if so will display a prompt to select the preferred package manager.
42
+ You can override this and force it to use npm with the `--use-npm` flag.
43
+
44
+ ### `--log-level`
45
+
46
+ You can control how much output is generated during the installation and setup with this flag. Valid options are `silent`, `info` and `verbose`. The default is `silent`
47
+
48
+ Example:
49
+
50
+ ```sh
51
+ npx @deenruv/create my-app --log-level verbose
52
+ ```
@@ -0,0 +1,14 @@
1
+ APP_ENV=dev
2
+ COOKIE_SECRET={{ cookieSecret }}
3
+ SUPERADMIN_USERNAME={{{ escapeSingle superadminIdentifier }}}
4
+ SUPERADMIN_PASSWORD={{{ escapeSingle superadminPassword }}}
5
+ {{#if requiresConnection}}
6
+ DB_HOST={{ dbHost }}
7
+ DB_PORT={{ dbPort }}
8
+ DB_NAME={{{ escapeSingle dbName }}}
9
+ DB_USERNAME={{{ escapeSingle dbUserName }}}
10
+ DB_PASSWORD={{{ escapeSingle dbPassword }}}
11
+ {{/if}}
12
+ {{#if dbSchema}}
13
+ DB_SCHEMA={{ dbSchema }}
14
+ {{/if}}
@@ -0,0 +1,9 @@
1
+ FROM node:20
2
+
3
+ WORKDIR /usr/src/app
4
+
5
+ COPY package.json ./
6
+ COPY {{#if useYarn}}yarn.lock{{else}}package-lock.json{{/if}} ./
7
+ RUN {{#if useYarn}}yarn{{else}}npm install{{/if}} --production
8
+ COPY . .
9
+ RUN {{#if useYarn}}yarn{{else}}npm run{{/if}} build
@@ -0,0 +1,109 @@
1
+ import {
2
+ dummyPaymentHandler,
3
+ DefaultJobQueuePlugin,
4
+ DefaultSearchPlugin,
5
+ DeenruvConfig,
6
+ } from '@deenruv/core';
7
+ import { defaultEmailHandlers, EmailPlugin } from '@deenruv/email-plugin';
8
+ import { AssetServerPlugin } from '@deenruv/asset-server-plugin';
9
+ import { AdminUiPlugin } from '@deenruv/admin-ui-plugin';
10
+ import 'dotenv/config';
11
+ import path from 'path';
12
+
13
+ const IS_DEV = process.env.APP_ENV === 'dev';
14
+
15
+ export const config: DeenruvConfig = {
16
+ apiOptions: {
17
+ port: 3000,
18
+ adminApiPath: 'admin-api',
19
+ shopApiPath: 'shop-api',
20
+ // The following options are useful in development mode,
21
+ // but are best turned off for production for security
22
+ // reasons.
23
+ ...(IS_DEV ? {
24
+ adminApiPlayground: {
25
+ settings: { 'request.credentials': 'include' },
26
+ },
27
+ adminApiDebug: true,
28
+ shopApiPlayground: {
29
+ settings: { 'request.credentials': 'include' },
30
+ },
31
+ shopApiDebug: true,
32
+ } : {}),
33
+ },
34
+ authOptions: {
35
+ tokenMethod: ['bearer', 'cookie'],
36
+ superadminCredentials: {
37
+ identifier: process.env.SUPERADMIN_USERNAME,
38
+ password: process.env.SUPERADMIN_PASSWORD,
39
+ },
40
+ cookieOptions: {
41
+ secret: process.env.COOKIE_SECRET,
42
+ },
43
+ },
44
+ dbConnectionOptions: {
45
+ type: '{{ dbType }}',
46
+ // See the README.md "Migrations" section for an explanation of
47
+ // the `synchronize` and `migrations` options.
48
+ synchronize: false,
49
+ migrations: [path.join(__dirname, './migrations/*.+(js|ts)')],
50
+ logging: false,
51
+ database: {{#if isSQLjs}}new Uint8Array([]){{else if isSQLite}}path.join(__dirname, '../deenruv.sqlite'){{else}}process.env.DB_NAME{{/if}},
52
+ {{#if dbSchema}}
53
+ schema: process.env.DB_SCHEMA,
54
+ {{/if}}
55
+ {{#if dbSSL}}
56
+ ssl: true,
57
+ {{/if}}
58
+ {{#if isSQLjs}}
59
+ location: path.join(__dirname, 'deenruv.sqlite'),
60
+ autoSave: true,
61
+ {{/if}}
62
+ {{#if requiresConnection}}
63
+ host: process.env.DB_HOST,
64
+ port: +process.env.DB_PORT,
65
+ username: process.env.DB_USERNAME,
66
+ password: process.env.DB_PASSWORD,
67
+ {{/if}}
68
+ },
69
+ paymentOptions: {
70
+ paymentMethodHandlers: [dummyPaymentHandler],
71
+ },
72
+ // When adding or altering custom field definitions, the database will
73
+ // need to be updated. See the "Migrations" section in README.md.
74
+ customFields: {},
75
+ plugins: [
76
+ AssetServerPlugin.init({
77
+ route: 'assets',
78
+ assetUploadDir: path.join(__dirname, '../static/assets'),
79
+ // For local dev, the correct value for assetUrlPrefix should
80
+ // be guessed correctly, but for production it will usually need
81
+ // to be set manually to match your production url.
82
+ assetUrlPrefix: IS_DEV ? undefined : 'https://www.my-shop.com/assets/',
83
+ }),
84
+ DefaultJobQueuePlugin.init({ useDatabaseForBuffer: true }),
85
+ DefaultSearchPlugin.init({ bufferUpdates: false, indexStockStatus: true }),
86
+ EmailPlugin.init({
87
+ devMode: true,
88
+ outputPath: path.join(__dirname, '../static/email/test-emails'),
89
+ route: 'mailbox',
90
+ handlers: defaultEmailHandlers,
91
+ templatePath: path.join(__dirname, '../static/email/templates'),
92
+ globalTemplateVars: {
93
+ // The following variables will change depending on your storefront implementation.
94
+ // Here we are assuming a storefront running at http://localhost:8080.
95
+ fromAddress: '"example" <noreply@example.com>',
96
+ verifyEmailAddressUrl: 'http://localhost:8080/verify',
97
+ passwordResetUrl: 'http://localhost:8080/password-reset',
98
+ changeEmailAddressUrl: 'http://localhost:8080/verify-email-address-change'
99
+ },
100
+ }),
101
+ AdminUiPlugin.init({
102
+ route: 'admin',
103
+ port: 3002,
104
+ adminUiConfig: {
105
+ apiPort: 3000,
106
+ },
107
+ }),
108
+ ],
109
+ };
@@ -0,0 +1,39 @@
1
+ version: "3"
2
+ services:
3
+ server:
4
+ build:
5
+ context: .
6
+ dockerfile: Dockerfile
7
+ ports:
8
+ - 3000:3000
9
+ command: [{{#if useYarn}}"yarn"{{else}}"npm", "run"{{/if}}, "start:server"]
10
+ volumes:
11
+ - /usr/src/app
12
+ environment:
13
+ DB_HOST: database
14
+ DB_PORT: 5432
15
+ DB_NAME: deenruv
16
+ DB_USERNAME: postgres
17
+ DB_PASSWORD: password
18
+ worker:
19
+ build:
20
+ context: .
21
+ dockerfile: Dockerfile
22
+ command: [{{#if useYarn}}"yarn"{{else}}"npm", "run"{{/if}}, "start:worker"]
23
+ volumes:
24
+ - /usr/src/app
25
+ environment:
26
+ DB_HOST: database
27
+ DB_PORT: 5432
28
+ DB_NAME: deenruv
29
+ DB_USERNAME: postgres
30
+ DB_PASSWORD: password
31
+ database:
32
+ image: postgres
33
+ volumes:
34
+ - /var/lib/postgresql/data
35
+ ports:
36
+ - 5432:5432
37
+ environment:
38
+ POSTGRES_PASSWORD: password
39
+ POSTGRES_DB: deenruv
@@ -0,0 +1,24 @@
1
+ export {};
2
+
3
+ // Here we declare the members of the process.env object, so that we
4
+ // can use them in our application code in a type-safe manner.
5
+ declare global {
6
+ namespace NodeJS {
7
+ interface ProcessEnv {
8
+ APP_ENV: string;
9
+ COOKIE_SECRET: string;
10
+ SUPERADMIN_USERNAME: string;
11
+ SUPERADMIN_PASSWORD: string;
12
+ {{#if requiresConnection}}
13
+ DB_HOST: string;
14
+ DB_PORT: number;
15
+ DB_NAME: string;
16
+ DB_USERNAME: string;
17
+ DB_PASSWORD: string;
18
+ {{/if}}
19
+ {{#if dbSchema}}
20
+ DB_SCHEMA: string;
21
+ {{/if}}
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ admin-ui
4
+ static/assets
5
+ static/email/test-emails
@@ -0,0 +1,8 @@
1
+ import { bootstrapWorker } from '@deenruv/core';
2
+ import { config } from './deenruv-config';
3
+
4
+ bootstrapWorker(config)
5
+ .then(worker => worker.startJobQueue())
6
+ .catch(err => {
7
+ console.log(err);
8
+ });
@@ -0,0 +1,8 @@
1
+ import { bootstrap, runMigrations } from '@deenruv/core';
2
+ import { config } from './deenruv-config';
3
+
4
+ runMigrations(config)
5
+ .then(() => bootstrap(config))
6
+ .catch(err => {
7
+ console.log(err);
8
+ });