Project

General

Profile

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

hydrilla-source-package-example / index.json @ bea4923f

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

    
64
    // Where this software/work initially comes from.
65
    "upstream_url": "https://git.koszko.org/pydrilla/tree/src/test/example_content/hello",
66

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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