@awesomeness-js/utils 1.0.0 → 1.0.2
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/build.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/build.js +4 -3
package/build.js
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -10,6 +10,7 @@ import { join, sep } from 'path';
|
|
|
10
10
|
* @returns {bool} - Returns true if the output file is generated successfully.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
|
|
13
14
|
function getAllFiles(base, dir, files = []) {
|
|
14
15
|
const directory = join(base, dir);
|
|
15
16
|
let sortedFiles = readdirSync(directory).sort();
|
|
@@ -78,7 +79,7 @@ function generateExports(src) {
|
|
|
78
79
|
const parts = file.split(sep).filter(p => p !== '.');
|
|
79
80
|
const functionName = parts.pop().replace('.js', '');
|
|
80
81
|
const namespace = parts.join('_');
|
|
81
|
-
const importPath = '
|
|
82
|
+
const importPath = src + '/' + file.replace(/\.js$/, '').replace(/\\/g, '/');
|
|
82
83
|
const filePath = join(src, file);
|
|
83
84
|
|
|
84
85
|
// Extract JSDoc comment, if present
|
|
@@ -118,10 +119,10 @@ function generateExports(src) {
|
|
|
118
119
|
|
|
119
120
|
async function build({
|
|
120
121
|
src = './src',
|
|
121
|
-
dest =
|
|
122
|
+
dest = './index.js'
|
|
122
123
|
} = {}) {
|
|
123
124
|
const indexContent = generateExports(src);
|
|
124
|
-
writeFileSync(
|
|
125
|
+
writeFileSync(dest, indexContent);
|
|
125
126
|
return true;
|
|
126
127
|
}
|
|
127
128
|
|