pear-state 1.0.4 → 1.1.0
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/bare/env.js +1 -1
- package/index.js +7 -3
- package/node/env.js +1 -1
- package/package.json +4 -3
package/bare/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('bare-env')
|
|
1
|
+
module.exports = require('bare-env')
|
package/index.js
CHANGED
|
@@ -57,10 +57,11 @@ module.exports = class State {
|
|
|
57
57
|
if (state.manifest) return state.manifest
|
|
58
58
|
const originDir = state.dir
|
|
59
59
|
if (pkg === null && state.key === null) pkg = await this.localPkg(state)
|
|
60
|
-
if (pkg === null)
|
|
60
|
+
if (pkg === null) {
|
|
61
61
|
throw ERR_INVALID_PROJECT_DIR(
|
|
62
62
|
`"package.json not found from: ${originDir}. Pear project must have a package.json`
|
|
63
63
|
)
|
|
64
|
+
}
|
|
64
65
|
state.pkg = pkg
|
|
65
66
|
state.options = state.pkg?.pear ?? {}
|
|
66
67
|
|
|
@@ -69,10 +70,11 @@ module.exports = class State {
|
|
|
69
70
|
state.main = state.options.main ?? pkg?.main ?? 'index.js'
|
|
70
71
|
|
|
71
72
|
const invalidName = /^[@/a-z0-9-_]+$/.test(state.name) === false
|
|
72
|
-
if (invalidName)
|
|
73
|
+
if (invalidName) {
|
|
73
74
|
throw ERR_INVALID_APP_NAME(
|
|
74
75
|
'App name must be lowercase and one word, and may contain letters, numbers, hyphens (-), underscores (_), forward slashes (/) and asperands (@).'
|
|
75
76
|
)
|
|
77
|
+
}
|
|
76
78
|
|
|
77
79
|
state.links = {
|
|
78
80
|
...Object.fromEntries(Object.entries(state.options.links ?? {})),
|
|
@@ -86,6 +88,7 @@ module.exports = class State {
|
|
|
86
88
|
state.unrouted = Array.from(new Set([...unrouted, ...state.entrypoints]))
|
|
87
89
|
const { entrypoint, routed } = this.route(state)
|
|
88
90
|
state.entrypoint = entrypoint
|
|
91
|
+
state.entry = state.entrypoint === '/' ? '/' + state.main : state.entrypoint
|
|
89
92
|
state.routed = routed
|
|
90
93
|
state.manifest = { ...pkg, pear: state.options }
|
|
91
94
|
return state.manifest
|
|
@@ -307,11 +310,12 @@ module.exports = class State {
|
|
|
307
310
|
this.storage !== null &&
|
|
308
311
|
this.storage.startsWith(this.dir) &&
|
|
309
312
|
this.storage.includes(path.sep + 'pear' + path.sep + 'pear' + path.sep) === false
|
|
310
|
-
if (invalidStorage)
|
|
313
|
+
if (invalidStorage) {
|
|
311
314
|
throw ERR_INVALID_APP_STORAGE(
|
|
312
315
|
'Application Storage may not be inside the project directory. --store "' +
|
|
313
316
|
this.storage +
|
|
314
317
|
'" is invalid'
|
|
315
318
|
)
|
|
319
|
+
}
|
|
316
320
|
}
|
|
317
321
|
}
|
package/node/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = process.env
|
|
1
|
+
module.exports = process.env
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pear-state",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "Pear state",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"author": "Holepunch Inc",
|
|
13
13
|
"scripts": {
|
|
14
14
|
"format": "prettier --write .",
|
|
15
|
-
"lint": "prettier --check .",
|
|
15
|
+
"lint": "prettier --check . && lunte",
|
|
16
16
|
"test:gen": "brittle -r test/all.js test/*.test.js",
|
|
17
|
-
"test": "npm run test:
|
|
17
|
+
"test": "npm run test:node && npm run test:bare",
|
|
18
18
|
"test:bare": "brittle-bare --coverage test/all.js",
|
|
19
19
|
"test:node": "brittle-node --coverage test/all.js"
|
|
20
20
|
},
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"brittle": "^3.0.0",
|
|
41
|
+
"lunte": "^1.3.0",
|
|
41
42
|
"pear-errors": "^1.0.0",
|
|
42
43
|
"prettier": "^3.6.2",
|
|
43
44
|
"prettier-config-holepunch": "^2.0.0",
|