diff --git a/clean.js b/clean.js index 1a94d74d..2e50f6e8 100644 --- a/clean.js +++ b/clean.js @@ -81,7 +81,7 @@ async function removeExecutionArtifacts() { * Main function for this script */ async function main() { - await yargs + await yargs(process.argv.slice(2)) .scriptName("clean") .usage("$0 [options]") .option("dry", { diff --git a/eslint.config.mjs b/eslint.config.mjs index 587ffe36..d7b7e8e2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -494,6 +494,7 @@ export default defineConfig([{ "rules": { "node/no-missing-require": "off", "node/no-missing-import": "off", + "@stylistic/indent": "off", "spaced-comment": "off", "comma-spacing": "off", "max-len": "off", diff --git a/packages/create/template.js b/packages/create/template.js index f6f4e87a..d63e46b4 100644 --- a/packages/create/template.js +++ b/packages/create/template.js @@ -104,6 +104,7 @@ async function copyPluginTemplates(pluginName, templates) { prepare.push("tsc --build"); files.set("tsconfig.json", path.join(templatePath, "tsconfig.json")); files.set("tsconfig.node.json", path.join(templatePath, "tsconfig.node.json")); + files.set("tsconfig.base.json", path.join(templatePath, "tsconfig.base.json")); if (webpack) { files.set("tsconfig.browser.json", path.join(templatePath, "tsconfig.browser.json")); } @@ -175,7 +176,7 @@ async function copyPluginTemplates(pluginName, templates) { module: templates.includes("module"), ctl: templates.includes("ctl"), web: templates.includes("web"), - // Macro flags for context requirements + // Macro flags for context requirements webpack: webpack, config: config, // String values for package json diff --git a/packages/create/templates/plugin-js/controller.js b/packages/create/templates/plugin-js/controller.js index b1611c6a..fae78fdc 100644 --- a/packages/create/templates/plugin-js/controller.js +++ b/packages/create/templates/plugin-js/controller.js @@ -26,7 +26,8 @@ class ControllerPlugin extends BaseControllerPlugin { //%endif //%if controller & web // Subscribing requires web content and the controller this.controller.subscriptions.handle(ExampleSubscribableUpdate, this.handleExampleSubscription.bind(this)); - this.exampleDatabase = new Map(); // If needed, replace with loading from database file + // If needed, replace with loading from database file such as lib.Datastore + this.exampleDatabase = new Map([["foo", new ExampleSubscribableValue("foo", 0, false)]]); //%endif //%if multi_context // Subscribing requires multi context } @@ -70,6 +71,7 @@ class ControllerPlugin extends BaseControllerPlugin { //%if controller & web // Subscribing requires web content and the controller async handleExampleSubscription(request) { + this.logger.info(JSON.stringify(request)); const values = [...this.exampleDatabase.values()].filter( value => value.updatedAtMs > request.lastRequestTimeMs, ); diff --git a/packages/create/templates/plugin-js/index.js b/packages/create/templates/plugin-js/index.js index edfa6a0e..d773d4c4 100644 --- a/packages/create/templates/plugin-js/index.js +++ b/packages/create/templates/plugin-js/index.js @@ -7,12 +7,14 @@ lib.definePermission({ name: "__plugin_name__.example.permission.event", title: "Example permission event", description: "Example Description. Event. Change me in index.js", + grantByDefault: true, }); lib.definePermission({ name: "__plugin_name__.example.permission.request", title: "Example permission request", description: "Example Description. Request. Change me in index.js", + grantByDefault: true, }); //%endif //%if controller & web // Subscribing requires web content and the controller @@ -21,6 +23,7 @@ lib.definePermission({ name: "__plugin_name__.example.permission.subscribe", title: "Example permission subscribe", description: "Example Description. Subscribe. Change me in index.js", + grantByDefault: true, }); //%endif //%if web @@ -29,6 +32,7 @@ lib.definePermission({ name: "__plugin_name__.page.view", title: "Example page view permission", description: "Example Description. View. Change me in index.js", + grantByDefault: true, }); //%endif diff --git a/packages/create/templates/plugin-js/web/plugin.jsx b/packages/create/templates/plugin-js/web/plugin.jsx index 92b78ae3..7a67c8f6 100644 --- a/packages/create/templates/plugin-js/web/plugin.jsx +++ b/packages/create/templates/plugin-js/web/plugin.jsx @@ -35,9 +35,9 @@ function MyTemplatePage() { return - //%if controller // Subscribing requires web content and the controller +//%if controller // Subscribing requires web content and the controller Synced: {String(synced)} Data: {JSON.stringify([...subscribableData.values()])} - //%endif +//%endif ; } @@ -57,7 +57,7 @@ export class WebPlugin extends BaseWebPlugin { permission: "__plugin_name__.example.permission.subscribe", //%endif //%if !controller - permission: undefined, // "__plugin_name__.example.permission.request", + permission: "__plugin_name__.example.permission.view", //%endif content: , }, diff --git a/packages/create/templates/plugin-ts/controller.ts b/packages/create/templates/plugin-ts/controller.ts index 49fed9b4..450b54dd 100644 --- a/packages/create/templates/plugin-ts/controller.ts +++ b/packages/create/templates/plugin-ts/controller.ts @@ -25,7 +25,8 @@ export class ControllerPlugin extends BaseControllerPlugin { //%endif //%if controller & web // Subscribing requires web content and the controller this.controller.subscriptions.handle(ExampleSubscribableUpdate, this.handleExampleSubscription.bind(this)); - this.exampleDatabase = new Map(); // If needed, replace with loading from database file such as lib.Datastore + // If needed, replace with loading from database file such as lib.Datastore + this.exampleDatabase = new Map([["foo", new ExampleSubscribableValue("foo", 0, false)]]); //%endif //%if multi_context // Subscribing requires multi context } @@ -69,6 +70,7 @@ export class ControllerPlugin extends BaseControllerPlugin { //%if controller & web // Subscribing requires web content and the controller async handleExampleSubscription(request: lib.SubscriptionRequest) { + this.logger.info(JSON.stringify(request)); const values = [...this.exampleDatabase.values()].filter( value => value.updatedAtMs > request.lastRequestTimeMs, ); diff --git a/packages/create/templates/plugin-ts/index.ts b/packages/create/templates/plugin-ts/index.ts index 8ef46604..539a66bc 100644 --- a/packages/create/templates/plugin-ts/index.ts +++ b/packages/create/templates/plugin-ts/index.ts @@ -6,12 +6,14 @@ lib.definePermission({ name: "__plugin_name__.example.permission.event", title: "Example permission event", description: "Example Description. Event. Change me in index.ts", + grantByDefault: true, }); lib.definePermission({ name: "__plugin_name__.example.permission.request", title: "Example permission request", description: "Example Description. Request. Change me in index.ts", + grantByDefault: true, }); //%endif //%if controller & web // Subscribing requires web content and the controller @@ -20,6 +22,7 @@ lib.definePermission({ name: "__plugin_name__.example.permission.subscribe", title: "Example permission subscribe", description: "Example Description. Subscribe. Change me in index.ts", + grantByDefault: true, }); //%endif //%if web @@ -28,6 +31,7 @@ lib.definePermission({ name: "__plugin_name__.page.view", title: "Example page view permission", description: "Example Description. View. Change me in index.ts", + grantByDefault: true, }); //%endif //%if config diff --git a/packages/create/templates/plugin-ts/web/plugin.tsx b/packages/create/templates/plugin-ts/web/plugin.tsx index 9d516f05..d4d9d150 100644 --- a/packages/create/templates/plugin-ts/web/plugin.tsx +++ b/packages/create/templates/plugin-ts/web/plugin.tsx @@ -35,9 +35,9 @@ function MyTemplatePage() { return - //%if controller // Subscribing requires web content and the controller +//%if controller // Subscribing requires web content and the controller Synced: {String(synced)} Data: {JSON.stringify([...subscribableData.values()])} - //%endif +//%endif ; } @@ -57,7 +57,7 @@ export class WebPlugin extends BaseWebPlugin { permission: "__plugin_name__.example.permission.subscribe", //%endif //%if !controller - permission: undefined, // "__plugin_name__.example.permission.request", + permission: "__plugin_name__.example.permission.view", //%endif content: , }, diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index fd9fdcd3..64d14f73 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -4,3 +4,5 @@ packages: - "external_plugins/*" - "external_plugins/*/*" - "test/" + +linkWorkspacePackages: true