@dcupl/cli 0.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 +0 -0
- package/bin/dcupl +2 -0
- package/dist/index.js +81 -0
- package/files/demo/bookstore_01/dcupl/api/author.csv +9126 -0
- package/files/demo/bookstore_01/dcupl/api/book.csv +10059 -0
- package/files/demo/bookstore_01/dcupl/api/book_language.json +32 -0
- package/files/demo/bookstore_01/dcupl/api/publisher.csv +26 -0
- package/files/demo/bookstore_01/dcupl/bookstore.dcupl.json +56 -0
- package/files/demo/bookstore_01/dcupl/bookstore_github.ldp.json +26 -0
- package/files/demo/bookstore_01/dcupl/bookstore_local.ldp.json +21 -0
- package/files/demo/bookstore_01/package.json +15 -0
- package/files/demo/bookstore_01/readme.md +14 -0
- package/files/demo/bookstore_02/dcupl/api/author.csv +9126 -0
- package/files/demo/bookstore_02/dcupl/api/book.csv +10059 -0
- package/files/demo/bookstore_02/dcupl/api/book_language.json +31 -0
- package/files/demo/bookstore_02/dcupl/api/publisher.csv +26 -0
- package/files/demo/bookstore_02/dcupl/bookstore.dcupl.json +62 -0
- package/files/demo/bookstore_02/dcupl/bookstore_github.ldp.json +26 -0
- package/files/demo/bookstore_02/dcupl/bookstore_local.ldp.json +26 -0
- package/files/demo/bookstore_02/package.json +15 -0
- package/files/demo/demo_01/package.json +14 -0
- package/files/empty/empty_01/dcupl/data/a.data.json +6 -0
- package/files/empty/empty_01/dcupl/models/a.model.json +9 -0
- package/files/empty/empty_01/package.json +14 -0
- package/package.json +34 -0
- package/src/index.ts +89 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
[
|
|
3
|
+
{"key":"eng","language_name":"English"},
|
|
4
|
+
{"key":"en-US","language_name":"United States English"},
|
|
5
|
+
{"key":"fre","language_name":"French"},
|
|
6
|
+
{"key":"spa","language_name":"Spanish"},
|
|
7
|
+
{"key":"en-GB","language_name":"British English"},
|
|
8
|
+
{"key":"mul","language_name":"Multiple Languages"},
|
|
9
|
+
{"key":"grc","language_name":"Greek"},
|
|
10
|
+
{"key":"enm","language_name":"Middle English"},
|
|
11
|
+
{"key":"en-CA","language_name":"Canadian English"},
|
|
12
|
+
{"key":"ger","language_name":"German"},
|
|
13
|
+
{"key":"jpn","language_name":"Japanese"},
|
|
14
|
+
{"key":"ara","language_name":"Arabic"},
|
|
15
|
+
{"key":"nl","language_name":"Dutch"},
|
|
16
|
+
{"key":"zho","language_name":"Chinese"},
|
|
17
|
+
{"key":"lat","language_name":"Latin"},
|
|
18
|
+
{"key":"por","language_name":"Portuguese"},
|
|
19
|
+
{"key":"srp","language_name":"Serbian"},
|
|
20
|
+
{"key":"ita","language_name":"Italian"},
|
|
21
|
+
{"key":"rus","language_name":"Russian"},
|
|
22
|
+
{"key":"msa","language_name":"Malaysian"},
|
|
23
|
+
{"key":"glg","language_name":"Galician"},
|
|
24
|
+
{"key":"wel","language_name":"Welsh"},
|
|
25
|
+
{"key":"swe","language_name":"Swedish"},
|
|
26
|
+
{"key":"nor","language_name":"Norwegian"},
|
|
27
|
+
{"key":"tur","language_name":"Turkish"},
|
|
28
|
+
{"key":"gla","language_name":"Gaelic"},
|
|
29
|
+
{"key":"ale","language_name":"Aleut"}
|
|
30
|
+
]
|
|
31
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
key;publisher_name
|
|
2
|
+
1;10/18
|
|
3
|
+
2;1st Book Library
|
|
4
|
+
3;1st World Library
|
|
5
|
+
4;A & C Black (Childrens books)
|
|
6
|
+
5;A Harvest Book/Harcourt Inc.
|
|
7
|
+
6;A K PETERS
|
|
8
|
+
7;AA World Services
|
|
9
|
+
8;Abacus
|
|
10
|
+
9;Abacus Books
|
|
11
|
+
10;Abacus Books (London)
|
|
12
|
+
11;Abdo Publishing Company
|
|
13
|
+
12;Abingdon Press
|
|
14
|
+
13;Abradale Books/Harry N. Abrams
|
|
15
|
+
14;Abraham Guillen Press
|
|
16
|
+
15;Abrams
|
|
17
|
+
16;Absolute Press
|
|
18
|
+
17;Abstract Studio
|
|
19
|
+
18;Academic Press
|
|
20
|
+
19;Academica Press
|
|
21
|
+
20;Academy Chicago Publishers
|
|
22
|
+
21;Ace
|
|
23
|
+
22;Ace Book
|
|
24
|
+
23;Ace Books
|
|
25
|
+
24;Ace Hardcover
|
|
26
|
+
25;Ace Trade
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"key": "publisher",
|
|
4
|
+
"properties": [
|
|
5
|
+
{
|
|
6
|
+
"key": "publisher_name",
|
|
7
|
+
"datatype": "string"
|
|
8
|
+
}
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"key": "author",
|
|
13
|
+
"properties": [
|
|
14
|
+
{
|
|
15
|
+
"key": "author_name",
|
|
16
|
+
"datatype": "string"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"key": "book_language",
|
|
22
|
+
"properties": [
|
|
23
|
+
{
|
|
24
|
+
"key": "language_code",
|
|
25
|
+
"datatype": "string"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"key": "language_name",
|
|
29
|
+
"datatype": "string"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "book",
|
|
35
|
+
"fields": [
|
|
36
|
+
{
|
|
37
|
+
"key": "publisher_id",
|
|
38
|
+
"model": "publisher",
|
|
39
|
+
"type": "singleValued"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"key": "author_ids",
|
|
43
|
+
"model": "author",
|
|
44
|
+
"type": "multiValued"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"properties": [
|
|
48
|
+
{
|
|
49
|
+
"key": "title",
|
|
50
|
+
"datatype": "string"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"key": "language_id",
|
|
54
|
+
"datatype": "string"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"key": "publication_date",
|
|
58
|
+
"datatype": "string"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"url": "http://localhost:8083/bookstore.dcupl.json",
|
|
4
|
+
"type":"model"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"url": "http://localhost:8083/api/author.csv",
|
|
8
|
+
"type":"data",
|
|
9
|
+
"model": "author"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"url": "http://localhost:8083/api/book.csv",
|
|
13
|
+
"type":"data",
|
|
14
|
+
"model": "book"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"url": "http://localhost:8083/api/publisher.csv",
|
|
18
|
+
"type":"data",
|
|
19
|
+
"model": "publisher"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"url": "http://localhost:8083/api/book_language.json",
|
|
23
|
+
"type":"data",
|
|
24
|
+
"model": "book_language"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"url": "http://localhost:8083/bookstore.dcupl.json",
|
|
4
|
+
"type":"model"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"url": "http://localhost:8083/api/author.csv",
|
|
8
|
+
"type":"data",
|
|
9
|
+
"model": "author"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"url": "http://localhost:8083/api/book.csv",
|
|
13
|
+
"type":"data",
|
|
14
|
+
"model": "book"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"url": "http://localhost:8083/api/publisher.csv",
|
|
18
|
+
"type":"data",
|
|
19
|
+
"model": "publisher"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"url": "http://localhost:8083/api/book_language.json",
|
|
23
|
+
"type":"data",
|
|
24
|
+
"model": "book_language"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dcupl-starter",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "http-server dcupl --cors --port 8083"
|
|
7
|
+
},
|
|
8
|
+
"repository": {},
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"http-server": "^14.0.0"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dcupl/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A CLI for dcupl",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dcupl": "bin/dcupl"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "npm run clean && tsc",
|
|
11
|
+
"clean": "rm -rf dist",
|
|
12
|
+
"global": "npm i -g && dcupl",
|
|
13
|
+
"postinstall": "npm run build && npm run global"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"bin/",
|
|
17
|
+
"src/",
|
|
18
|
+
"files/"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/fs-extra": "^9.0.13",
|
|
24
|
+
"@types/inquirer": "^8.2.0",
|
|
25
|
+
"@types/yargs": "^17.0.8",
|
|
26
|
+
"typescript": "^4.5.5"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"fs-extra": "^10.0.0",
|
|
30
|
+
"inquirer": "^8.2.0",
|
|
31
|
+
"kleur": "^4.1.4",
|
|
32
|
+
"yargs": "^17.3.1"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { hideBin } from 'yargs/helpers';
|
|
3
|
+
|
|
4
|
+
import { copySync, mkdirSync } from 'fs-extra';
|
|
5
|
+
import { join, resolve } from 'path';
|
|
6
|
+
import inquirer from 'inquirer';
|
|
7
|
+
|
|
8
|
+
import { blue } from 'kleur';
|
|
9
|
+
|
|
10
|
+
const initFn = () => {
|
|
11
|
+
inquirer
|
|
12
|
+
.prompt([
|
|
13
|
+
{
|
|
14
|
+
type: 'input',
|
|
15
|
+
name: 'projectName',
|
|
16
|
+
message: "What's your project name",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'list',
|
|
20
|
+
name: 'projectType',
|
|
21
|
+
message: 'Do you want to start from scratch or a demo application?',
|
|
22
|
+
choices: [
|
|
23
|
+
{
|
|
24
|
+
name: 'Empty Project',
|
|
25
|
+
value: 'empty',
|
|
26
|
+
checked: true,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Demo Project',
|
|
30
|
+
value: 'demo',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Demo Bookstore',
|
|
34
|
+
value: 'bookstore',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
])
|
|
39
|
+
.then(({ projectName, projectType }) => {
|
|
40
|
+
const codeBasePath = resolve(__dirname, '../');
|
|
41
|
+
const filesBasePath = join(codeBasePath, 'files');
|
|
42
|
+
const demoBasePath = join(filesBasePath, 'demo', 'demo_01',);
|
|
43
|
+
const bookstoreBasePath = join(filesBasePath, 'demo','bookstore_01');
|
|
44
|
+
const empty01BasePath = join(filesBasePath, 'empty', 'empty_01');
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const currentBasePath = join(process.cwd());
|
|
48
|
+
const projectFolderPath = join(currentBasePath, projectName);
|
|
49
|
+
|
|
50
|
+
mkdirSync(projectFolderPath, { recursive: true });
|
|
51
|
+
|
|
52
|
+
if (projectType === 'demo') {
|
|
53
|
+
copySync(demoBasePath, projectFolderPath, {
|
|
54
|
+
recursive: true,
|
|
55
|
+
overwrite: true,
|
|
56
|
+
});
|
|
57
|
+
}else if (projectType === 'bookstore') {
|
|
58
|
+
copySync(bookstoreBasePath, projectFolderPath, {
|
|
59
|
+
recursive: true,
|
|
60
|
+
overwrite: true,
|
|
61
|
+
});
|
|
62
|
+
} else if (projectType === 'empty') {
|
|
63
|
+
copySync(empty01BasePath, projectFolderPath, {
|
|
64
|
+
recursive: true,
|
|
65
|
+
overwrite: true,
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
throw new Error('you have to select a project type');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
console.log(blue('All done! - Next Steps:'));
|
|
72
|
+
|
|
73
|
+
console.log('cd ' + projectName);
|
|
74
|
+
console.log('npm i');
|
|
75
|
+
console.log('npm run serve');
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
yargs(hideBin(process.argv))
|
|
80
|
+
.command(
|
|
81
|
+
'init',
|
|
82
|
+
'Init a Project',
|
|
83
|
+
() => {},
|
|
84
|
+
(argv) => {
|
|
85
|
+
initFn();
|
|
86
|
+
},
|
|
87
|
+
)
|
|
88
|
+
.demandCommand(1)
|
|
89
|
+
.parse();
|