create-steedos-app 3.0.2-beta.9 → 3.0.2
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/create-app.d.ts +2 -5
- package/dist/create-app.js +55 -142
- package/dist/create-app.js.map +1 -1
- package/dist/index.js +30 -85
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/templates/default/.env +6 -4
- package/templates/default/README.md +60 -55
- package/templates/default/gitignore +21 -0
- package/templates/default/package.json +4 -21
- package/templates/default/steedos-packages/example-app/README.md +3 -0
- package/templates/default/steedos-packages/example-app/package.json +7 -0
- package/templates/default/steedos-packages/example-app/package.service.js +21 -0
- package/templates/default/steedos.config.js +1 -15
- package/templates/default/.vscode/tasks.json +0 -20
- package/templates/default/steedos-packages/example-service/README.md +0 -19
- package/templates/default/steedos-packages/example-service/package.json +0 -8
- package/templates/default/steedos-packages/example-service/package.service.js +0 -88
- package/templates/default/steedos-platform/.env +0 -10
- package/templates/default/steedos-platform/README.md +0 -32
- package/templates/default/steedos-platform/docker-compose.yml +0 -25
- package/templates/default/steedos-platform/package.json +0 -13
- package/templates/default/steedos-platform/steedos.config.js +0 -22
package/dist/create-app.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { PackageManager } from
|
|
1
|
+
import type { PackageManager } from "./helpers/get-pkg-manager";
|
|
2
2
|
export declare class DownloadError extends Error {
|
|
3
3
|
}
|
|
4
|
-
export declare function createApp({ appPath, packageManager,
|
|
4
|
+
export declare function createApp({ appPath, packageManager, }: {
|
|
5
5
|
appPath: string;
|
|
6
6
|
packageManager: PackageManager;
|
|
7
|
-
example?: string;
|
|
8
|
-
examplePath?: string;
|
|
9
|
-
typescript?: boolean;
|
|
10
7
|
}): Promise<void>;
|
package/dist/create-app.js
CHANGED
|
@@ -5,13 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DownloadError = void 0;
|
|
7
7
|
exports.createApp = createApp;
|
|
8
|
-
const async_retry_1 = __importDefault(require("async-retry"));
|
|
9
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
9
|
const cpy_1 = __importDefault(require("cpy"));
|
|
11
10
|
const fs_1 = __importDefault(require("fs"));
|
|
12
11
|
const os_1 = __importDefault(require("os"));
|
|
13
12
|
const path_1 = __importDefault(require("path"));
|
|
14
|
-
const
|
|
13
|
+
const child_process_1 = require("child_process");
|
|
15
14
|
const make_dir_1 = require("./helpers/make-dir");
|
|
16
15
|
const git_1 = require("./helpers/git");
|
|
17
16
|
const install_1 = require("./helpers/install");
|
|
@@ -21,48 +20,12 @@ const is_writeable_1 = require("./helpers/is-writeable");
|
|
|
21
20
|
class DownloadError extends Error {
|
|
22
21
|
}
|
|
23
22
|
exports.DownloadError = DownloadError;
|
|
24
|
-
async function createApp({ appPath, packageManager,
|
|
25
|
-
|
|
26
|
-
const template = 'default';
|
|
27
|
-
if (example) {
|
|
28
|
-
let repoUrl;
|
|
29
|
-
try {
|
|
30
|
-
repoUrl = new URL(example);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
if (error.code !== 'ERR_INVALID_URL') {
|
|
34
|
-
console.error(error);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (repoUrl) {
|
|
39
|
-
if (repoUrl.origin !== 'https://github.com') {
|
|
40
|
-
console.error(`Invalid URL: ${chalk_1.default.red(`"${example}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
repoInfo = await (0, examples_1.getRepoInfo)(repoUrl, examplePath);
|
|
44
|
-
if (!repoInfo) {
|
|
45
|
-
console.error(`Found invalid GitHub URL: ${chalk_1.default.red(`"${example}"`)}. Please fix the URL and try again.`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
const found = await (0, examples_1.hasRepo)(repoInfo);
|
|
49
|
-
if (!found) {
|
|
50
|
-
console.error(`Could not locate the repository for ${chalk_1.default.red(`"${example}"`)}. Please check that the repository exists and try again.`);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else if (example !== '__internal-testing-retry') {
|
|
55
|
-
const found = await (0, examples_1.existsInRepo)(example);
|
|
56
|
-
if (!found) {
|
|
57
|
-
console.error(`Could not locate an example named ${chalk_1.default.red(`"${example}"`)}. It could be due to the following:\n`, `1. Your spelling of example ${chalk_1.default.red(`"${example}"`)} might be incorrect.\n`, `2. You might not be connected to the internet or you are behind a proxy.`);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
23
|
+
async function createApp({ appPath, packageManager, }) {
|
|
24
|
+
const template = "default";
|
|
62
25
|
const root = path_1.default.resolve(appPath);
|
|
63
26
|
if (!(await (0, is_writeable_1.isWriteable)(path_1.default.dirname(root)))) {
|
|
64
|
-
console.error(
|
|
65
|
-
console.error(
|
|
27
|
+
console.error("The application path is not writable, please check folder permissions and try again.");
|
|
28
|
+
console.error("It is likely you do not have write permissions for this folder.");
|
|
66
29
|
process.exit(1);
|
|
67
30
|
}
|
|
68
31
|
const appName = path_1.default.basename(root);
|
|
@@ -70,116 +33,66 @@ async function createApp({ appPath, packageManager, example, examplePath, typesc
|
|
|
70
33
|
if (!(0, is_folder_empty_1.isFolderEmpty)(root, appName)) {
|
|
71
34
|
process.exit(1);
|
|
72
35
|
}
|
|
73
|
-
const useYarn = packageManager ===
|
|
36
|
+
const useYarn = packageManager === "yarn";
|
|
74
37
|
const isOnline = !useYarn || (await (0, is_online_1.getOnline)());
|
|
75
38
|
const originalDirectory = process.cwd();
|
|
76
39
|
console.log(`Creating a new steedos app in ${chalk_1.default.green(root)}.`);
|
|
77
40
|
console.log();
|
|
78
41
|
process.chdir(root);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
console.log(`Downloading files for example ${chalk_1.default.cyan(example)}. This might take a moment.`);
|
|
93
|
-
console.log();
|
|
94
|
-
await (0, async_retry_1.default)(() => (0, examples_1.downloadAndExtractExample)(root, example), {
|
|
95
|
-
retries: 3,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (reason) {
|
|
100
|
-
function isErrorLike(err) {
|
|
101
|
-
return (typeof err === 'object' &&
|
|
102
|
-
err !== null &&
|
|
103
|
-
typeof err.message === 'string');
|
|
104
|
-
}
|
|
105
|
-
throw new DownloadError(isErrorLike(reason) ? reason.message : reason + '');
|
|
106
|
-
}
|
|
107
|
-
const ignorePath = path_1.default.join(root, '.gitignore');
|
|
108
|
-
if (!fs_1.default.existsSync(ignorePath)) {
|
|
109
|
-
fs_1.default.copyFileSync(path_1.default.join(__dirname, '..', 'templates', template, 'gitignore'), ignorePath);
|
|
110
|
-
}
|
|
111
|
-
const tsconfigPath = path_1.default.join(root, 'tsconfig.json');
|
|
112
|
-
if (fs_1.default.existsSync(tsconfigPath)) {
|
|
113
|
-
fs_1.default.copyFileSync(path_1.default.join(__dirname, '..', 'templates', 'typescript', 'next-env.d.ts'), path_1.default.join(root, 'next-env.d.ts'));
|
|
114
|
-
}
|
|
115
|
-
hasPackageJson = fs_1.default.existsSync(packageJsonPath);
|
|
116
|
-
if (hasPackageJson) {
|
|
117
|
-
console.log('Installing packages. This might take a couple of minutes.');
|
|
118
|
-
console.log();
|
|
119
|
-
await (0, install_1.install)(root, null, { packageManager, isOnline });
|
|
120
|
-
console.log();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
console.log(chalk_1.default.bold(`Using ${packageManager}.`));
|
|
125
|
-
const packageJson = {
|
|
126
|
-
name: appName,
|
|
127
|
-
version: '0.1.0',
|
|
128
|
-
private: true,
|
|
129
|
-
scripts: {
|
|
130
|
-
start: "moleculer-runner services/*/package.service.js --hot --repl",
|
|
131
|
-
repl: "moleculer-runner --repl",
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
fs_1.default.writeFileSync(path_1.default.join(root, 'package.json'), JSON.stringify(packageJson, null, 2) + os_1.default.EOL);
|
|
135
|
-
const installFlags = { packageManager, isOnline };
|
|
136
|
-
const dependencies = [
|
|
137
|
-
'@steedos/service-package-loader'
|
|
138
|
-
];
|
|
139
|
-
const devDependencies = [
|
|
140
|
-
'moleculer-repl'
|
|
141
|
-
];
|
|
142
|
-
if (typescript) {
|
|
143
|
-
devDependencies.push('typescript');
|
|
144
|
-
}
|
|
145
|
-
if (dependencies.length) {
|
|
146
|
-
console.log();
|
|
147
|
-
console.log('Installing dependencies:');
|
|
148
|
-
for (const dependency of dependencies) {
|
|
149
|
-
console.log(`- ${chalk_1.default.cyan(dependency)}`);
|
|
42
|
+
console.log(chalk_1.default.bold(`Using ${packageManager}.`));
|
|
43
|
+
await (0, cpy_1.default)(["**"], root, {
|
|
44
|
+
dot: true,
|
|
45
|
+
parents: true,
|
|
46
|
+
cwd: path_1.default.join(__dirname, "..", "templates", template),
|
|
47
|
+
rename: (name) => {
|
|
48
|
+
switch (name) {
|
|
49
|
+
case "gitignore": {
|
|
50
|
+
return ".".concat(name);
|
|
51
|
+
}
|
|
52
|
+
default: {
|
|
53
|
+
return name;
|
|
54
|
+
}
|
|
150
55
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
console.log(`- ${chalk_1.default.cyan(devDependency)}`);
|
|
159
|
-
}
|
|
160
|
-
console.log();
|
|
161
|
-
const devInstallFlags = Object.assign({ devDependencies: true }, installFlags);
|
|
162
|
-
await (0, install_1.install)(root, devDependencies, devInstallFlags);
|
|
163
|
-
}
|
|
164
|
-
console.log();
|
|
165
|
-
await (0, cpy_1.default)(['**'], root, {
|
|
166
|
-
dot: true,
|
|
167
|
-
parents: true,
|
|
168
|
-
cwd: path_1.default.join(__dirname, '..', 'templates', template),
|
|
169
|
-
});
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const packageJsonPath = path_1.default.join(root, "package.json");
|
|
59
|
+
if (fs_1.default.existsSync(packageJsonPath)) {
|
|
60
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, "utf8"));
|
|
61
|
+
packageJson.name = appName;
|
|
62
|
+
fs_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + os_1.default.EOL);
|
|
170
63
|
}
|
|
171
64
|
if ((0, git_1.tryGitInit)(root)) {
|
|
172
|
-
console.log(
|
|
65
|
+
console.log("Initialized a git repository.");
|
|
173
66
|
console.log();
|
|
174
67
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
cdpath = appPath;
|
|
181
|
-
}
|
|
182
|
-
console.log(`${chalk_1.default.green('Success!')} Created ${appName} at ${appPath}`);
|
|
68
|
+
console.log("Installing packages. This might take a couple of minutes.");
|
|
69
|
+
console.log();
|
|
70
|
+
await (0, install_1.install)(root, null, { packageManager, isOnline });
|
|
183
71
|
console.log();
|
|
72
|
+
console.log(`${chalk_1.default.green("Success!")} Created ${appName} at ${appPath}`);
|
|
73
|
+
console.log();
|
|
74
|
+
console.log(`Running ${chalk_1.default.cyan(`${packageManager} start`)}...`);
|
|
75
|
+
const child = (0, child_process_1.spawn)(packageManager, ["start"], {
|
|
76
|
+
stdio: "inherit",
|
|
77
|
+
cwd: root,
|
|
78
|
+
shell: true,
|
|
79
|
+
});
|
|
80
|
+
const cleanup = () => {
|
|
81
|
+
if (child) {
|
|
82
|
+
child.kill("SIGINT");
|
|
83
|
+
}
|
|
84
|
+
process.exit();
|
|
85
|
+
};
|
|
86
|
+
process.on("SIGINT", cleanup);
|
|
87
|
+
process.on("SIGTERM", cleanup);
|
|
88
|
+
child.on("close", (code) => {
|
|
89
|
+
process.removeListener("SIGINT", cleanup);
|
|
90
|
+
process.removeListener("SIGTERM", cleanup);
|
|
91
|
+
if (code !== 0) {
|
|
92
|
+
console.log();
|
|
93
|
+
console.log(chalk_1.default.red("The application exited with an error."));
|
|
94
|
+
}
|
|
95
|
+
process.exit(code || 0);
|
|
96
|
+
});
|
|
184
97
|
}
|
|
185
98
|
//# sourceMappingURL=create-app.js.map
|
package/dist/create-app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app.js","sourceRoot":"","sources":["../src/create-app.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"create-app.js","sourceRoot":"","sources":["../src/create-app.ts"],"names":[],"mappings":";;;;;;AA0BA,8BAyHC;AAjJD,kDAA0B;AAC1B,8CAAsB;AACtB,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,iDAAsC;AAStC,iDAA6C;AAC7C,uCAA2C;AAC3C,+CAA4C;AAC5C,+DAA0D;AAC1D,mDAAgD;AAChD,yDAAqD;AAGrD,MAAa,aAAc,SAAQ,KAAK;CAAG;AAA3C,sCAA2C;AAEpC,KAAK,UAAU,SAAS,CAAC,EAC9B,OAAO,EACP,cAAc,GAIf;IACC,MAAM,QAAQ,GAAG,SAAS,CAAC;IAC3B,MAAM,IAAI,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAGnC,IAAI,CAAC,CAAC,MAAM,IAAA,0BAAW,EAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,CAAC,KAAK,CACX,sFAAsF,CACvF,CAAC;QACF,OAAO,CAAC,KAAK,CACX,iEAAiE,CAClE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,M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AE;QACnB,IAAI,KAAK,EAAE,CAAC;YAGV,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC;IAGF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAG/B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAEzB,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE3C,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,69 +12,44 @@ const update_check_1 = __importDefault(require("update-check"));
|
|
|
12
12
|
const create_app_1 = require("./create-app");
|
|
13
13
|
const get_pkg_manager_1 = require("./helpers/get-pkg-manager");
|
|
14
14
|
const validate_pkg_1 = require("./helpers/validate-pkg");
|
|
15
|
-
const packageJson = require(
|
|
16
|
-
let projectPath =
|
|
15
|
+
const packageJson = require("../package.json");
|
|
16
|
+
let projectPath = "";
|
|
17
17
|
const program = new commander_1.default.Command(packageJson.name)
|
|
18
18
|
.version(packageJson.version)
|
|
19
|
-
.arguments(
|
|
20
|
-
.usage(`${chalk_1.default.green(
|
|
19
|
+
.arguments("<project-directory>")
|
|
20
|
+
.usage(`${chalk_1.default.green("<project-directory>")} [options]`)
|
|
21
21
|
.action((name) => {
|
|
22
22
|
projectPath = name;
|
|
23
23
|
})
|
|
24
|
-
.option('--ts, --typescript', `
|
|
25
|
-
|
|
26
|
-
Initialize as a TypeScript project.
|
|
27
|
-
`)
|
|
28
|
-
.option('--use-npm', `
|
|
29
|
-
|
|
30
|
-
Explicitly tell the CLI to bootstrap the app using npm
|
|
31
|
-
`)
|
|
32
|
-
.option('--use-pnpm', `
|
|
33
|
-
|
|
34
|
-
Explicitly tell the CLI to bootstrap the app using pnpm
|
|
35
|
-
`)
|
|
36
|
-
.option('-e, --example [name]|[github-url]', `
|
|
37
|
-
|
|
38
|
-
An example to bootstrap the app with. You can use an example name
|
|
39
|
-
from the official Next.js repo or a GitHub URL. The URL can use
|
|
40
|
-
any branch and/or subdirectory
|
|
41
|
-
`)
|
|
42
|
-
.option('--example-path <path-to-example>', `
|
|
43
|
-
|
|
44
|
-
In a rare case, your GitHub URL might contain a branch name with
|
|
45
|
-
a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).
|
|
46
|
-
In this case, you must specify the path to the example separately:
|
|
47
|
-
--example-path foo/bar
|
|
48
|
-
`)
|
|
49
24
|
.allowUnknownOption()
|
|
50
25
|
.parse(process.argv);
|
|
51
26
|
async function run() {
|
|
52
|
-
if (typeof projectPath ===
|
|
27
|
+
if (typeof projectPath === "string") {
|
|
53
28
|
projectPath = projectPath.trim();
|
|
54
29
|
}
|
|
55
30
|
if (!projectPath) {
|
|
56
31
|
const res = await (0, prompts_1.default)({
|
|
57
|
-
type:
|
|
58
|
-
name:
|
|
59
|
-
message:
|
|
60
|
-
initial:
|
|
32
|
+
type: "text",
|
|
33
|
+
name: "path",
|
|
34
|
+
message: "What is your project named?",
|
|
35
|
+
initial: "my-app",
|
|
61
36
|
validate: (name) => {
|
|
62
37
|
const validation = (0, validate_pkg_1.validateNpmName)(path_1.default.basename(path_1.default.resolve(name)));
|
|
63
38
|
if (validation.valid) {
|
|
64
39
|
return true;
|
|
65
40
|
}
|
|
66
|
-
return
|
|
41
|
+
return "Invalid project name: " + validation.problems[0];
|
|
67
42
|
},
|
|
68
43
|
});
|
|
69
|
-
if (typeof res.path ===
|
|
44
|
+
if (typeof res.path === "string") {
|
|
70
45
|
projectPath = res.path.trim();
|
|
71
46
|
}
|
|
72
47
|
}
|
|
73
48
|
if (!projectPath) {
|
|
74
|
-
console.log(
|
|
75
|
-
` ${chalk_1.default.cyan(program.name())} ${chalk_1.default.green(
|
|
76
|
-
|
|
77
|
-
` ${chalk_1.default.cyan(program.name())} ${chalk_1.default.green(
|
|
49
|
+
console.log("\nPlease specify the project directory:\n" +
|
|
50
|
+
` ${chalk_1.default.cyan(program.name())} ${chalk_1.default.green("<project-directory>")}\n` +
|
|
51
|
+
"For example:\n" +
|
|
52
|
+
` ${chalk_1.default.cyan(program.name())} ${chalk_1.default.green("my-steedos-app")}\n\n` +
|
|
78
53
|
`Run ${chalk_1.default.cyan(`${program.name()} --help`)} to see all options.`);
|
|
79
54
|
process.exit(1);
|
|
80
55
|
}
|
|
@@ -83,48 +58,18 @@ async function run() {
|
|
|
83
58
|
const { valid, problems } = (0, validate_pkg_1.validateNpmName)(projectName);
|
|
84
59
|
if (!valid) {
|
|
85
60
|
console.error(`Could not create a project called ${chalk_1.default.red(`"${projectName}"`)} because of npm naming restrictions:`);
|
|
86
|
-
problems.forEach((p) => console.error(` ${chalk_1.default.red.bold(
|
|
61
|
+
problems.forEach((p) => console.error(` ${chalk_1.default.red.bold("*")} ${p}`));
|
|
87
62
|
process.exit(1);
|
|
88
63
|
}
|
|
89
64
|
if (program.example === true) {
|
|
90
|
-
console.error(
|
|
65
|
+
console.error("Please provide an example name or url, otherwise remove the example option.");
|
|
91
66
|
process.exit(1);
|
|
92
67
|
}
|
|
93
|
-
const packageManager =
|
|
94
|
-
|
|
95
|
-
:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const example = typeof program.example === 'string' ? program.example.trim() : undefined;
|
|
99
|
-
try {
|
|
100
|
-
await (0, create_app_1.createApp)({
|
|
101
|
-
appPath: resolvedProjectPath,
|
|
102
|
-
packageManager,
|
|
103
|
-
example: example && example !== 'default' ? example : undefined,
|
|
104
|
-
examplePath: program.examplePath,
|
|
105
|
-
typescript: program.typescript,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
catch (reason) {
|
|
109
|
-
if (!(reason instanceof create_app_1.DownloadError)) {
|
|
110
|
-
throw reason;
|
|
111
|
-
}
|
|
112
|
-
const res = await (0, prompts_1.default)({
|
|
113
|
-
type: 'confirm',
|
|
114
|
-
name: 'builtin',
|
|
115
|
-
message: `Could not download "${example}" because of a connectivity issue between your machine and GitHub.\n` +
|
|
116
|
-
`Do you want to use the default template instead?`,
|
|
117
|
-
initial: true,
|
|
118
|
-
});
|
|
119
|
-
if (!res.builtin) {
|
|
120
|
-
throw reason;
|
|
121
|
-
}
|
|
122
|
-
await (0, create_app_1.createApp)({
|
|
123
|
-
appPath: resolvedProjectPath,
|
|
124
|
-
packageManager,
|
|
125
|
-
typescript: program.typescript,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
68
|
+
const packageManager = "yarn";
|
|
69
|
+
await (0, create_app_1.createApp)({
|
|
70
|
+
appPath: resolvedProjectPath,
|
|
71
|
+
packageManager,
|
|
72
|
+
});
|
|
128
73
|
}
|
|
129
74
|
const update = (0, update_check_1.default)(packageJson).catch(() => null);
|
|
130
75
|
async function notifyUpdate() {
|
|
@@ -132,13 +77,13 @@ async function notifyUpdate() {
|
|
|
132
77
|
const res = await update;
|
|
133
78
|
if (res === null || res === void 0 ? void 0 : res.latest) {
|
|
134
79
|
const pkgManager = (0, get_pkg_manager_1.getPkgManager)();
|
|
135
|
-
console.log(chalk_1.default.yellow.bold(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
chalk_1.default.cyan(pkgManager ===
|
|
139
|
-
?
|
|
80
|
+
console.log(chalk_1.default.yellow.bold("A new version of `create-steedos-app` is available!") +
|
|
81
|
+
"\n" +
|
|
82
|
+
"You can update by running: " +
|
|
83
|
+
chalk_1.default.cyan(pkgManager === "yarn"
|
|
84
|
+
? "yarn global add create-steedos-app"
|
|
140
85
|
: `${pkgManager} install --global create-steedos-app`) +
|
|
141
|
-
|
|
86
|
+
"\n");
|
|
142
87
|
}
|
|
143
88
|
process.exit();
|
|
144
89
|
}
|
|
@@ -149,12 +94,12 @@ run()
|
|
|
149
94
|
.then(notifyUpdate)
|
|
150
95
|
.catch(async (reason) => {
|
|
151
96
|
console.log();
|
|
152
|
-
console.log(
|
|
97
|
+
console.log("Aborting installation.");
|
|
153
98
|
if (reason.command) {
|
|
154
99
|
console.log(` ${chalk_1.default.cyan(reason.command)} has failed.`);
|
|
155
100
|
}
|
|
156
101
|
else {
|
|
157
|
-
console.log(chalk_1.default.red(
|
|
102
|
+
console.log(chalk_1.default.red("Unexpected error. Please report it as a bug:") + "\n", reason);
|
|
158
103
|
}
|
|
159
104
|
console.log();
|
|
160
105
|
await notifyUpdate();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,0DAAkC;AAClC,gDAAwB;AACxB,sDAA8B;AAC9B,gEAA0C;AAC1C,6CAAwD;AACxD,+DAA0D;AAC1D,yDAAyD;AACzD,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,IAAI,WAAW,GAAW,EAAE,CAAC;AAE7B,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;KACpD,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC;KAC5B,SAAS,CAAC,qBAAqB,CAAC;KAChC,KAAK,CAAC,GAAG,eAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,YAAY,CAAC;KACxD,MAAM,C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2
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"steedos"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"start": "node ./dist/index.js",
|
|
23
23
|
"dev": "ts-node src/index.ts",
|
|
24
|
-
"build": "rm -rf dist && tsc"
|
|
24
|
+
"build": "rm -rf dist && npx tsc"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@vercel/ncc": "0.33.4",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=14"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c0246fe673fc4f885c8a10df6935ac047abd6322"
|
|
53
53
|
}
|
package/templates/default/.env
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
PORT=5100
|
|
2
|
+
ROOT_URL=http://127.0.0.1:5100
|
|
1
3
|
TRANSPORTER=redis://127.0.0.1:6379
|
|
4
|
+
CACHER=redis://127.0.0.1:6379/1
|
|
5
|
+
MONGO_URL=mongodb://127.0.0.1:27017/steedos
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
METADATA_APIKEY=
|
|
6
|
-
DEFAULT_PACKAGE_PATH=steedos-packages/contract
|
|
7
|
+
|
|
8
|
+
DEVELOPER_STANDARD_OBJECTS=true
|
|
@@ -1,87 +1,92 @@
|
|
|
1
|
+
# Steedos Example App
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
This is an enterprise-grade low-code/no-code application built on the [Steedos Platform](https://www.steedos.com/).
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
This project was scaffolded using `create-steedos-app`. It provides a foundation for rapid metadata modeling, API extensions, and business logic development.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
- [What is Steedos Package](https://docs.steedos.com/developer/package/overview)
|
|
7
|
+
## 🛠 Prerequisites
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Before you begin, ensure you have the following installed in your development environment:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **Node.js**: v22.0 or higher
|
|
12
|
+
- **MongoDB**: v7.0 or higher
|
|
13
|
+
- **Redis**:
|
|
14
|
+
- **Yarn**
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
## 🚀 Quick Start
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
cd steedos-platform
|
|
17
|
-
docker-compose up
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
You can also refer to the instructions in the `./steedos-platform` dir to run Steedos Platform with Node.js.
|
|
21
|
-
|
|
22
|
-
### Register Admin Account
|
|
23
|
-
|
|
24
|
-
Upon its first launch, the system will prompt you to register an account and create an organization. This account will also become the administrator account for the organization.
|
|
18
|
+
### 1. Start Db Services
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
Make sure your MongoDB and Redis services are running. You can start them using the following commands:
|
|
27
21
|
|
|
28
|
-
|
|
22
|
+
```bash
|
|
23
|
+
yarn start:db
|
|
24
|
+
```
|
|
25
|
+
### 2. Install Dependencies
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
Run the following command in the project root to install the required Node packages:
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
```bash
|
|
30
|
+
yarn install
|
|
31
|
+
yarn
|
|
32
|
+
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
### 3. Start the Server
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Start the development server. Steedos will output the access URL in the console.
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
|
|
39
|
+
yarn start
|
|
40
40
|
```
|
|
41
|
-
:::tip
|
|
42
|
-
Please make sure the TRANSPORTER you configured matches the Steedos server you wish to connect to and that the network is interconnected.
|
|
43
|
-
:::
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
For running in a production environment, be sure to configure the Redis password.
|
|
47
|
-
:::
|
|
42
|
+
### 4. Access the Application
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
Once the server starts successfully, open your browser and visit:
|
|
45
|
+
`http://localhost:5100` (Default port)
|
|
50
46
|
|
|
51
|
-
Setup environment variables required for metadata synchronization.
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
steedos source:config
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
- Metadata Server: METADATA_SERVER is the ROOT_URL of the Steedos server you wish to connect to.
|
|
58
|
-
- Metadata API Key: METADATA_APIKEY is used to authenticate your identity.
|
|
48
|
+
## 📂 Project Structure
|
|
59
49
|
|
|
60
|
-
|
|
50
|
+
Here is an overview of the core file structure:
|
|
61
51
|
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
```text
|
|
53
|
+
my-project/
|
|
54
|
+
├── .env # Environment variables (Do not commit sensitive info)
|
|
55
|
+
├── .env.local # Local environment overrides
|
|
56
|
+
├── package.json # Project dependencies and scripts
|
|
57
|
+
├── steedos-config.js # Core Steedos configuration
|
|
58
|
+
├── steedos-packages/example-app/ # Core app directory
|
|
59
|
+
│ ├── main/
|
|
60
|
+
│ │ └── default/
|
|
61
|
+
│ │ ├── objects/ # Object definitions (Metadata)
|
|
62
|
+
│ │ ├── app/ # app definitions (Metadata)
|
|
63
|
+
│ └── package.json # Business package definition
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
## ⚙️ Configuration
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
Create or modify the `.env` file in the project root to configure the database connection and service ports:
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
```shell
|
|
71
|
+
# Service Port
|
|
72
|
+
PORT=5100
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
# Database Connection (MongoDB)
|
|
75
|
+
MONGO_URL=mongodb://127.0.0.1:27017/steedos
|
|
76
|
+
|
|
77
|
+
# Root URL (Important for attachments and API callbacks)
|
|
78
|
+
ROOT_URL=http://localhost:5100
|
|
79
|
+
|
|
80
|
+
# Metadata Storage Directory
|
|
81
|
+
STEEDOS_STORAGE_DIR=./storage
|
|
75
82
|
```
|
|
76
83
|
|
|
77
|
-
|
|
84
|
+
## 💻 Development Guide
|
|
78
85
|
|
|
79
|
-
|
|
86
|
+
### Exporting Metadata
|
|
80
87
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
```
|
|
88
|
+
If you modify configurations via the UI (Steedos Objects), you can sync changes back to your local code using the Steedos command line tools or the VS Code extension.
|
|
89
|
+
## 📚 Resources
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
:::
|
|
91
|
+
- [Steedos Documentation](https://docs.steedos.com/)
|
|
92
|
+
- [Steedos GitHub Repository](https://github.com/steedos/steedos-platform)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
**/.DS_Store
|
|
4
|
+
|
|
5
|
+
**/node_modules
|
|
6
|
+
|
|
7
|
+
**/npm-error.log
|
|
8
|
+
**/yarn-error.log
|
|
9
|
+
**/lerna-debug.log
|
|
10
|
+
|
|
11
|
+
dist
|
|
12
|
+
logs
|
|
13
|
+
|
|
14
|
+
.env.local
|
|
15
|
+
|
|
16
|
+
yarn.lock
|
|
17
|
+
package-lock.json
|
|
18
|
+
steedos-storage
|
|
19
|
+
|
|
20
|
+
.steedos
|
|
21
|
+
plugins
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"name": "steedos-project-template",
|
|
2
3
|
"version": "0.0.1",
|
|
3
4
|
"private": true,
|
|
4
5
|
"workspaces": [
|
|
5
6
|
"steedos-packages/*"
|
|
6
7
|
],
|
|
7
8
|
"scripts": {
|
|
8
|
-
"start": "
|
|
9
|
-
"start
|
|
9
|
+
"start:db": "docker-compose up mongodb redis",
|
|
10
|
+
"start": "steedos start"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@steedos/
|
|
13
|
-
"@steedos/service-package-loader": "^3.0.0-beta.96",
|
|
14
|
-
"dotenv-flow": "^3.2.0",
|
|
15
|
-
"moleculer": "^0.14.31",
|
|
16
|
-
"ts-node": "^10.9.1",
|
|
17
|
-
"typescript": "^4.9.3"
|
|
18
|
-
},
|
|
19
|
-
"resolutions": {
|
|
20
|
-
"@azure/core-auth": "1.5.0",
|
|
21
|
-
"@azure/core-client": "1.7.3",
|
|
22
|
-
"@azure/core-lro": "2.5.4",
|
|
23
|
-
"@azure/core-rest-pipeline": "1.12.1",
|
|
24
|
-
"@azure/core-util": "1.5.0",
|
|
25
|
-
"@azure/keyvault-keys": "4.7.2",
|
|
26
|
-
"@azure/logger": "1.0.4",
|
|
27
|
-
"@azure/core-tracing": "1.0.1",
|
|
28
|
-
"@azure/core-paging": "1.5.0",
|
|
29
|
-
"@types/mime": "3.0.0",
|
|
30
|
-
"undici": "5.16.0"
|
|
13
|
+
"@steedos/server": "^3.0"
|
|
31
14
|
}
|
|
32
15
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const project = require('./package.json');
|
|
2
|
+
const packageLoader = require('@steedos/service-package-loader');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
name: project.name,
|
|
6
|
+
|
|
7
|
+
mixins: [packageLoader],
|
|
8
|
+
|
|
9
|
+
metadata: {
|
|
10
|
+
$package: {
|
|
11
|
+
name: project.name,
|
|
12
|
+
version: project.version,
|
|
13
|
+
path: __dirname,
|
|
14
|
+
isPackage: true
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
actions: {
|
|
18
|
+
},
|
|
19
|
+
events: {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
require('dotenv-flow').config({});
|
|
2
|
-
// Moleculer Configuration
|
|
3
|
-
// https://moleculer.services/docs/0.14/configuration.html
|
|
4
|
-
module.exports = {
|
|
5
|
-
// Namespace of nodes to segment your nodes on the same network.
|
|
6
|
-
namespace: "steedos",
|
|
7
|
-
// Default log level for built-in console logger. It can be overwritten in logger options above.
|
|
8
|
-
// Available values: trace, debug, info, warn, error, fatal
|
|
9
|
-
logLevel: "info",
|
|
10
|
-
|
|
11
|
-
transporter: process.env.TRANSPORTER,
|
|
12
1
|
|
|
13
|
-
|
|
14
|
-
started(broker) {
|
|
15
|
-
}
|
|
16
|
-
|
|
2
|
+
module.exports = {
|
|
17
3
|
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.0.0",
|
|
3
|
-
"tasks": [
|
|
4
|
-
{
|
|
5
|
-
"label": "Install Steedos DX",
|
|
6
|
-
"type": "shell",
|
|
7
|
-
"command": "echo Please Install Steedos DX Extensions",
|
|
8
|
-
"linux": {
|
|
9
|
-
"command": "npx json5 .vscode/extensions.json | npx json-cli-tool --path=recommendations --output=newline | xargs -L 1 code --install-extension",
|
|
10
|
-
},
|
|
11
|
-
"presentation": {
|
|
12
|
-
"reveal": "always",
|
|
13
|
-
"panel": "new"
|
|
14
|
-
},
|
|
15
|
-
"runOptions": {
|
|
16
|
-
"runOn": "folderOpen"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
微服务软件包
|
|
2
|
-
===
|
|
3
|
-
|
|
4
|
-
可以使用微服务方式扩展化验魔方。
|
|
5
|
-
|
|
6
|
-
## 启动服务
|
|
7
|
-
|
|
8
|
-
```sh
|
|
9
|
-
yarn start:services
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
启动服务之后,为华炎魔方服务扩展了以下API
|
|
13
|
-
|
|
14
|
-
- hello, 获取当前登录用户: http://127.0.0.1:5000/service/api/example-service/hello/jack
|
|
15
|
-
- me, 获取当前登录用户: http://127.0.0.1:5000/service/api/example-service/me
|
|
16
|
-
|
|
17
|
-
## 参考
|
|
18
|
-
|
|
19
|
-
- [Moleculer Nodejs](https://moleculer.services/zh/)
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
const project = require('./package.json');
|
|
2
|
-
const packageLoader = require('@steedos/service-package-loader');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
name: "example-service",
|
|
6
|
-
|
|
7
|
-
mixins: [packageLoader],
|
|
8
|
-
|
|
9
|
-
metadata: {
|
|
10
|
-
$package: {
|
|
11
|
-
name: project.name,
|
|
12
|
-
version: project.version,
|
|
13
|
-
path: __dirname,
|
|
14
|
-
isPackage: true
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
actions: {
|
|
19
|
-
hello: {
|
|
20
|
-
// 使用微服务方式定义 API 接口。
|
|
21
|
-
// 访问地址: GET /service/api/example-service/hello/:name
|
|
22
|
-
rest: { method: 'GET', path: '/hello/:name' },
|
|
23
|
-
handler(ctx) {
|
|
24
|
-
return {
|
|
25
|
-
data: 'Welcome ' + ctx.params.name
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
me: {
|
|
30
|
-
rest: { method: 'GET', path: '/me' },
|
|
31
|
-
// 在微服务中获取当前登录的用户信息
|
|
32
|
-
async handler(ctx) {
|
|
33
|
-
return ctx.meta.user
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
// 在微服务中调用graphql查询数据库
|
|
37
|
-
graphqlQuerySpaceUsers: {
|
|
38
|
-
rest: { method: 'GET', path: '/graphql' },
|
|
39
|
-
async handler(ctx) {
|
|
40
|
-
return await this.broker.call('api.graphql', {
|
|
41
|
-
query: `
|
|
42
|
-
query {
|
|
43
|
-
space_users(filters: ["user", "=", "${ctx.meta.user.userId}"]) {
|
|
44
|
-
name
|
|
45
|
-
organization__expand {
|
|
46
|
-
name
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`},
|
|
51
|
-
// 如果查询 GraphQL 需要带上当前用户的权限,需要传入 user 属性。
|
|
52
|
-
{
|
|
53
|
-
meta: {
|
|
54
|
-
user: ctx.meta.user
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
// 在微服务中调用objectql查询数据库, 需要 mixins: [require('@steedos/service-object-mixin')],
|
|
61
|
-
objectqlQuerySpaceUsers: {
|
|
62
|
-
rest: { method: 'GET', path: '/objectql' },
|
|
63
|
-
async handler(ctx) {
|
|
64
|
-
return await this.getObject('space_users').find(
|
|
65
|
-
{
|
|
66
|
-
filters: ['user', '=', ctx.meta.user.userId]
|
|
67
|
-
},
|
|
68
|
-
ctx.meta.user
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
// 使用微服务定义触发器
|
|
73
|
-
spaceUsersBeforeUpdate: {
|
|
74
|
-
trigger: { listenTo: 'space_users', when: ['beforeUpdate', 'beforeInsert']},
|
|
75
|
-
async handler(ctx) {
|
|
76
|
-
this.broker.logger.info('spaceUsersBeforeUpdate', ctx)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
events: {
|
|
81
|
-
"@space_users.updated": {
|
|
82
|
-
handler(payload) {
|
|
83
|
-
// 监听人员修改事件
|
|
84
|
-
this.broker.logger.info(payload);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# https://docs.steedos.com/deploy/steedos-config
|
|
2
|
-
|
|
3
|
-
PORT=5100
|
|
4
|
-
ROOT_URL=http://127.0.0.1:5100
|
|
5
|
-
TRANSPORTER=redis://127.0.0.1:6379
|
|
6
|
-
CACHER=redis://127.0.0.1:6379/1
|
|
7
|
-
MONGO_URL=mongodb://127.0.0.1:27017/steedos
|
|
8
|
-
MONGO_OPLOG_URL=mongodb://127.0.0.1:27017/local
|
|
9
|
-
|
|
10
|
-
STEEDOS_STORAGE_DIR=./steedos-storage
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Steedos Platform
|
|
2
|
-
|
|
3
|
-
Steedos Low-code PaaS platform is an open-source alternative to Salesforce Platform. It provides a powerful and flexible platform for building enterprise applications quickly and easily. With Steedos, you can create custom applications without writing a single line of code.
|
|
4
|
-
|
|
5
|
-
## Starting Steedos
|
|
6
|
-
|
|
7
|
-
Instructions for initializing the Steedos Platform, a powerful low-code solution, using different methods.
|
|
8
|
-
|
|
9
|
-
### 1. Launching Steedos with Docker
|
|
10
|
-
|
|
11
|
-
It is recommended to use Docker for launching the Steedos platform as it automatically initializes all dependent services.
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
docker-compose up
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### 2. Launching Steedos with Node.js
|
|
18
|
-
|
|
19
|
-
Alternatively, the Steedos platform can be started using Node.js. This method requires you to first install MongoDB, Redis, and NATS locally, or initiate these dependent services with Docker.
|
|
20
|
-
|
|
21
|
-
1. Start Mongodb & Redis
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
docker-compose up redis mongodb mongodb-init
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
2. Start Steedos
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
yarn
|
|
31
|
-
yarn start
|
|
32
|
-
```
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
version: "3.9"
|
|
2
|
-
|
|
3
|
-
services:
|
|
4
|
-
|
|
5
|
-
steedos:
|
|
6
|
-
image: steedos/steedos-enterprise:3.0.0-beta.63
|
|
7
|
-
ports:
|
|
8
|
-
- "5100:80" # Steedos
|
|
9
|
-
- "27017:27017" # MongoDB
|
|
10
|
-
- "9001:9001" # Supervisor
|
|
11
|
-
- "6379:6379" # Redis
|
|
12
|
-
env_file:
|
|
13
|
-
- .env
|
|
14
|
-
- .env.local
|
|
15
|
-
environment:
|
|
16
|
-
- STEEDOS_WIDGETS_ADDITIONAL=@steedos-widgets/liveblocks
|
|
17
|
-
- STEEDOS_AUTH_COOKIES_USE_SAMESITE=None
|
|
18
|
-
- STEEDOS_TENANT_ENABLE_REGISTER=false
|
|
19
|
-
- STEEDOS_TENANT_ENABLE_CREATE_TENANT=false
|
|
20
|
-
- B6_PORT=5100
|
|
21
|
-
- B6_MO_LOG_LEVEL=warn
|
|
22
|
-
- STEEDOS_INITIAL_PACKAGES=file:/steedos-packages/media-report,file:/steedos-packages/sync_orgs_users
|
|
23
|
-
volumes:
|
|
24
|
-
- "./steedos-storage:/steedos-storage"
|
|
25
|
-
- "../steedos-packages:/steedos-packages"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
require('dotenv-flow').config({
|
|
3
|
-
path: path.join(__dirname, '.')
|
|
4
|
-
});
|
|
5
|
-
|
|
6
|
-
// Moleculer Configuration
|
|
7
|
-
// https://moleculer.services/docs/0.14/configuration.html
|
|
8
|
-
module.exports = {
|
|
9
|
-
// Namespace of nodes to segment your nodes on the same network.
|
|
10
|
-
namespace: "steedos",
|
|
11
|
-
// Default log level for built-in console logger. It can be overwritten in logger options above.
|
|
12
|
-
// Available values: trace, debug, info, warn, error, fatal
|
|
13
|
-
logLevel: "warn",
|
|
14
|
-
|
|
15
|
-
transporter: process.env.TRANSPORTER,
|
|
16
|
-
|
|
17
|
-
// Called after broker started.
|
|
18
|
-
started(broker) {
|
|
19
|
-
broker.createService(require("@steedos/service-community"));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
};
|