@stackbit/dev 0.0.11 → 0.0.15
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/assets/loading-page.html +10 -4
- package/dist/command.d.ts +3 -0
- package/dist/command.js +44 -0
- package/dist/command.js.map +1 -0
- package/dist/index.js +2 -38
- package/dist/index.js.map +1 -1
- package/dist/services/file-watcher.js +2 -2
- package/dist/services/file-watcher.js.map +1 -1
- package/dist/services/user-config.js +2 -2
- package/dist/services/user-config.js.map +1 -1
- package/package.json +4 -4
- package/src/assets/loading-page.html +10 -4
- package/src/command.ts +41 -0
- package/src/index.ts +2 -44
- package/src/services/file-watcher.ts +2 -2
- package/src/services/user-config.ts +2 -2
|
@@ -30,15 +30,21 @@
|
|
|
30
30
|
fill: #f25458;
|
|
31
31
|
}
|
|
32
32
|
#info-text a {
|
|
33
|
-
color: #
|
|
33
|
+
color: #0b69db;
|
|
34
34
|
}
|
|
35
35
|
</style>
|
|
36
36
|
</head>
|
|
37
37
|
<body>
|
|
38
38
|
<div id="main-container">
|
|
39
|
-
<svg
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
<svg width="239" height="81" viewBox="0 0 239 81" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
40
|
+
<path d="M119.641 79.7368C141.383 79.7368 159.009 62.111 159.009 40.3684C159.009 18.6258 141.383 1 119.641 1C97.8983 1 80.2725 18.6258 80.2725 40.3684C80.2725 62.111 97.8983 79.7368 119.641 79.7368Z" stroke="#979797" stroke-miterlimit="10"/>
|
|
41
|
+
<path d="M198.538 79.7368C220.28 79.7368 237.906 62.111 237.906 40.3684C237.906 18.6258 220.28 1 198.538 1C176.795 1 159.169 18.6258 159.169 40.3684C159.169 62.111 176.795 79.7368 198.538 79.7368Z" stroke="#979797" stroke-miterlimit="10"/>
|
|
42
|
+
<path d="M1.37549 79.7369L80.2723 1.00006L159.009 79.7369L237.906 1.00006" stroke="#979797" stroke-miterlimit="10"/>
|
|
43
|
+
<path d="M1.37549 1.00006L80.2723 79.7369L159.009 1.00006L237.906 79.7369" stroke="#979797" stroke-miterlimit="10"/>
|
|
44
|
+
<path d="M40.7439 79.7369C62.4865 79.7369 80.1123 62.111 80.1123 40.3685C80.1123 18.6259 62.4865 1.00006 40.7439 1.00006C19.0013 1.00006 1.37549 18.6259 1.37549 40.3685C1.37549 62.111 19.0013 79.7369 40.7439 79.7369Z" stroke="#979797" stroke-miterlimit="10"/>
|
|
45
|
+
</svg>
|
|
46
|
+
<h1>Failed to connect to your site's local server</h1>
|
|
47
|
+
<div id="info-text">Your local stackbit dev cannot connect to the dev server of your site, which should be running at __URL__.<br/>Please check that it is up and running. <a href="https://docs.stackbit.com/how-to-guides/local-dev/#troubleshooting" target="_blank">Learn more.</a></div>
|
|
42
48
|
</div>
|
|
43
49
|
<script type="application/javascript">
|
|
44
50
|
function poll() {
|
package/dist/command.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = void 0;
|
|
4
|
+
function builder(yargs) {
|
|
5
|
+
yargs
|
|
6
|
+
.option('port', {
|
|
7
|
+
alias: 'p',
|
|
8
|
+
description: 'port',
|
|
9
|
+
default: 3000
|
|
10
|
+
})
|
|
11
|
+
.options('host', {
|
|
12
|
+
alias: 'h',
|
|
13
|
+
description: 'hostname',
|
|
14
|
+
default: 'localhost'
|
|
15
|
+
})
|
|
16
|
+
.options('dir', {
|
|
17
|
+
alias: 'd',
|
|
18
|
+
description: 'root dir',
|
|
19
|
+
default: process.cwd()
|
|
20
|
+
})
|
|
21
|
+
.options('runnable-dir', {
|
|
22
|
+
description: 'runnable dir',
|
|
23
|
+
default: ''
|
|
24
|
+
})
|
|
25
|
+
.options('log-level', {
|
|
26
|
+
description: 'log level',
|
|
27
|
+
default: 'info'
|
|
28
|
+
})
|
|
29
|
+
.options('help', {});
|
|
30
|
+
}
|
|
31
|
+
exports.builder = builder;
|
|
32
|
+
async function handler(argv) {
|
|
33
|
+
if (argv['log-level']) {
|
|
34
|
+
process.env.LOG_LEVEL = argv['log-level'];
|
|
35
|
+
}
|
|
36
|
+
return require('./dev').start({
|
|
37
|
+
ssgPort: argv.port,
|
|
38
|
+
ssgHost: argv.host,
|
|
39
|
+
rootDir: argv.dir,
|
|
40
|
+
runnableDir: argv['runnable-dir']
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.handler = handler;
|
|
44
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;AAEA,SAAgB,OAAO,CAAC,KAAiB;IACrC,KAAK;SACA,MAAM,CAAC,MAAM,EAAE;QACZ,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,IAAI;KAChB,CAAC;SACD,OAAO,CAAC,MAAM,EAAE;QACb,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,WAAW;KACvB,CAAC;SACD,OAAO,CAAC,KAAK,EAAE;QACZ,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;KACzB,CAAC;SACD,OAAO,CAAC,cAAc,EAAE;QACrB,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,EAAE;KACd,CAAC;SACD,OAAO,CAAC,WAAW,EAAE;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,MAAM;KAClB,CAAC;SACD,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AA1BD,0BA0BC;AAEM,KAAK,UAAU,OAAO,CAAC,IAAS;IACnC,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE;QACnB,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;KAC7C;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;QAC1B,OAAO,EAAE,IAAI,CAAC,IAAI;QAClB,OAAO,EAAE,IAAI,CAAC,IAAI;QAClB,OAAO,EAAE,IAAI,CAAC,GAAG;QACjB,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;KACpC,CAAC,CAAC;AACP,CAAC;AAVD,0BAUC"}
|
package/dist/index.js
CHANGED
|
@@ -5,42 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const yargs_1 = __importDefault(require("yargs"));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.option('port', {
|
|
11
|
-
alias: 'p',
|
|
12
|
-
description: 'port',
|
|
13
|
-
default: 3000
|
|
14
|
-
})
|
|
15
|
-
.options('host', {
|
|
16
|
-
alias: 'h',
|
|
17
|
-
description: 'hostname',
|
|
18
|
-
default: 'localhost'
|
|
19
|
-
})
|
|
20
|
-
.options('dir', {
|
|
21
|
-
alias: 'd',
|
|
22
|
-
description: 'root dir',
|
|
23
|
-
default: process.cwd()
|
|
24
|
-
})
|
|
25
|
-
.options('runnable-dir', {
|
|
26
|
-
description: 'runnable dir',
|
|
27
|
-
default: ''
|
|
28
|
-
})
|
|
29
|
-
.options('log-level', {
|
|
30
|
-
description: 'log level',
|
|
31
|
-
default: 'info'
|
|
32
|
-
})
|
|
33
|
-
.options('help', {}), async (argv) => {
|
|
34
|
-
if (argv['log-level']) {
|
|
35
|
-
process.env.LOG_LEVEL = argv['log-level'];
|
|
36
|
-
}
|
|
37
|
-
return require('./dev').start({
|
|
38
|
-
ssgPort: argv.port,
|
|
39
|
-
ssgHost: argv.host,
|
|
40
|
-
rootDir: argv.dir,
|
|
41
|
-
runnableDir: argv['runnable-dir']
|
|
42
|
-
});
|
|
43
|
-
})
|
|
44
|
-
.demandCommand()
|
|
45
|
-
.parse();
|
|
8
|
+
const command_1 = require("./command");
|
|
9
|
+
(0, yargs_1.default)(process.argv.slice(2)).command('$0', 'stackbit-dev', command_1.builder, command_1.handler).demandCommand().parse();
|
|
46
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,uCAA6C;AAE7C,IAAA,eAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,iBAAO,EAAE,iBAAO,CAAC,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -17,8 +17,8 @@ function watchDir(dir, onFileChange, throttleDelay = 1000) {
|
|
|
17
17
|
return (filePath.includes(`/.git/`) ||
|
|
18
18
|
filePath.includes(`/.next/`) ||
|
|
19
19
|
filePath.includes(`/.cache/`) ||
|
|
20
|
-
filePath.includes(`/node_modules
|
|
21
|
-
(filePath.includes(`/.`) && !filePath.includes(`/.stackbit
|
|
20
|
+
filePath.includes(`/node_modules`) ||
|
|
21
|
+
((filePath.includes(`/.`) || filePath.startsWith(`.`)) && !(filePath.includes(`/.stackbit`) || filePath.startsWith(`.stackbit`))));
|
|
22
22
|
},
|
|
23
23
|
persistent: true,
|
|
24
24
|
ignoreInitial: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-watcher.js","sourceRoot":"","sources":["../../src/services/file-watcher.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,gDAAwB;AACxB,wDAAgC;AAChC,sDAA8B;AAE9B,SAAgB,QAAQ,CAAC,GAAW,EAAE,YAA2C,EAAE,aAAa,GAAG,IAAI;IACnG,MAAM,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IACjD,gBAAM,CAAC,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,kBAAQ,CAAC,KAAK,CAAC,GAAG,EAAE;QAChC,GAAG,EAAE,OAAO;QACZ,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;YAClB,OAAO,CACH,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAC3B,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAC5B,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAC7B,QAAQ,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"file-watcher.js","sourceRoot":"","sources":["../../src/services/file-watcher.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,gDAAwB;AACxB,wDAAgC;AAChC,sDAA8B;AAE9B,SAAgB,QAAQ,CAAC,GAAW,EAAE,YAA2C,EAAE,aAAa,GAAG,IAAI;IACnG,MAAM,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IACjD,gBAAM,CAAC,KAAK,CAAC,yBAAyB,GAAG,OAAO,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,kBAAQ,CAAC,KAAK,CAAC,GAAG,EAAE;QAChC,GAAG,EAAE,OAAO;QACZ,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;YAClB,OAAO,CACH,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAC3B,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAC5B,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAC7B,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC;gBAClC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CACpI,CAAC;QACN,CAAC;QACD,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACtB,CAAC,CAAC;IACH,IAAI,YAAY,GAAa,EAAE,CAAC;IAChC,MAAM,mBAAmB,GAAG,gBAAC,CAAC,QAAQ,CAAC,GAAG,EAAE;QACxC,IAAI,YAAY,CAAC,MAAM,EAAE;YACrB,YAAY,CAAC,YAAY,CAAC,CAAC;YAC3B,YAAY,GAAG,EAAE,CAAC;SACrB;IACL,CAAC,EAAE,aAAa,CAAC,CAAC;IAClB,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAE,EAAE;QAC1C,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAClC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC/B;QACD,mBAAmB,EAAE,CAAC;IAC1B,CAAC,CAAC;IACF,OAAO;SACF,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC;SAC3B,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAC9B,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAC9B,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAC9B,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAEvC,OAAO,OAAO,CAAC;AACnB,CAAC;AAtCD,4BAsCC"}
|
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getUserId = void 0;
|
|
7
7
|
const configstore_1 = __importDefault(require("configstore"));
|
|
8
|
-
const uuid_1 =
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
9
|
const config = new configstore_1.default('stackbit-dev', {
|
|
10
|
-
userId: uuid_1.
|
|
10
|
+
userId: (0, uuid_1.v4)().toString().replace(/\-/g, '')
|
|
11
11
|
}, { globalConfigPath: true });
|
|
12
12
|
function getUserId() {
|
|
13
13
|
return config.get('userId');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-config.js","sourceRoot":"","sources":["../../src/services/user-config.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAsC;AACtC
|
|
1
|
+
{"version":3,"file":"user-config.js","sourceRoot":"","sources":["../../src/services/user-config.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAsC;AACtC,+BAAoC;AAEpC,MAAM,MAAM,GAAG,IAAI,qBAAW,CAC1B,cAAc,EACd;IACI,MAAM,EAAE,IAAA,SAAM,GAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;CACjD,EACD,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC7B,CAAC;AAEF,SAAgB,SAAS;IACrB,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAFD,8BAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackbit/dev",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "stackbit-dev",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@stackbit/cms-core": "^0.0.8",
|
|
26
|
-
"@stackbit/dev-common": "^0.0.
|
|
26
|
+
"@stackbit/dev-common": "^0.0.13",
|
|
27
27
|
"@stackbit/sdk": "^0.2.22",
|
|
28
28
|
"axios": "^0.25.0",
|
|
29
29
|
"chalk": "^4.1.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"http-proxy-middleware": "^0.20.0",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
38
|
"rimraf": "^3.0.2",
|
|
39
|
-
"uuid": "^3.
|
|
39
|
+
"uuid": "^8.3.2",
|
|
40
40
|
"winston": "^3.4.0",
|
|
41
41
|
"yargs": "^17.3.1"
|
|
42
42
|
},
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"ts-jest": "^27.1.3",
|
|
55
55
|
"typescript": "^4.5.4"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "6d9739126e1da0dd431a7c75585cacba805883bc"
|
|
58
58
|
}
|
|
@@ -30,15 +30,21 @@
|
|
|
30
30
|
fill: #f25458;
|
|
31
31
|
}
|
|
32
32
|
#info-text a {
|
|
33
|
-
color: #
|
|
33
|
+
color: #0b69db;
|
|
34
34
|
}
|
|
35
35
|
</style>
|
|
36
36
|
</head>
|
|
37
37
|
<body>
|
|
38
38
|
<div id="main-container">
|
|
39
|
-
<svg
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
<svg width="239" height="81" viewBox="0 0 239 81" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
40
|
+
<path d="M119.641 79.7368C141.383 79.7368 159.009 62.111 159.009 40.3684C159.009 18.6258 141.383 1 119.641 1C97.8983 1 80.2725 18.6258 80.2725 40.3684C80.2725 62.111 97.8983 79.7368 119.641 79.7368Z" stroke="#979797" stroke-miterlimit="10"/>
|
|
41
|
+
<path d="M198.538 79.7368C220.28 79.7368 237.906 62.111 237.906 40.3684C237.906 18.6258 220.28 1 198.538 1C176.795 1 159.169 18.6258 159.169 40.3684C159.169 62.111 176.795 79.7368 198.538 79.7368Z" stroke="#979797" stroke-miterlimit="10"/>
|
|
42
|
+
<path d="M1.37549 79.7369L80.2723 1.00006L159.009 79.7369L237.906 1.00006" stroke="#979797" stroke-miterlimit="10"/>
|
|
43
|
+
<path d="M1.37549 1.00006L80.2723 79.7369L159.009 1.00006L237.906 79.7369" stroke="#979797" stroke-miterlimit="10"/>
|
|
44
|
+
<path d="M40.7439 79.7369C62.4865 79.7369 80.1123 62.111 80.1123 40.3685C80.1123 18.6259 62.4865 1.00006 40.7439 1.00006C19.0013 1.00006 1.37549 18.6259 1.37549 40.3685C1.37549 62.111 19.0013 79.7369 40.7439 79.7369Z" stroke="#979797" stroke-miterlimit="10"/>
|
|
45
|
+
</svg>
|
|
46
|
+
<h1>Failed to connect to your site's local server</h1>
|
|
47
|
+
<div id="info-text">Your local stackbit dev cannot connect to the dev server of your site, which should be running at __URL__.<br/>Please check that it is up and running. <a href="https://docs.stackbit.com/how-to-guides/local-dev/#troubleshooting" target="_blank">Learn more.</a></div>
|
|
42
48
|
</div>
|
|
43
49
|
<script type="application/javascript">
|
|
44
50
|
function poll() {
|
package/src/command.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
|
|
3
|
+
export function builder(yargs: yargs.Argv) {
|
|
4
|
+
yargs
|
|
5
|
+
.option('port', {
|
|
6
|
+
alias: 'p',
|
|
7
|
+
description: 'port',
|
|
8
|
+
default: 3000
|
|
9
|
+
})
|
|
10
|
+
.options('host', {
|
|
11
|
+
alias: 'h',
|
|
12
|
+
description: 'hostname',
|
|
13
|
+
default: 'localhost'
|
|
14
|
+
})
|
|
15
|
+
.options('dir', {
|
|
16
|
+
alias: 'd',
|
|
17
|
+
description: 'root dir',
|
|
18
|
+
default: process.cwd()
|
|
19
|
+
})
|
|
20
|
+
.options('runnable-dir', {
|
|
21
|
+
description: 'runnable dir',
|
|
22
|
+
default: ''
|
|
23
|
+
})
|
|
24
|
+
.options('log-level', {
|
|
25
|
+
description: 'log level',
|
|
26
|
+
default: 'info'
|
|
27
|
+
})
|
|
28
|
+
.options('help', {});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function handler(argv: any) {
|
|
32
|
+
if (argv['log-level']) {
|
|
33
|
+
process.env.LOG_LEVEL = argv['log-level'];
|
|
34
|
+
}
|
|
35
|
+
return require('./dev').start({
|
|
36
|
+
ssgPort: argv.port,
|
|
37
|
+
ssgHost: argv.host,
|
|
38
|
+
rootDir: argv.dir,
|
|
39
|
+
runnableDir: argv['runnable-dir']
|
|
40
|
+
});
|
|
41
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,48 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import yargs from 'yargs';
|
|
4
|
+
import { builder, handler } from './command';
|
|
4
5
|
|
|
5
|
-
yargs(process.argv.slice(2))
|
|
6
|
-
.command(
|
|
7
|
-
'$0',
|
|
8
|
-
'stackbit-dev',
|
|
9
|
-
(yargs) =>
|
|
10
|
-
yargs
|
|
11
|
-
.option('port', {
|
|
12
|
-
alias: 'p',
|
|
13
|
-
description: 'port',
|
|
14
|
-
default: 3000
|
|
15
|
-
})
|
|
16
|
-
.options('host', {
|
|
17
|
-
alias: 'h',
|
|
18
|
-
description: 'hostname',
|
|
19
|
-
default: 'localhost'
|
|
20
|
-
})
|
|
21
|
-
.options('dir', {
|
|
22
|
-
alias: 'd',
|
|
23
|
-
description: 'root dir',
|
|
24
|
-
default: process.cwd()
|
|
25
|
-
})
|
|
26
|
-
.options('runnable-dir', {
|
|
27
|
-
description: 'runnable dir',
|
|
28
|
-
default: ''
|
|
29
|
-
})
|
|
30
|
-
.options('log-level', {
|
|
31
|
-
description: 'log level',
|
|
32
|
-
default: 'info'
|
|
33
|
-
})
|
|
34
|
-
.options('help', {}),
|
|
35
|
-
async (argv) => {
|
|
36
|
-
if (argv['log-level']) {
|
|
37
|
-
process.env.LOG_LEVEL = argv['log-level'];
|
|
38
|
-
}
|
|
39
|
-
return require('./dev').start({
|
|
40
|
-
ssgPort: argv.port,
|
|
41
|
-
ssgHost: argv.host,
|
|
42
|
-
rootDir: argv.dir,
|
|
43
|
-
runnableDir: argv['runnable-dir']
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
)
|
|
47
|
-
.demandCommand()
|
|
48
|
-
.parse();
|
|
6
|
+
yargs(process.argv.slice(2)).command('$0', 'stackbit-dev', builder, handler).demandCommand().parse();
|
|
@@ -13,8 +13,8 @@ export function watchDir(dir: string, onFileChange: (filePaths: string[]) => voi
|
|
|
13
13
|
filePath.includes(`/.git/`) ||
|
|
14
14
|
filePath.includes(`/.next/`) ||
|
|
15
15
|
filePath.includes(`/.cache/`) ||
|
|
16
|
-
filePath.includes(`/node_modules
|
|
17
|
-
(filePath.includes(`/.`) && !filePath.includes(`/.stackbit
|
|
16
|
+
filePath.includes(`/node_modules`) ||
|
|
17
|
+
((filePath.includes(`/.`) || filePath.startsWith(`.`)) && !(filePath.includes(`/.stackbit`) || filePath.startsWith(`.stackbit`)))
|
|
18
18
|
);
|
|
19
19
|
},
|
|
20
20
|
persistent: true,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Configstore from 'configstore';
|
|
2
|
-
import
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
|
|
4
4
|
const config = new Configstore(
|
|
5
5
|
'stackbit-dev',
|
|
6
6
|
{
|
|
7
|
-
userId:
|
|
7
|
+
userId: uuidv4().toString().replace(/\-/g, '')
|
|
8
8
|
},
|
|
9
9
|
{ globalConfigPath: true }
|
|
10
10
|
);
|