@angular-schule/prerender-format 0.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/LICENSE +20 -0
- package/README.md +188 -0
- package/application/builder.d.ts +9 -0
- package/application/builder.js +78 -0
- package/application/builder.js.map +1 -0
- package/application/file-format.d.ts +20 -0
- package/application/file-format.js +124 -0
- package/application/file-format.js.map +1 -0
- package/application/schema.json +800 -0
- package/application/ships-server.d.ts +4 -0
- package/application/ships-server.js +7 -0
- package/application/ships-server.js.map +1 -0
- package/builders.json +10 -0
- package/collection.json +11 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/ng-add-schema.json +17 -0
- package/ng-add.d.ts +7 -0
- package/ng-add.js +60 -0
- package/ng-add.js.map +1 -0
- package/package.json +62 -0
- package/public_api.d.ts +2 -0
- package/public_api.js +9 -0
- package/public_api.js.map +1 -0
- package/utils.d.ts +3 -0
- package/utils.js +25 -0
- package/utils.js.map +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shipsServer = shipsServer;
|
|
4
|
+
function shipsServer(options) {
|
|
5
|
+
return options.outputMode === 'server' || (options.outputMode === undefined && !!options.ssr);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ships-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ships-server.js","sourceRoot":"","sources":["../../application/ships-server.ts"],"names":[],"mappings":";;AAKA,kCAEC;AAFD,SAAgB,WAAW,CAAC,OAAgD;IAC1E,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAChG,CAAC","sourcesContent":["/**\n * Whether a build with these options ships an Angular SSR server.\n * With `outputMode: \"static\"` the SSR entry only renders at build time.\n * Without `outputMode`, an `ssr` option builds a server (legacy SSR).\n */\nexport function shipsServer(options: { outputMode?: unknown; ssr?: unknown }): boolean {\n return options.outputMode === 'server' || (options.outputMode === undefined && !!options.ssr);\n}\n"]}
|
package/builders.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "@angular-devkit/architect/src/builders-schema.json",
|
|
3
|
+
"builders": {
|
|
4
|
+
"application": {
|
|
5
|
+
"implementation": "./application/builder",
|
|
6
|
+
"schema": "./application/schema.json",
|
|
7
|
+
"description": "Build an application with @angular/build:application, optionally writing prerendered routes as 'foo.html' instead of 'foo/index.html'."
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
package/collection.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Switch the build target to @angular-schule/prerender-format with prerenderFormat 'file'",
|
|
6
|
+
"factory": "./ng-add#ngAdd",
|
|
7
|
+
"schema": "./ng-add-schema.json",
|
|
8
|
+
"aliases": ["install"]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public_api';
|
package/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./public_api"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B","sourcesContent":["export * from './public_api';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "prerender-format-ng-add-schematic",
|
|
4
|
+
"title": "@angular-schule/prerender-format ng-add schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The project whose build target should use prerenderFormat 'file'",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": [],
|
|
16
|
+
"additionalProperties": false
|
|
17
|
+
}
|
package/ng-add.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
+
interface NgAddOptions {
|
|
3
|
+
project: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const BUILDER_NAME = "@angular-schule/prerender-format:application";
|
|
6
|
+
export declare const ngAdd: (options: NgAddOptions) => (tree: Tree, context: SchematicContext) => Promise<import("@angular-devkit/schematics/src/tree/interface").Tree>;
|
|
7
|
+
export {};
|
package/ng-add.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = exports.BUILDER_NAME = void 0;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const ships_server_1 = require("./application/ships-server");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
exports.BUILDER_NAME = '@angular-schule/prerender-format:application';
|
|
9
|
+
const ANGULAR_BUILDER_NAME = '@angular/build:application';
|
|
10
|
+
const ngAdd = (options) => async (tree, context) => {
|
|
11
|
+
const host = (0, utils_1.createHost)(tree);
|
|
12
|
+
const { workspace } = await core_1.workspaces.readWorkspace('/', host);
|
|
13
|
+
if (!options.project) {
|
|
14
|
+
if (workspace.projects.size === 1) {
|
|
15
|
+
options.project = Array.from(workspace.projects.keys())[0];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new schematics_1.SchematicsException('There is more than one project in your workspace. Please select it manually by using the --project argument.');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const project = workspace.projects.get(options.project);
|
|
22
|
+
if (!project) {
|
|
23
|
+
throw new schematics_1.SchematicsException('The specified Angular project is not defined in this workspace');
|
|
24
|
+
}
|
|
25
|
+
if (project.extensions.projectType !== 'application') {
|
|
26
|
+
throw new schematics_1.SchematicsException(`@angular-schule/prerender-format requires an Angular project type of "application" in angular.json`);
|
|
27
|
+
}
|
|
28
|
+
const buildTarget = project.targets.get('build');
|
|
29
|
+
if (!buildTarget) {
|
|
30
|
+
throw new schematics_1.SchematicsException(`Cannot find build target for the Angular project "${options.project}" in angular.json.`);
|
|
31
|
+
}
|
|
32
|
+
if (buildTarget.builder !== ANGULAR_BUILDER_NAME && buildTarget.builder !== exports.BUILDER_NAME) {
|
|
33
|
+
throw new schematics_1.SchematicsException(`The build target of "${options.project}" uses "${buildTarget.builder}". ` +
|
|
34
|
+
`@angular-schule/prerender-format replaces "${ANGULAR_BUILDER_NAME}" only.`);
|
|
35
|
+
}
|
|
36
|
+
const configurationsWithServer = [
|
|
37
|
+
['options', buildTarget.options ?? {}],
|
|
38
|
+
...Object.entries(buildTarget.configurations ?? {}).map(([name, configuration]) => [`configuration "${name}"`, { ...buildTarget.options, ...configuration }])
|
|
39
|
+
]
|
|
40
|
+
.filter(([, options]) => (0, ships_server_1.shipsServer)(options))
|
|
41
|
+
.map(([name]) => name);
|
|
42
|
+
if (configurationsWithServer.length) {
|
|
43
|
+
throw new schematics_1.SchematicsException(`The build target of "${options.project}" ships an Angular SSR server (${configurationsWithServer.join(', ')}). ` +
|
|
44
|
+
`prerenderFormat "file" requires "outputMode": "static", because the SSR server looks up prerendered pages as 'index.html'. ` +
|
|
45
|
+
`Set "outputMode": "static" and run ng add again.`);
|
|
46
|
+
}
|
|
47
|
+
buildTarget.builder = exports.BUILDER_NAME;
|
|
48
|
+
buildTarget.options = { ...buildTarget.options, prerenderFormat: 'file' };
|
|
49
|
+
await core_1.workspaces.writeWorkspace(workspace, host);
|
|
50
|
+
context.logger.info('');
|
|
51
|
+
context.logger.info('🚀 @angular-schule/prerender-format is ready!');
|
|
52
|
+
context.logger.info('');
|
|
53
|
+
context.logger.info('Next steps:');
|
|
54
|
+
context.logger.info(' 1. Make sure your host serves foo.html under /foo without a redirect.');
|
|
55
|
+
context.logger.info(' 2. Build via: ng build');
|
|
56
|
+
context.logger.info(' 3. Have a nice day!');
|
|
57
|
+
return tree;
|
|
58
|
+
};
|
|
59
|
+
exports.ngAdd = ngAdd;
|
|
60
|
+
//# sourceMappingURL=ng-add.js.map
|
package/ng-add.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-add.js","sourceRoot":"","sources":["../ng-add.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAClD,2DAAyF;AAEzF,6DAAyD;AACzD,mCAAqC;AAMxB,QAAA,YAAY,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CAAC,+CAA+C,CAAC,CAAC;IACrE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACnC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;IAC/F,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAChD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAE7C,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAxEW,QAAA,KAAK,SAwEhB","sourcesContent":["import { workspaces } from '@angular-devkit/core';\nimport { SchematicContext, SchematicsException, Tree } from '@angular-devkit/schematics';\n\nimport { shipsServer } from './application/ships-server';\nimport { createHost } from './utils';\n\ninterface NgAddOptions {\n project: string;\n}\n\nexport const BUILDER_NAME = '@angular-schule/prerender-format:application';\nconst ANGULAR_BUILDER_NAME = '@angular/build:application';\n\nexport const ngAdd = (options: NgAddOptions) => async (tree: Tree, context: SchematicContext) => {\n const host = createHost(tree);\n const { workspace } = await workspaces.readWorkspace('/', host);\n\n if (!options.project) {\n if (workspace.projects.size === 1) {\n // If there is only one project, return that one.\n options.project = Array.from(workspace.projects.keys())[0];\n } else {\n throw new SchematicsException(\n 'There is more than one project in your workspace. Please select it manually by using the --project argument.'\n );\n }\n }\n\n const project = workspace.projects.get(options.project);\n if (!project) {\n throw new SchematicsException('The specified Angular project is not defined in this workspace');\n }\n\n if (project.extensions.projectType !== 'application') {\n throw new SchematicsException(\n `@angular-schule/prerender-format requires an Angular project type of \"application\" in angular.json`\n );\n }\n\n const buildTarget = project.targets.get('build');\n if (!buildTarget) {\n throw new SchematicsException(\n `Cannot find build target for the Angular project \"${options.project}\" in angular.json.`\n );\n }\n\n if (buildTarget.builder !== ANGULAR_BUILDER_NAME && buildTarget.builder !== BUILDER_NAME) {\n throw new SchematicsException(\n `The build target of \"${options.project}\" uses \"${buildTarget.builder}\". ` +\n `@angular-schule/prerender-format replaces \"${ANGULAR_BUILDER_NAME}\" only.`\n );\n }\n\n const configurationsWithServer = [\n ['options', buildTarget.options ?? {}] as const,\n ...Object.entries(buildTarget.configurations ?? {}).map(\n ([name, configuration]) =>\n [`configuration \"${name}\"`, { ...buildTarget.options, ...configuration }] as const\n )\n ]\n .filter(([, options]) => shipsServer(options))\n .map(([name]) => name);\n\n if (configurationsWithServer.length) {\n throw new SchematicsException(\n `The build target of \"${options.project}\" ships an Angular SSR server (${configurationsWithServer.join(', ')}). ` +\n `prerenderFormat \"file\" requires \"outputMode\": \"static\", because the SSR server looks up prerendered pages as 'index.html'. ` +\n `Set \"outputMode\": \"static\" and run ng add again.`\n );\n }\n\n buildTarget.builder = BUILDER_NAME;\n buildTarget.options = { ...buildTarget.options, prerenderFormat: 'file' };\n\n await workspaces.writeWorkspace(workspace, host);\n\n context.logger.info('');\n context.logger.info('🚀 @angular-schule/prerender-format is ready!');\n context.logger.info('');\n context.logger.info('Next steps:');\n context.logger.info(' 1. Make sure your host serves foo.html under /foo without a redirect.');\n context.logger.info(' 2. Build via: ng build');\n context.logger.info(' 3. Have a nice day!');\n\n return tree;\n};\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@angular-schule/prerender-format",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Angular application builder that writes prerendered routes as foo.html instead of foo/index.html (no trailing slash redirects)",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "^22.22.3 || ^24.15.0 || >=26.0.0",
|
|
9
|
+
"npm": ">=10.0.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"prebuild": "rimraf dist",
|
|
13
|
+
"build": "tsc -p tsconfig.build.json",
|
|
14
|
+
"postbuild": "copyfiles builders.json collection.json ng-add-schema.json package.json application/schema.json dist && copyfiles -f ../README.md ../LICENSE dist",
|
|
15
|
+
"build:schema": "node scripts/build-schema.mjs",
|
|
16
|
+
"test": "node scripts/build-schema.mjs --check && vitest run"
|
|
17
|
+
},
|
|
18
|
+
"schematics": "./collection.json",
|
|
19
|
+
"builders": "./builders.json",
|
|
20
|
+
"ng-add": {
|
|
21
|
+
"save": "devDependencies"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/angular-schule/prerender-format.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"angular",
|
|
29
|
+
"angular-cli",
|
|
30
|
+
"builder",
|
|
31
|
+
"prerender",
|
|
32
|
+
"ssg",
|
|
33
|
+
"static site",
|
|
34
|
+
"trailing slash",
|
|
35
|
+
"github pages",
|
|
36
|
+
"cloudflare pages"
|
|
37
|
+
],
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Angular.Schule (by Johannes Hoppe)"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/angular-schule/prerender-format/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/angular-schule/prerender-format/#readme",
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@angular/build": "^22.0.7",
|
|
48
|
+
"@types/node": "^24.0.0",
|
|
49
|
+
"copyfiles": "^2.4.1",
|
|
50
|
+
"rimraf": "^6.0.1",
|
|
51
|
+
"typescript": "~6.0.3",
|
|
52
|
+
"vitest": "^4.0.8"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@angular-devkit/architect": ">=0.2200.0 <0.2300.0",
|
|
56
|
+
"@angular-devkit/core": ">=22.0.0 <23.0.0",
|
|
57
|
+
"@angular-devkit/schematics": ">=22.0.0 <23.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@angular/build": ">=22.0.0 <23.0.0"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/public_api.d.ts
ADDED
package/public_api.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toFilePath = exports.toFileOutput = exports.executeBuild = void 0;
|
|
4
|
+
var builder_1 = require("./application/builder");
|
|
5
|
+
Object.defineProperty(exports, "executeBuild", { enumerable: true, get: function () { return builder_1.executeBuild; } });
|
|
6
|
+
var file_format_1 = require("./application/file-format");
|
|
7
|
+
Object.defineProperty(exports, "toFileOutput", { enumerable: true, get: function () { return file_format_1.toFileOutput; } });
|
|
8
|
+
Object.defineProperty(exports, "toFilePath", { enumerable: true, get: function () { return file_format_1.toFilePath; } });
|
|
9
|
+
//# sourceMappingURL=public_api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../public_api.ts"],"names":[],"mappings":";;;AAAA,iDAA8E;AAArE,uGAAA,YAAY,OAAA;AACrB,yDAAqE;AAA5D,2GAAA,YAAY,OAAA;AAAE,yGAAA,UAAU,OAAA","sourcesContent":["export { executeBuild, PrerenderFormat, Schema } from './application/builder';\nexport { toFileOutput, toFilePath } from './application/file-format';\n"]}
|
package/utils.d.ts
ADDED
package/utils.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHost = createHost;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
function createHost(tree) {
|
|
6
|
+
return {
|
|
7
|
+
async readFile(path) {
|
|
8
|
+
const data = tree.read(path);
|
|
9
|
+
if (!data) {
|
|
10
|
+
throw new schematics_1.SchematicsException('File not found.');
|
|
11
|
+
}
|
|
12
|
+
return data.toString('utf-8');
|
|
13
|
+
},
|
|
14
|
+
async writeFile(path, data) {
|
|
15
|
+
return tree.overwrite(path, data);
|
|
16
|
+
},
|
|
17
|
+
async isDirectory(path) {
|
|
18
|
+
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
|
19
|
+
},
|
|
20
|
+
async isFile(path) {
|
|
21
|
+
return tree.exists(path);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
package/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":";;AAGA,gCAmBC;AArBD,2DAAuE;AAEvE,SAAgB,UAAU,CAAC,IAAU;IACnC,OAAO;QACL,KAAK,CAAC,QAAQ,CAAC,IAAY;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,gCAAmB,CAAC,iBAAiB,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,IAAY;YACxC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,IAAY;YAC5B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,IAAY;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { workspaces } from '@angular-devkit/core';\nimport { SchematicsException, Tree } from '@angular-devkit/schematics';\n\nexport function createHost(tree: Tree): workspaces.WorkspaceHost {\n return {\n async readFile(path: string): Promise<string> {\n const data = tree.read(path);\n if (!data) {\n throw new SchematicsException('File not found.');\n }\n return data.toString('utf-8');\n },\n async writeFile(path: string, data: string): Promise<void> {\n return tree.overwrite(path, data);\n },\n async isDirectory(path: string): Promise<boolean> {\n return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;\n },\n async isFile(path: string): Promise<boolean> {\n return tree.exists(path);\n }\n };\n}\n"]}
|