@trevordsouzabrite/test-package 1.0.0 → 1.0.1
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/package.json +3 -1
- package/scripts/install-to-root.js +55 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trevordsouzabrite/test-package",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "test description",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"lib/",
|
|
22
22
|
"pageRepository/",
|
|
23
23
|
"playwright/",
|
|
24
|
+
"scripts/",
|
|
24
25
|
"specs/",
|
|
25
26
|
"test-data/",
|
|
26
27
|
"tests/",
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
"bitbucket-pipelines.yml"
|
|
29
30
|
],
|
|
30
31
|
"scripts": {
|
|
32
|
+
"postinstall": "node scripts/install-to-root.js",
|
|
31
33
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const PACKAGE_FILES = [
|
|
5
|
+
'.claude',
|
|
6
|
+
'.github',
|
|
7
|
+
'.vscode',
|
|
8
|
+
'lib',
|
|
9
|
+
'pageRepository',
|
|
10
|
+
'playwright',
|
|
11
|
+
'specs',
|
|
12
|
+
'test-data',
|
|
13
|
+
'tests',
|
|
14
|
+
'.mcp.json',
|
|
15
|
+
'bitbucket-pipelines.yml',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
function copyRecursive(src, dest) {
|
|
19
|
+
const stat = fs.statSync(src);
|
|
20
|
+
|
|
21
|
+
if (stat.isDirectory()) {
|
|
22
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
23
|
+
for (const entry of fs.readdirSync(src)) {
|
|
24
|
+
copyRecursive(path.join(src, entry), path.join(dest, entry));
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
30
|
+
fs.copyFileSync(src, dest);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function installToRoot() {
|
|
34
|
+
const targetDir = process.env.INIT_CWD || process.cwd();
|
|
35
|
+
const packageDir = path.resolve(__dirname, '..');
|
|
36
|
+
|
|
37
|
+
if (path.resolve(targetDir) === path.resolve(packageDir)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (const file of PACKAGE_FILES) {
|
|
42
|
+
const src = path.join(packageDir, file);
|
|
43
|
+
const dest = path.join(targetDir, file);
|
|
44
|
+
|
|
45
|
+
if (!fs.existsSync(src)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
copyRecursive(src, dest);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log('@trevordsouzabrite/test-package: scaffold files copied to project root.');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
installToRoot();
|