@mondaydotcomorg/z2h-cli 0.14.0 → 0.15.0
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/create-workspace.d.ts.map +1 -1
- package/dist/commands/create-workspace.js +3 -2
- package/dist/esm/commands/create-workspace.d.ts.map +1 -1
- package/dist/esm/commands/create-workspace.mjs +3 -2
- package/package.json +1 -1
- package/src/commands/create-workspace.ts +3 -2
- package/src/util/__tests__/workspace-templates-shipped.test.ts +0 -26
- package/src/templates/workspace/npmrc +0 -4
- package/src/templates/workspace/yarnrc.yml +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../src/commands/create-workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../src/commands/create-workspace.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,sBAAsB,CAAC,IAAI,GAAE,sBAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C7F"}
|
|
@@ -7,6 +7,7 @@ const util_logger = require('../util/logger.js');
|
|
|
7
7
|
const util_workspace = require('../util/workspace.js');
|
|
8
8
|
const util_templates = require('../util/templates.js');
|
|
9
9
|
const util_npm_install = require('../util/npm/install.js');
|
|
10
|
+
const util_npm_brokerConfig = require('../util/npm/broker-config.js');
|
|
10
11
|
|
|
11
12
|
const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
12
13
|
|
|
@@ -36,11 +37,11 @@ async function createWorkspaceCommand(opts = {}) {
|
|
|
36
37
|
await Promise.all([
|
|
37
38
|
fs.writeFile(path__default.default.join(home, 'package.json'), pkgRaw),
|
|
38
39
|
fs.copy(path__default.default.join(wsTemplatesDir, 'gitignore'), path__default.default.join(home, '.gitignore')),
|
|
39
|
-
fs.
|
|
40
|
+
fs.writeFile(path__default.default.join(home, '.yarnrc.yml'), util_npm_brokerConfig.workspaceYarnrcContents()),
|
|
40
41
|
fs.copy(path__default.default.join(wsTemplatesDir, 'nx.json'), path__default.default.join(home, 'nx.json')),
|
|
41
42
|
fs.copy(path__default.default.join(wsTemplatesDir, 'yarnlock'), path__default.default.join(home, 'yarn.lock')),
|
|
42
43
|
fs.copy(path__default.default.join(wsTemplatesDir, 'nvmrc'), path__default.default.join(home, '.nvmrc')),
|
|
43
|
-
fs.
|
|
44
|
+
fs.writeFile(path__default.default.join(home, '.npmrc'), util_npm_brokerConfig.workspaceNpmrcContents()),
|
|
44
45
|
fs.copy(path__default.default.join(wsTemplatesDir, 'README.md'), path__default.default.join(home, 'README.md')),
|
|
45
46
|
fs.copy(path__default.default.join(wsTemplatesDir, 'yarn-releases', 'yarn-4.5.1.cjs'), path__default.default.join(home, '.yarn', 'releases', 'yarn-4.5.1.cjs')),
|
|
46
47
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../../src/commands/create-workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../../src/commands/create-workspace.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,sBAAsB,CAAC,IAAI,GAAE,sBAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C7F"}
|
|
@@ -5,6 +5,7 @@ import { setOutputMode, output, info } from '../util/logger.mjs';
|
|
|
5
5
|
import { getWorkspaceHome } from '../util/workspace.mjs';
|
|
6
6
|
import { getTemplatesDir } from '../util/templates.mjs';
|
|
7
7
|
import { runYarnInstall } from '../util/npm/install.mjs';
|
|
8
|
+
import { workspaceYarnrcContents, workspaceNpmrcContents } from '../util/npm/broker-config.mjs';
|
|
8
9
|
|
|
9
10
|
async function createWorkspaceCommand(opts = {}) {
|
|
10
11
|
if (opts.json) {
|
|
@@ -30,11 +31,11 @@ async function createWorkspaceCommand(opts = {}) {
|
|
|
30
31
|
await Promise.all([
|
|
31
32
|
writeFile(path.join(home, 'package.json'), pkgRaw),
|
|
32
33
|
copy(path.join(wsTemplatesDir, 'gitignore'), path.join(home, '.gitignore')),
|
|
33
|
-
|
|
34
|
+
writeFile(path.join(home, '.yarnrc.yml'), workspaceYarnrcContents()),
|
|
34
35
|
copy(path.join(wsTemplatesDir, 'nx.json'), path.join(home, 'nx.json')),
|
|
35
36
|
copy(path.join(wsTemplatesDir, 'yarnlock'), path.join(home, 'yarn.lock')),
|
|
36
37
|
copy(path.join(wsTemplatesDir, 'nvmrc'), path.join(home, '.nvmrc')),
|
|
37
|
-
|
|
38
|
+
writeFile(path.join(home, '.npmrc'), workspaceNpmrcContents()),
|
|
38
39
|
copy(path.join(wsTemplatesDir, 'README.md'), path.join(home, 'README.md')),
|
|
39
40
|
copy(path.join(wsTemplatesDir, 'yarn-releases', 'yarn-4.5.1.cjs'), path.join(home, '.yarn', 'releases', 'yarn-4.5.1.cjs')),
|
|
40
41
|
]);
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { info, output, setOutputMode } from '../util/logger';
|
|
|
5
5
|
import { getWorkspaceHome } from '../util/workspace';
|
|
6
6
|
import { getTemplatesDir } from '../util/templates';
|
|
7
7
|
import { runYarnInstall } from '../util/npm/install';
|
|
8
|
+
import { workspaceNpmrcContents, workspaceYarnrcContents } from '../util/npm/broker-config';
|
|
8
9
|
|
|
9
10
|
export interface CreateWorkspaceOptions {
|
|
10
11
|
json?: boolean;
|
|
@@ -37,11 +38,11 @@ export async function createWorkspaceCommand(opts: CreateWorkspaceOptions = {}):
|
|
|
37
38
|
await Promise.all([
|
|
38
39
|
writeFile(path.join(home, 'package.json'), pkgRaw),
|
|
39
40
|
copy(path.join(wsTemplatesDir, 'gitignore'), path.join(home, '.gitignore')),
|
|
40
|
-
|
|
41
|
+
writeFile(path.join(home, '.yarnrc.yml'), workspaceYarnrcContents()),
|
|
41
42
|
copy(path.join(wsTemplatesDir, 'nx.json'), path.join(home, 'nx.json')),
|
|
42
43
|
copy(path.join(wsTemplatesDir, 'yarnlock'), path.join(home, 'yarn.lock')),
|
|
43
44
|
copy(path.join(wsTemplatesDir, 'nvmrc'), path.join(home, '.nvmrc')),
|
|
44
|
-
|
|
45
|
+
writeFile(path.join(home, '.npmrc'), workspaceNpmrcContents()),
|
|
45
46
|
copy(path.join(wsTemplatesDir, 'README.md'), path.join(home, 'README.md')),
|
|
46
47
|
copy(
|
|
47
48
|
path.join(wsTemplatesDir, 'yarn-releases', 'yarn-4.5.1.cjs'),
|
|
@@ -7,10 +7,8 @@ describe('workspace templates ship with the package', () => {
|
|
|
7
7
|
const expected = [
|
|
8
8
|
'workspace/package.json.tmpl',
|
|
9
9
|
'workspace/gitignore',
|
|
10
|
-
'workspace/yarnrc.yml',
|
|
11
10
|
'workspace/nx.json',
|
|
12
11
|
'workspace/nvmrc',
|
|
13
|
-
'workspace/npmrc',
|
|
14
12
|
'workspace/README.md',
|
|
15
13
|
'workspace/yarn-releases/yarn-4.5.1.cjs',
|
|
16
14
|
];
|
|
@@ -28,28 +26,4 @@ describe('workspace templates ship with the package', () => {
|
|
|
28
26
|
expect(raw).toMatch(/"\*"/);
|
|
29
27
|
expect(raw).toMatch(/"\*\/\.zth"/);
|
|
30
28
|
});
|
|
31
|
-
|
|
32
|
-
it('workspace yarnrc points yarnPath at the bundled berry release', async () => {
|
|
33
|
-
const raw = await readFile(path.join(getTemplatesDir(), 'workspace', 'yarnrc.yml'), 'utf8');
|
|
34
|
-
expect(raw).toMatch(/yarnPath:\s*\.yarn\/releases\/yarn-4\.5\.1\.cjs/);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('workspace yarnrc scope-splits @mondaydotcomorg to the broker with the Z2H placeholder, no legacy token', async () => {
|
|
38
|
-
const raw = await readFile(path.join(getTemplatesDir(), 'workspace', 'yarnrc.yml'), 'utf8');
|
|
39
|
-
expect(raw).not.toContain('${NPM_TOKEN}');
|
|
40
|
-
expect(raw).toContain('npmScopes:');
|
|
41
|
-
expect(raw).toContain('mondaydotcomorg:');
|
|
42
|
-
expect(raw).toContain('npmRegistryServer: "https://bigbrain-zth.bigbrain.me/z2h-cli/npm"');
|
|
43
|
-
expect(raw).toContain('npmAuthToken: "${Z2H_NPM_TOKEN}"');
|
|
44
|
-
// Default registry stays public/direct.
|
|
45
|
-
expect(raw).toContain('npmRegistryServer: "https://registry.npmjs.org/"');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('workspace npmrc routes the broker scope + keeps a public default registry, no legacy token', async () => {
|
|
49
|
-
const raw = await readFile(path.join(getTemplatesDir(), 'workspace', 'npmrc'), 'utf8');
|
|
50
|
-
expect(raw).not.toContain('${NPM_TOKEN}');
|
|
51
|
-
expect(raw).toContain('@mondaydotcomorg:registry=https://bigbrain-zth.bigbrain.me/z2h-cli/npm/');
|
|
52
|
-
expect(raw).toContain('//bigbrain-zth.bigbrain.me/z2h-cli/npm/:_authToken=${Z2H_NPM_TOKEN}');
|
|
53
|
-
expect(raw).toContain('registry=https://registry.npmjs.org/');
|
|
54
|
-
});
|
|
55
29
|
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
|
2
|
-
|
|
3
|
-
npmScopes:
|
|
4
|
-
mondaydotcomorg:
|
|
5
|
-
npmRegistryServer: "https://bigbrain-zth.bigbrain.me/z2h-cli/npm"
|
|
6
|
-
npmAuthToken: "${Z2H_NPM_TOKEN}"
|
|
7
|
-
npmAlwaysAuth: true
|
|
8
|
-
|
|
9
|
-
npmRegistryServer: "https://registry.npmjs.org/"
|
|
10
|
-
|
|
11
|
-
yarnPath: .yarn/releases/yarn-4.5.1.cjs
|