@steedos/create-steedos-package 2.7.22

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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ # Open Source License
2
+
3
+ Steedos is licensed under a modified version of the Apache License 2.0, with the following additional conditions:
4
+
5
+ 1. Steedos may be utilized commercially, including as a backend service for other applications or as an application development platform for enterprises. Should the conditions below be met, a commercial license must be obtained from the producer:
6
+
7
+ a. Multi-tenant service: Unless explicitly authorized by Steedos in writing, you may not use the Steedos source code to operate a multi-tenant environment.
8
+ - Tenant Definition: Within the context of Steedos, one tenant corresponds to one space. The space provides a separated area for each tenant's data and configurations.
9
+
10
+ b. LOGO and copyright information: In the process of using Steedos's frontend, you may not remove or modify the LOGO or copyright information in the Steedos console or applications. This restriction is inapplicable to uses of Steedos that do not involve its frontend.
11
+
12
+ 2. As a contributor, you should agree that:
13
+
14
+ a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
15
+ b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations.
16
+
17
+ Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
18
+
19
+ The interactive design of this product is protected by appearance patent.
20
+
21
+ © 2025 Steedos, Inc.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ ## 创建steedos package
2
+ - 此包是npx命令`@steedos/create-steedos-package`,用于创建项目,如 `npx @steedos/create-steedos-package my-package`
@@ -0,0 +1,101 @@
1
+ /*
2
+ * @Author: baozhoutao@steedos.com
3
+ * @Date: 2022-03-29 10:05:06
4
+ * @Description:
5
+ */
6
+ 'use strict';
7
+ const spinner = new (require('@geek/spinner'))();
8
+ const chalk = require('chalk');
9
+ const commander = require('commander');
10
+ const fs = require('fs-extra');
11
+ const path = require("path");
12
+ const cpy = require("cpy");
13
+
14
+ const packageJson = require('./package.json');
15
+
16
+ const projectConfigName = 'package.json'
17
+ const defaultTemplate = "default";
18
+
19
+
20
+ let packageName;
21
+
22
+ const program = new commander.Command(packageJson.name)
23
+ .version(packageJson.version)
24
+ .arguments('<package-directory>')
25
+ .usage(`${chalk.green('<package-directory>')}`)
26
+ .action(name => {
27
+ packageName = name;
28
+ }).parse(process.argv);
29
+
30
+
31
+ if (typeof packageName === 'undefined') {
32
+ console.error('Please specify the package directory:');
33
+ console.log(
34
+ ` ${chalk.cyan(program.name())} ${chalk.green('<package-directory>')}`
35
+ );
36
+ console.log();
37
+ console.log('For example:');
38
+ console.log(` ${chalk.cyan(program.name())} ${chalk.green('my-package')}`);
39
+ console.log();
40
+ console.log(
41
+ `Run ${chalk.cyan(`${program.name()} --help`)} to see all options.`
42
+ );
43
+ process.exit(1);
44
+ }
45
+
46
+ /**
47
+ * TODO 支持参数:useNpm, example, examplePath, typescript
48
+ */
49
+ function createPackage(name) {
50
+ const root = path.resolve(name);
51
+ const projectName = path.basename(root);
52
+
53
+ const infoName = name === projectName ? projectName : name
54
+ let template = defaultTemplate;
55
+ let projectDir = root || path.join(process.cwd(), projectName)
56
+
57
+ if (fs.existsSync(projectDir)) {
58
+ spinner.fail(`${projectDir} already exists`);
59
+ return
60
+ }
61
+
62
+ const filterFunction = function (src, dest) {
63
+ if (src.endsWith('package.json')) {
64
+ return false
65
+ }
66
+ return true;
67
+ }
68
+
69
+ if (template) {
70
+ spinner.start(`Create steedos package ${projectName}`);
71
+ cpy([
72
+ '**'
73
+ ], projectDir, {
74
+ dot: true,
75
+ parents: true,
76
+ flat: false,
77
+ cwd: path.join(__dirname, 'templates', template),
78
+ rename: (name) => {
79
+ switch (name) {
80
+ case '_package.json': {
81
+ return 'package.json'
82
+ }
83
+ default: {
84
+ return name
85
+ }
86
+ }
87
+ }
88
+ }).then((result) => {
89
+ const projectConfig = fs.readJsonSync(path.join(projectDir, projectConfigName))
90
+ projectConfig.name = projectName
91
+ projectConfig.version = `1.0.0`;
92
+ fs.outputJsonSync(path.join(projectDir, 'package.json'), projectConfig, { spaces: 4, EOL: '\r\n' })
93
+
94
+ spinner.succeed()
95
+ console.info('Created successfully');
96
+ }).catch((err) => {
97
+ spinner.fail(err);
98
+ })
99
+ }
100
+ }
101
+ createPackage(packageName);
package/index.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ var currentNodeVersion = process.versions.node;
6
+ var semver = currentNodeVersion.split('.');
7
+ var major = semver[0];
8
+ if (major < 12) {
9
+ console.error(
10
+ 'You are running Node ' +
11
+ currentNodeVersion +
12
+ '.\n' +
13
+ 'Create Steedos App requires Node 12 or higher. \n' +
14
+ 'Please update your version of Node.'
15
+ );
16
+ process.exit(1);
17
+ }
18
+
19
+ require('./createSteedosPackage');
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@steedos/create-steedos-package",
3
+ "version": "2.7.22",
4
+ "keywords": [
5
+ "steedos"
6
+ ],
7
+ "description": "Create steedos package with no build configuration.",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/steedos/steedos-platform.git",
11
+ "directory": "packages/create-steedos-package"
12
+ },
13
+ "license": "MIT",
14
+ "engines": {
15
+ "node": ">=12"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/steedos/steedos-platform/issues"
19
+ },
20
+ "files": [
21
+ "index.js",
22
+ "templates/**",
23
+ "createSteedosPackage.js"
24
+ ],
25
+ "bin": {
26
+ "create-steedos-package": "./index.js"
27
+ },
28
+ "dependencies": {
29
+ "@geek/spinner": "1.0.0",
30
+ "chalk": "3.0.0",
31
+ "commander": "4.1.0",
32
+ "cpy": "7.3.0",
33
+ "fs-extra": "8.1.0"
34
+ },
35
+ "resolutions": {
36
+ "**/chalk": "3.0.0"
37
+ },
38
+ "private": false,
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "gitHead": "9ed113426c7ae61498c1dab6544e380e89851494"
43
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "create-steedos-package",
3
+ "version": "1.0.0",
4
+ "keywords": [
5
+ "steedos"
6
+ ],
7
+ "description": "steedos package",
8
+ "repository": {},
9
+ "license": "MIT",
10
+ "dependencies": {}
11
+ }
12
+
File without changes
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ const project = require('./package.json');
3
+ const packageName = project.name;
4
+ const packageLoader = require('@steedos/service-package-loader');
5
+ /**
6
+ * @typedef {import('moleculer').Context} Context Moleculer's Context
7
+ * 软件包服务启动后也需要抛出事件。
8
+ */
9
+ module.exports = {
10
+ name: packageName,
11
+ namespace: "steedos",
12
+ mixins: [packageLoader],
13
+ /**
14
+ * Settings
15
+ */
16
+ settings: {
17
+ packageInfo: {
18
+ path: __dirname,
19
+ name: packageName
20
+ }
21
+ },
22
+
23
+ /**
24
+ * Dependencies
25
+ */
26
+ dependencies: [],
27
+
28
+ /**
29
+ * Actions
30
+ */
31
+ actions: {
32
+
33
+ },
34
+
35
+ /**
36
+ * Events
37
+ */
38
+ events: {
39
+
40
+ },
41
+
42
+ /**
43
+ * Methods
44
+ */
45
+ methods: {
46
+
47
+ },
48
+
49
+ /**
50
+ * Service created lifecycle event handler
51
+ */
52
+ async created() {
53
+
54
+ },
55
+
56
+ /**
57
+ * Service started lifecycle event handler
58
+ */
59
+ async started() {
60
+
61
+ },
62
+
63
+ /**
64
+ * Service stopped lifecycle event handler
65
+ */
66
+ async stopped() {
67
+
68
+ }
69
+ };
@@ -0,0 +1,3 @@
1
+ ### 静态公开资源文件
2
+
3
+ - 此文件夹中的文件自动添加到根路由
@@ -0,0 +1,3 @@
1
+ ### src
2
+
3
+ - 软件包不会加载此文件夹下的文件, 可用于存放ts文件等
@@ -0,0 +1 @@
1
+ - 存放web项目