oclif 4.1.0 → 4.1.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/lib/tarballs/build.js +35 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/lib/tarballs/build.js
CHANGED
|
@@ -22,6 +22,39 @@ const pack = async (from, to) => {
|
|
|
22
22
|
? await exec(`tar czf ${to} ${path.basename(from)}`, { cwd })
|
|
23
23
|
: await exec(`tar cfJ ${to} ${path.basename(from)}`, { cwd });
|
|
24
24
|
};
|
|
25
|
+
const isYarnProject = (yarnRootPath) => {
|
|
26
|
+
const yarnLockFileName = 'yarn.lock';
|
|
27
|
+
const rootYarnLockFilePath = path.join(yarnRootPath, yarnLockFileName);
|
|
28
|
+
return (0, node_fs_1.existsSync)(rootYarnLockFilePath);
|
|
29
|
+
};
|
|
30
|
+
const copyCoreYarnFiles = async (yarnRootPath, workspacePath) => {
|
|
31
|
+
// copy yarn dependencies lock file
|
|
32
|
+
const yarnLockFileName = 'yarn.lock';
|
|
33
|
+
const rootYarnLockFilePath = path.join(yarnRootPath, yarnLockFileName);
|
|
34
|
+
const workspaceYarnLockFilePath = path.join(workspacePath, yarnLockFileName);
|
|
35
|
+
if ((0, node_fs_1.existsSync)(rootYarnLockFilePath)) {
|
|
36
|
+
await (0, fs_extra_1.copy)(rootYarnLockFilePath, workspaceYarnLockFilePath);
|
|
37
|
+
}
|
|
38
|
+
// copy yarn configuration file
|
|
39
|
+
const yarnConfigFileName = '.yarnrc.yml';
|
|
40
|
+
const rootYarnConfigFilePath = path.join(yarnRootPath, yarnConfigFileName);
|
|
41
|
+
const workspaceYarnConfigFilePath = path.join(workspacePath, yarnConfigFileName);
|
|
42
|
+
if ((0, node_fs_1.existsSync)(rootYarnConfigFilePath)) {
|
|
43
|
+
await (0, fs_extra_1.copy)(rootYarnConfigFilePath, workspaceYarnConfigFilePath);
|
|
44
|
+
}
|
|
45
|
+
// copy yarn releases e.g. yarn may be installed via a local config path like "yarnPath"
|
|
46
|
+
const yarnReleasesDirectoryRelativePath = './.yarn/releases/';
|
|
47
|
+
const rootYarnReleasesDirectoryPath = path.join(yarnRootPath, yarnReleasesDirectoryRelativePath);
|
|
48
|
+
const workspaceYarnReleasesDirectoryPath = path.join(workspacePath, yarnReleasesDirectoryRelativePath);
|
|
49
|
+
if ((0, node_fs_1.existsSync)(rootYarnReleasesDirectoryPath)) {
|
|
50
|
+
// create the directory if it does not exist
|
|
51
|
+
if (!(0, node_fs_1.existsSync)(workspaceYarnReleasesDirectoryPath)) {
|
|
52
|
+
await (0, promises_1.mkdir)(workspaceYarnReleasesDirectoryPath, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
// recursively copy all files in the directory
|
|
55
|
+
await (0, fs_extra_1.copy)(rootYarnReleasesDirectoryPath, workspaceYarnReleasesDirectoryPath);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
25
58
|
async function build(c, options = {}) {
|
|
26
59
|
const { config, xz } = c;
|
|
27
60
|
const packCLI = async () => {
|
|
@@ -52,8 +85,8 @@ async function build(c, options = {}) {
|
|
|
52
85
|
};
|
|
53
86
|
const addDependencies = async () => {
|
|
54
87
|
const yarnRoot = findYarnWorkspaceRoot(c.root) || c.root;
|
|
55
|
-
if ((
|
|
56
|
-
await (
|
|
88
|
+
if (isYarnProject(yarnRoot)) {
|
|
89
|
+
await copyCoreYarnFiles(yarnRoot, c.workspace());
|
|
57
90
|
const { stdout } = await exec('yarn -v');
|
|
58
91
|
const yarnVersion = stdout.charAt(0);
|
|
59
92
|
if (yarnVersion === '1') {
|
package/oclif.manifest.json
CHANGED