@shopify/cli-hydrogen 3.25.0 → 3.26.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/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright 2019-present, Shopify Inc.
2
+
3
+ ​​
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -25,15 +25,15 @@ function multipleLockfilesWarning(lockfiles) {
25
25
  'pnpm-lock.yaml': 'pnpm',
26
26
  };
27
27
  const lockfileList = lockfiles.map((lockfile) => {
28
- return `• ${lockfile} (created by ${packageManagers[lockfile]})`;
28
+ return `${lockfile} (created by ${packageManagers[lockfile]})`;
29
29
  });
30
30
  renderWarning({
31
31
  headline: 'Multiple lockfiles found',
32
32
  body: [
33
33
  `Your project contains more than one lockfile. This can cause version ` +
34
34
  `conflicts when installing and deploying your app. The following ` +
35
- `lockfiles were detected:\n\n`,
36
- lockfileList.join('\n '),
35
+ `lockfiles were detected:\n`,
36
+ { list: { items: lockfileList } },
37
37
  ],
38
38
  nextSteps: ['Delete any unneeded lockfiles', 'Commit the change to your repository'],
39
39
  });
@@ -1 +1 @@
1
- {"version":3,"file":"check-lockfile.js","sourceRoot":"","sources":["../../../../src/cli/services/build/check-lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,4CAA4C,CAAA;AAGpE,SAAS,sBAAsB;IAC7B,aAAa,CAAC;QACZ,QAAQ,EAAE,mBAAmB;QAC7B,IAAI,EACF,wEAAwE;YACxE,0EAA0E;YAC1E,gDAAgD;QAClD,SAAS,EAAE;YACT;gBACE,0BAA0B;gBAC1B;oBACE,OAAO,EAAE,uBAAuB;iBACjC;aACF;YACD,wCAAwC;SACzC;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,SAAqB;IACrD,MAAM,eAAe,GAAG;QACtB,WAAW,EAAE,MAAM;QACnB,mBAAmB,EAAE,KAAK;QAC1B,gBAAgB,EAAE,MAAM;KACzB,CAAA;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC9C,OAAO,KAAK,QAAQ,gBAAgB,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAA;IAClE,CAAC,CAAC,CAAA;IAEF,aAAa,CAAC;QACZ,QAAQ,EAAE,0BAA0B;QACpC,IAAI,EAAE;YACJ,uEAAuE;gBACrE,kEAAkE;gBAClE,8BAA8B;YAChC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;SACzB;QACD,SAAS,EAAE,CAAC,+BAA+B,EAAE,sCAAsC,CAAC;KACrF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAgB;IAC9C,aAAa,CAAC;QACZ,QAAQ,EAAE,yBAAyB;QACnC,IAAI,EACF,0EAA0E;YAC1E,0EAA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les} from '@shopify/cli-kit/node/node-package-manager'\nimport type {Lockfile} from '@shopify/cli-kit/node/node-package-manager'\n\nfunction missingLockfileWarning() {\n renderWarning({\n headline: 'No lockfile found',\n body:\n `If you don’t commit a lockfile, then your app might install the wrong ` +\n `package versions when deploying. To avoid versioning issues, generate a ` +\n `new lockfile and commit it to your repository.`,\n nextSteps: [\n [\n 'Generate a lockfile. Run',\n {\n command: 'npm|yarn|pnpm install',\n },\n ],\n 'Commit the new file to your repository',\n ],\n })\n}\n\nfunction multipleLockfilesWarning(lockfiles: Lockfile[]) {\n const packageManagers = {\n 'yarn.lock': 'yarn',\n 'package-lock.json': 'npm',\n 'pnpm-lock.yaml': 'pnpm',\n }\n\n const lockfileList = lockfiles.map((lockfile) => {\n return `• ${lockfile} (created by ${packageManagers[lockfile]})`\n })\n\n renderWarning({\n headline: 'Multiple lockfiles found',\n body: [\n `Your project contains more than one lockfile. This can cause version ` +\n `conflicts when installing and deploying your app. The following ` +\n `lockfiles were detected:\\n\\n`,\n lockfileList.join('\\n '),\n ],\n nextSteps: ['Delete any unneeded lockfiles', 'Commit the change to your repository'],\n })\n}\n\nfunction lockfileIgnoredWarning(lockfile: string) {\n renderWarning({\n headline: 'Lockfile ignored by Git',\n body:\n `Your project’s lockfile isn’t being tracked by Git. If you don’t commit ` +\n `a lockfile, then your app might install the wrong package versions when ` +\n `deploying.`,\n nextSteps: [\n `In your project’s .gitignore file, delete any references to ${lockfile}`,\n 'Commit the change to your repository',\n ],\n })\n}\n\ntype LockFileStatus = 'missing' | 'multiple' | 'ignored' | 'ok'\n\nexport async function checkLockfileStatus(directory: string): Promise<LockFileStatus> {\n const availableLockfiles = await lockfiles.reduce(async (acc, lockFileName) => {\n const lockfilePath = path.resolve(directory, lockFileName)\n if (await file.exists(lockfilePath)) {\n return (await acc).concat(lockFileName)\n } else {\n return acc\n }\n }, Promise.resolve([] as Lockfile[]))\n\n if (!availableLockfiles.length) {\n missingLockfileWarning()\n return 'missing'\n }\n\n if (availableLockfiles.length > 1) {\n multipleLockfilesWarning(availableLockfiles)\n return 'multiple'\n }\n\n const repo = git.factory(directory)\n const lockfile = availableLockfiles[0]!\n const ignoredLockfile = await repo.checkIgnore([lockfile])\n\n if (ignoredLockfile.length) {\n lockfileIgnoredWarning(lockfile)\n return 'ignored'\n }\n\n return 'ok'\n}\n"]}
1
+ {"version":3,"file":"check-lockfile.js","sourceRoot":"","sources":["../../../../src/cli/services/build/check-lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,4CAA4C,CAAA;AAGpE,SAAS,sBAAsB;IAC7B,aAAa,CAAC;QACZ,QAAQ,EAAE,mBAAmB;QAC7B,IAAI,EACF,wEAAwE;YACxE,0EAA0E;YAC1E,gDAAgD;QAClD,SAAS,EAAE;YACT;gBACE,0BAA0B;gBAC1B;oBACE,OAAO,EAAE,uBAAuB;iBACjC;aACF;YACD,wCAAwC;SACzC;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,SAAqB;IACrD,MAAM,eAAe,GAAG;QACtB,WAAW,EAAE,MAAM;QACnB,mBAAmB,EAAE,KAAK;QAC1B,gBAAgB,EAAE,MAAM;KACzB,CAAA;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC9C,OAAO,GAAG,QAAQ,gBAAgB,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,aAAa,CAAC;QACZ,QAAQ,EAAE,0BAA0B;QACpC,IAAI,EAAE;YACJ,uEAAuE;gBACrE,kEAAkE;gBAClE,4BAA4B;YAC9B,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,YAAY,EAAC,EAAC;SAC9B;QACD,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M,EAAE;QAC1B,sBAAsB,CAAC,QAAQ,CAAC,CAAA;QAChC,OAAO,SAAS,CAAA;KACjB;IAED,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import {file, git, path} from '@shopify/cli-kit'\nimport {renderWarning} from '@shopify/cli-kit/node/ui'\nimport {lockfiles} from '@shopify/cli-kit/node/node-package-manager'\nimport type {Lockfile} from '@shopify/cli-kit/node/node-package-manager'\n\nfunction missingLockfileWarning() {\n renderWarning({\n headline: 'No lockfile found',\n body:\n `If you don’t commit a lockfile, then your app might install the wrong ` +\n `package versions when deploying. To avoid versioning issues, generate a ` +\n `new lockfile and commit it to your repository.`,\n nextSteps: [\n [\n 'Generate a lockfile. Run',\n {\n command: 'npm|yarn|pnpm install',\n },\n ],\n 'Commit the new file to your repository',\n ],\n })\n}\n\nfunction multipleLockfilesWarning(lockfiles: Lockfile[]) {\n const packageManagers = {\n 'yarn.lock': 'yarn',\n 'package-lock.json': 'npm',\n 'pnpm-lock.yaml': 'pnpm',\n }\n\n const lockfileList = lockfiles.map((lockfile) => {\n return `${lockfile} (created by ${packageManagers[lockfile]})`\n })\n\n renderWarning({\n headline: 'Multiple lockfiles found',\n body: [\n `Your project contains more than one lockfile. This can cause version ` +\n `conflicts when installing and deploying your app. The following ` +\n `lockfiles were detected:\\n`,\n {list: {items: lockfileList}},\n ],\n nextSteps: ['Delete any unneeded lockfiles', 'Commit the change to your repository'],\n })\n}\n\nfunction lockfileIgnoredWarning(lockfile: string) {\n renderWarning({\n headline: 'Lockfile ignored by Git',\n body:\n `Your project’s lockfile isn’t being tracked by Git. If you don’t commit ` +\n `a lockfile, then your app might install the wrong package versions when ` +\n `deploying.`,\n nextSteps: [\n `In your project’s .gitignore file, delete any references to ${lockfile}`,\n 'Commit the change to your repository',\n ],\n })\n}\n\ntype LockFileStatus = 'missing' | 'multiple' | 'ignored' | 'ok'\n\nexport async function checkLockfileStatus(directory: string): Promise<LockFileStatus> {\n const availableLockfiles = await lockfiles.reduce(async (acc, lockFileName) => {\n const lockfilePath = path.resolve(directory, lockFileName)\n if (await file.exists(lockfilePath)) {\n return (await acc).concat(lockFileName)\n } else {\n return acc\n }\n }, Promise.resolve([] as Lockfile[]))\n\n if (!availableLockfiles.length) {\n missingLockfileWarning()\n return 'missing'\n }\n\n if (availableLockfiles.length > 1) {\n multipleLockfilesWarning(availableLockfiles)\n return 'multiple'\n }\n\n const repo = git.factory(directory)\n const lockfile = availableLockfiles[0]!\n const ignoredLockfile = await repo.checkIgnore([lockfile])\n\n if (ignoredLockfile.length) {\n lockfileIgnoredWarning(lockfile)\n return 'ignored'\n }\n\n return 'ok'\n}\n"]}