pinstripe 0.35.0 → 0.36.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.
- package/README.md +1 -1
- package/cli.js +53 -0
- package/lib/annotatable.js +1 -0
- package/lib/bundle.js +95 -0
- package/lib/class.js +1 -1
- package/lib/command.js +13 -0
- package/lib/command.test.js +70 -0
- package/lib/commands/_file_importer.js +1 -0
- package/lib/commands/generate_command.js +42 -0
- package/lib/commands/generate_job.js +50 -0
- package/lib/commands/generate_project.js +178 -0
- package/lib/commands/generate_service.js +38 -0
- package/lib/commands/generate_view.js +83 -0
- package/lib/commands/initialize_project.js +6 -0
- package/lib/commands/list_jobs.js +21 -0
- package/lib/commands/list_services.js +21 -0
- package/lib/commands/list_views.js +22 -0
- package/lib/commands/run_job.js +15 -0
- package/lib/commands/show_config.js +12 -0
- package/lib/commands/show_theme.js +11 -0
- package/lib/commands/start_repl.js +12 -0
- package/lib/commands/start_server.js +57 -0
- package/lib/component.js +1 -767
- package/lib/constants.js +1 -1
- package/lib/context.js +2 -0
- package/lib/defer.js +2 -0
- package/lib/html.js +72 -0
- package/lib/import_all.js +9 -0
- package/lib/importable_registry.js +2 -0
- package/lib/index.js +11 -0
- package/lib/inflector.js +1 -1
- package/lib/initialize.js +23 -14
- package/lib/job.js +43 -0
- package/lib/json.js +47 -0
- package/lib/json.test.js +399 -0
- package/lib/lru_cache.js +1 -1
- package/lib/missing_resource_error.js +2 -0
- package/lib/model.js +72 -0
- package/lib/project.js +70 -0
- package/lib/registry.js +1 -1
- package/lib/service_factory.js +20 -0
- package/lib/service_file_importers/js.js +49 -0
- package/lib/services/_file_importer.js +1 -0
- package/lib/services/bundler.js +11 -0
- package/lib/services/call_handler.js +94 -0
- package/lib/services/config.js +84 -0
- package/lib/services/cookies.js +18 -0
- package/lib/services/create_model.js +8 -0
- package/lib/services/css_classes_for.js +13 -0
- package/lib/services/defer.js +12 -0
- package/lib/services/environment.js +24 -0
- package/lib/services/feature_flags.js +32 -0
- package/lib/services/format_date.js +8 -0
- package/lib/services/fs_builder.js +94 -0
- package/lib/services/inflector.js +8 -0
- package/lib/services/initial_params.js +14 -0
- package/lib/services/is_client.js +10 -0
- package/lib/services/job_coordinator.js +20 -0
- package/lib/services/job_queue.js +20 -0
- package/lib/services/job_scheduler.js +70 -0
- package/lib/services/job_worker.js +47 -0
- package/lib/services/params.js +14 -0
- package/lib/services/parse_html.js +8 -0
- package/lib/services/project.js +8 -0
- package/lib/services/render_form.js +147 -0
- package/lib/services/render_html.js +12 -0
- package/lib/services/render_json.js +12 -0
- package/lib/services/render_redirect.js +5 -0
- package/lib/services/render_table.js +48 -0
- package/lib/services/render_tag.js +26 -0
- package/lib/services/render_text.js +8 -0
- package/lib/services/render_view.js +16 -0
- package/lib/services/repl.js +54 -0
- package/lib/services/run_command.js +8 -0
- package/lib/services/run_in_new_workspace.js +18 -0
- package/lib/services/run_job.js +9 -0
- package/lib/services/send_mail.js +64 -0
- package/lib/services/server.js +227 -0
- package/lib/services/service_manager.js +12 -0
- package/lib/services/service_worker.js +99 -0
- package/lib/services/theme.js +11 -0
- package/lib/services/trapify.js +8 -0
- package/lib/services/version.js +27 -0
- package/lib/services/view.js +6 -0
- package/lib/services/view_map.js +83 -0
- package/lib/services/view_map.test.js +36 -0
- package/lib/singleton.js +2 -0
- package/lib/text.js +10 -0
- package/lib/theme.js +75 -0
- package/lib/theme.test.js +30 -0
- package/lib/theme_default_design_tokens.js +455 -0
- package/lib/trapify.js +1 -1
- package/lib/validateable.js +2 -0
- package/lib/validation_error.js +2 -0
- package/lib/view.js +132 -0
- package/lib/view_file_importers/js.js +62 -0
- package/lib/views/_file_importer.js +1 -0
- package/lib/views/_pinstripe/_button.js +154 -0
- package/lib/views/_pinstripe/_content.js +256 -0
- package/lib/views/_pinstripe/_form.js +301 -0
- package/lib/views/_pinstripe/_pagination.js +47 -0
- package/lib/views/_pinstripe/_panel.js +69 -0
- package/lib/views/_pinstripe/_shell/environment.json.js +8 -0
- package/lib/views/_pinstripe/_shell/feature_flags.json.js +8 -0
- package/lib/views/_pinstripe/_shell/index.js +206 -0
- package/lib/views/_pinstripe/_shell/service_worker.js.map.js +7 -0
- package/lib/views/_pinstripe/_shell/styles.css.js +61 -0
- package/lib/views/_pinstripe/_shell/version.json.js +8 -0
- package/lib/views/_pinstripe/_shell/window.js.js +7 -0
- package/lib/views/_pinstripe/_shell/window.js.map.js +7 -0
- package/lib/views/_pinstripe/_table.js +139 -0
- package/lib/views/_placeholders/overlay.js +55 -0
- package/lib/views/service_worker.js.js +7 -0
- package/lib/views/up.js +11 -0
- package/lib/virtual_node.js +1 -1
- package/lib/workspace.js +4 -0
- package/package.json +32 -8
- package/lib/component_event.js +0 -28
- package/lib/components/helpers.js +0 -74
- package/lib/components/index.js +0 -15
- package/lib/components/pinstripe_anchor.js +0 -25
- package/lib/components/pinstripe_body.js +0 -42
- package/lib/components/pinstripe_document.js +0 -114
- package/lib/components/pinstripe_form.js +0 -65
- package/lib/components/pinstripe_frame.js +0 -86
- package/lib/components/pinstripe_global_styles.js +0 -13
- package/lib/components/pinstripe_menu.js +0 -33
- package/lib/components/pinstripe_modal.js +0 -165
- package/lib/components/pinstripe_overlay.js +0 -51
- package/lib/components/pinstripe_popover.js +0 -86
- package/lib/components/pinstripe_progress_bar.js +0 -78
- package/lib/components/pinstripe_redirect.js +0 -18
- package/lib/components/pinstripe_script.js +0 -12
- package/lib/components/pinstripe_skeleton.js +0 -57
- package/lib/proof_of_work.js +0 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { ServiceFactory } from 'pinstripe';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
meta(){
|
|
7
|
+
this.assignProps({
|
|
8
|
+
description: 'Lists all available services in the current project.'
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
run(){
|
|
13
|
+
console.log('');
|
|
14
|
+
console.log('The following services are available:');
|
|
15
|
+
console.log('');
|
|
16
|
+
ServiceFactory.names.forEach(serviceFactoryName => {
|
|
17
|
+
console.log(` * ${chalk.green(serviceFactoryName)}`);
|
|
18
|
+
});
|
|
19
|
+
console.log('');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { View } from 'pinstripe';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
meta(){
|
|
7
|
+
this.assignProps({
|
|
8
|
+
description: 'Lists all available views in the current project.'
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
run(){
|
|
13
|
+
console.log('');
|
|
14
|
+
console.log(`The following views are available:`);
|
|
15
|
+
console.log('');
|
|
16
|
+
View.names.forEach(viewName => {
|
|
17
|
+
console.log(` * ${chalk.green(viewName)}`);
|
|
18
|
+
});
|
|
19
|
+
console.log('');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
export default {
|
|
3
|
+
meta(){
|
|
4
|
+
this.assignProps({
|
|
5
|
+
description: 'Runs a job by name from the lib/jobs directory.'
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
this.hasParam('name', { type: 'string', alias: 'arg1', description: 'The name of the job to run (in snake_case).' });
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
async run(){
|
|
12
|
+
const normalizedName = this.inflector.snakeify(this.params.name);
|
|
13
|
+
this.runJob(normalizedName);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
export default {
|
|
3
|
+
meta(){
|
|
4
|
+
this.assignProps({
|
|
5
|
+
description: 'Starts the web server and optionally the job worker.'
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
this.hasParam('host', {
|
|
9
|
+
type: 'string',
|
|
10
|
+
optional: true,
|
|
11
|
+
description: 'Host and port configuration (e.g. "127.0.0.1:3000"). Defaults to PINSTRIPE_HOST environment variable or "127.0.0.1:3000".'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
this.hasParam('withoutJobs', {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
optional: true,
|
|
17
|
+
description: 'Skip starting the job worker.'
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
async run(){
|
|
22
|
+
await this.runHook('beforeServerStart');
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
host = process.env.PINSTRIPE_HOST || '127.0.0.1:3000',
|
|
26
|
+
withoutJobs = false
|
|
27
|
+
} = this.params;
|
|
28
|
+
|
|
29
|
+
for(let pair of host.trim().split(/\s+/)){
|
|
30
|
+
const matches = pair.match(/^([^:]+):(\d+)$/);
|
|
31
|
+
const hostname = matches ? matches[1] : host;
|
|
32
|
+
const port = matches ? matches[2] : port;
|
|
33
|
+
|
|
34
|
+
this.server.start({
|
|
35
|
+
port: parseInt(port),
|
|
36
|
+
hostname
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if(!withoutJobs){
|
|
41
|
+
this.jobCoordinator.start();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
await this.runHook('afterServerStart');
|
|
45
|
+
|
|
46
|
+
// Keep the command running to prevent context destruction.
|
|
47
|
+
// This ensures the database connection stays alive for background services.
|
|
48
|
+
await new Promise((resolve) => {
|
|
49
|
+
const shutdown = async () => {
|
|
50
|
+
await this.runHook('beforeServerStop');
|
|
51
|
+
resolve();
|
|
52
|
+
};
|
|
53
|
+
process.on('SIGINT', shutdown);
|
|
54
|
+
process.on('SIGTERM', shutdown);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|