@dbos-inc/create 0.0.0-placeholder
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/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +29 -0
- package/dist/cli.js.map +1 -0
- package/dist/init.d.ts +7 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +59 -0
- package/dist/init.js.map +1 -0
- package/package.json +42 -0
- package/templates/hello/.eslintignore +4 -0
- package/templates/hello/.eslintrc +19 -0
- package/templates/hello/.vscode/extensions.json +7 -0
- package/templates/hello/.vscode/launch.json +22 -0
- package/templates/hello/.vscode/tasks.json +17 -0
- package/templates/hello/README.md +50 -0
- package/templates/hello/knexfile.js +20 -0
- package/templates/hello/migrations/20240212161006_create_dbos_hello_tables.js +18 -0
- package/templates/hello/package-lock.json +5505 -0
- package/templates/hello/package.json +24 -0
- package/templates/hello/start_postgres_docker.bat +36 -0
- package/templates/hello/start_postgres_docker.sh +23 -0
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { init } from './init.js';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from "path";
|
|
6
|
+
const program = new Command();
|
|
7
|
+
////////////////////////
|
|
8
|
+
/* LOCAL DEVELOPMENT */
|
|
9
|
+
////////////////////////
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
13
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json")).toString());
|
|
14
|
+
program.version(packageJson.version);
|
|
15
|
+
program
|
|
16
|
+
.description('Init a DBOS application')
|
|
17
|
+
.option('-n, --appName <application-name>', 'Application name', 'dbos-hello-app')
|
|
18
|
+
.option('-t, --template <template name>', 'Name of template application to copy', 'hello')
|
|
19
|
+
.action(async (options) => {
|
|
20
|
+
await init(options.appName, options.template);
|
|
21
|
+
});
|
|
22
|
+
// If no arguments provided, display help by default
|
|
23
|
+
if (!process.argv.slice(2).length) {
|
|
24
|
+
program.outputHelp();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
program.parse(process.argv);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AAExB,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAY,CAAC;AAClH,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAErC,OAAO;KACJ,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,kCAAkC,EAAE,kBAAkB,EAAE,gBAAgB,CAAC;KAChF,MAAM,CAAC,gCAAgC,EAAE,sCAAsC,EAAE,OAAO,CAAC;KACzF,MAAM,CAAC,KAAK,EAAE,OAA8C,EAAE,EAAE;IAC/D,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC;AAEL,oDAAoD;AACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC;KACI,CAAC;IACJ,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface CopyOption {
|
|
2
|
+
rename?: (basename: string) => string;
|
|
3
|
+
}
|
|
4
|
+
export declare const copy: (src: string, targets: string[], dest: string, { rename }?: CopyOption) => Promise<void[]>;
|
|
5
|
+
export declare function init(appName: string, templateName: string): Promise<void>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../init.ts"],"names":[],"mappings":"AAOA,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;CACtC;AAID,eAAO,MAAM,IAAI,QACV,MAAM,WACF,MAAM,EAAE,QACX,MAAM,eACW,UAAU,oBA4BlC,CAAA;AASD,wBAAsB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,iBA2B/D"}
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import glob from 'fast-glob';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
import validator from 'validator';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
const identity = (x) => x;
|
|
8
|
+
export const copy = async (src, targets, dest, { rename = identity } = {}) => {
|
|
9
|
+
if (targets.length === 0 || !dest) {
|
|
10
|
+
throw new TypeError('`src` and `dest` are required');
|
|
11
|
+
}
|
|
12
|
+
const sourceFiles = await glob(targets, {
|
|
13
|
+
cwd: src,
|
|
14
|
+
dot: true,
|
|
15
|
+
absolute: false,
|
|
16
|
+
stats: false,
|
|
17
|
+
ignore: ['**/node_modules/**', '**/dist/**']
|
|
18
|
+
});
|
|
19
|
+
return Promise.all(sourceFiles.map(async (p) => {
|
|
20
|
+
const dirname = path.dirname(p);
|
|
21
|
+
const basename = rename(path.basename(p));
|
|
22
|
+
const from = path.resolve(src, p);
|
|
23
|
+
const to = path.join(dest, dirname, basename);
|
|
24
|
+
// Ensure the destination directory exists
|
|
25
|
+
await fs.promises.mkdir(path.dirname(to), { recursive: true });
|
|
26
|
+
return fs.promises.copyFile(from, to);
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
function isValidApplicationName(appName) {
|
|
30
|
+
if (appName.length < 3 || appName.length > 30) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return validator.matches(appName, "^[a-z0-9-_]+$");
|
|
34
|
+
}
|
|
35
|
+
export async function init(appName, templateName) {
|
|
36
|
+
if (!isValidApplicationName(appName)) {
|
|
37
|
+
throw new Error(`Invalid application name: ${appName}. Application name must be between 3 and 30 characters long and can only contain lowercase letters, numbers, hyphens and underscores. Exiting...`);
|
|
38
|
+
}
|
|
39
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
40
|
+
const templatePath = path.resolve(__dirname, '..', 'templates', templateName);
|
|
41
|
+
if (!fs.existsSync(templatePath)) {
|
|
42
|
+
throw new Error(`Template does not exist: ${templateName}. Exiting...`);
|
|
43
|
+
}
|
|
44
|
+
if (fs.existsSync(appName)) {
|
|
45
|
+
throw new Error(`Directory ${appName} already exists, exiting...`);
|
|
46
|
+
}
|
|
47
|
+
const targets = ["**"];
|
|
48
|
+
await copy(templatePath, targets, appName);
|
|
49
|
+
const packageJsonName = path.resolve(appName, 'package.json');
|
|
50
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonName, 'utf-8'));
|
|
51
|
+
packageJson.name = appName;
|
|
52
|
+
fs.writeFileSync(packageJsonName, JSON.stringify(packageJson, null, 2), 'utf-8');
|
|
53
|
+
execSync("npm ci --no-fund", { cwd: appName, stdio: 'inherit' });
|
|
54
|
+
execSync("npm uninstall --no-fund @dbos-inc/dbos-sdk", { cwd: appName, stdio: 'inherit' });
|
|
55
|
+
execSync("npm install --no-fund --save @dbos-inc/dbos-sdk@latest", { cwd: appName, stdio: 'inherit' });
|
|
56
|
+
execSync("npm install --no-fund --save-dev @dbos-inc/dbos-cloud@latest", { cwd: appName, stdio: 'inherit' });
|
|
57
|
+
console.log("Application initialized successfully!");
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../init.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAMpC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAA;AAEjC,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EACvB,GAAW,EACX,OAAiB,EACjB,IAAY,EACZ,EAAE,MAAM,GAAG,QAAQ,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,CAAC;IACjF,QAAQ,CAAC,kBAAkB,EAAE,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;IAC9D,QAAQ,CAAC,4CAA4C,EAAE,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;IACxF,QAAQ,CAAC,wDAAwD,EAAE,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;IACpG,QAAQ,CAAC,8DAA8D,EAAE,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;IAC1G,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAA;AACtD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dbos-inc/create",
|
|
3
|
+
"version": "0.0.0-placeholder",
|
|
4
|
+
"description": "Tool for performing project initialization from template",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dbos-inc/dbos-ts",
|
|
10
|
+
"directory": "packages/create"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://docs.dbos.dev/",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc --project tsconfig.json",
|
|
15
|
+
"test": "echo \"No tests\"",
|
|
16
|
+
"setversion": "grunt setversion"
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"create": "./dist/cli.js"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^20.6.3",
|
|
23
|
+
"@types/prompt-sync": "^4.2.3",
|
|
24
|
+
"@types/update-notifier": "^6.0.8",
|
|
25
|
+
"@types/validator": "^13.11.9",
|
|
26
|
+
"grunt": "^1.6.1",
|
|
27
|
+
"nerdbank-gitversioning": "^3.6.133",
|
|
28
|
+
"typescript": "^5.3.3"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"axios": "^1.6.7",
|
|
32
|
+
"chalk": "4.1.2",
|
|
33
|
+
"commander": "^12.0.0",
|
|
34
|
+
"fast-glob": "^3.3.2",
|
|
35
|
+
"open": "^10.1.0",
|
|
36
|
+
"prompt-sync": "^4.2.0",
|
|
37
|
+
"update-notifier": "^7.0.0",
|
|
38
|
+
"validator": "^13.11.0",
|
|
39
|
+
"winston": "^3.12.0",
|
|
40
|
+
"winston-transport": "^4.7.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"extends": [
|
|
4
|
+
"plugin:@dbos-inc/dbosRecommendedConfig"
|
|
5
|
+
],
|
|
6
|
+
"plugins": [
|
|
7
|
+
"@dbos-inc"
|
|
8
|
+
],
|
|
9
|
+
"env": {
|
|
10
|
+
"node": true,
|
|
11
|
+
"es6": true
|
|
12
|
+
},
|
|
13
|
+
"rules": {
|
|
14
|
+
},
|
|
15
|
+
"parser": "@typescript-eslint/parser",
|
|
16
|
+
"parserOptions": {
|
|
17
|
+
"project": "./tsconfig.json"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"type": "node-terminal",
|
|
9
|
+
"request": "launch",
|
|
10
|
+
"name": "Local Debug",
|
|
11
|
+
"command": "npx dbos-sdk start",
|
|
12
|
+
"preLaunchTask": "npm: build",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "node-terminal",
|
|
16
|
+
"request": "launch",
|
|
17
|
+
"name": "Time Travel Debug",
|
|
18
|
+
"command": "npx dbos-sdk debug -x ${command:dbos-ttdbg.get-proxy-url} -u ${command:dbos-ttdbg.pick-workflow-id}",
|
|
19
|
+
"preLaunchTask": "npm: build"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# DBOS Hello
|
|
2
|
+
|
|
3
|
+
This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/dbos-sdk init`.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Before you can launch your app, you need a database.
|
|
8
|
+
DBOS works with any Postgres database, but to make things easier, we've provided a script that starts a Docker Postgres container and creates a database.
|
|
9
|
+
On Linux or Mac, run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
export PGPASSWORD=dbos
|
|
13
|
+
./start_postgres_docker.sh
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
On Windows (cmd), run:
|
|
17
|
+
|
|
18
|
+
```cmd
|
|
19
|
+
set PGPASSWORD=dbos
|
|
20
|
+
start_postgres_docker.bat
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If successful, the script should print `Database started successfully!`.
|
|
24
|
+
|
|
25
|
+
Then, let's run a schema migration to create some tables:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx dbos-sdk migrate
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If successful, the migration should print `Migration successful!`.
|
|
32
|
+
|
|
33
|
+
Next, build and run the app:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run build
|
|
37
|
+
npx dbos-sdk start
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To see that it's working, visit this URL in your browser: [`http://localhost:3000/greeting/dbos`](http://localhost:3000/greeting/dbos).
|
|
41
|
+
You should get this message: `Hello, dbos! You have been greeted 1 times.`
|
|
42
|
+
Each time you refresh the page, the counter should go up by one!
|
|
43
|
+
|
|
44
|
+
Congratulations! You just launched a DBOS application.
|
|
45
|
+
|
|
46
|
+
## Next Steps
|
|
47
|
+
|
|
48
|
+
- To add more functionality to this application, modify `src/operations.ts`, then re-build and re-start it. For a detailed tutorial, check out our [programming quickstart](https://docs.dbos.dev/getting-started/quickstart-programming).
|
|
49
|
+
- To learn how to deploy your application to DBOS Cloud, visit our [cloud quickstart](https://docs.dbos.dev/getting-started/quickstart-cloud/)
|
|
50
|
+
- To learn more about DBOS, take a look at [our documentation](https://docs.dbos.dev/) or our [source code](https://github.com/dbos-inc/dbos-sdk).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const { parseConfigFile } = require('@dbos-inc/dbos-sdk/dist/src/dbos-runtime/config');
|
|
2
|
+
const { DBOSConfig } = require('@dbos-inc/dbos-sdk/dist/src/dbos-executor');
|
|
3
|
+
|
|
4
|
+
const [dbosConfig, ] = parseConfigFile();
|
|
5
|
+
|
|
6
|
+
const config = {
|
|
7
|
+
client: 'pg',
|
|
8
|
+
connection: {
|
|
9
|
+
host: dbosConfig.poolConfig.host,
|
|
10
|
+
user: dbosConfig.poolConfig.user,
|
|
11
|
+
password: dbosConfig.poolConfig.password,
|
|
12
|
+
database: dbosConfig.poolConfig.database,
|
|
13
|
+
ssl: dbosConfig.poolConfig.ssl,
|
|
14
|
+
},
|
|
15
|
+
migrations: {
|
|
16
|
+
directory: './migrations'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = config;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { Knex } = require("knex");
|
|
2
|
+
|
|
3
|
+
exports.up = async function(knex) {
|
|
4
|
+
await knex.schema.createTable('dbos_hello', table => {
|
|
5
|
+
table.text('name').primary();
|
|
6
|
+
table.integer('greet_count').defaultTo(0);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
return knex.schema.createTable('dbos_greetings', table => {
|
|
10
|
+
table.text('greeting_name');
|
|
11
|
+
table.text('greeting_note_content');
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.down = async function(knex) {
|
|
16
|
+
await knex.schema.dropTable('dbos_greetings');
|
|
17
|
+
return knex.schema.dropTable('dbos_hello');
|
|
18
|
+
};
|