iceforge-asis 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Caitlin Salt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # iceforge-asis
2
+ "As-is" plugin for the [Iceforge](https://github.com/caitlinsalt/iceforge) static site generator.
3
+
4
+ In operation, Iceforge processes files whose extensions (or names in general) match patterns it knows about, and passes other files through unchanged.
5
+
6
+ However, out of the box, Iceforge installs handlers for JSON and Markdown files which render them through templates, making it impossible for your site to deliver a file named `example.json` or `something.md`.
7
+
8
+ Enter `iceforge-asis`. It lets you pass files through unchanged, aside from removing `.asis` from the filename.
9
+
10
+ ## Usage
11
+
12
+ 1. In your Iceforge site, install iceforge-asis with `npm i iceforge-asis`.
13
+ 2. In your site `config.json`, add `iceforge-asis` to the plugins section.
14
+ 3. Rename the JSON or MD files you need to deliver unchanged, by adding `.asis` to the extension. For example, `example.json` becomes `example.json.asis`
15
+
16
+ Iceforge's build process will rename the file back to `example.json`, but will not process the file itself.
17
+
18
+ iceforge-asis is based on the [wintersmith-asis](https://github.com/luckyrandom/wintersmith-asis) plugin for the [Wintersmith](https://wintersmith.io/) static site generator, written by Chenliang Xu.
@@ -0,0 +1,10 @@
1
+ import { FilePath, IEnvironment, StaticFile } from 'iceforge';
2
+ export declare class AsisFile extends StaticFile {
3
+ constructor(filepath: FilePath);
4
+ get name(): string;
5
+ get filename(): string;
6
+ get pluginColour(): string;
7
+ static fromFile(filepath: FilePath): Promise<AsisFile>;
8
+ }
9
+ declare const registerPlugin: (env: IEnvironment) => Promise<void>;
10
+ export default registerPlugin;
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ import { StaticFile } from 'iceforge';
2
+ export class AsisFile extends StaticFile {
3
+ constructor(filepath) {
4
+ super(filepath);
5
+ }
6
+ get name() {
7
+ return 'AsisFile';
8
+ }
9
+ get filename() {
10
+ let rv = super.filename;
11
+ rv = rv.replace(/\.asis$/, '');
12
+ rv = rv.replace(/(^|\/)_asis_\.(?=[^/]*$)/, '/');
13
+ return rv;
14
+ }
15
+ get pluginColour() {
16
+ return 'blue';
17
+ }
18
+ static async fromFile(filepath) {
19
+ return new AsisFile(filepath);
20
+ }
21
+ }
22
+ const registerPlugin = async (env) => {
23
+ env.registerContentPlugin('asis', '**/*.asis', AsisFile);
24
+ env.registerContentPlugin('asis', '**/_asis_.*', AsisFile);
25
+ };
26
+ export default registerPlugin;
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "iceforge-asis",
3
+ "version": "1.0.0",
4
+ "description": "As-is plugin for the Iceforge static site generator",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "dev": "tsc --watch",
13
+ "prepack": "tsc",
14
+ "lint": "eslint --ext .js,.ts --ignore-path .eslintignore",
15
+ "test": "vitest"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/caitlinsalt/iceforge-asis.git"
20
+ },
21
+ "author": "Caitlin Salt",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/caitlinsalt/iceforge-asis/issues"
25
+ },
26
+ "homepage": "https://github.com/caitlinsalt/iceforge-asis#readme",
27
+ "dependencies": {
28
+ "iceforge": "^1.0.2"
29
+ },
30
+ "devDependencies": {
31
+ "@typescript-eslint/eslint-plugin": "^7.13.1",
32
+ "@typescript-eslint/parser": "^7.13.1",
33
+ "eslint": "^8.57.0",
34
+ "typescript": "^5.4.5",
35
+ "vitest": "^1.6.0",
36
+ "winston": "^3.13.0"
37
+ }
38
+ }