@appthen/cli 1.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/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+ quote_type = single
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
package/.eslintignore ADDED
@@ -0,0 +1,16 @@
1
+ # 忽略目录
2
+ node_modules/
3
+ build/
4
+ dist/
5
+ test-cases/
6
+ test/
7
+ tests/
8
+ output/
9
+ es/
10
+ lib/
11
+ coverage/
12
+
13
+ # 忽略文件
14
+ **/*.min.js
15
+ **/*-min.js
16
+ **/*.bundle.js
package/.eslintrc.js ADDED
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ extends: 'eslint-config-ali/typescript/react',
3
+ rules: {
4
+ 'max-len': ['error', { code: 500 }],
5
+ 'comma-dangle': 0,
6
+ '@typescript-eslint/no-unused-vars': 0,
7
+ 'guard-for-in': 0,
8
+ 'no-await-in-loop': 0,
9
+ 'no-console': 0,
10
+ 'no-lonely-if': 0,
11
+ 'prefer-template': 0
12
+ },
13
+ };
package/.gitignore ADDED
@@ -0,0 +1,106 @@
1
+ # project custom
2
+ build
3
+ es
4
+ lib
5
+ dist
6
+ output
7
+ package-lock.json
8
+ deploy-space/packages
9
+ deploy-space/.env
10
+ generated
11
+ cache
12
+
13
+ # IDE
14
+ .vscode
15
+ .idea
16
+
17
+ # Logs
18
+ logs
19
+ *.log
20
+ npm-debug.log*
21
+ yarn-debug.log*
22
+ yarn-error.log*
23
+ lerna-debug.log*
24
+
25
+ # Runtime data
26
+ pids
27
+ *.pid
28
+ *.seed
29
+ *.pid.lock
30
+
31
+
32
+ # Directory for instrumented libs generated by jscoverage/JSCover
33
+ lib-cov
34
+
35
+ # Coverage directory used by tools like istanbul
36
+ coverage
37
+
38
+ # nyc test coverage
39
+ .nyc_output
40
+
41
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
42
+ .grunt
43
+
44
+ # Bower dependency directory (https://bower.io/)
45
+ bower_components
46
+
47
+ # node-waf configuration
48
+ .lock-wscript
49
+
50
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
51
+ build/Release
52
+ lib
53
+
54
+ # Dependency directories
55
+ node_modules/
56
+ jspm_packages/
57
+
58
+ # TypeScript v1 declaration files
59
+ typings/
60
+
61
+ # Optional npm cache directory
62
+ .npm
63
+
64
+ # Optional eslint cache
65
+ .eslintcache
66
+
67
+ # Optional REPL history
68
+ .node_repl_history
69
+
70
+ # Output of 'npm pack'
71
+ *.tgz
72
+
73
+ # Yarn Integrity file
74
+ .yarn-integrity
75
+
76
+ # dotenv environment variables file
77
+ .env
78
+ .env.test
79
+
80
+ # parcel-bundler cache (https://parceljs.org/)
81
+ .cache
82
+
83
+ # next.js build output
84
+ .next
85
+
86
+ # nuxt.js build output
87
+ .nuxt
88
+
89
+ # vuepress build output
90
+ .vuepress/dist
91
+
92
+ # Serverless directories
93
+ .serverless/
94
+
95
+ # FuseBox cache
96
+ .fusebox/
97
+
98
+ # DynamoDB Local files
99
+ .dynamodb/
100
+
101
+ # mac config files
102
+ .DS_Store
103
+
104
+ # codealike
105
+ codealike.json
106
+ .node
@@ -0,0 +1 @@
1
+ /test-cases/
package/.prettierrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "singleQuote": true,
4
+ "trailingComma": "es5"
5
+ }
package/CHANGELOG.md ADDED
File without changes
@@ -0,0 +1,19 @@
1
+ # 欢迎共建
2
+
3
+ # 注意
4
+
5
+ - 注意解决 eslint 问题
6
+ - 注意代码格式化 -- 建议安装 prettier 插件
7
+ - 发布前注意要跑通 demo 和所有的单测
8
+
9
+ ## 本地调试运行 Demo
10
+
11
+ ```sh
12
+ > npm run demo
13
+ ```
14
+
15
+ ## 本地跑单测
16
+
17
+ ```sh
18
+ > npm test
19
+ ```
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # AppThen Cli
2
+
3
+ ## Install
4
+
5
+ ```sh
6
+ npm install -g @appthen/cli
7
+ ```
8
+
9
+ ## Export
10
+ ```sh
11
+ # 项目根目录中运行
12
+ appthen --output src/pages/app --id 项目ID(浏览器链接中获取) --auth token
13
+ ```
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-var */
3
+ /* eslint-disable prefer-arrow-callback */
4
+ /* eslint-disable @typescript-eslint/no-require-imports */
5
+
6
+ const pkg = require('../package.json');
7
+
8
+ var program = require('commander');
9
+
10
+ program
11
+ .command('generate', { isDefault: true })
12
+ .description('Generate code from ali lowcode schema')
13
+ .requiredOption('-p, --id <id>', 'project id')
14
+ .requiredOption('-a, --auth <auth>', 'auth token')
15
+ .option('-cc, --clear <clear>', 'clear cache')
16
+ // .option('-i, --input <input>', 'specify the input schema file')
17
+ .option('-o, --output <output>', 'specify the output directory', 'generated')
18
+ .option('-fn, --filter <filter>', 'filter docments')
19
+ .option('-fd, --folder <folder>', 'filter docments by folder')
20
+ .option('-fr, --frame <frame>', 'code frame web or app')
21
+ .option('-env, --env <env>', 'lowcode env')
22
+ .option('-c, --cwd <cwd>', 'specify the working directory', '.')
23
+ .option(
24
+ '-q, --quiet',
25
+ 'be quiet, do not output anything unless get error',
26
+ false
27
+ )
28
+ .option('-vb, --verbose', 'be verbose, output more information', false)
29
+ .arguments('[input-schema] ali lowcode schema JSON file')
30
+ .action(function doGenerate(inputSchema, command) {
31
+ var options = command.opts();
32
+ if (options.cwd) {
33
+ process.chdir(options.cwd);
34
+ }
35
+
36
+ require('../dist/index.js')
37
+ .run(inputSchema ? [inputSchema] : [], options)
38
+ .then((retCode) => {
39
+ process.exit(retCode);
40
+ });
41
+ });
42
+
43
+ program
44
+ .command('version', { isDefault: false })
45
+ .description('show cli version')
46
+ .action(function doGenerate(inputSchema, command) {
47
+ console.log('version: ', pkg.version);
48
+ process.exit();
49
+ });
50
+
51
+ program
52
+ .command('release-material', { isDefault: false })
53
+ .description('release material and upload to cdn')
54
+ .requiredOption('-a, --auth <auth>', 'auth token')
55
+ .action(function doGenerate(command) {
56
+ var options = command?.opts?.() || {};
57
+ if (options.cwd) {
58
+ process.chdir(options.cwd);
59
+ }
60
+
61
+ require('../dist/index.js')
62
+ .releaseMaterial(options)
63
+ .then((retCode) => {
64
+ process.exit(retCode);
65
+ });
66
+ });
67
+
68
+ program.parse(process.argv);