@cedarjs/structure 3.0.0-canary.13594 → 3.0.0-canary.13596
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/README.md +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -8
- package/dist/model/RWEnvHelper.js +1 -1
- package/dist/model/RWProject.d.ts +0 -6
- package/dist/model/RWProject.d.ts.map +1 -1
- package/dist/model/RWProject.js +7 -9
- package/dist/model/RWRouter.js +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ The most common use-case is getting the diagnostics of a complete Cedar project:
|
|
|
21
21
|
```ts
|
|
22
22
|
import { getProject } from '@cedarjs/structure'
|
|
23
23
|
async function test() {
|
|
24
|
-
const project = getProject(
|
|
24
|
+
const project = getProject()
|
|
25
25
|
for (const d of await project.collectDiagnostics()) {
|
|
26
26
|
console.log(d.diagnostic.severity + ': ' + d.diagnostic.message)
|
|
27
27
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { RWProject, RWRoute } from './model';
|
|
|
3
3
|
export { URL_file } from './x/URL';
|
|
4
4
|
import { RWProject } from './model';
|
|
5
5
|
import type { GetSeverityLabelFunction } from './x/diagnostics';
|
|
6
|
-
export declare function getProject(
|
|
7
|
-
export declare function printDiagnostics(
|
|
6
|
+
export declare function getProject(): RWProject;
|
|
7
|
+
export declare function printDiagnostics(opts?: {
|
|
8
8
|
getSeverityLabel?: GetSeverityLabelFunction;
|
|
9
9
|
}): Promise<void>;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAG/D,wBAAgB,UAAU,cAEzB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,CAAC,EAAE;IAC5C,gBAAgB,CAAC,EAAE,wBAAwB,CAAA;CAC5C,iBAkCA"}
|
package/dist/index.js
CHANGED
|
@@ -30,18 +30,18 @@ _Object$defineProperty(exports, "URL_file", {
|
|
|
30
30
|
});
|
|
31
31
|
exports.getProject = getProject;
|
|
32
32
|
exports.printDiagnostics = printDiagnostics;
|
|
33
|
+
var _projectConfig = require("@cedarjs/project-config");
|
|
33
34
|
var _diagnostics = require("./x/diagnostics");
|
|
34
35
|
var _model = require("./model");
|
|
35
36
|
var _URL = require("./x/URL");
|
|
36
|
-
function getProject(
|
|
37
|
-
return new _model.RWProject(
|
|
38
|
-
projectRoot
|
|
39
|
-
});
|
|
37
|
+
function getProject() {
|
|
38
|
+
return new _model.RWProject();
|
|
40
39
|
}
|
|
41
|
-
async function printDiagnostics(
|
|
42
|
-
const
|
|
40
|
+
async function printDiagnostics(opts) {
|
|
41
|
+
const base = (0, _projectConfig.getPaths)().base;
|
|
42
|
+
const project = getProject();
|
|
43
43
|
const formatOpts = {
|
|
44
|
-
cwd:
|
|
44
|
+
cwd: base,
|
|
45
45
|
...opts
|
|
46
46
|
};
|
|
47
47
|
try {
|
|
@@ -65,6 +65,9 @@ async function printDiagnostics(projectRoot, opts) {
|
|
|
65
65
|
process.exit(1);
|
|
66
66
|
}
|
|
67
67
|
} catch (e) {
|
|
68
|
-
|
|
68
|
+
if (e instanceof Error) {
|
|
69
|
+
throw e;
|
|
70
|
+
}
|
|
71
|
+
throw new Error(String(e));
|
|
69
72
|
}
|
|
70
73
|
}
|
|
@@ -84,7 +84,7 @@ let RWEnvHelper = exports.RWEnvHelper = (_dec = (0, _decorators.lazy)(), _dec2 =
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
_dotenv(f) {
|
|
87
|
-
const file = (0, _nodePath.join)(this.parent.
|
|
87
|
+
const file = (0, _nodePath.join)(this.parent.pathHelper.base, f);
|
|
88
88
|
if (!_nodeFs.default.existsSync(file)) {
|
|
89
89
|
return undefined;
|
|
90
90
|
}
|
|
@@ -10,18 +10,12 @@ import { RWRouter } from './RWRouter';
|
|
|
10
10
|
import { RWSDL } from './RWSDL';
|
|
11
11
|
import { RWService } from './RWService';
|
|
12
12
|
import { RWTOML } from './RWTOML';
|
|
13
|
-
export interface RWProjectOptions {
|
|
14
|
-
projectRoot: string;
|
|
15
|
-
}
|
|
16
13
|
/**
|
|
17
14
|
* Represents a Redwood project.
|
|
18
15
|
* This is the root node.
|
|
19
16
|
*/
|
|
20
17
|
export declare class RWProject extends BaseNode {
|
|
21
|
-
opts: RWProjectOptions;
|
|
22
|
-
constructor(opts: RWProjectOptions);
|
|
23
18
|
parent: undefined;
|
|
24
|
-
get projectRoot(): string;
|
|
25
19
|
get id(): string;
|
|
26
20
|
children(): (RWComponent | RWTOML | RWPage | RWRouter | RWService | RWSDL | RWLayout | RWEnvHelper)[];
|
|
27
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RWProject.d.ts","sourceRoot":"","sources":["../../src/model/RWProject.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAUpD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAUnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CA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,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAYhD,oBAAoB;IAQlC,IAAY,WAAW,IAAI,MAAM,CAEhC;IAEO,OAAO,KAAK,eAAe,GAMlC;IAED,IAAY,KAAK,IAAI,MAAM,EAAE,CAI5B;IAED,IAAY,MAAM,aAEjB;IACD,SAAS,iBAER;IAGD,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAO7B,IAAY,2BAA2B,WAGtC;IAED,IAAY,QAAQ,gBAMnB;IAED,IAAY,IAAI,YAIf;IAED,IAAY,OAAO,IAAI,QAAQ,EAAE,CAMhC;IAED,IAAY,SAAS,IAAI,UAAU,EAAE,CAKpC;IAED,IAAY,UAAU,IAAI,WAAW,EAAE,CAYtC;IAED,IAAY,KAAK,aAEhB;IAGD,IAAY,KAAK,aAEhB;IAED;;;QAGI;IACJ,IAAY,KAAK,IAAI,MAAM,EAAE,CAI5B;IAED,IAAY,SAAS,IAAI,WAAW,CAEnC;CACF"}
|
package/dist/model/RWProject.js
CHANGED
|
@@ -36,19 +36,15 @@ const allFilesGlob = '/**/*.{js,jsx,ts,tsx}';
|
|
|
36
36
|
* This is the root node.
|
|
37
37
|
*/
|
|
38
38
|
let RWProject = exports.RWProject = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.lazy)(), _dec3 = (0, _decorators.lazy)(), _dec4 = (0, _decorators.memo)(), _dec5 = (0, _decorators.memo)(), _dec6 = (0, _decorators.lazy)(), _dec7 = (0, _decorators.lazy)(), _dec8 = (0, _decorators.lazy)(), _dec9 = (0, _decorators.lazy)(), _dec0 = (0, _decorators.lazy)(), _dec1 = (0, _decorators.lazy)(), _dec10 = (0, _decorators.lazy)(), _dec11 = (0, _decorators.lazy)(), _dec12 = (0, _decorators.lazy)(), _dec13 = (0, _decorators.lazy)(), _dec14 = (0, _decorators.lazy)(), _dec15 = (0, _decorators.lazy)(), _dec16 = (0, _decorators.lazy)(), _dec17 = (0, _decorators.lazy)(), _class = class RWProject extends _nodes.BaseNode {
|
|
39
|
-
constructor(
|
|
40
|
-
super();
|
|
39
|
+
constructor(...args) {
|
|
40
|
+
super(...args);
|
|
41
41
|
this.parent = undefined;
|
|
42
42
|
this.getRouter = () => {
|
|
43
43
|
return new _RWRouter.RWRouter(this.pathHelper.web.routes, this);
|
|
44
44
|
};
|
|
45
|
-
this.opts = opts;
|
|
46
|
-
}
|
|
47
|
-
get projectRoot() {
|
|
48
|
-
return this.opts.projectRoot;
|
|
49
45
|
}
|
|
50
46
|
get id() {
|
|
51
|
-
return (0, _URL.URL_file)(this.
|
|
47
|
+
return (0, _URL.URL_file)(this.pathHelper.base);
|
|
52
48
|
}
|
|
53
49
|
children() {
|
|
54
50
|
return [this.redwoodTOML, ...this.pages, this.router, ...this.services, ...this.sdls, ...this.layouts, ...this.components, this.envHelper];
|
|
@@ -58,14 +54,16 @@ let RWProject = exports.RWProject = (_dec = (0, _decorators.lazy)(), _dec2 = (0,
|
|
|
58
54
|
* Path constants that are relevant to a Redwood project.
|
|
59
55
|
*/
|
|
60
56
|
get pathHelper() {
|
|
61
|
-
return (0, _projectConfig.getPaths)(
|
|
57
|
+
return (0, _projectConfig.getPaths)();
|
|
62
58
|
}
|
|
59
|
+
|
|
63
60
|
/**
|
|
64
61
|
* Checks for the presence of a tsconfig.json at the root.
|
|
65
62
|
*/
|
|
66
63
|
get isTypeScriptProject() {
|
|
67
64
|
return (0, _nodeFs.existsSync)((0, _nodePath.join)(this.pathHelper.web.base, 'tsconfig.json')) || (0, _nodeFs.existsSync)((0, _nodePath.join)(this.pathHelper.api.base, 'tsconfig.json'));
|
|
68
65
|
}
|
|
66
|
+
|
|
69
67
|
// TODO: do we move this to a separate node? (ex: RWDatabase)
|
|
70
68
|
async prismaDMMF() {
|
|
71
69
|
try {
|
|
@@ -89,7 +87,7 @@ let RWProject = exports.RWProject = (_dec = (0, _decorators.lazy)(), _dec2 = (0,
|
|
|
89
87
|
return (0, _map.default)(_context = dmmf.datamodel.models).call(_context, m => m.name);
|
|
90
88
|
}
|
|
91
89
|
get redwoodTOML() {
|
|
92
|
-
return new _RWTOML.RWTOML((0, _projectConfig.getConfigPath)(
|
|
90
|
+
return new _RWTOML.RWTOML((0, _projectConfig.getConfigPath)(), this);
|
|
93
91
|
}
|
|
94
92
|
get processPagesDir() {
|
|
95
93
|
try {
|
package/dist/model/RWRouter.js
CHANGED
|
@@ -102,7 +102,7 @@ let RWRouter = exports.RWRouter = (_dec = (0, _decorators.memo)(), _dec2 = (0, _
|
|
|
102
102
|
*diagnostics() {
|
|
103
103
|
if (!this.fileExists) {
|
|
104
104
|
// should we assign this error to the project? to cedar.toml?
|
|
105
|
-
const uri = (0, _URL.URL_file)((0, _projectConfig.getConfigPath)(
|
|
105
|
+
const uri = (0, _URL.URL_file)((0, _projectConfig.getConfigPath)());
|
|
106
106
|
const message = `Routes.js does not exist`;
|
|
107
107
|
yield (0, _diagnostics.err)(uri, message);
|
|
108
108
|
// TODO: add quickFix (create a simple Routes.js)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/structure",
|
|
3
|
-
"version": "3.0.0-canary.
|
|
3
|
+
"version": "3.0.0-canary.13596+e3364d309",
|
|
4
4
|
"description": "noun: the arrangement of and relations between the parts or elements of something complex",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/runtime-corejs3": "7.29.0",
|
|
29
|
-
"@cedarjs/project-config": "3.0.0-canary.
|
|
29
|
+
"@cedarjs/project-config": "3.0.0-canary.13596",
|
|
30
30
|
"@prisma/internals": "6.19.2",
|
|
31
31
|
"@types/line-column": "1.0.2",
|
|
32
32
|
"camelcase": "6.3.0",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"lodash": "4.17.23",
|
|
41
41
|
"lodash-decorators": "6.0.1",
|
|
42
42
|
"lru-cache": "11.2.7",
|
|
43
|
-
"proxyquire": "2.1.3",
|
|
44
43
|
"smol-toml": "1.6.0",
|
|
45
44
|
"ts-morph": "23.0.0",
|
|
46
45
|
"yargs-parser": "21.1.1"
|
|
@@ -56,5 +55,5 @@
|
|
|
56
55
|
"publishConfig": {
|
|
57
56
|
"access": "public"
|
|
58
57
|
},
|
|
59
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "e3364d3098475cbd73b315c90f60845f69838bc1"
|
|
60
59
|
}
|