@nizza/devkit 0.1.3-beta.2 → 0.1.3-beta.3

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.
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../shared/utils.cjs');
4
+
5
+ async function runExecutor(opts, context) {
6
+ const { root, name } = utils.getProjectConfig(context);
7
+ const commandToExecute = opts.unlink ? `pnpm unlink --global` : `pnpm link --global`;
8
+ try {
9
+ await utils.runCommand(commandToExecute, root);
10
+ const now = new Date().toLocaleString();
11
+ const action = opts.unlink ? 'unlinked' : 'linked';
12
+ return utils.ok(`✨ ${name} has been ${action} globally on ${now}`);
13
+ } catch (error) {
14
+ const actionError = opts.unlink ? 'unlink' : 'link';
15
+ return utils.err(error, `❌ Failed to ${actionError} ${name} globally`);
16
+ }
17
+ }
18
+
19
+ module.exports = runExecutor;
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "title": "Global Link/Unlink package executor",
4
+ "description": "Links or unlinks a package globally using pnpm",
5
+ "type": "object",
6
+ "properties": {
7
+ "unlink": {
8
+ "type": "boolean",
9
+ "description": "If set to true, the package will be unlinked globally instead of linked",
10
+ "default": false
11
+ }
12
+ },
13
+ "required": [],
14
+ "additionalProperties": false
15
+ }
@@ -2,26 +2,28 @@
2
2
 
3
3
  var index = require('./executors/deploy/index.cjs');
4
4
  var index$1 = require('./executors/environments/index.cjs');
5
- var index$2 = require('./executors/publish/index.cjs');
6
- var index$3 = require('./executors/update-executors-file/index.cjs');
7
- var index$4 = require('./executors/verify-changesets/index.cjs');
8
- var index$5 = require('./executors/vtex-link/index.cjs');
5
+ var index$2 = require('./executors/npm-link/index.cjs');
6
+ var index$3 = require('./executors/publish/index.cjs');
7
+ var index$4 = require('./executors/update-executors-file/index.cjs');
8
+ var index$5 = require('./executors/verify-changesets/index.cjs');
9
+ var index$6 = require('./executors/vtex-link/index.cjs');
9
10
  var main = require('./vitejs/config-builder/main.cjs');
10
11
  var types = require('./vitejs/config-builder/shared/types.cjs');
11
12
  var helpers = require('./vitejs/config-builder/shared/utils/helpers.cjs');
12
13
  var projectConfig = require('./vitejs/config-builder/shared/utils/projectConfig.cjs');
13
14
  var viteCommand = require('./vitejs/config-builder/shared/utils/viteCommand.cjs');
14
15
  var main$1 = require('./vitejs/plugins/third-party-css-inject/main.cjs');
15
- var index$6 = require('./vitejs/plugins/shadow-dom-inject-css/index.cjs');
16
+ var index$7 = require('./vitejs/plugins/shadow-dom-inject-css/index.cjs');
16
17
 
17
18
 
18
19
 
19
20
  exports.deployExecutor = index;
20
21
  exports.environmentsExecutor = index$1;
21
- exports.publishExecutor = index$2;
22
- exports.updateExecutorsFileExecutor = index$3;
23
- exports.verifyChangesetsExecutor = index$4;
24
- exports.vtexLinkExecutor = index$5;
22
+ exports.npmLinkExecutor = index$2;
23
+ exports.publishExecutor = index$3;
24
+ exports.updateExecutorsFileExecutor = index$4;
25
+ exports.verifyChangesetsExecutor = index$5;
26
+ exports.vtexLinkExecutor = index$6;
25
27
  exports.createConfigBuilder = main.createConfigBuilder;
26
28
  Object.defineProperty(exports, "Flag", {
27
29
  enumerable: true,
@@ -55,4 +57,4 @@ exports.mergeConfigs = projectConfig.mergeConfigs;
55
57
  exports.getViteCmdFlags = viteCommand.getViteCmdFlags;
56
58
  exports.getViteCommand = viteCommand.getViteCommand;
57
59
  exports.thirdPartyCssInjectPlugin = main$1.thirdPartyCssInjectPlugin;
58
- exports.injectCssIntoShadowDom = index$6.injectCssIntoShadowDom;
60
+ exports.injectCssIntoShadowDom = index$7.injectCssIntoShadowDom;
@@ -78,10 +78,14 @@ var viteCommand = require('./viteCommand.cjs');
78
78
  */ const getExternalDependencies = (path, globs = [])=>{
79
79
  const pkgJson = utils.getPkgJson(path); // Assumes getLocalPkgJson is a function that reads and parses package.json
80
80
  const dependencies = Object.keys(pkgJson.dependencies || {});
81
+ const peerDependencies = Object.keys(pkgJson.peerDependencies || {});
81
82
  const globPatterns = Array.isArray(globs) ? globs : [
82
83
  globs
83
84
  ];
84
- return dependencies.filter((dep)=>globPatterns.some((pattern)=>minimatch.minimatch(dep, pattern)));
85
+ return [
86
+ ...dependencies,
87
+ ...peerDependencies
88
+ ].filter((dep)=>globPatterns.some((pattern)=>minimatch.minimatch(dep, pattern)));
85
89
  };
86
90
  /**
87
91
  * Generates a string of initials based on the input string,
@@ -0,0 +1,17 @@
1
+ import { getProjectConfig, runCommand, ok, err } from '../shared/utils.mjs';
2
+
3
+ async function runExecutor(opts, context) {
4
+ const { root, name } = getProjectConfig(context);
5
+ const commandToExecute = opts.unlink ? `pnpm unlink --global` : `pnpm link --global`;
6
+ try {
7
+ await runCommand(commandToExecute, root);
8
+ const now = new Date().toLocaleString();
9
+ const action = opts.unlink ? 'unlinked' : 'linked';
10
+ return ok(`✨ ${name} has been ${action} globally on ${now}`);
11
+ } catch (error) {
12
+ const actionError = opts.unlink ? 'unlink' : 'link';
13
+ return err(error, `❌ Failed to ${actionError} ${name} globally`);
14
+ }
15
+ }
16
+
17
+ export { runExecutor as default };
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "title": "Global Link/Unlink package executor",
4
+ "description": "Links or unlinks a package globally using pnpm",
5
+ "type": "object",
6
+ "properties": {
7
+ "unlink": {
8
+ "type": "boolean",
9
+ "description": "If set to true, the package will be unlinked globally instead of linked",
10
+ "default": false
11
+ }
12
+ },
13
+ "required": [],
14
+ "additionalProperties": false
15
+ }
@@ -1,5 +1,6 @@
1
1
  export { default as deployExecutor } from './executors/deploy/index.mjs';
2
2
  export { default as environmentsExecutor } from './executors/environments/index.mjs';
3
+ export { default as npmLinkExecutor } from './executors/npm-link/index.mjs';
3
4
  export { default as publishExecutor } from './executors/publish/index.mjs';
4
5
  export { default as updateExecutorsFileExecutor } from './executors/update-executors-file/index.mjs';
5
6
  export { default as verifyChangesetsExecutor } from './executors/verify-changesets/index.mjs';
@@ -76,10 +76,14 @@ import { getViteCommand } from './viteCommand.mjs';
76
76
  */ const getExternalDependencies = (path, globs = [])=>{
77
77
  const pkgJson = getPkgJson(path); // Assumes getLocalPkgJson is a function that reads and parses package.json
78
78
  const dependencies = Object.keys(pkgJson.dependencies || {});
79
+ const peerDependencies = Object.keys(pkgJson.peerDependencies || {});
79
80
  const globPatterns = Array.isArray(globs) ? globs : [
80
81
  globs
81
82
  ];
82
- return dependencies.filter((dep)=>globPatterns.some((pattern)=>minimatch(dep, pattern)));
83
+ return [
84
+ ...dependencies,
85
+ ...peerDependencies
86
+ ].filter((dep)=>globPatterns.some((pattern)=>minimatch(dep, pattern)));
83
87
  };
84
88
  /**
85
89
  * Generates a string of initials based on the input string,
package/executors.json CHANGED
@@ -29,6 +29,11 @@
29
29
  "implementation": "./dist/cjs/executors/verify-changesets/index.cjs",
30
30
  "schema": "./dist/cjs/executors/verify-changesets/schema.json",
31
31
  "description": "Verify if the current library has a corresponding changeset"
32
+ },
33
+ "npm-link": {
34
+ "implementation": "./dist/cjs/executors/npm-link/index.cjs",
35
+ "schema": "./dist/cjs/executors/npm-link/schema.json",
36
+ "description": "Links a package globally using pnpm"
32
37
  }
33
38
  }
34
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/devkit",
3
- "version": "0.1.3-beta.2",
3
+ "version": "0.1.3-beta.3",
4
4
  "type": "module",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",