Project

General

Profile

Download (10.1 KB) Statistics
| Branch: | Revision:

hydrilla-source-package-example / index.json @ 48a440fd

1
// SPDX-License-Identifier: CC0-1.0
2

    
3
// Copyright (C) 2021, 2022 Wojtek Kosior <koszko@koszko.org>
4
// Available under the terms of Creative Commons Zero v1.0 Universal.
5

    
6
// This is an example index.json file describing Hydrilla packages. As you can
7
// see, for storing this information Hydrilla utilizes JSON with an additional
8
// extension in the form of '//' comments support.
9

    
10
// An index.json file conveys definitions of site resources and pattern->payload
11
// mappings. The definitions may reference files under index.json's containing
12
// directory, using relative paths. This is how scripts, license texts, etc. are
13
// included.
14
// File reference always takes the form of an object with "file" property
15
// specifying path to the file. In certain contexts additional properties may be
16
// allowed or required. Unix paths (using '/' as separator) are assumed. It is
17
// not allowed for an index.json file to reference files outside its directory.
18

    
19
// Certain objects are allowed to contain a "comment" field. Although '//'
20
// comments can be used in index.json files, they will not be included in
21
// generated JSON definitions. If a comment should be included in the
22
// definitions served by Hydrilla API, it should be put in a "comment" field of
23
// the proper object.
24

    
25
// Unknown object properties will be ignored. This is for compatibility with
26
// possible future revisions of the format.
27
{
28
    // Once our index.json schema changes, this field's value will change. Our
29
    // software will be able to handle both current and older formats thanks to
30
    // this information present in every index.json file. Schemas that differ by
31
    // the first (major) number are always incompatible (e.g. a Hydrilla builder
32
    // instance released at the time of 1.2 being the most recent schema version
33
    // will not understand version 2.1).
34
    // Schemas that are backwards-compatible will have the same major number
35
    // and might differ by the second (minor) version number. The third (patch)
36
    // and subsequent numbers are being ignored right now.
37
    "$schema": "https://hydrilla.koszko.org/schemas/package_source-1.schema.json",
38

    
39
    // Used when referring to this source package. Should be consize, unique
40
    // (among other source package names) and can only use a restricted set of
41
    // characters. It has to match: [-0-9a-z.]+
42
    "source_name": "hello",
43

    
44
    // This property lists files that contain copyright information regarding
45
    // this source package as well as texts of licenses used. Although no
46
    // specific format of these files is mandated, it is recommended to make
47
    // each source package REUSE-compliant, generate an spdx report for it as
48
    // `report.spdx` and list this report together with all license files here.
49
    "copyright":  [
50
	{"file": "report.spdx"},
51
	{"file": "LICENSES/CC0-1.0.txt"}
52
    ],
53

    
54
    // Where this software/work initially comes from.
55
    "upstream_url": "https://git.koszko.org/hydrilla-source-package-example",
56

    
57
    // Additional "comment" field can be used if needed.
58
    // "comment": ""
59

    
60
    // List of actual site resources and pattern->payload mappings. Each of them
61
    // is represented by an object. Meta-sites and replacement site interfaces
62
    // will also belong here once they get implemented.
63
    "definitions": [
64
	{
65
	    // Value of "type" can currently be one of: "resource", "mapping"
66
	    // and "mapping_and_resource" for a combined definition. The one we
67
	    // have here, "mapping", associates resources with pages on which
68
	    // they are to be used.
69
	    "type": "mapping",
70

    
71
	    // Used when referring to this mapping in "required_mappings" list
72
	    // of another item. Should be consize and can only use a restricted
73
	    // set of characters. It has to match: [-0-9a-z]+
74
	    "identifier": "helloapple",
75

    
76
	    // "long_name" should be used to specify a user-friendly alternative
77
	    // to an identifier. It should generally not collide with a long
78
	    // name of some resource with a different UUID and also shouldn't
79
	    // change in-between versions of the same resource, although
80
	    // exceptions to both rules might be considered. Long name is
81
	    // allowed to contain arbitrary unicode characters (within reason!).
82
	    "long_name": "Hello Apple",
83

    
84
	    // Item definitions contain version information. Version is
85
	    // represented as an array of integers, with major version number
86
	    // being the first array item. In case of resources, version is
87
	    // accompanied by a revision field which contains a positive
88
	    // integer. If versions specified by arrays of different length need
89
	    // to be compared, the shorter array gets padded with zeroes on the
90
	    // right. This means that for example version 1.3 could be given as
91
	    // both [1, 3] and [1, 3, 0, 0] (aka 1.3.0.0) and either would mean
92
	    // the same.
93
	    // Different versions (e.g. 1.0 and 1.3) of the same resource can be
94
	    // defined in separate index.json files. This makes it easy to
95
	    // accidently cause an identifier clash. To help detect it, we allow
96
	    // each item to have a UUID associated with it. Attempt to define
97
	    // multiple mapping with the same identifier and different UUIDs
98
	    // will result in an error being reported. Defining multiple
99
	    // mappings with different identifiers and the same UUID is
100
	    // disallowed for now (it may be later permitted if we consider it
101
	    // good for some use-case).
102
	    // As of package source schema version 2.0, UUIDs are optional and
103
	    // can be omitted.
104
	    "uuid": "54d23bba-472e-42f5-9194-eaa24c0e3ee7",
105

    
106
	    // Thanks to the "version" field (and "revision" field in case of
107
	    // "resource" or "mapping_and_resource", clients will know they have
108
	    // to update certain item after a new version has appeared in the
109
	    // repository. If multiple definitions of the same version of given
110
	    // item are provided to Hydrilla server, an error is generated.
111
	    // "version" differs from its counterpart in resource in that it has
112
	    // no accompanying revision number. For combined definitions with
113
	    // "mapping_and_resource" as type, the value of "revision" is
114
	    // appended as the last component of the resulting mapping's
115
	    // version. If type is simply "mapping", revision number is ignored.
116
	    "version": [2021, 11, 10],
117

    
118
	    // A short, meaningful description of what the mapping does.
119
	    "description": "causes apple to get greeted on Hydrillabugs issue tracker",
120

    
121
	    // If needed, a "comment" field can be added to provide some
122
	    // additional information.
123
	    // "comment": "this resource something something",
124

    
125
	    // The "payloads" object specifies which payloads are to be applied
126
	    // to which URLs.
127
	    "payloads": {
128
		// Each key should be a valid Haketilo URL pattern.
129
		"https://hydrillabugs.koszko.org/***": {
130
		    // Should be the name of an existing resource. The resource
131
		    // may, but doesn't have to, be defined in the same
132
		    // index.json file.
133
		    "identifier": "helloapple"
134
		},
135
		// More associations may follow.
136
		"https://hachettebugs.koszko.org/***": {
137
		    "identifier": "helloapple"
138
		}
139
	    }
140
	}, {
141
	    // A "resource" item defines a list of injectable scripts that can
142
	    // be used as a payload or as a dependency of another "resource". In
143
	    // the future CSS style sheets and WASM modules will also be
144
	    // composite parts of a "resource" as scripts are now.
145
	    "type": "resource",
146

    
147
	    // Has similar function to mapping's identifier. Used when
148
	    // referring to this resource in "dependencies" list of another
149
	    // resource or in "payload" field of a mapping. Should be consize
150
	    // and can only use a restricted set of characters. It has to match:
151
	    // [-0-9a-z]+
152
	    // It can be the same as some mapping identifier (those are
153
	    // different entities and are treated separately).
154
	    "identifier": "helloapple",
155

    
156
	    // "long name" and "uuid" have the same meaning as in the case of
157
	    // resources and "uuid" is also optional. UUIDs of a resource and a
158
	    // mapping can technically be the same but it is recommended to
159
	    // avoid even this kind of repetition.
160
	    "long_name": "Hello Apple",
161
	    "uuid": "a6754dcb-58d8-4b7a-a245-24fd7ad4cd68",
162

    
163
	    // Version should match the upstream version of the resource (e.g. a
164
	    // version of JavaScript library). Revision number starts as 1 for
165
	    // each new resource version and gets incremented by 1 each time a
166
	    // modification to the packaging of this version is done.
167
	    // If multiple definitions of the same version of given resource are
168
	    // provided to Hydrilla server, an error is generated (even if those
169
	    // definitions differ by revision number).
170
	    "version": [2021, 11, 10],
171
	    "revision": 1,
172

    
173
	    // A short, meaningful description of what the resource is and/or
174
	    // what it does.
175
	    "description": "greets an apple",
176

    
177
	    // A comment, if necessary.
178
	    // "comment": "blah blah because bleh"
179

    
180
	    // Resource's "dependencies" array shall contain names of other
181
	    // resources that (in case of scripts at least) should get evaluated
182
	    // on a page before this resource's own scripts.
183
	    "dependencies": [{"identifier": "hello-message"}],
184

    
185
	    // Array of JavaScript files that belong to this resource.
186
	    "scripts": [
187
		{"file": "hello.js"},
188
		{"file":   "bye.js"}
189
	    ]
190
	}, {
191
	    "type":	   "resource",
192
	    "identifier":  "hello-message",
193
	    "long_name":   "Hello Message",
194
	    "uuid":	   "1ec36229-298c-4b35-8105-c4f2e1b9811e",
195
	    "version":     [2021, 11, 10],
196
	    "revision":    2,
197
	    "description": "define messages for saying hello and bye",
198
	    // If "dependencies" is empty, it can also be omitted.
199
	    // "dependencies": [],
200
	    "scripts": [{"file": "message.js"}]
201
	}
202
    ],
203
    // We can also list additional files to include in the produced source
204
    // archive. Hydrilla builder will then include those together with all
205
    // script and copyright files used.
206
    "additional_files": [
207
	{"file": "README.txt"},
208
	{"file": "README.txt.license"},
209
	{"file": ".reuse/dep5"}
210
    ],
211
    // We can optionally tell Hydrilla builder to run the REUSE tool to generate
212
    // report.spdx file. Using this option requires REUSE to be installed and
213
    // and importable in the Python virtualenv used by Hydrilla builder.
214
    "reuse_generate_spdx_report": true
215
}
(5-5/6)