Project

General

Profile

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

hydrilla-source-package-example / index.json @ 26c46224

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 site content. As you
7
// can see, for storing site content information Hydrilla utilizes JSON with an
8
// additional 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
// Various kinds of objects contain version information. Version is always an
29
// array of integers, with major version number being the first array item. When
30
// applicable, a version is accompanied by a revision field which contains a
31
// positive integer. If versions specified by arrays of different length need to
32
// be compared, the shorter array gets padded with zeroes on the right. This
33
// means that for example version 1.3 could be given as both [1, 3] and
34
// [1, 3, 0, 0] (aka 1.3.0.0) and either would mean the same.
35

    
36
{
37
    // Once our index.json schema changes, this field's value will change. Our
38
    // software will be able to handle both current and older formats thanks to
39
    // this information present in every index.json file. Schemas that differ by
40
    // the first (major) number are always incompatible (e.g. a Hydrilla builder
41
    // instance released at the time of 1.2 being the most recent schema version
42
    // will not understand version 2.0).
43
    // Schemas that are backwards-compatible will have the same major number
44
    // and might differ by the second (minor) version number. The third (patch)
45
    // and subsequent numbers are being ignored right now.
46
    "source_schema_version": [1],
47

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

    
53
    // This property lists files that contain copyright information regarding
54
    // this source package as well as texts of licenses used. Although no
55
    // specific format of these files is mandated, it is recommended to make
56
    // each source package REUSE-compliant, generate an spdx report for it as
57
    // `report.spdx` and list this report together with all license files here.
58
    "copyright":  [
59
	{"file": "report.spdx"},
60
	{"file": "LICENSES/CC0-1.0.txt"}
61
    ],
62

    
63
    // Where this software/work initially comes from.
64
    "upstream_url": "https://git.koszko.org/hydrilla-source-package-example",
65

    
66
    // Additional "comment" field can be used if needed.
67
    // "comment": ""
68

    
69
    // List of actual site resources and pattern->payload mappings. Each of them
70
    // is represented by an object. Meta-sites and replacement site interfaces
71
    // will also belong here once they get implemented.
72
    "definitions": [
73
	{
74
	    // Value of "type" can currently be one of: "resource" and
75
	    // "mapping". The one we have here, "resource", defines a list
76
	    // of injectable scripts that can be used as a payload or as a
77
	    // dependency of another "resource". In the future CSS style sheets
78
	    // and WASM modules will also be composite parts of a "resource" as
79
	    // scripts are now.
80
	    "type": "resource",
81

    
82
	    // Used when referring to this resource in "dependencies" list of
83
	    // another resource or in "payload" field of a mapping. Should
84
	    // be consize and can only use a restricted set of characters. It
85
	    // has to match: [-0-9a-z]+
86
	    "identifier": "helloapple",
87

    
88
	    // "long_name" should be used to specify a user-friendly alternative
89
	    // to an identifier. It should generally not collide with a long
90
	    // name of some resource with a different uuid and also shouldn't
91
	    // change in-between versions of the same resource, although
92
	    // exceptions to both rules might be considered. Long name is
93
	    // allowed to contain arbitrary unicode characters (within reason!).
94
	    "long_name": "Hello Apple",
95

    
96
	    // Different versions (e.g. 1.0 and 1.3) of the same resource can be
97
	    // defined in separate index.json files. This makes it easy to
98
	    // accidently cause an identifier clash. To help detect it, we
99
	    // require that each resource has a uuid associated with it. Attempt
100
	    // to define multiple resources with the same identifier and
101
	    // different uuids will result in an error being reported. Defining
102
	    // multiple resources with different identifiers and the same uuid
103
	    // is disallowed for now (it may be later permitted if we consider
104
	    // it good for some use-case).
105
	    "uuid": "a6754dcb-58d8-4b7a-a245-24fd7ad4cd68",
106

    
107
	    // Version should match the upstream version of the resource (e.g. a
108
	    // version of javascript library). Revision number starts as 1 for
109
	    // each new resource version and gets incremented by 1 each time a
110
	    // modification to the packaging of this version is done. Hydrilla
111
	    // will allow multiple definitions of the same resource to load, as
112
	    // long as their versions differ. Thanks to the "version" and
113
	    // "revision" fields, clients will know they have to update certain
114
	    // resource after it has been updated. If multiple definitions of
115
	    // the same version of given resource are provided, an error is
116
	    // generated (even if those definitions differ by revision number).
117
	    "version": [2021, 11, 10],
118
	    "revision": 1,
119

    
120
	    // A short, meaningful description of what the resource is and/or
121
	    // what it does.
122
	    "description": "greets an apple",
123

    
124
	    // If needed, a "comment" field can be added to provide some
125
	    // additional information.
126
	    // "comment": "this resource something something",
127

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

    
133
	    // Array of javascript files that belong to this resource.
134
	    "scripts": [
135
		{"file": "hello.js"},
136
		{"file":   "bye.js"}
137
	    ]
138
	}, {
139
	    "type":	   "resource",
140
	    "identifier":  "hello-message",
141
	    "long_name":   "Hello Message",
142
	    "uuid":	   "1ec36229-298c-4b35-8105-c4f2e1b9811e",
143
	    "version":     [2021, 11, 10],
144
	    "revision":    2,
145
	    "description": "define messages for saying hello and bye",
146
	    // If "dependencies" is empty, it can also be omitted.
147
	    // "dependencies": [],
148
	    "scripts": [{"file": "message.js"}]
149
	}, {
150
	    "type": "mapping",
151

    
152
	    // Has similar function to resource's identifier. Should be consize
153
	    // and can only use a restricted set of characters. It has to match:
154
	    // [-0-9a-z]+
155
	    // It can be the same as some resource identifier (those are
156
	    // different entities and are treated separately).
157
	    "identifier": "helloapple",
158

    
159
	    // "long name" and "uuid" have the same meaning as in the case of
160
	    // resources. Uuids of a resource and a mapping can technically be
161
	    // the same, but it is recommended to avoid even this kind of
162
	    // repetition.
163
	    "long_name": "Hello Apple",
164
	    "uuid": "54d23bba-472e-42f5-9194-eaa24c0e3ee7",
165

    
166
	    // "version" differs from its counterpart in resource in that it has
167
	    // no accompanying revision number.
168
	    "version": [2021, 11, 10],
169

    
170
	    // A short, meaningful description of what the mapping does.
171
	    "description": "causes apple to get greeted on Hydrillabugs issue tracker",
172

    
173
	    // A comment, if necessary.
174
	    // "comment": "blah blah because bleh"
175

    
176
	    // The "payloads" object specifies which payloads are to be applied
177
	    // to which URLs.
178
	    "payloads": {
179
		// Each key should be a valid Haketilo URL pattern.
180
		"https://hydrillabugs.koszko.org/***": {
181
		    // Should be the name of an existing resource. The resource
182
		    // may, but doesn't have to, be defined in the same
183
		    // index.json file.
184
		    "identifier": "helloapple"
185
		},
186
		// More associations may follow.
187
		"https://hachettebugs.koszko.org/***": {
188
		    "identifier": "helloapple"
189
		}
190
	    }
191
	}
192
    ],
193
    // We can also list additional files to include in the produced source
194
    // archive. Hydrilla builder will then include those together with all
195
    // script and copyright files used.
196
    "additional_files": [
197
	{"file": "README.txt"},
198
	{"file": "README.txt.license"},
199
	{"file": ".reuse/dep5"}
200
    ],
201
    // We can optionally tell Hydrilla builder to run the REUSE tool to generate
202
    // report.spdx file. Using this option requires REUSE to be installed and
203
    // and importable in the Python virtualenv used by Hydrilla builder.
204
    "reuse_generate_spdx_report": true
205
}
(5-5/6)