@codenotch/codenotch.cli 1.0.48 → 1.0.49

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.
@@ -13,7 +13,7 @@ export interface IBuildOptions {
13
13
  pwa?: boolean;
14
14
  }
15
15
  export default abstract class BuildUtils {
16
- static readonly CN_REACT_VERSION = "2.0.1";
16
+ static readonly CN_REACT_VERSION = "2.0.3";
17
17
  /** Root of the Codenotch project a folder belongs to, walking up to the closest manifest.json */
18
18
  static findWorkspace(fromDir?: string): string | undefined;
19
19
  static findWorkspaceFromFile(childPath: string): string | undefined;
@@ -14,7 +14,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
14
14
  const ShellUtils_1 = __importDefault(require("./ShellUtils"));
15
15
  const ConsoleUtils_1 = __importDefault(require("./ConsoleUtils"));
16
16
  class BuildUtils {
17
- static CN_REACT_VERSION = '2.0.1';
17
+ static CN_REACT_VERSION = '2.0.3';
18
18
  /** Root of the Codenotch project a folder belongs to, walking up to the closest manifest.json */
19
19
  static findWorkspace(fromDir = process.cwd()) {
20
20
  // findWorkspaceFromFile strips the last segment, hand it a dummy file
@@ -198,7 +198,7 @@ class ProjectTemplates {
198
198
  * and the processes cannot drift apart silently.
199
199
  */
200
200
  static createTodolistApi() {
201
- return this.lines(`import { getCodenotch } from '@codenotch/codenotch.react';`, `import type { ITodoList } from '../tables/todolist';`, `import type { ITodo } from '../tables/todo';`, ``, `// TODO: startProcess() is not implemented yet in @codenotch/codenotch.react 2.0.1 (it throws 'Not implemented.').`, `// The calls below are typed against the processes of ./processes and will work as is once it lands;`, `// until then the pages show the error it raises.`, `async function call<TInput, TOutput>(processId: string, input: TInput): Promise<TOutput> {`, `\tconst result = await getCodenotch().startProcess<string, TInput, TOutput>(processId, input);`, `\tif (result.isError) {`, `\t\tthrow new Error(result.errorMessage);`, `\t}`, `\treturn result.output;`, `}`, ``, `export const listTodoLists = () => call<{}, ITodoList[]>('ListTodoLists', {});`, `export const createTodoList = (name: string) => call<{ name: string }, { id: string }>('CreateTodoList', { name });`, `export const deleteTodoList = (listId: string) => call<{ listId: string }, { deleted: boolean }>('DeleteTodoList', { listId });`, ``, `export const listTodos = (listId: string) => call<{ listId: string }, ITodo[]>('ListTodos', { listId });`, `export const createTodo = (listId: string, title: string) => call<{ listId: string; title: string }, { id: string }>('CreateTodo', { listId, title });`, `export const toggleTodo = (todoId: string) => call<{ todoId: string }, { done: boolean }>('ToggleTodo', { todoId });`, `export const deleteTodo = (todoId: string) => call<{ todoId: string }, { deleted: boolean }>('DeleteTodo', { todoId });`, ``);
201
+ return this.lines(`import { getCodenotch } from '@codenotch/codenotch.react';`, `import type { ITodoList } from '../tables/todolist';`, `import type { ITodo } from '../tables/todo';`, ``, `// TODO: startProcess() is not implemented yet in @codenotch/codenotch.react 2.0.3 (it throws 'Not implemented.').`, `// The calls below are typed against the processes of ./processes and will work as is once it lands;`, `// until then the pages show the error it raises.`, `async function call<TInput, TOutput>(processId: string, input: TInput): Promise<TOutput> {`, `\tconst result = await getCodenotch().startProcess<string, TInput, TOutput>(processId, input);`, `\tif (result.isError) {`, `\t\tthrow new Error(result.errorMessage);`, `\t}`, `\treturn result.output;`, `}`, ``, `export const listTodoLists = () => call<{}, ITodoList[]>('ListTodoLists', {});`, `export const createTodoList = (name: string) => call<{ name: string }, { id: string }>('CreateTodoList', { name });`, `export const deleteTodoList = (listId: string) => call<{ listId: string }, { deleted: boolean }>('DeleteTodoList', { listId });`, ``, `export const listTodos = (listId: string) => call<{ listId: string }, ITodo[]>('ListTodos', { listId });`, `export const createTodo = (listId: string, title: string) => call<{ listId: string; title: string }, { id: string }>('CreateTodo', { listId, title });`, `export const toggleTodo = (todoId: string) => call<{ todoId: string }, { done: boolean }>('ToggleTodo', { todoId });`, `export const deleteTodo = (todoId: string) => call<{ todoId: string }, { deleted: boolean }>('DeleteTodo', { todoId });`, ``);
202
202
  }
203
203
  static createTodolistApp() {
204
204
  return this.lines(`import React from 'react';`, `import { HashRouter, Route, Routes } from 'react-router';`, `import './${DEFAULT_APP_NAME}.scss';`, `import Layout from './components/Layout';`, `import TodoListsPage from './pages/TodoListsPage';`, `import TodoListPage from './pages/TodoListPage';`, ``, `// HashRouter keeps the routing client side, whatever URL the runtime serves the app from`, `const ${DEFAULT_APP_NAME}: React.FC<{}> = () => {`, `\treturn <HashRouter>`, `\t\t<Routes>`, `\t\t\t<Route element={<Layout />}>`, `\t\t\t\t<Route index element={<TodoListsPage />} />`, `\t\t\t\t<Route path="lists/:listId" element={<TodoListPage />} />`, `\t\t\t</Route>`, `\t\t</Routes>`, `\t</HashRouter>;`, `};`, ``, `export default ${DEFAULT_APP_NAME};`, ``);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codenotch/codenotch.cli",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "description": "The Codenotch CLI ('cn'): scaffold, run, validate, package and deploy full-stack TypeScript Codenotch projects - processes, tables, documents and React apps - on a local Codenotch runtime",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -60,7 +60,7 @@ What the generated code relies on:
60
60
  | `cn.env` | the environment the runtime gave the app |
61
61
  | `cn.getTheme()` / `cn.setTheme('light' \| 'dark')` | theme; `setTheme` toggles the `dark` class on `<html>` |
62
62
  | `cn.getLanguage()` / `cn.setLanguage(lang)` / `cn.getLanguages()` | languages, from `manifest.json` |
63
- | `cn.startProcess(processId, input)` | call a server-side process — **not implemented yet** in `@codenotch/codenotch.react` 2.0.1 (it throws `Not implemented.`) |
63
+ | `cn.startProcess(processId, input)` | call a server-side process — **not implemented yet** in `@codenotch/codenotch.react` 2.0.3 (it throws `Not implemented.`) |
64
64
 
65
65
  For the full surface, read the typings in
66
66
  `node_modules/@codenotch/codenotch.react/dist/`. Because `startProcess` is not settled, generated