@bunch-good-drive/good-drive-frontend-components
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -19,12 +19,18 @@ /*** | ||
(async function() { | ||
const componentSrcPath = path.join(__dirname, "..", "src", "components/"); | ||
const componentSrcPath = path.join(__dirname, "..", "src", "components"); | ||
const componentDestinationPath = path.join(__dirname, "..", "compiled_components"); | ||
function outputPath(filePath) { | ||
const localFilePath = filePath.slice(componentSrcPath.length); | ||
return path.join(__dirname, "..", "compiled_components", localFilePath); | ||
const setExtension = (filePath, newExt) => { | ||
const sliceEnd = -path.extname(filePath).length || undefined; | ||
return filePath.slice(0, sliceEnd) + newExt; | ||
} | ||
const srcPathToDestinationPath = (path) => | ||
path.replace(componentSrcPath, componentDestinationPath); | ||
const files = await globPromise(path.join(componentSrcPath, "**", "*.svelte")); | ||
console.log('srcpath', componentSrcPath); | ||
console.log('files', files); | ||
for(const file of files) { | ||
console.log('file', file); | ||
//Compile Svelte to bundle | ||
@@ -48,3 +54,3 @@ const bundle = await rollup.rollup({ | ||
format: yargs.format || 'iife', | ||
file: outputPath(file).replace(/svelte$/, "js"), | ||
file: setExtension(srcPathToDestinationPath(file), '.js'), | ||
name: path.basename(file, '.svelte'), | ||
@@ -58,12 +64,15 @@ }); | ||
const fileImports = files.map((file) => { | ||
const name = path.basename(file, '.svelte'); | ||
return { | ||
name, | ||
path: outputPath(file).replace(/svelte$/, "js"), | ||
}; | ||
const name = path.basename(file, '.svelte'); | ||
const absolutePath = srcPathToDestinationPath(file); | ||
const relativePath = './' + path.relative(componentDestinationPath, absolutePath); | ||
console.log({name, absolutePath, relativePath}); | ||
const res = { | ||
name, | ||
path: relativePath, | ||
}; | ||
console.log('fileImports', res); | ||
return res; | ||
}); | ||
const exportsFolderPath = path.join(__dirname, "..", "exports"); | ||
await mkdirp(exportsFolderPath); | ||
await fs.writeFile(path.join(exportsFolderPath, "index.js"), [ | ||
await fs.writeFile(path.join(componentDestinationPath, "index.js"), [ | ||
...fileImports.map(({ name, path }) => `import ${name} from '${path}';`), | ||
@@ -70,0 +79,0 @@ `export {`, |
@@ -1,5 +0,5 @@ | ||
import BreadCrumbs from '/home/bladt/repos/deranged/good-drive/svelte/compiled_components/internal/BreadCrumbs.js'; | ||
import ClickableText from '/home/bladt/repos/deranged/good-drive/svelte/compiled_components/internal/ClickableText.js'; | ||
import FileActions from '/home/bladt/repos/deranged/good-drive/svelte/compiled_components/internal/FileActions.js'; | ||
import FolderListing from '/home/bladt/repos/deranged/good-drive/svelte/compiled_components/standalone/FolderListing.js'; | ||
import BreadCrumbs from './compiled_components/internal/BreadCrumbs.svelte'; | ||
import ClickableText from './compiled_components/internal/ClickableText.svelte'; | ||
import FileActions from './compiled_components/internal/FileActions.svelte'; | ||
import FolderListing from './compiled_components/standalone/FolderListing.svelte'; | ||
export { | ||
@@ -6,0 +6,0 @@ BreadCrumbs, |
{ | ||
"name": "@bunch-good-drive/good-drive-frontend-components", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"main": "compiled_components", | ||
"svelte": "exports/index.js", | ||
"scripts": { | ||
@@ -6,0 +7,0 @@ "build": "rollup -c", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
663746
29
4965
1