lowdefy 4.0.0-alpha.4 → 4.0.0-alpha.5
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/commands/build/build.js +3 -1
- package/dist/commands/build/runLowdefyBuild.js +2 -1
- package/dist/commands/start/runStart.js +31 -0
- package/dist/commands/start/start.js +25 -0
- package/dist/index.js +6 -1
- package/dist/utils/getSendTelemetry.js +16 -4
- package/dist/utils/spawnProcess.js +0 -1
- package/package.json +4 -4
|
@@ -28,7 +28,8 @@ async function runLowdefyBuild({ context }) {
|
|
|
28
28
|
env: {
|
|
29
29
|
...process.env,
|
|
30
30
|
LOWDEFY_BUILD_DIRECTORY: context.directories.build,
|
|
31
|
-
LOWDEFY_CONFIG_DIRECTORY: context.directories.base
|
|
31
|
+
LOWDEFY_CONFIG_DIRECTORY: context.directories.base,
|
|
32
|
+
LOWDEFY_SERVER_DIRECTORY: context.directories.server
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
silent: false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import spawnProcess from '../../utils/spawnProcess.js';
|
|
16
|
+
async function runStart({ context }) {
|
|
17
|
+
context.print.spin(`Running "${context.packageManager} run start".`);
|
|
18
|
+
await spawnProcess({
|
|
19
|
+
context,
|
|
20
|
+
command: context.packageManager,
|
|
21
|
+
args: [
|
|
22
|
+
'run',
|
|
23
|
+
'start'
|
|
24
|
+
],
|
|
25
|
+
processOptions: {
|
|
26
|
+
cwd: context.directories.server
|
|
27
|
+
},
|
|
28
|
+
silent: false
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export default runStart;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import runStart from './runStart.js';
|
|
16
|
+
async function build({ context }) {
|
|
17
|
+
context.print.info('Starting server.');
|
|
18
|
+
context.sendTelemetry({
|
|
19
|
+
sendTypes: true
|
|
20
|
+
});
|
|
21
|
+
await runStart({
|
|
22
|
+
context
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export default build;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
/*
|
|
2
3
|
Copyright 2020-2021 Lowdefy, Inc
|
|
3
4
|
|
|
@@ -17,11 +18,12 @@ import program from 'commander';
|
|
|
17
18
|
import build from './commands/build/build.js';
|
|
18
19
|
// import dev from './commands/dev/dev.js';
|
|
19
20
|
import init from './commands/init/init.js';
|
|
21
|
+
import start from './commands/start/start.js';
|
|
20
22
|
import runCommand from './utils/runCommand.js';
|
|
21
23
|
const packageJson = JSON.parse(await readFile(new URL('../package.json', import.meta.url).pathname));
|
|
22
24
|
const { description , version } = packageJson;
|
|
23
25
|
program.name('lowdefy').description(description).version(version, '-v, --version');
|
|
24
|
-
program.command('build').description('Build a Lowdefy
|
|
26
|
+
program.command('build').description('Build a Lowdefy production app.').usage(`[options]`).option('--base-directory <base-directory>', 'Change base directory. Default is the current working directory.').option('--disable-telemetry', 'Disable telemetry.').option('--output-directory <output-directory>', 'Change the directory to which build artifacts are saved. Default is "<base-directory>/.lowdefy".').option('--package-manager <package-manager>', 'The package manager to use. Options are "npm" or "yarn".').option('--ref-resolver <ref-resolver-function-path>', 'Path to a JavaScript file containing a _ref resolver function to be used as the app default _ref resolver.').action(runCommand({
|
|
25
27
|
cliVersion: version
|
|
26
28
|
})(build));
|
|
27
29
|
// program
|
|
@@ -54,4 +56,7 @@ program.command('build').description('Build a Lowdefy deployment.').usage(`[opti
|
|
|
54
56
|
program.command('init').description('Initialize a Lowdefy project.').usage(`[options]`).action(runCommand({
|
|
55
57
|
cliVersion: version
|
|
56
58
|
})(init));
|
|
59
|
+
program.command('start').description('Start a Lowdefy production app.').usage(`[options]`).option('--base-directory <base-directory>', 'Change base directory. Default is the current working directory.').option('--disable-telemetry', 'Disable telemetry.').option('--output-directory <output-directory>', 'Change the directory to which build artifacts are saved. Default is "<base-directory>/.lowdefy".').option('--package-manager <package-manager>', 'The package manager to use. Options are "npm" or "yarn".').action(runCommand({
|
|
60
|
+
cliVersion: version
|
|
61
|
+
})(start));
|
|
57
62
|
program.parse(process.argv);
|
|
@@ -12,15 +12,26 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ import
|
|
16
|
-
|
|
15
|
+
*/ import path from 'path';
|
|
16
|
+
import axios from 'axios';
|
|
17
|
+
import { readFile } from '@lowdefy/node-utils';
|
|
18
|
+
async function getTypes({ directories }) {
|
|
19
|
+
return JSON.parse(await readFile(path.join(directories.build, 'types.json')));
|
|
20
|
+
}
|
|
21
|
+
function getSendTelemetry({ appId , cliVersion , command , directories , lowdefyVersion , options }) {
|
|
17
22
|
if (options.disableTelemetry) {
|
|
18
23
|
return ()=>{
|
|
19
24
|
};
|
|
20
25
|
}
|
|
21
26
|
async function sendTelemetry({ data ={
|
|
22
|
-
} } = {
|
|
27
|
+
} , sendTypes =false } = {
|
|
23
28
|
}) {
|
|
29
|
+
let types;
|
|
30
|
+
if (sendTypes) {
|
|
31
|
+
types = await getTypes({
|
|
32
|
+
directories
|
|
33
|
+
});
|
|
34
|
+
}
|
|
24
35
|
try {
|
|
25
36
|
await axios.request({
|
|
26
37
|
method: 'post',
|
|
@@ -33,7 +44,8 @@ function getSendTelemetry({ appId , cliVersion , command , lowdefyVersion , opti
|
|
|
33
44
|
app_id: appId,
|
|
34
45
|
cli_version: cliVersion,
|
|
35
46
|
command,
|
|
36
|
-
lowdefy_version: lowdefyVersion
|
|
47
|
+
lowdefy_version: lowdefyVersion,
|
|
48
|
+
types
|
|
37
49
|
}
|
|
38
50
|
});
|
|
39
51
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lowdefy",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy CLI",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"test": "FORCE_COLOR=3 jest --coverage"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
44
|
-
"@lowdefy/node-utils": "4.0.0-alpha.
|
|
43
|
+
"@lowdefy/helpers": "4.0.0-alpha.5",
|
|
44
|
+
"@lowdefy/node-utils": "4.0.0-alpha.5",
|
|
45
45
|
"axios": "0.24.0",
|
|
46
46
|
"chalk": "4.1.2",
|
|
47
47
|
"chokidar": "3.5.2",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "995fcdb020927f3cdc626fc99c15a2e4137bd962"
|
|
68
68
|
}
|