@ascua/mdfiles 0.3.1 → 0.3.3
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/addon/services/mdfiles.js +1 -7
- package/index.js +2 -0
- package/lib/files.js +9 -3
- package/package.json +2 -2
|
@@ -9,13 +9,7 @@ export default class extends Service {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
async folder(folder) {
|
|
12
|
-
return fetch(
|
|
13
|
-
return data.json();
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async file(folder, name) {
|
|
18
|
-
return fetch(config.rootURL + folders[folder] + `/${name}.json`).then(data => {
|
|
12
|
+
return fetch(folders[folder]).then(data => {
|
|
19
13
|
return data.json();
|
|
20
14
|
});
|
|
21
15
|
}
|
package/index.js
CHANGED
|
@@ -43,6 +43,7 @@ module.exports = {
|
|
|
43
43
|
let files = new MarkdownFiles(folders.map(v => v.dir), {
|
|
44
44
|
type: 'addon',
|
|
45
45
|
folders: folders,
|
|
46
|
+
rootURL: this.conf.rootURL,
|
|
46
47
|
basePath: this.app.project.root,
|
|
47
48
|
outputDir: 'assets',
|
|
48
49
|
});
|
|
@@ -66,6 +67,7 @@ module.exports = {
|
|
|
66
67
|
let files = new MarkdownFiles(folders.map(v => v.dir), {
|
|
67
68
|
type: 'files',
|
|
68
69
|
folders: folders,
|
|
70
|
+
rootURL: this.conf.rootURL,
|
|
69
71
|
basePath: this.app.project.root,
|
|
70
72
|
outputDir: 'assets',
|
|
71
73
|
});
|
package/lib/files.js
CHANGED
|
@@ -27,7 +27,12 @@ module.exports = class Trees extends Plugin {
|
|
|
27
27
|
if (this.opts.type === 'addon') {
|
|
28
28
|
|
|
29
29
|
let output = this.opts.folders.reduce((list, folder) => {
|
|
30
|
-
list[folder.name] = path.join(
|
|
30
|
+
list[folder.name] = path.join(
|
|
31
|
+
this.opts.rootURL,
|
|
32
|
+
this.opts.outputDir,
|
|
33
|
+
folder.name,
|
|
34
|
+
'index.json'
|
|
35
|
+
);
|
|
31
36
|
return list;
|
|
32
37
|
}, {});
|
|
33
38
|
let buffer = `export default ${JSON.stringify(output)}`;
|
|
@@ -42,7 +47,7 @@ module.exports = class Trees extends Plugin {
|
|
|
42
47
|
// Write the index.json file contents
|
|
43
48
|
|
|
44
49
|
let buffer = JSON.stringify(entries.map(v => {
|
|
45
|
-
return { name: v.name, attributes: v.attributes };
|
|
50
|
+
return { name: v.name, path: v.path, attributes: v.attributes };
|
|
46
51
|
}));
|
|
47
52
|
let folder = path.join(this.outputPath, this.opts.outputDir, name);
|
|
48
53
|
let file = path.join(folder, 'index.json');
|
|
@@ -74,7 +79,7 @@ module.exports = class Trees extends Plugin {
|
|
|
74
79
|
|
|
75
80
|
let fileExt = path.extname(file);
|
|
76
81
|
let fileName = file.replace(/\.[^/.]+$/, '');
|
|
77
|
-
let filePath = path.join(name, fileName);
|
|
82
|
+
let filePath = path.join(this.opts.rootURL, this.opts.outputDir, name, `${fileName}.json`);
|
|
78
83
|
let fullPath = path.join(dir, file);
|
|
79
84
|
let isDirectory = fs.lstatSync(path.join(dir, file)).isDirectory();
|
|
80
85
|
|
|
@@ -85,6 +90,7 @@ module.exports = class Trees extends Plugin {
|
|
|
85
90
|
|
|
86
91
|
let entry = {
|
|
87
92
|
name: fileName,
|
|
93
|
+
path: filePath,
|
|
88
94
|
body: content.body,
|
|
89
95
|
attributes: content.attributes,
|
|
90
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ascua/mdfiles",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Small description for @ascua/mdfiles goes here",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "6b3c9df78f40cdcb8fe2e0ea796276ede8cef5ca"
|
|
31
31
|
}
|