docker-composer 4.1.3 → 5.0.1
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/README.md +3 -4
- package/ReleaseNotes.md +8 -0
- package/index.js +11 -15
- package/lib/lib.js +24 -0
- package/package.json +8 -6
- package/scripts/compile-ts-types.js +16 -0
- package/CODE_OF_CONDUCT.md +0 -76
- package/compile-ts-types.js +0 -10
package/README.md
CHANGED
|
@@ -14,8 +14,7 @@ Docker Compose Reference is [HERE](https://docs.docker.com/compose/compose-file/
|
|
|
14
14
|
|
|
15
15
|
### Changes of the Latest Release
|
|
16
16
|
|
|
17
|
-
## Version
|
|
18
|
-
- Remove gulp
|
|
17
|
+
## Version 5.0.1 (19.09.2023)
|
|
19
18
|
- Update dependencies
|
|
20
19
|
|
|
21
20
|
You can find all Release Notes [HERE](https://github.com/tudvari/docker-composer/blob/master/ReleaseNotes.md).
|
|
@@ -24,9 +23,9 @@ You can find all Release Notes [HERE](https://github.com/tudvari/docker-composer
|
|
|
24
23
|
|
|
25
24
|
```javascript
|
|
26
25
|
|
|
27
|
-
const composer = require('docker-composer')
|
|
26
|
+
const composer = require('docker-composer');
|
|
28
27
|
.
|
|
29
|
-
|
|
28
|
+
const generatedYML = composer.generate(inputJSON);
|
|
30
29
|
```
|
|
31
30
|
|
|
32
31
|
## Full Example
|
package/ReleaseNotes.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
+
## Version 5.0.1 (19.09.2023)
|
|
4
|
+
- Update dependencies
|
|
5
|
+
|
|
6
|
+
## Version 5.0.0 (29.12.2022)
|
|
7
|
+
- Reorganize code base
|
|
8
|
+
- Update dependencies
|
|
9
|
+
- Change code style
|
|
10
|
+
|
|
3
11
|
## Version 4.1.3 (22.12.2022)
|
|
4
12
|
- Remove gulp
|
|
5
13
|
- Update dependencies
|
package/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if ( !v.validate(inputJSON, schema).valid )
|
|
11
|
-
throw new Error('Invalid input!')
|
|
12
|
-
|
|
13
|
-
return YAML.stringify( inputJSON )
|
|
1
|
+
const lib = require('./lib/lib.js');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generate compose file from a JSON document
|
|
5
|
+
* @param {string} inputJSON - JSON document, what represent the compose file.
|
|
6
|
+
* @return {string} The generated compose file in YAML format.
|
|
7
|
+
*/
|
|
8
|
+
function generateCompose(inputJSON) {
|
|
9
|
+
return lib.generateCompose(inputJSON);
|
|
14
10
|
}
|
|
15
11
|
|
|
16
12
|
module.exports = {
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
generate: generateCompose,
|
|
14
|
+
};
|
package/lib/lib.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const YAML = require('json2yaml');
|
|
4
|
+
const Validator = require('jsonschema').Validator;
|
|
5
|
+
const v = new Validator();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Generate compose file from a JSON document
|
|
9
|
+
* @param {string} inputJSON - JSON document, what represent the compose file.
|
|
10
|
+
* @return {string} The generated compose file in YAML format.
|
|
11
|
+
*/
|
|
12
|
+
function generateCompose(inputJSON) {
|
|
13
|
+
const schema = JSON.parse(
|
|
14
|
+
fs.readFileSync(path.resolve(__dirname, '../schema.json')));
|
|
15
|
+
|
|
16
|
+
if (!v.validate(inputJSON, schema).valid) {
|
|
17
|
+
throw new Error('Invalid input!');
|
|
18
|
+
}
|
|
19
|
+
return YAML.stringify(inputJSON);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
generateCompose,
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docker-composer",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
|
+
"description": "Library for generating docker-compose.yml from JSON.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "./node_modules/mocha/bin/mocha.js
|
|
7
|
+
"test": "./node_modules/mocha/bin/mocha.js ./tests/*Test.js",
|
|
8
8
|
"coverage": "nyc npm run test",
|
|
9
|
-
"generate-ts-types": "node compile-ts-types.js"
|
|
9
|
+
"generate-ts-types": "node ./scripts/compile-ts-types.js",
|
|
10
|
+
"linter": "npx eslint *.js tests/*.js"
|
|
10
11
|
},
|
|
11
12
|
"keywords": [
|
|
12
13
|
"docker",
|
|
@@ -34,9 +35,10 @@
|
|
|
34
35
|
"jsonschema": "^1.4.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"eslint": "8.30.0",
|
|
38
|
+
"eslint": "^8.30.0",
|
|
39
|
+
"eslint-config-google": "^0.14.0",
|
|
38
40
|
"js-yaml": "^4.0.0",
|
|
39
|
-
"json-schema-to-typescript": "^
|
|
41
|
+
"json-schema-to-typescript": "^13.0.1",
|
|
40
42
|
"mocha": "10.2.0",
|
|
41
43
|
"nyc": "^15.1.0",
|
|
42
44
|
"should": "13.2.3"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const compiler = require('json-schema-to-typescript');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to generate typescript types from json schema
|
|
7
|
+
*/
|
|
8
|
+
async function runner() {
|
|
9
|
+
const compiledTs = await compiler.compileFromFile(
|
|
10
|
+
path.resolve(__dirname, '../schema.json'));
|
|
11
|
+
fs.writeFileSync('index.d.ts', compiledTs);
|
|
12
|
+
console.log('Types are generated..');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
runner();
|
|
16
|
+
|
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
-
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
-
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
-
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
-
|
|
12
|
-
## Our Standards
|
|
13
|
-
|
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
|
15
|
-
include:
|
|
16
|
-
|
|
17
|
-
* Using welcoming and inclusive language
|
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
|
19
|
-
* Gracefully accepting constructive criticism
|
|
20
|
-
* Focusing on what is best for the community
|
|
21
|
-
* Showing empathy towards other community members
|
|
22
|
-
|
|
23
|
-
Examples of unacceptable behavior by participants include:
|
|
24
|
-
|
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
-
advances
|
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
-
* Public or private harassment
|
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
|
30
|
-
address, without explicit permission
|
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
-
professional setting
|
|
33
|
-
|
|
34
|
-
## Our Responsibilities
|
|
35
|
-
|
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
-
response to any instances of unacceptable behavior.
|
|
39
|
-
|
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
-
threatening, offensive, or harmful.
|
|
45
|
-
|
|
46
|
-
## Scope
|
|
47
|
-
|
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
-
when an individual is representing the project or its community. Examples of
|
|
50
|
-
representing a project or community include using an official project e-mail
|
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
|
53
|
-
further defined and clarified by project maintainers.
|
|
54
|
-
|
|
55
|
-
## Enforcement
|
|
56
|
-
|
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at tudvari@tudvari.com. All
|
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
|
63
|
-
|
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
-
members of the project's leadership.
|
|
67
|
-
|
|
68
|
-
## Attribution
|
|
69
|
-
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
-
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
-
|
|
73
|
-
[homepage]: https://www.contributor-covenant.org
|
|
74
|
-
|
|
75
|
-
For answers to common questions about this code of conduct, see
|
|
76
|
-
https://www.contributor-covenant.org/faq
|
package/compile-ts-types.js
DELETED