@adonisjs/assembler 6.1.3-11 → 6.1.3-13
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/src/bundler.js +2 -3
- package/build/src/debug.d.ts +3 -0
- package/build/src/debug.js +10 -0
- package/build/src/helpers.d.ts +5 -0
- package/build/src/helpers.js +39 -0
- package/build/src/test_runner.js +1 -1
- package/package.json +4 -2
package/build/src/bundler.js
CHANGED
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
9
|
import slash from 'slash';
|
|
10
|
-
import copyfiles from 'cpy';
|
|
11
10
|
import fs from 'node:fs/promises';
|
|
12
11
|
import { fileURLToPath } from 'node:url';
|
|
13
12
|
import { join, relative } from 'node:path';
|
|
14
13
|
import { cliui } from '@poppinss/cliui';
|
|
15
|
-
import { run, parseConfig } from './helpers.js';
|
|
14
|
+
import { run, parseConfig, copyFiles } from './helpers.js';
|
|
16
15
|
/**
|
|
17
16
|
* Instance of CLIUI
|
|
18
17
|
*/
|
|
@@ -89,7 +88,7 @@ export class Bundler {
|
|
|
89
88
|
*/
|
|
90
89
|
async #copyFiles(files, outDir) {
|
|
91
90
|
try {
|
|
92
|
-
await
|
|
91
|
+
await copyFiles(files, this.#cwdPath, outDir);
|
|
93
92
|
}
|
|
94
93
|
catch (error) {
|
|
95
94
|
if (!error.message.includes("the file doesn't exist")) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/assembler
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
import { debuglog } from 'node:util';
|
|
10
|
+
export default debuglog('adonisjs:assembler');
|
package/build/src/helpers.d.ts
CHANGED
|
@@ -43,3 +43,8 @@ export declare function isRcFile(filePath: string): boolean;
|
|
|
43
43
|
* stops after first find.
|
|
44
44
|
*/
|
|
45
45
|
export declare function getPort(cwd: URL): Promise<number>;
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to copy files from relative paths or glob
|
|
48
|
+
* patterns
|
|
49
|
+
*/
|
|
50
|
+
export declare function copyFiles(files: string[], cwd: string, outDir: string): Promise<string[]>;
|
package/build/src/helpers.js
CHANGED
|
@@ -6,11 +6,16 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
+
import cpy from 'cpy';
|
|
10
|
+
import { isNotJunk } from 'junk';
|
|
11
|
+
import fastGlob from 'fast-glob';
|
|
9
12
|
import getRandomPort from 'get-port';
|
|
10
13
|
import { fileURLToPath } from 'node:url';
|
|
11
14
|
import { execaNode, execa } from 'execa';
|
|
15
|
+
import { isAbsolute, relative } from 'node:path';
|
|
12
16
|
import { EnvLoader, EnvParser } from '@adonisjs/env';
|
|
13
17
|
import { ConfigParser, Watcher } from '@poppinss/chokidar-ts';
|
|
18
|
+
import debug from './debug.js';
|
|
14
19
|
/**
|
|
15
20
|
* Default set of args to pass in order to run TypeScript
|
|
16
21
|
* source. Used by "run" and "runNode" scripts
|
|
@@ -140,3 +145,37 @@ export async function getPort(cwd) {
|
|
|
140
145
|
*/
|
|
141
146
|
return getRandomPort({ port: 3333 });
|
|
142
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Helper function to copy files from relative paths or glob
|
|
150
|
+
* patterns
|
|
151
|
+
*/
|
|
152
|
+
export async function copyFiles(files, cwd, outDir) {
|
|
153
|
+
/**
|
|
154
|
+
* Looping over files and create a new collection with paths
|
|
155
|
+
* and glob patterns
|
|
156
|
+
*/
|
|
157
|
+
const { paths, patterns } = files.reduce((result, file) => {
|
|
158
|
+
if (fastGlob.isDynamicPattern(file)) {
|
|
159
|
+
result.patterns.push(file);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
result.paths.push(file);
|
|
163
|
+
}
|
|
164
|
+
return result;
|
|
165
|
+
}, { patterns: [], paths: [] });
|
|
166
|
+
debug('copyFiles inputs: %O, paths: %O, patterns: %O', files, paths, patterns);
|
|
167
|
+
/**
|
|
168
|
+
* Getting list of relative paths from glob patterns
|
|
169
|
+
*/
|
|
170
|
+
const filePaths = paths.concat(await fastGlob(patterns, { cwd }));
|
|
171
|
+
/**
|
|
172
|
+
* Computing relative destination. This is because, cpy is buggy when
|
|
173
|
+
* outDir is an absolute path.
|
|
174
|
+
*/
|
|
175
|
+
const destination = isAbsolute(outDir) ? relative(cwd, outDir) : outDir;
|
|
176
|
+
debug('copying files %O to destination "%s"', filePaths, destination);
|
|
177
|
+
return cpy(filePaths.filter(isNotJunk), destination, {
|
|
178
|
+
cwd: cwd,
|
|
179
|
+
flat: false,
|
|
180
|
+
});
|
|
181
|
+
}
|
package/build/src/test_runner.js
CHANGED
|
@@ -65,7 +65,7 @@ export class TestRunner {
|
|
|
65
65
|
})
|
|
66
66
|
.map((suite) => suite.files)
|
|
67
67
|
.flat(1));
|
|
68
|
-
this.#scriptArgs = this.#convertOptionsToArgs();
|
|
68
|
+
this.#scriptArgs = this.#convertOptionsToArgs().concat(this.#options.scriptArgs);
|
|
69
69
|
this.#initialFiltersArgs = this.#convertFiltersToArgs(this.#options.filters);
|
|
70
70
|
}
|
|
71
71
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/assembler",
|
|
3
|
-
"version": "6.1.3-
|
|
3
|
+
"version": "6.1.3-13",
|
|
4
4
|
"description": "Provides utilities to run AdonisJS development server and build project for production",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -66,9 +66,11 @@
|
|
|
66
66
|
"@adonisjs/env": "^4.2.0-3",
|
|
67
67
|
"@poppinss/chokidar-ts": "^4.1.0-4",
|
|
68
68
|
"@poppinss/cliui": "^6.1.1-3",
|
|
69
|
-
"cpy": "^
|
|
69
|
+
"cpy": "^10.1.0",
|
|
70
70
|
"execa": "^7.0.0",
|
|
71
|
+
"fast-glob": "^3.3.0",
|
|
71
72
|
"get-port": "^7.0.0",
|
|
73
|
+
"junk": "^4.0.1",
|
|
72
74
|
"picomatch": "^2.3.1",
|
|
73
75
|
"slash": "^5.1.0"
|
|
74
76
|
},
|