@researchdatabox/redbox-dev-tools 0.0.1 → 5.0.0-RC1
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 +259 -14
- package/bin/cli.js +3 -0
- package/bin/run-hook-mocha.js +3 -0
- package/bin/run-hook-tsc.js +3 -0
- package/bin/wrapper-webpack.js +168 -0
- package/config/tsconfig.base.json +16 -0
- package/dist/bin/run-hook-mocha.d.ts +1 -0
- package/dist/bin/run-hook-mocha.js +49 -0
- package/dist/bin/run-hook-tsc.d.ts +1 -0
- package/dist/bin/run-hook-tsc.js +19 -0
- package/dist/cli-parsers.d.ts +9 -0
- package/dist/cli-parsers.js +131 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +495 -0
- package/dist/commands/form-config.d.ts +6 -0
- package/dist/commands/form-config.js +401 -0
- package/dist/commands/sync-translation.d.ts +23 -0
- package/dist/commands/sync-translation.js +348 -0
- package/dist/completion/index.d.ts +1 -0
- package/dist/completion/index.js +218 -0
- package/dist/generators/add-method.d.ts +27 -0
- package/dist/generators/add-method.js +235 -0
- package/dist/generators/angular-app.d.ts +24 -0
- package/dist/generators/angular-app.js +342 -0
- package/dist/generators/angular-service.d.ts +21 -0
- package/dist/generators/angular-service.js +154 -0
- package/dist/generators/controller.d.ts +40 -0
- package/dist/generators/controller.js +195 -0
- package/dist/generators/form-component.d.ts +46 -0
- package/dist/generators/form-component.js +906 -0
- package/dist/generators/form-field.d.ts +15 -0
- package/dist/generators/form-field.js +160 -0
- package/dist/generators/migration.d.ts +15 -0
- package/dist/generators/migration.js +100 -0
- package/dist/generators/model.d.ts +42 -0
- package/dist/generators/model.js +206 -0
- package/dist/generators/service.d.ts +16 -0
- package/dist/generators/service.js +111 -0
- package/dist/runtime-resolver.d.ts +3 -0
- package/dist/runtime-resolver.js +27 -0
- package/dist/templates/hook-archetype.d.ts +12 -0
- package/dist/templates/hook-archetype.js +187 -0
- package/dist/testing.d.ts +7 -0
- package/dist/testing.js +53 -0
- package/dist/utils/config-helper.d.ts +71 -0
- package/dist/utils/config-helper.js +574 -0
- package/dist/utils/generator.d.ts +10 -0
- package/dist/utils/generator.js +68 -0
- package/dist/utils/hook-tsconfig.d.ts +9 -0
- package/dist/utils/hook-tsconfig.js +104 -0
- package/dist/utils/paths.d.ts +10 -0
- package/dist/utils/paths.js +60 -0
- package/index.js +4 -0
- package/package.json +76 -19
- package/runtime-resolver.d.ts +1 -0
- package/runtime-resolver.js +3 -0
- package/skills/redbox-angular-apps/SKILL.md +42 -0
- package/skills/redbox-angular-services/SKILL.md +29 -0
- package/skills/redbox-controllers/SKILL.md +65 -0
- package/skills/redbox-feature-design-planner/SKILL.md +169 -0
- package/skills/redbox-feature-implementation-review/SKILL.md +117 -0
- package/skills/redbox-form-components/SKILL.md +114 -0
- package/skills/redbox-form-config/SKILL.md +34 -0
- package/skills/redbox-hook-development/SKILL.md +66 -0
- package/skills/redbox-services/SKILL.md +54 -0
- package/skills/redbox-test-verification/SKILL.md +38 -0
- package/skills/redbox-testing/SKILL.md +64 -0
- package/skills/redbox-web-verification/SKILL.md +71 -0
- package/skills/redbox-web-verification/redbox-angular-apps/SKILL.md +48 -0
- package/skills/redbox-web-verification/redbox-angular-services/SKILL.md +30 -0
- package/skills/redbox-web-verification/redbox-controllers/SKILL.md +56 -0
- package/skills/redbox-web-verification/redbox-form-config/SKILL.md +29 -0
- package/skills/redbox-web-verification/redbox-hook-development/SKILL.md +61 -0
- package/skills/redbox-web-verification/redbox-services/SKILL.md +45 -0
- package/skills/redbox-web-verification/redbox-testing/SKILL.md +53 -0
- package/skills/redbox-web-verification/redbox-web-verification/SKILL.md +47 -0
- package/templates/hook-archetype/standard/.gitignore.hbs +5 -0
- package/templates/hook-archetype/standard/.npmignore.hbs +4 -0
- package/templates/hook-archetype/standard/.npmrc.hbs +6 -0
- package/templates/hook-archetype/standard/.nvmrc.hbs +1 -0
- package/templates/hook-archetype/standard/AGENTS.md.hbs +51 -0
- package/templates/hook-archetype/standard/Dockerfile.hbs +29 -0
- package/templates/hook-archetype/standard/README.md.hbs +57 -0
- package/templates/hook-archetype/standard/assets/default/.gitkeep +1 -0
- package/templates/hook-archetype/standard/assets/fonts/.gitkeep +1 -0
- package/templates/hook-archetype/standard/assets/images/.gitkeep +1 -0
- package/templates/hook-archetype/standard/assets/styles/.gitkeep +1 -0
- package/templates/hook-archetype/standard/language-defaults/.gitkeep +1 -0
- package/templates/hook-archetype/standard/language-defaults/README.md.hbs +10 -0
- package/templates/hook-archetype/standard/language-defaults/en/translation.json.hbs +3 -0
- package/templates/hook-archetype/standard/language-defaults/meta.json.hbs +6 -0
- package/templates/hook-archetype/standard/package.json.hbs +44 -0
- package/templates/hook-archetype/standard/src/api/controllers/ExampleController.ts.hbs +21 -0
- package/templates/hook-archetype/standard/src/api/controllers/index.ts.hbs +23 -0
- package/templates/hook-archetype/standard/src/api/services/ExampleService.ts.hbs +22 -0
- package/templates/hook-archetype/standard/src/api/services/index.ts.hbs +23 -0
- package/templates/hook-archetype/standard/src/config/brandingConfigurationDefaults.ts.hbs +9 -0
- package/templates/hook-archetype/standard/src/config/reusableFormDefinitions.ts.hbs +6 -0
- package/templates/hook-archetype/standard/src/form-config/default-1.0-draft.ts.hbs +20 -0
- package/templates/hook-archetype/standard/src/form-config/index.ts.hbs +8 -0
- package/templates/hook-archetype/standard/src/index.ts.hbs +55 -0
- package/templates/hook-archetype/standard/src/migrations/index.ts.hbs +19 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/namedqueries/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/records/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/reports/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/bootstrap-data/vocabularies/.gitkeep +1 -0
- package/templates/hook-archetype/standard/support/development/core-mount.env.hbs +3 -0
- package/templates/hook-archetype/standard/support/development/docker-compose.core-mount.yml.hbs +37 -0
- package/templates/hook-archetype/standard/support/development/docker-compose.yml.hbs +108 -0
- package/templates/hook-archetype/standard/support/development/prepare-core-mount.sh.hbs +61 -0
- package/templates/hook-archetype/standard/support/integration-testing/docker-compose.mocha.yml.hbs +118 -0
- package/templates/hook-archetype/standard/support/integration-testing/run-mocha-hook.sh.hbs +14 -0
- package/templates/hook-archetype/standard/support/integration-testing/run-mocha-redbox.sh.hbs +100 -0
- package/templates/hook-archetype/standard/support/prepare-minio.sh.hbs +74 -0
- package/templates/hook-archetype/standard/test/integration/hook-registration.test.ts.hbs +15 -0
- package/templates/hook-archetype/standard/test/support/globals.ts.hbs +40 -0
- package/templates/hook-archetype/standard/test/tsconfig.json.hbs +8 -0
- package/templates/hook-archetype/standard/test/unit/.mocharc.cjs.hbs +9 -0
- package/templates/hook-archetype/standard/test/unit/index.test.ts.hbs +46 -0
- package/templates/hook-archetype/standard/tsconfig.json.hbs +15 -0
- package/templates/hook-archetype/standard/views/.gitkeep +1 -0
- package/templates/hook-archetype/standard/views/default/.gitkeep +1 -0
- package/testing.d.ts +1 -0
- package/testing.js +3 -0
- package/.travis.yml +0 -23
- package/commands/initProject.js +0 -129
- package/redbox-dev-tools +0 -70
- package/yarn.lock +0 -1061
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FormConfigFrame } from '@researchdatabox/sails-ng-common';
|
|
2
|
+
import { FormConfigExports as CoreFormConfigExports } from '@researchdatabox/redbox-core';
|
|
3
|
+
|
|
4
|
+
function isFormConfigFrame(value: unknown): value is FormConfigFrame {
|
|
5
|
+
return typeof value === 'object' && value !== null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (!('generated-view-only' in CoreFormConfigExports)) {
|
|
9
|
+
throw new Error("CoreFormConfigExports is missing the 'generated-view-only' form config.");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const generatedViewOnly = CoreFormConfigExports['generated-view-only'];
|
|
13
|
+
|
|
14
|
+
if (!isFormConfigFrame(generatedViewOnly)) {
|
|
15
|
+
throw new Error("CoreFormConfigExports['generated-view-only'] is not a valid FormConfigFrame.");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const defaultDraft: FormConfigFrame = generatedViewOnly;
|
|
19
|
+
|
|
20
|
+
export default defaultDraft;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FormConfigFrame } from '@researchdatabox/sails-ng-common';
|
|
2
|
+
import { FormConfigExports as CoreFormConfigExports } from '@researchdatabox/redbox-core';
|
|
3
|
+
import defaultDraft from './default-1.0-draft';
|
|
4
|
+
|
|
5
|
+
export const FormConfigExports: Record<string, FormConfigFrame> = {
|
|
6
|
+
'default-1.0-draft': defaultDraft,
|
|
7
|
+
'generated-view-only': CoreFormConfigExports['generated-view-only']
|
|
8
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import '@researchdatabox/redbox-core';
|
|
2
|
+
import { defineRedboxHook, type HookRegistrationMap } from '@researchdatabox/redbox-core';
|
|
3
|
+
import type { FormConfigFrame } from '@researchdatabox/sails-ng-common';
|
|
4
|
+
import type { HookRedboxControllers } from './api/controllers';
|
|
5
|
+
import type { HookRedboxServices } from './api/services';
|
|
6
|
+
import { brandingConfigurationDefaults } from './config/brandingConfigurationDefaults';
|
|
7
|
+
import { reusableFormDefinitions } from './config/reusableFormDefinitions';
|
|
8
|
+
import { MigrationExports, registerRedboxMigrations } from './migrations';
|
|
9
|
+
|
|
10
|
+
export {};
|
|
11
|
+
|
|
12
|
+
const hook = defineRedboxHook({
|
|
13
|
+
initialize(_sails, done) {
|
|
14
|
+
done();
|
|
15
|
+
},
|
|
16
|
+
routes() {
|
|
17
|
+
return {
|
|
18
|
+
before: {},
|
|
19
|
+
after: {
|
|
20
|
+
'GET /hooks/{{hookShortName}}/status': 'ExampleController.index'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
configure() {},
|
|
25
|
+
defaults: {
|
|
26
|
+
__configKey__: {
|
|
27
|
+
_hookTimeout: 120000
|
|
28
|
+
},
|
|
29
|
+
policies: {}
|
|
30
|
+
},
|
|
31
|
+
registerRedboxConfig(): HookRegistrationMap {
|
|
32
|
+
return {
|
|
33
|
+
brandingConfigurationDefaults,
|
|
34
|
+
reusableFormDefinitions
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
registerRedboxControllers(): HookRedboxControllers {
|
|
38
|
+
return require('./api/controllers').ControllerExports as HookRedboxControllers;
|
|
39
|
+
},
|
|
40
|
+
registerRedboxServices(): HookRedboxServices {
|
|
41
|
+
return require('./api/services').ServiceExports as HookRedboxServices;
|
|
42
|
+
},
|
|
43
|
+
registerRedboxFormConfigs(): Record<string, FormConfigFrame> {
|
|
44
|
+
return require('./form-config').FormConfigExports as Record<string, FormConfigFrame>;
|
|
45
|
+
},
|
|
46
|
+
additionalExports: {
|
|
47
|
+
ControllerExports: require('./api/controllers').ControllerExports,
|
|
48
|
+
ServiceExports: require('./api/services').ServiceExports,
|
|
49
|
+
FormConfigExports: require('./form-config').FormConfigExports,
|
|
50
|
+
MigrationExports,
|
|
51
|
+
registerRedboxMigrations
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
module.exports = hook;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RedboxMigration } from '@researchdatabox/redbox-core';
|
|
2
|
+
|
|
3
|
+
export const MigrationExports: RedboxMigration[] = [];
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook migration registry. The ReDBox loader discovers this via
|
|
7
|
+
* `package.json` -> `sails.hasMigrations: true` and calls it through the
|
|
8
|
+
* generated `config/migrations.js` shim.
|
|
9
|
+
*
|
|
10
|
+
* Keep this function synchronous. Migrations are ordered lexically by `name`,
|
|
11
|
+
* so prefix new migration names with the hook package name and a sortable
|
|
12
|
+
* timestamp, for example:
|
|
13
|
+
* `{{packageName}}:20260703T000000-seed-client-defaults`.
|
|
14
|
+
*/
|
|
15
|
+
export function registerRedboxMigrations(): RedboxMigration[] {
|
|
16
|
+
return MigrationExports;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default registerRedboxMigrations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/templates/hook-archetype/standard/support/development/docker-compose.core-mount.yml.hbs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
networks:
|
|
2
|
+
main:
|
|
3
|
+
|
|
4
|
+
services:
|
|
5
|
+
rbportal:
|
|
6
|
+
environment:
|
|
7
|
+
- sails_angularDev=true
|
|
8
|
+
volumes:
|
|
9
|
+
- "../../:/opt/redbox-portal/node_modules/{{packageName}}"
|
|
10
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/app.js:/opt/redbox-portal/app.js:delegated"
|
|
11
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/agenda-sqs-backend:/opt/redbox-portal/packages/agenda-sqs-backend:delegated"
|
|
12
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/raido:/opt/redbox-portal/packages/raido:delegated"
|
|
13
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/packages/redbox-core:delegated"
|
|
14
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-dev-tools:/opt/redbox-portal/packages/redbox-dev-tools:delegated"
|
|
15
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/rva-registry:/opt/redbox-portal/packages/rva-registry:delegated"
|
|
16
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-hook-redbox-storage-mongo:/opt/redbox-portal/packages/sails-hook-redbox-storage-mongo:delegated"
|
|
17
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-ng-common:/opt/redbox-portal/packages/sails-ng-common:delegated"
|
|
18
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/views:/opt/redbox-portal/views:delegated"
|
|
19
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/agenda-sqs-backend:/opt/redbox-portal/node_modules/@researchdatabox/agenda-sqs-backend:delegated"
|
|
20
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/raido:/opt/redbox-portal/node_modules/@researchdatabox/raido-openapi-generated-node:delegated"
|
|
21
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core:delegated"
|
|
22
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core-types:delegated"
|
|
23
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-dev-tools:/opt/redbox-portal/node_modules/@researchdatabox/redbox-dev-tools:delegated"
|
|
24
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/rva-registry:/opt/redbox-portal/node_modules/@researchdatabox/rva-registry-openapi-generated-node:delegated"
|
|
25
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-hook-redbox-storage-mongo:/opt/redbox-portal/node_modules/@researchdatabox/sails-hook-redbox-storage-mongo:delegated"
|
|
26
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-ng-common:/opt/redbox-portal/node_modules/@researchdatabox/sails-ng-common:delegated"
|
|
27
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/agenda-sqs-backend:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/agenda-sqs-backend:delegated"
|
|
28
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/raido:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/raido-openapi-generated-node:delegated"
|
|
29
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/redbox-core:delegated"
|
|
30
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-core:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/redbox-core-types:delegated"
|
|
31
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/redbox-dev-tools:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/redbox-dev-tools:delegated"
|
|
32
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/rva-registry:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/rva-registry-openapi-generated-node:delegated"
|
|
33
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-hook-redbox-storage-mongo:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/sails-hook-redbox-storage-mongo:delegated"
|
|
34
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/packages/sails-ng-common:/opt/redbox-portal/node_modules/{{packageName}}/node_modules/@researchdatabox/sails-ng-common:delegated"
|
|
35
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/assets/angular:/opt/redbox-portal/assets/angular:delegated"
|
|
36
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/assets/angular:/opt/redbox-portal/.tmp/public/angular:delegated"
|
|
37
|
+
- "${REDBOX_PORTAL_PATH:?Run dev:run:core:prepare first}/.tmp/public/default/default/js:/opt/redbox-portal/.tmp/public/default/default/js:delegated"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
networks:
|
|
2
|
+
main:
|
|
3
|
+
|
|
4
|
+
services:
|
|
5
|
+
rbportal:
|
|
6
|
+
build:
|
|
7
|
+
context: '../..'
|
|
8
|
+
dockerfile: 'Dockerfile'
|
|
9
|
+
target: '{{packageName}}'
|
|
10
|
+
ports:
|
|
11
|
+
- "1500:1500"
|
|
12
|
+
- "9876:9876"
|
|
13
|
+
volumes:
|
|
14
|
+
- "../../:/opt/redbox-portal/node_modules/{{packageName}}"
|
|
15
|
+
- "../../language-defaults:/opt/redbox-portal/language-defaults"
|
|
16
|
+
- "../../support/bootstrap-data:/opt/redbox-portal/bootstrap-data"
|
|
17
|
+
- "./.tmp/attachments/staging:/attachments/staging"
|
|
18
|
+
expose:
|
|
19
|
+
- "1500"
|
|
20
|
+
environment:
|
|
21
|
+
- sails_appUrl=http://localhost:1500
|
|
22
|
+
- NODE_ENV=docker
|
|
23
|
+
- NODE_PATH=/opt/redbox-portal/node_modules:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core/node_modules
|
|
24
|
+
- LOAD_DEFAULT_FORMS=true
|
|
25
|
+
- PORT=1500
|
|
26
|
+
- NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
27
|
+
- sails_security__csrf=false
|
|
28
|
+
- sails_redbox__apiKey=development-api-key
|
|
29
|
+
- sails_auth__default__local__default__token=development-token
|
|
30
|
+
- sails_brandingConfigurationDefaults__auth__local__default__token=development-token
|
|
31
|
+
- HOOK_S3_ACCESS_KEY=minioadmin
|
|
32
|
+
- HOOK_S3_SECRET_KEY=minioadmin
|
|
33
|
+
- HOOK_S3_REGION=ap-southeast-2
|
|
34
|
+
- HOOK_S3_BUCKET=test-aws-{{packageName}}-attachments
|
|
35
|
+
- HOOK_S3_ENDPOINT=http://minio:9000
|
|
36
|
+
- HOOK_S3_KEY_PREFIX=attachments/
|
|
37
|
+
- HOOK_ATTACHMENTS_STAGE_DIR=/attachments/staging
|
|
38
|
+
- HOOK_S3_FORCE_PATH_STYLE=true
|
|
39
|
+
- HOOK_S3_SUPPORTS_ACL=false
|
|
40
|
+
- MINIO_WAIT_SECONDS=180
|
|
41
|
+
- REGENERATE_SHIMS=true
|
|
42
|
+
networks:
|
|
43
|
+
main:
|
|
44
|
+
aliases:
|
|
45
|
+
- rbportal
|
|
46
|
+
entrypoint: >-
|
|
47
|
+
/bin/bash -c "set -x;
|
|
48
|
+
if [ -n \"$${HOOK_S3_BUCKET:-}\" ]; then bash /opt/redbox-portal/node_modules/{{packageName}}/support/prepare-minio.sh development || true; fi;
|
|
49
|
+
cd /opt/redbox-portal &&
|
|
50
|
+
npm --prefix /opt/redbox-portal/node_modules/{{packageName}} run compile &&
|
|
51
|
+
node --enable-source-maps --inspect=0.0.0.0:9876 app.js;"
|
|
52
|
+
depends_on:
|
|
53
|
+
mongodb:
|
|
54
|
+
condition: service_started
|
|
55
|
+
solr:
|
|
56
|
+
condition: service_started
|
|
57
|
+
minio:
|
|
58
|
+
condition: service_healthy
|
|
59
|
+
|
|
60
|
+
mongodb:
|
|
61
|
+
image: mongo:7
|
|
62
|
+
networks:
|
|
63
|
+
main:
|
|
64
|
+
aliases:
|
|
65
|
+
- mongodb
|
|
66
|
+
ports:
|
|
67
|
+
- "27017:27017"
|
|
68
|
+
volumes:
|
|
69
|
+
- ".tmp/mongo:/data/db"
|
|
70
|
+
|
|
71
|
+
solr:
|
|
72
|
+
image: solr:8.11.1
|
|
73
|
+
networks:
|
|
74
|
+
main:
|
|
75
|
+
aliases:
|
|
76
|
+
- solr
|
|
77
|
+
expose:
|
|
78
|
+
- "8983"
|
|
79
|
+
ports:
|
|
80
|
+
- "8983:8983"
|
|
81
|
+
environment:
|
|
82
|
+
- SOLR_HOME=/var/solr/data
|
|
83
|
+
entrypoint:
|
|
84
|
+
- docker-entrypoint.sh
|
|
85
|
+
- solr-precreate
|
|
86
|
+
- redbox
|
|
87
|
+
|
|
88
|
+
minio:
|
|
89
|
+
image: minio/minio:latest
|
|
90
|
+
command: server /data --console-address ":9001"
|
|
91
|
+
networks:
|
|
92
|
+
main:
|
|
93
|
+
aliases:
|
|
94
|
+
- minio
|
|
95
|
+
ports:
|
|
96
|
+
- "9000:9000"
|
|
97
|
+
- "9001:9001"
|
|
98
|
+
environment:
|
|
99
|
+
- MINIO_ROOT_USER=minioadmin
|
|
100
|
+
- MINIO_ROOT_PASSWORD=minioadmin
|
|
101
|
+
volumes:
|
|
102
|
+
- "./.tmp/minio/data:/data"
|
|
103
|
+
healthcheck:
|
|
104
|
+
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/ready"]
|
|
105
|
+
interval: 2s
|
|
106
|
+
timeout: 5s
|
|
107
|
+
retries: 90
|
|
108
|
+
start_period: 5s
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
6
|
+
HOOK_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd -P)"
|
|
7
|
+
DEFAULT_ENV_FILE="${SCRIPT_DIR}/core-mount.env"
|
|
8
|
+
TMP_DIR="${HOOK_ROOT}/support/development/.tmp"
|
|
9
|
+
RESOLVED_ENV_FILE="${TMP_DIR}/core-mount.env"
|
|
10
|
+
|
|
11
|
+
if [[ -z "${REDBOX_PORTAL_PATH:-}" && -f "${DEFAULT_ENV_FILE}" ]]; then
|
|
12
|
+
set -a
|
|
13
|
+
# shellcheck disable=SC1090
|
|
14
|
+
source "${DEFAULT_ENV_FILE}"
|
|
15
|
+
set +a
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [[ -z "${REDBOX_PORTAL_PATH:-}" ]]; then
|
|
19
|
+
echo "FATAL: Set REDBOX_PORTAL_PATH to the redbox-portal checkout you want to mount." >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [[ "${REDBOX_PORTAL_PATH}" = /* ]]; then
|
|
24
|
+
PORTAL_ROOT="$(cd "${REDBOX_PORTAL_PATH}" && pwd -P)"
|
|
25
|
+
else
|
|
26
|
+
PORTAL_ROOT="$(cd "${HOOK_ROOT}/${REDBOX_PORTAL_PATH}" && pwd -P)"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
for required_path in \
|
|
30
|
+
package.json \
|
|
31
|
+
app.js \
|
|
32
|
+
packages/redbox-core/package.json \
|
|
33
|
+
packages/redbox-dev-tools/package.json \
|
|
34
|
+
packages/sails-ng-common/package.json \
|
|
35
|
+
packages/raido/package.json \
|
|
36
|
+
packages/rva-registry/package.json \
|
|
37
|
+
packages/sails-hook-redbox-storage-mongo/package.json
|
|
38
|
+
do
|
|
39
|
+
if [[ ! -e "${PORTAL_ROOT}/${required_path}" ]]; then
|
|
40
|
+
echo "FATAL: Missing required portal path: ${PORTAL_ROOT}/${required_path}" >&2
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
done
|
|
44
|
+
|
|
45
|
+
mkdir -p "${TMP_DIR}/attachments/staging" "${TMP_DIR}/mongo" "${TMP_DIR}/minio/data"
|
|
46
|
+
chmod -R 777 "${TMP_DIR}" || true
|
|
47
|
+
|
|
48
|
+
printf 'REDBOX_PORTAL_PATH=%s\n' "${PORTAL_ROOT}" > "${RESOLVED_ENV_FILE}"
|
|
49
|
+
|
|
50
|
+
if [[ ! -d "${PORTAL_ROOT}/node_modules" ]]; then
|
|
51
|
+
(cd "${PORTAL_ROOT}" && npm install --ignore-scripts --strict-peer-deps)
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
if [[ ! -d "${HOOK_ROOT}/node_modules" ]]; then
|
|
55
|
+
(cd "${HOOK_ROOT}" && npm install --ignore-scripts)
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
(cd "${HOOK_ROOT}" && npm run compile)
|
|
59
|
+
(cd "${PORTAL_ROOT}" && npm run compile:server)
|
|
60
|
+
|
|
61
|
+
echo "Prepared core mount against: ${PORTAL_ROOT}"
|
package/templates/hook-archetype/standard/support/integration-testing/docker-compose.mocha.yml.hbs
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
networks:
|
|
2
|
+
main:
|
|
3
|
+
|
|
4
|
+
x-rbportal-env: &rbportal-env
|
|
5
|
+
- NODE_ENV=integrationtest
|
|
6
|
+
- NODE_PATH=/opt/redbox-portal/node_modules:/opt/redbox-portal/node_modules/@researchdatabox/redbox-core/node_modules
|
|
7
|
+
- PORT=1500
|
|
8
|
+
- sails_redbox__apiKey=integration-api-key
|
|
9
|
+
- sails_redbox__mochaTesting=true
|
|
10
|
+
- sails_brandingConfigurationDefaults__auth__local__default__token=integration-token
|
|
11
|
+
- sails_security__csrf=false
|
|
12
|
+
- LOAD_DEFAULT_FORMS=true
|
|
13
|
+
- HOOK_S3_ACCESS_KEY=minioadmin
|
|
14
|
+
- HOOK_S3_SECRET_KEY=minioadmin
|
|
15
|
+
- HOOK_S3_REGION=ap-southeast-2
|
|
16
|
+
- HOOK_S3_BUCKET=test-aws-{{packageName}}-attachments
|
|
17
|
+
- HOOK_S3_ENDPOINT=http://minio:9000
|
|
18
|
+
- HOOK_S3_KEY_PREFIX=attachments/
|
|
19
|
+
- HOOK_ATTACHMENTS_STAGE_DIR=/attachments/staging
|
|
20
|
+
- HOOK_S3_FORCE_PATH_STYLE=true
|
|
21
|
+
- HOOK_S3_SUPPORTS_ACL=false
|
|
22
|
+
- MINIO_WAIT_SECONDS=180
|
|
23
|
+
- REGENERATE_SHIMS=true
|
|
24
|
+
- CI=${CI:-false}
|
|
25
|
+
- RBPORTAL_COVERAGE_DIR=/tmp/redbox-coverage/mocha
|
|
26
|
+
|
|
27
|
+
x-rbportal-depends: &rbportal-depends
|
|
28
|
+
mongodb:
|
|
29
|
+
condition: service_healthy
|
|
30
|
+
solr:
|
|
31
|
+
condition: service_healthy
|
|
32
|
+
minio:
|
|
33
|
+
condition: service_healthy
|
|
34
|
+
|
|
35
|
+
services:
|
|
36
|
+
redboxportal:
|
|
37
|
+
build:
|
|
38
|
+
context: ../..
|
|
39
|
+
dockerfile: Dockerfile
|
|
40
|
+
target: {{packageName}}
|
|
41
|
+
ports:
|
|
42
|
+
- "1500:1500"
|
|
43
|
+
volumes:
|
|
44
|
+
- "../../language-defaults:/opt/redbox-portal/language-defaults"
|
|
45
|
+
- "../../support/bootstrap-data:/opt/redbox-portal/bootstrap-data:ro"
|
|
46
|
+
- "../../support/prepare-minio.sh:/opt/redbox-portal/support/prepare-minio.sh:ro"
|
|
47
|
+
- "../../support/integration-testing:/opt/redbox-portal/support/integration-testing:ro"
|
|
48
|
+
- "../../tsconfig.json:/opt/redbox-portal/tsconfig.json:ro"
|
|
49
|
+
- "../../test/integration:/opt/redbox-portal/test/integration/{{integrationDirName}}"
|
|
50
|
+
- "./.tmp/attachments/staging:/attachments/staging"
|
|
51
|
+
depends_on: *rbportal-depends
|
|
52
|
+
expose:
|
|
53
|
+
- "1500"
|
|
54
|
+
environment: *rbportal-env
|
|
55
|
+
networks:
|
|
56
|
+
main:
|
|
57
|
+
aliases:
|
|
58
|
+
- redboxportal
|
|
59
|
+
init: true
|
|
60
|
+
entrypoint:
|
|
61
|
+
- bash
|
|
62
|
+
- /opt/redbox-portal/support/integration-testing/run-mocha-hook.sh
|
|
63
|
+
|
|
64
|
+
mongodb:
|
|
65
|
+
image: mongo:7
|
|
66
|
+
networks:
|
|
67
|
+
main:
|
|
68
|
+
aliases:
|
|
69
|
+
- mongodb
|
|
70
|
+
ports:
|
|
71
|
+
- "27017:27017"
|
|
72
|
+
healthcheck:
|
|
73
|
+
test: ['CMD-SHELL', "echo 'db.runCommand(\"ping\").ok' | mongosh"]
|
|
74
|
+
interval: '10s'
|
|
75
|
+
timeout: '5s'
|
|
76
|
+
retries: 10
|
|
77
|
+
start_period: '30s'
|
|
78
|
+
|
|
79
|
+
solr:
|
|
80
|
+
image: solr:8.11.1
|
|
81
|
+
expose:
|
|
82
|
+
- "8983"
|
|
83
|
+
ports:
|
|
84
|
+
- "8983:8983"
|
|
85
|
+
healthcheck:
|
|
86
|
+
test: ['CMD-SHELL', 'curl http://localhost:8983']
|
|
87
|
+
interval: '10s'
|
|
88
|
+
timeout: '5s'
|
|
89
|
+
retries: 10
|
|
90
|
+
start_period: '30s'
|
|
91
|
+
networks:
|
|
92
|
+
main:
|
|
93
|
+
aliases:
|
|
94
|
+
- solr
|
|
95
|
+
entrypoint:
|
|
96
|
+
- docker-entrypoint.sh
|
|
97
|
+
- solr-precreate
|
|
98
|
+
- redbox
|
|
99
|
+
|
|
100
|
+
minio:
|
|
101
|
+
image: minio/minio:latest
|
|
102
|
+
command: server /data --console-address ":9001"
|
|
103
|
+
networks:
|
|
104
|
+
main:
|
|
105
|
+
aliases:
|
|
106
|
+
- minio
|
|
107
|
+
expose:
|
|
108
|
+
- "9000"
|
|
109
|
+
- "9001"
|
|
110
|
+
environment:
|
|
111
|
+
- MINIO_ROOT_USER=minioadmin
|
|
112
|
+
- MINIO_ROOT_PASSWORD=minioadmin
|
|
113
|
+
healthcheck:
|
|
114
|
+
test: [ 'CMD-SHELL', 'curl -fsS http://localhost:9000/minio/health/ready' ]
|
|
115
|
+
interval: '5s'
|
|
116
|
+
timeout: '5s'
|
|
117
|
+
retries: 20
|
|
118
|
+
start_period: '10s'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
cd /opt/redbox-portal
|
|
6
|
+
|
|
7
|
+
export RBPORTAL_MOCHA_TEST_PATHS=${RBPORTAL_MOCHA_TEST_PATHS:-$'test/integration/{{integrationDirName}}/**/*.test.ts'}
|
|
8
|
+
export RBPORTAL_SAILS_LOG_LEVEL=${RBPORTAL_SAILS_LOG_LEVEL:-error}
|
|
9
|
+
|
|
10
|
+
if [ -n "${HOOK_S3_BUCKET:-}" ] && [ -f /opt/redbox-portal/support/prepare-minio.sh ]; then
|
|
11
|
+
bash /opt/redbox-portal/support/prepare-minio.sh integration
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
exec bash /opt/redbox-portal/support/integration-testing/run-mocha-redbox.sh
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
set -o xtrace
|
|
5
|
+
|
|
6
|
+
cd /opt/redbox-portal
|
|
7
|
+
|
|
8
|
+
rm -rf /opt/redbox-portal/coverage/mocha/* || true
|
|
9
|
+
rm /opt/redbox-portal/.tmp/junit/backend-mocha/backend-mocha.xml || true
|
|
10
|
+
|
|
11
|
+
node_cmd=(node)
|
|
12
|
+
|
|
13
|
+
export TS_NODE_PROJECT=/opt/redbox-portal/tsconfig.json
|
|
14
|
+
export TS_NODE_TRANSPILE_ONLY=true
|
|
15
|
+
export TS_NODE_COMPILER_OPTIONS='{"module":"commonjs","moduleResolution":"node","esModuleInterop":true}'
|
|
16
|
+
|
|
17
|
+
export RBPORTAL_COVERAGE_DIR=${RBPORTAL_COVERAGE_DIR:-/tmp/coverage/mocha}
|
|
18
|
+
mkdir -p "$RBPORTAL_COVERAGE_DIR"
|
|
19
|
+
chmod 777 "$RBPORTAL_COVERAGE_DIR" || true
|
|
20
|
+
|
|
21
|
+
export NYC_OUTPUT=${NYC_OUTPUT:-/tmp/nyc_output}
|
|
22
|
+
mkdir -p "$NYC_OUTPUT"
|
|
23
|
+
chmod 777 "$NYC_OUTPUT" || true
|
|
24
|
+
|
|
25
|
+
test_args=()
|
|
26
|
+
if [[ -n "${RBPORTAL_MOCHA_TEST_PATHS:-}" ]]; then
|
|
27
|
+
mapfile -t env_test_args <<< "${RBPORTAL_MOCHA_TEST_PATHS}"
|
|
28
|
+
test_args+=("${env_test_args[@]}")
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if [[ ${#@} -gt 0 ]]; then
|
|
32
|
+
test_args+=("$@")
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if [[ ${#test_args[@]} -eq 0 ]]; then
|
|
36
|
+
test_args=(test/integration/**/*.test.ts)
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
if [[ ! -x node_modules/.bin/mocha ]] || [[ ! -x node_modules/.bin/nyc ]]; then
|
|
40
|
+
echo "Test dependencies not found. Running npm install..."
|
|
41
|
+
npm install
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
if [[ ! -f node_modules/redoc/bundles/redoc.standalone.js ]]; then
|
|
45
|
+
npm install --no-save --ignore-scripts --strict-peer-deps redoc@2.5.2
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
npm run webpack
|
|
49
|
+
|
|
50
|
+
rm -rf node_modules/redoc node_modules/should
|
|
51
|
+
|
|
52
|
+
echo "Generating shims via redbox-core loader..."
|
|
53
|
+
node -e "
|
|
54
|
+
const { generateAllShims } = require('@researchdatabox/redbox-core');
|
|
55
|
+
generateAllShims(process.cwd(), {
|
|
56
|
+
forceRegenerate: true,
|
|
57
|
+
verbose: true
|
|
58
|
+
}).catch(err => {
|
|
59
|
+
console.error('Shim generation failed:', err);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
|
62
|
+
"
|
|
63
|
+
|
|
64
|
+
bootstrap_test=test/bootstrap.test.ts
|
|
65
|
+
|
|
66
|
+
mocha_cmd=(node_modules/.bin/mocha)
|
|
67
|
+
nyc_cmd=(node_modules/.bin/nyc)
|
|
68
|
+
if [[ -n "${RBPORTAL_REMOTE_DEBUG:-}" ]]; then
|
|
69
|
+
nyc_cmd+=(--inspect="${RBPORTAL_REMOTE_DEBUG}")
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
final_args=("${node_cmd[@]}" "${mocha_cmd[@]}")
|
|
73
|
+
|
|
74
|
+
mocha_config_args=()
|
|
75
|
+
if [[ -f test/integration/.mocharc.js ]]; then
|
|
76
|
+
mocha_config_args+=(--config test/integration/.mocharc.js)
|
|
77
|
+
else
|
|
78
|
+
mocha_config_args+=(
|
|
79
|
+
--require ts-node/register
|
|
80
|
+
--require chai
|
|
81
|
+
--extension ts,js
|
|
82
|
+
--recursive
|
|
83
|
+
--timeout 30s
|
|
84
|
+
--ui bdd
|
|
85
|
+
)
|
|
86
|
+
if [[ "${CI:-false}" == "true" ]]; then
|
|
87
|
+
mocha_config_args+=(--reporter mocha-junit-reporter --reporter-option mochaFile=./.tmp/junit/backend-mocha/backend-mocha.xml)
|
|
88
|
+
else
|
|
89
|
+
mocha_config_args+=(--reporter spec)
|
|
90
|
+
fi
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
exec "${nyc_cmd[@]}" --no-clean \
|
|
94
|
+
--temp-dir "$NYC_OUTPUT" \
|
|
95
|
+
--report-dir "$RBPORTAL_COVERAGE_DIR" \
|
|
96
|
+
--reporter=lcov --exclude-after-remap=false \
|
|
97
|
+
"${final_args[@]}" \
|
|
98
|
+
\
|
|
99
|
+
"${mocha_config_args[@]}" \
|
|
100
|
+
--exit "${bootstrap_test}" "${test_args[@]}"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#! /bin/sh
|
|
2
|
+
MINIO_URL="${HOOK_S3_ENDPOINT:-http://minio:9000}"
|
|
3
|
+
MINIO_WAIT_SECONDS="${MINIO_WAIT_SECONDS:-180}"
|
|
4
|
+
|
|
5
|
+
wait_for_minio() {
|
|
6
|
+
echo "Waiting for MinIO at ${MINIO_URL}..."
|
|
7
|
+
for _ in $(seq 1 "${MINIO_WAIT_SECONDS}"); do
|
|
8
|
+
if curl -fsS "${MINIO_URL}/minio/health/ready" >/dev/null; then
|
|
9
|
+
return 0
|
|
10
|
+
fi
|
|
11
|
+
sleep 1
|
|
12
|
+
done
|
|
13
|
+
echo "MinIO did not become ready within ${MINIO_WAIT_SECONDS} seconds." >&2
|
|
14
|
+
return 1
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ensure_mc() {
|
|
18
|
+
if [ ! -x /tmp/mc ]; then
|
|
19
|
+
case "$(uname -m)" in
|
|
20
|
+
x86_64) mc_arch=amd64 ;;
|
|
21
|
+
aarch64|arm64) mc_arch=arm64 ;;
|
|
22
|
+
*) echo "Unsupported architecture: $(uname -m)" >&2; return 1 ;;
|
|
23
|
+
esac
|
|
24
|
+
curl -fsSL -o /tmp/mc "https://dl.min.io/client/mc/release/linux-${mc_arch}/mc"
|
|
25
|
+
chmod +x /tmp/mc
|
|
26
|
+
fi
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ensure_alias() {
|
|
30
|
+
/tmp/mc alias set local "${MINIO_URL}" "${HOOK_S3_ACCESS_KEY}" "${HOOK_S3_SECRET_KEY}" >/dev/null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ensure_bucket() {
|
|
34
|
+
if /tmp/mc stat "local/${HOOK_S3_BUCKET}" >/dev/null 2>&1; then
|
|
35
|
+
echo "Attachments bucket exists, skipping creation."
|
|
36
|
+
return 0
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
/tmp/mc mb "local/${HOOK_S3_BUCKET}"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ensure_credentials() {
|
|
43
|
+
CREDS_DIR=/home/node/.aws
|
|
44
|
+
CREDS_FILE="${CREDS_DIR}/credentials"
|
|
45
|
+
DESIRED_CREDS_FILE=/tmp/minio-credentials
|
|
46
|
+
|
|
47
|
+
cat > "${DESIRED_CREDS_FILE}" <<EOF
|
|
48
|
+
[default]
|
|
49
|
+
aws_access_key_id = ${HOOK_S3_ACCESS_KEY}
|
|
50
|
+
aws_secret_access_key = ${HOOK_S3_SECRET_KEY}
|
|
51
|
+
EOF
|
|
52
|
+
|
|
53
|
+
mkdir -p "${CREDS_DIR}"
|
|
54
|
+
|
|
55
|
+
if [ -f "${CREDS_FILE}" ] && cmp -s "${CREDS_FILE}" "${DESIRED_CREDS_FILE}"; then
|
|
56
|
+
echo "Reusing existing credentials file: ${CREDS_FILE}"
|
|
57
|
+
rm -f "${DESIRED_CREDS_FILE}"
|
|
58
|
+
return 0
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
echo "Writing credentials file: ${CREDS_FILE}"
|
|
62
|
+
mv "${DESIRED_CREDS_FILE}" "${CREDS_FILE}"
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if [ -z "${HOOK_S3_BUCKET:-}" ]; then
|
|
66
|
+
echo "HOOK_S3_BUCKET is not set; skipping MinIO preparation."
|
|
67
|
+
exit 0
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
ensure_mc
|
|
71
|
+
wait_for_minio
|
|
72
|
+
ensure_alias
|
|
73
|
+
ensure_bucket
|
|
74
|
+
ensure_credentials
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { expect, firstValueFrom } = require('@researchdatabox/redbox-dev-tools/testing');
|
|
2
|
+
|
|
3
|
+
describe('{{packageName}} integration', function () {
|
|
4
|
+
it('registers example services, form configs, config, and migrations with the lifted portal', async function () {
|
|
5
|
+
expect(sails.services.exampleservice).to.exist;
|
|
6
|
+
|
|
7
|
+
const result = await firstValueFrom(sails.services.exampleservice.describe());
|
|
8
|
+
expect(result).to.deep.equal({ hook: '{{packageName}}', status: 'ready' });
|
|
9
|
+
|
|
10
|
+
const hookModule = require('{{packageName}}');
|
|
11
|
+
expect(hookModule.registerRedboxConfig()).to.have.property('brandingConfigurationDefaults');
|
|
12
|
+
expect(hookModule.registerRedboxFormConfigs()).to.have.property('generated-view-only');
|
|
13
|
+
expect(hookModule.registerRedboxMigrations()).to.deep.equal([]);
|
|
14
|
+
});
|
|
15
|
+
});
|