@cerema/cadriciel 0.6.1 → 1.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/cmd/gitignore.txt +136 -0
- package/cmd/init.js +25 -73
- package/lib/s3.js +1 -2
- package/package.json +5 -3
- package/gitignore +0 -50
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
node_modules
|
|
2
|
+
etc
|
|
3
|
+
.env
|
|
4
|
+
docker
|
|
5
|
+
.angular
|
|
6
|
+
|
|
7
|
+
# Logs
|
|
8
|
+
logs
|
|
9
|
+
*.log
|
|
10
|
+
npm-debug.log*
|
|
11
|
+
yarn-debug.log*
|
|
12
|
+
yarn-error.log*
|
|
13
|
+
lerna-debug.log*
|
|
14
|
+
.pnpm-debug.log*
|
|
15
|
+
|
|
16
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
17
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
18
|
+
|
|
19
|
+
# Runtime data
|
|
20
|
+
pids
|
|
21
|
+
*.pid
|
|
22
|
+
*.seed
|
|
23
|
+
*.pid.lock
|
|
24
|
+
|
|
25
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
26
|
+
lib-cov
|
|
27
|
+
|
|
28
|
+
# Coverage directory used by tools like istanbul
|
|
29
|
+
coverage
|
|
30
|
+
*.lcov
|
|
31
|
+
|
|
32
|
+
# nyc test coverage
|
|
33
|
+
.nyc_output
|
|
34
|
+
|
|
35
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
36
|
+
.grunt
|
|
37
|
+
|
|
38
|
+
# Bower dependency directory (https://bower.io/)
|
|
39
|
+
bower_components
|
|
40
|
+
|
|
41
|
+
# node-waf configuration
|
|
42
|
+
.lock-wscript
|
|
43
|
+
|
|
44
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
45
|
+
build/Release
|
|
46
|
+
|
|
47
|
+
# Dependency directories
|
|
48
|
+
node_modules/
|
|
49
|
+
jspm_packages/
|
|
50
|
+
|
|
51
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
52
|
+
web_modules/
|
|
53
|
+
|
|
54
|
+
# TypeScript cache
|
|
55
|
+
*.tsbuildinfo
|
|
56
|
+
|
|
57
|
+
# Optional npm cache directory
|
|
58
|
+
.npm
|
|
59
|
+
|
|
60
|
+
# Optional eslint cache
|
|
61
|
+
.eslintcache
|
|
62
|
+
|
|
63
|
+
# Optional stylelint cache
|
|
64
|
+
.stylelintcache
|
|
65
|
+
|
|
66
|
+
# Microbundle cache
|
|
67
|
+
.rpt2_cache/
|
|
68
|
+
.rts2_cache_cjs/
|
|
69
|
+
.rts2_cache_es/
|
|
70
|
+
.rts2_cache_umd/
|
|
71
|
+
|
|
72
|
+
# Optional REPL history
|
|
73
|
+
.node_repl_history
|
|
74
|
+
|
|
75
|
+
# Output of 'npm pack'
|
|
76
|
+
*.tgz
|
|
77
|
+
|
|
78
|
+
# Yarn Integrity file
|
|
79
|
+
.yarn-integrity
|
|
80
|
+
|
|
81
|
+
# dotenv environment variable files
|
|
82
|
+
.env
|
|
83
|
+
.env.development.local
|
|
84
|
+
.env.test.local
|
|
85
|
+
.env.production.local
|
|
86
|
+
.env.local
|
|
87
|
+
|
|
88
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
89
|
+
.cache
|
|
90
|
+
.parcel-cache
|
|
91
|
+
|
|
92
|
+
# Next.js build output
|
|
93
|
+
.next
|
|
94
|
+
out
|
|
95
|
+
|
|
96
|
+
# Nuxt.js build / generate output
|
|
97
|
+
.nuxt
|
|
98
|
+
dist
|
|
99
|
+
|
|
100
|
+
# Gatsby files
|
|
101
|
+
.cache/
|
|
102
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
103
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
104
|
+
# public
|
|
105
|
+
|
|
106
|
+
# vuepress build output
|
|
107
|
+
.vuepress/dist
|
|
108
|
+
|
|
109
|
+
# vuepress v2.x temp and cache directory
|
|
110
|
+
.temp
|
|
111
|
+
.cache
|
|
112
|
+
|
|
113
|
+
# Docusaurus cache and generated files
|
|
114
|
+
.docusaurus
|
|
115
|
+
|
|
116
|
+
# Serverless directories
|
|
117
|
+
.serverless/
|
|
118
|
+
|
|
119
|
+
# FuseBox cache
|
|
120
|
+
.fusebox/
|
|
121
|
+
|
|
122
|
+
# DynamoDB Local files
|
|
123
|
+
.dynamodb/
|
|
124
|
+
|
|
125
|
+
# TernJS port file
|
|
126
|
+
.tern-port
|
|
127
|
+
|
|
128
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
129
|
+
.vscode-test
|
|
130
|
+
|
|
131
|
+
# yarn v2
|
|
132
|
+
.yarn/cache
|
|
133
|
+
.yarn/unplugged
|
|
134
|
+
.yarn/build-state.yml
|
|
135
|
+
.yarn/install-state.gz
|
|
136
|
+
.pnp.*
|
package/cmd/init.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
module.exports = function (program) {
|
|
2
2
|
var UID = require('shortid').generate();
|
|
3
3
|
const inquirer = require('inquirer');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const AdmZip = require('adm-zip');
|
|
4
6
|
const ora = require('ora');
|
|
5
7
|
const os = require('os');
|
|
6
|
-
const unzipper = require('unzipper');
|
|
7
8
|
const recursive = require('recursive-readdir');
|
|
8
9
|
const fs = require('fs');
|
|
9
10
|
const log = require('log-beautify');
|
|
@@ -16,17 +17,27 @@ module.exports = function (program) {
|
|
|
16
17
|
} = require('../lib/util');
|
|
17
18
|
const { S3 } = require('../lib/s3');
|
|
18
19
|
|
|
20
|
+
const unzipFile = (zipFilePath, outputPath, callback) => {
|
|
21
|
+
const zip = new AdmZip(zipFilePath);
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
zip.extractAllTo(outputPath, true);
|
|
25
|
+
callback();
|
|
26
|
+
} catch (err) {
|
|
27
|
+
console.error(
|
|
28
|
+
"Une erreur s'est produite lors de la décompression :",
|
|
29
|
+
err
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
19
34
|
const download = async (name, cb) => {
|
|
20
35
|
var client = await S3();
|
|
21
36
|
client.get('templates', `${name}.zip`, function () {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
DEFAULT_TEMPLATE = name;
|
|
27
|
-
fs.unlink(`${os.tmpdir()}/${name}.zip`, cb);
|
|
28
|
-
})
|
|
29
|
-
);
|
|
37
|
+
unzipFile(`${os.tmpdir()}/${name}.zip`, `${os.tmpdir()}/${UID}`, () => {
|
|
38
|
+
DEFAULT_TEMPLATE = name;
|
|
39
|
+
fs.unlink(`${os.tmpdir()}/${name}.zip`, cb);
|
|
40
|
+
});
|
|
30
41
|
});
|
|
31
42
|
};
|
|
32
43
|
|
|
@@ -41,7 +52,6 @@ module.exports = function (program) {
|
|
|
41
52
|
var text = fs.readFileSync(input, 'utf-8');
|
|
42
53
|
text = text.replace(/§§project§§/g, o.project);
|
|
43
54
|
text = text.replace(/§§projectUpper§§/g, o.project.toUpperCase());
|
|
44
|
-
text = text.replace(/§§projectNS§§/g, capitalizeFirstLetter(o.project));
|
|
45
55
|
text = text.replace(/§§projectID§§/g, capitalizeFirstLetter(o.project));
|
|
46
56
|
text = text.replace(/§§pg_port§§/g, o.pg_port);
|
|
47
57
|
text = text.replace(/§§inbucket_port§§/g, o.inbucket_port);
|
|
@@ -89,73 +99,15 @@ module.exports = function (program) {
|
|
|
89
99
|
process.cwd() + '/' + o.project + '/.project',
|
|
90
100
|
JSON.stringify(o)
|
|
91
101
|
);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
# config/config.js
|
|
97
|
-
|
|
98
|
-
##########################
|
|
99
|
-
# General
|
|
100
|
-
##########################
|
|
101
|
-
|
|
102
|
-
#####
|
|
103
|
-
# OS X temporary files
|
|
104
|
-
#
|
|
105
|
-
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
|
106
|
-
.DS_Store
|
|
107
|
-
__MACOSX
|
|
108
|
-
|
|
109
|
-
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
|
110
|
-
.Trashes
|
|
111
|
-
|
|
112
|
-
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
|
113
|
-
*.swp
|
|
114
|
-
|
|
115
|
-
#####
|
|
116
|
-
# Node stuff
|
|
117
|
-
#
|
|
118
|
-
# Logs
|
|
119
|
-
logs
|
|
120
|
-
*.log
|
|
121
|
-
npm-debug.log*
|
|
122
|
-
|
|
123
|
-
# Runtime data
|
|
124
|
-
pids
|
|
125
|
-
*.pid
|
|
126
|
-
*.seed
|
|
127
|
-
|
|
128
|
-
# Coverage directory used by tools like istanbul
|
|
129
|
-
coverage
|
|
130
|
-
|
|
131
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
132
|
-
.grunt
|
|
133
|
-
|
|
134
|
-
# node-waf configuration
|
|
135
|
-
.lock-wscript
|
|
136
|
-
|
|
137
|
-
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
138
|
-
build/Release
|
|
139
|
-
|
|
140
|
-
# Dependency directory
|
|
141
|
-
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
|
|
142
|
-
node_modules
|
|
143
|
-
`;
|
|
102
|
+
const gitIgnore = fs.readFileSync(
|
|
103
|
+
__dirname + '/cmd/gitignore.txt',
|
|
104
|
+
'utf-8'
|
|
105
|
+
);
|
|
144
106
|
fs.writeFileSync(
|
|
145
107
|
process.cwd() + '/' + o.project + '/.gitignore',
|
|
146
|
-
|
|
108
|
+
gitIgnore
|
|
147
109
|
);
|
|
148
110
|
spinner.succeed(`projet ${o.project} crée avec succès.`);
|
|
149
|
-
console.log('\n');
|
|
150
|
-
console.log('Prochaines étapes');
|
|
151
|
-
console.log('-----------------');
|
|
152
|
-
console.log('cd ' + o.project);
|
|
153
|
-
console.log('git init');
|
|
154
|
-
console.log('git add --all');
|
|
155
|
-
console.log('git commit -m "first commit"');
|
|
156
|
-
console.log('npm i');
|
|
157
|
-
console.log('Lancer le backend avec votre IDE préféré ;-)');
|
|
158
|
-
console.log('\n');
|
|
159
111
|
console.log('\n🚀 Happy coding !\n');
|
|
160
112
|
});
|
|
161
113
|
});
|
package/lib/s3.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const os = require('os');
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const util = require('util');
|
|
4
|
-
const userHomeDir = os.homedir();
|
|
5
4
|
const S3_URI = 's3.siipro.fr';
|
|
6
5
|
const Minio = require('minio');
|
|
7
6
|
|
|
@@ -15,7 +14,7 @@ const S3 = async function (current_login) {
|
|
|
15
14
|
current_login.useSSL = true;
|
|
16
15
|
return new Minio.Client(current_login);
|
|
17
16
|
}
|
|
18
|
-
const r = await readFile(`${
|
|
17
|
+
const r = await readFile(`${os.homedir}/.cadriciel/account.json`, 'utf-8');
|
|
19
18
|
if (r) return new Minio.Client(JSON.parse(r));
|
|
20
19
|
};
|
|
21
20
|
var client = await login(current_login);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerema/cadriciel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"npm": ">=8.0.0",
|
|
@@ -9,17 +9,19 @@
|
|
|
9
9
|
"cadriciel": "./cli.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"adm-zip": "^0.5.10",
|
|
12
13
|
"chalk-v2": "^1.0.2",
|
|
13
14
|
"commander": "^10.0.0",
|
|
14
15
|
"figlet": "^1.5.2",
|
|
15
16
|
"inquirer": "8.2.5",
|
|
16
17
|
"isbinaryfile": "^5.0.0",
|
|
17
18
|
"log-beautify": "^1.2.0",
|
|
18
|
-
"minio": "",
|
|
19
|
+
"minio": "^7.0.32",
|
|
19
20
|
"ora": "^5.4.1",
|
|
20
21
|
"recursive-readdir": "^2.2.3",
|
|
21
22
|
"shortid": "^2.2.16",
|
|
22
23
|
"terminal-link": "2.1.1",
|
|
23
|
-
"unzipper": "^0.10.11"
|
|
24
|
+
"unzipper": "^0.10.11",
|
|
25
|
+
"yauzl": "^2.10.0"
|
|
24
26
|
}
|
|
25
27
|
}
|
package/gitignore
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
##########################
|
|
2
|
-
# Application specfic
|
|
3
|
-
##########################
|
|
4
|
-
# config/config.js
|
|
5
|
-
|
|
6
|
-
##########################
|
|
7
|
-
# General
|
|
8
|
-
##########################
|
|
9
|
-
|
|
10
|
-
#####
|
|
11
|
-
# OS X temporary files
|
|
12
|
-
#
|
|
13
|
-
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
|
14
|
-
.DS_Store
|
|
15
|
-
__MACOSX
|
|
16
|
-
|
|
17
|
-
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
|
18
|
-
.Trashes
|
|
19
|
-
|
|
20
|
-
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
|
21
|
-
*.swp
|
|
22
|
-
|
|
23
|
-
#####
|
|
24
|
-
# Node stuff
|
|
25
|
-
#
|
|
26
|
-
# Logs
|
|
27
|
-
logs
|
|
28
|
-
*.log
|
|
29
|
-
npm-debug.log*
|
|
30
|
-
|
|
31
|
-
# Runtime data
|
|
32
|
-
pids
|
|
33
|
-
*.pid
|
|
34
|
-
*.seed
|
|
35
|
-
|
|
36
|
-
# Coverage directory used by tools like istanbul
|
|
37
|
-
coverage
|
|
38
|
-
|
|
39
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
40
|
-
.grunt
|
|
41
|
-
|
|
42
|
-
# node-waf configuration
|
|
43
|
-
.lock-wscript
|
|
44
|
-
|
|
45
|
-
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
46
|
-
build/Release
|
|
47
|
-
|
|
48
|
-
# Dependency directory
|
|
49
|
-
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
|
|
50
|
-
node_modules
|