kustom-mc 0.1.1 → 0.1.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/dist/commands/bundle.js +37 -13
- package/dist/commands/init.js +1 -3
- package/dist/config.js +1 -1
- package/package.json +1 -1
package/dist/commands/bundle.js
CHANGED
|
@@ -91,21 +91,45 @@ export const bundleCommand = new Command('bundle')
|
|
|
91
91
|
'models/**/*',
|
|
92
92
|
'sounds/**/*'
|
|
93
93
|
];
|
|
94
|
+
const outDir = config.outDir || 'dist';
|
|
95
|
+
const outDirResolved = path.resolve(process.cwd(), outDir);
|
|
94
96
|
const addedFiles = new Set();
|
|
95
97
|
for (const pattern of includePatterns) {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
const isJsPattern = pattern.includes('*.js');
|
|
99
|
+
if (isJsPattern) {
|
|
100
|
+
// JS files live in outDir (e.g. dist/)
|
|
101
|
+
const files = await glob(pattern, {
|
|
102
|
+
cwd: outDirResolved,
|
|
103
|
+
nodir: true,
|
|
104
|
+
ignore: ['node_modules/**', '*.ts', 'kustompack.json']
|
|
105
|
+
});
|
|
106
|
+
for (const file of files) {
|
|
107
|
+
if (addedFiles.has(file))
|
|
108
|
+
continue;
|
|
109
|
+
const filePath = path.resolve(outDirResolved, file);
|
|
110
|
+
if (fs.existsSync(filePath)) {
|
|
111
|
+
archive.file(filePath, { name: file });
|
|
112
|
+
addedFiles.add(file);
|
|
113
|
+
fileCount++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// Asset files live in cwd (source directory)
|
|
119
|
+
const files = await glob(pattern, {
|
|
120
|
+
cwd: process.cwd(),
|
|
121
|
+
nodir: true,
|
|
122
|
+
ignore: ['node_modules/**', 'dist/**', '*.ts', 'kustompack.json']
|
|
123
|
+
});
|
|
124
|
+
for (const file of files) {
|
|
125
|
+
if (addedFiles.has(file))
|
|
126
|
+
continue;
|
|
127
|
+
const filePath = path.resolve(process.cwd(), file);
|
|
128
|
+
if (fs.existsSync(filePath)) {
|
|
129
|
+
archive.file(filePath, { name: file });
|
|
130
|
+
addedFiles.add(file);
|
|
131
|
+
fileCount++;
|
|
132
|
+
}
|
|
109
133
|
}
|
|
110
134
|
}
|
|
111
135
|
}
|
package/dist/commands/init.js
CHANGED
|
@@ -88,7 +88,7 @@ export const initCommand = new Command('init')
|
|
|
88
88
|
"**/*.test.ts",
|
|
89
89
|
"**/*.spec.ts"
|
|
90
90
|
],
|
|
91
|
-
outDir: "
|
|
91
|
+
outDir: "dist",
|
|
92
92
|
lib: ["scripts/lib"],
|
|
93
93
|
manifest: {
|
|
94
94
|
id: packId,
|
|
@@ -186,8 +186,6 @@ export function delay(ms: number): Promise<void> {
|
|
|
186
186
|
const gitignore = `node_modules/
|
|
187
187
|
dist/
|
|
188
188
|
.kustom/
|
|
189
|
-
*.js
|
|
190
|
-
!scripts/lib/**/*.js
|
|
191
189
|
`;
|
|
192
190
|
fs.writeFileSync(path.join(targetDir, '.gitignore'), gitignore);
|
|
193
191
|
console.log(chalk.green('\nProject initialized successfully!'));
|
package/dist/config.js
CHANGED