diff --git a/.github/hooks/pre-commit b/.husky/pre-commit old mode 100755 new mode 100644 similarity index 60% rename from .github/hooks/pre-commit rename to .husky/pre-commit index c41c405fb..372362317 --- a/.github/hooks/pre-commit +++ b/.husky/pre-commit @@ -1,3 +1 @@ -#!/bin/sh - yarn lint-staged diff --git a/.yarn/plugins/@yarnpkg/plugin-git-hooks.cjs b/.yarn/plugins/@yarnpkg/plugin-git-hooks.cjs deleted file mode 100644 index 4ebbcb939..000000000 --- a/.yarn/plugins/@yarnpkg/plugin-git-hooks.cjs +++ /dev/null @@ -1,259 +0,0 @@ -/* eslint-disable */ -//prettier-ignore -module.exports = { - name: '@yarnpkg/plugin-git-hooks', - factory: function (require) { - var plugin = (() => { - var p = Object.create; - var i = Object.defineProperty; - var u = Object.getOwnPropertyDescriptor; - var l = Object.getOwnPropertyNames; - var P = Object.getPrototypeOf, - m = Object.prototype.hasOwnProperty; - var _ = ((n) => - typeof require < 'u' - ? require - : typeof Proxy < 'u' - ? new Proxy(n, { get: (e, E) => (typeof require < 'u' ? require : e)[E] }) - : n)(function (n) { - if (typeof require < 'u') return require.apply(this, arguments); - throw new Error('Dynamic require of "' + n + '" is not supported'); - }); - var c = (n, e) => () => (e || n((e = { exports: {} }).exports, e), e.exports), - A = (n, e) => { - for (var E in e) i(n, E, { get: e[E], enumerable: !0 }); - }, - C = (n, e, E, s) => { - if ((e && typeof e == 'object') || typeof e == 'function') - for (let I of l(e)) - !m.call(n, I) && - I !== E && - i(n, I, { get: () => e[I], enumerable: !(s = u(e, I)) || s.enumerable }); - return n; - }; - var U = (n, e, E) => ( - (E = n != null ? p(P(n)) : {}), - C(e || !n || !n.__esModule ? i(E, 'default', { value: n, enumerable: !0 }) : E, n) - ), - v = (n) => C(i({}, '__esModule', { value: !0 }), n); - var L = c((M, B) => { - B.exports = [ - { name: 'Appcircle', constant: 'APPCIRCLE', env: 'AC_APPCIRCLE' }, - { name: 'AppVeyor', constant: 'APPVEYOR', env: 'APPVEYOR', pr: 'APPVEYOR_PULL_REQUEST_NUMBER' }, - { name: 'AWS CodeBuild', constant: 'CODEBUILD', env: 'CODEBUILD_BUILD_ARN' }, - { - name: 'Azure Pipelines', - constant: 'AZURE_PIPELINES', - env: 'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI', - pr: 'SYSTEM_PULLREQUEST_PULLREQUESTID', - }, - { name: 'Bamboo', constant: 'BAMBOO', env: 'bamboo_planKey' }, - { - name: 'Bitbucket Pipelines', - constant: 'BITBUCKET', - env: 'BITBUCKET_COMMIT', - pr: 'BITBUCKET_PR_ID', - }, - { name: 'Bitrise', constant: 'BITRISE', env: 'BITRISE_IO', pr: 'BITRISE_PULL_REQUEST' }, - { - name: 'Buddy', - constant: 'BUDDY', - env: 'BUDDY_WORKSPACE_ID', - pr: 'BUDDY_EXECUTION_PULL_REQUEST_ID', - }, - { - name: 'Buildkite', - constant: 'BUILDKITE', - env: 'BUILDKITE', - pr: { env: 'BUILDKITE_PULL_REQUEST', ne: 'false' }, - }, - { name: 'CircleCI', constant: 'CIRCLE', env: 'CIRCLECI', pr: 'CIRCLE_PULL_REQUEST' }, - { name: 'Cirrus CI', constant: 'CIRRUS', env: 'CIRRUS_CI', pr: 'CIRRUS_PR' }, - { - name: 'Codefresh', - constant: 'CODEFRESH', - env: 'CF_BUILD_ID', - pr: { any: ['CF_PULL_REQUEST_NUMBER', 'CF_PULL_REQUEST_ID'] }, - }, - { name: 'Codemagic', constant: 'CODEMAGIC', env: 'CM_BUILD_ID', pr: 'CM_PULL_REQUEST' }, - { name: 'Codeship', constant: 'CODESHIP', env: { CI_NAME: 'codeship' } }, - { name: 'Drone', constant: 'DRONE', env: 'DRONE', pr: { DRONE_BUILD_EVENT: 'pull_request' } }, - { name: 'dsari', constant: 'DSARI', env: 'DSARI' }, - { name: 'Expo Application Services', constant: 'EAS', env: 'EAS_BUILD' }, - { name: 'Gerrit', constant: 'GERRIT', env: 'GERRIT_PROJECT' }, - { - name: 'GitHub Actions', - constant: 'GITHUB_ACTIONS', - env: 'GITHUB_ACTIONS', - pr: { GITHUB_EVENT_NAME: 'pull_request' }, - }, - { name: 'GitLab CI', constant: 'GITLAB', env: 'GITLAB_CI', pr: 'CI_MERGE_REQUEST_ID' }, - { name: 'GoCD', constant: 'GOCD', env: 'GO_PIPELINE_LABEL' }, - { name: 'Google Cloud Build', constant: 'GOOGLE_CLOUD_BUILD', env: 'BUILDER_OUTPUT' }, - { name: 'Harness CI', constant: 'HARNESS', env: 'HARNESS_BUILD_ID' }, - { - name: 'Heroku', - constant: 'HEROKU', - env: { env: 'NODE', includes: '/app/.heroku/node/bin/node' }, - }, - { name: 'Hudson', constant: 'HUDSON', env: 'HUDSON_URL' }, - { - name: 'Jenkins', - constant: 'JENKINS', - env: ['JENKINS_URL', 'BUILD_ID'], - pr: { any: ['ghprbPullId', 'CHANGE_ID'] }, - }, - { name: 'LayerCI', constant: 'LAYERCI', env: 'LAYERCI', pr: 'LAYERCI_PULL_REQUEST' }, - { name: 'Magnum CI', constant: 'MAGNUM', env: 'MAGNUM' }, - { - name: 'Netlify CI', - constant: 'NETLIFY', - env: 'NETLIFY', - pr: { env: 'PULL_REQUEST', ne: 'false' }, - }, - { - name: 'Nevercode', - constant: 'NEVERCODE', - env: 'NEVERCODE', - pr: { env: 'NEVERCODE_PULL_REQUEST', ne: 'false' }, - }, - { name: 'ReleaseHub', constant: 'RELEASEHUB', env: 'RELEASE_BUILD_ID' }, - { name: 'Render', constant: 'RENDER', env: 'RENDER', pr: { IS_PULL_REQUEST: 'true' } }, - { name: 'Sail CI', constant: 'SAIL', env: 'SAILCI', pr: 'SAIL_PULL_REQUEST_NUMBER' }, - { - name: 'Screwdriver', - constant: 'SCREWDRIVER', - env: 'SCREWDRIVER', - pr: { env: 'SD_PULL_REQUEST', ne: 'false' }, - }, - { name: 'Semaphore', constant: 'SEMAPHORE', env: 'SEMAPHORE', pr: 'PULL_REQUEST_NUMBER' }, - { name: 'Shippable', constant: 'SHIPPABLE', env: 'SHIPPABLE', pr: { IS_PULL_REQUEST: 'true' } }, - { name: 'Solano CI', constant: 'SOLANO', env: 'TDDIUM', pr: 'TDDIUM_PR_ID' }, - { name: 'Sourcehut', constant: 'SOURCEHUT', env: { CI_NAME: 'sourcehut' } }, - { name: 'Strider CD', constant: 'STRIDER', env: 'STRIDER' }, - { name: 'TaskCluster', constant: 'TASKCLUSTER', env: ['TASK_ID', 'RUN_ID'] }, - { name: 'TeamCity', constant: 'TEAMCITY', env: 'TEAMCITY_VERSION' }, - { - name: 'Travis CI', - constant: 'TRAVIS', - env: 'TRAVIS', - pr: { env: 'TRAVIS_PULL_REQUEST', ne: 'false' }, - }, - { name: 'Vercel', constant: 'VERCEL', env: { any: ['NOW_BUILDER', 'VERCEL'] } }, - { name: 'Visual Studio App Center', constant: 'APPCENTER', env: 'APPCENTER_BUILD_ID' }, - { - name: 'Woodpecker', - constant: 'WOODPECKER', - env: { CI: 'woodpecker' }, - pr: { CI_BUILD_EVENT: 'pull_request' }, - }, - { - name: 'Xcode Cloud', - constant: 'XCODE_CLOUD', - env: 'CI_XCODE_PROJECT', - pr: 'CI_PULL_REQUEST_NUMBER', - }, - { name: 'Xcode Server', constant: 'XCODE_SERVER', env: 'XCS' }, - ]; - }); - var T = c((a) => { - 'use strict'; - var D = L(), - t = process.env; - Object.defineProperty(a, '_vendors', { - value: D.map(function (n) { - return n.constant; - }), - }); - a.name = null; - a.isPR = null; - D.forEach(function (n) { - let E = (Array.isArray(n.env) ? n.env : [n.env]).every(function (s) { - return S(s); - }); - if (((a[n.constant] = E), !!E)) - switch (((a.name = n.name), typeof n.pr)) { - case 'string': - a.isPR = !!t[n.pr]; - break; - case 'object': - 'env' in n.pr - ? (a.isPR = n.pr.env in t && t[n.pr.env] !== n.pr.ne) - : 'any' in n.pr - ? (a.isPR = n.pr.any.some(function (s) { - return !!t[s]; - })) - : (a.isPR = S(n.pr)); - break; - default: - a.isPR = null; - } - }); - a.isCI = !!( - t.CI !== 'false' && - (t.BUILD_ID || - t.BUILD_NUMBER || - t.CI || - t.CI_APP_ID || - t.CI_BUILD_ID || - t.CI_BUILD_NUMBER || - t.CI_NAME || - t.CONTINUOUS_INTEGRATION || - t.RUN_ID || - a.name || - !1) - ); - function S(n) { - return typeof n == 'string' - ? !!t[n] - : 'env' in n - ? t[n.env] && t[n.env].includes(n.includes) - : 'any' in n - ? n.any.some(function (e) { - return !!t[e]; - }) - : Object.keys(n).every(function (e) { - return t[e] === n[e]; - }); - } - }); - var d = {}; - A(d, { default: () => O }); - var o = U(_('process')), - r = _('@yarnpkg/core'), - R = U(T()), - N = { - configuration: { - gitHooksPath: { - description: 'Path to git hooks directory (recommended: .github/hooks)', - type: r.SettingsType.STRING, - default: null, - }, - disableGitHooks: { - description: 'Disable automatic git hooks installation', - type: r.SettingsType.BOOLEAN, - default: R.default.isCI, - }, - }, - hooks: { - afterAllInstalled: async (n) => { - let e = n.configuration.get('gitHooksPath'), - E = n.configuration.get('disableGitHooks'), - s = Boolean(n.cwd?.endsWith(`dlx-${o.default.pid}`)); - if (e && !R.default.isCI && !s && !E) - return r.execUtils.pipevp('git', ['config', 'core.hooksPath', e], { - cwd: n.cwd, - strict: !0, - stdin: o.default.stdin, - stdout: o.default.stdout, - stderr: o.default.stderr, - }); - }, - }, - }, - O = N; - return v(d); - })(); - return plugin; - }, -}; diff --git a/.yarnrc.yml b/.yarnrc.yml index 315a7d312..4fb8d32bf 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -4,8 +4,3 @@ nodeLinker: node-modules plugins: - path: ./.yarn/plugins/postinstallDev.cjs - - checksum: f8ce3a541a57481f6213647cfe7ac8555d87cb1fc23a73a102e64e12be07f603826d822f4d0285333400f0f15baed92510c33dcce75dde2953b2811e36efa012 - path: .yarn/plugins/@yarnpkg/plugin-git-hooks.cjs - spec: "https://raw.githubusercontent.com/trufflehq/yarn-plugin-git-hooks/main/bundles/%40yarnpkg/plugin-git-hooks.js" - -gitHooksPath: .github/hooks diff --git a/package.json b/package.json index 9cf0df6e8..397be7e2e 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "prepack": "yarn insert-cli-metadata && yarn build && yarn update-docs", "insert-cli-metadata": "tsx scripts/insert-cli-metadata.ts", "update-docs": "tsx scripts/generate-cli-docs.ts", - "postinstall": "node -e \"console.log('We have an active developer community on Discord. You can find it on https://discord.gg/crawlee-apify-801163717915574323.');\"" + "postinstall": "node -e \"console.log('We have an active developer community on Discord. You can find it on https://discord.gg/crawlee-apify-801163717915574323.');\"", + "prepare": "husky" }, "files": [ "dist" @@ -123,7 +124,6 @@ "@types/cors": "^2.8.17", "@types/execa": "^2.0.2", "@types/express": "^5.0.0", - "@types/is-ci": "^3.0.4", "@types/jju": "^1.4.5", "@types/js-levenshtein": "^1", "@types/lodash.clonedeep": "^4", @@ -136,6 +136,7 @@ "cross-env": "^10.0.0", "eslint": "^9.25.1", "eslint-config-prettier": "^10.1.2", + "husky": "^9", "lint-staged": "^16.0.0", "mock-stdin": "^1.0.0", "prettier": "^3.5.3", diff --git a/yarn.lock b/yarn.lock index a1f80c36f..e495be758 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1584,15 +1584,6 @@ __metadata: languageName: node linkType: hard -"@types/is-ci@npm:^3.0.4": - version: 3.0.4 - resolution: "@types/is-ci@npm:3.0.4" - dependencies: - ci-info: "npm:^3.1.0" - checksum: 10c0/80a3d444d06af53b32429ef9e70184adf12bd98a2f851d8c050aecf7b4abfdab9671abc317785be834d41cad98331992040147ef382bacc2b2a441fee1549a3e - languageName: node - linkType: hard - "@types/jju@npm:^1.4.5": version: 1.4.5 resolution: "@types/jju@npm:1.4.5" @@ -2271,7 +2262,6 @@ __metadata: "@types/cors": "npm:^2.8.17" "@types/execa": "npm:^2.0.2" "@types/express": "npm:^5.0.0" - "@types/is-ci": "npm:^3.0.4" "@types/jju": "npm:^1.4.5" "@types/js-levenshtein": "npm:^1" "@types/lodash.clonedeep": "npm:^4" @@ -2300,6 +2290,7 @@ __metadata: express: "npm:~5.2.0" globby: "npm:~15.0.0" handlebars: "npm:~4.7.8" + husky: "npm:^9" indent-string: "npm:^5.0.0" is-ci: "npm:~4.1.0" istextorbinary: "npm:~9.5.0" @@ -3006,13 +2997,6 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:^3.1.0": - version: 3.9.0 - resolution: "ci-info@npm:3.9.0" - checksum: 10c0/6f0109e36e111684291d46123d491bc4e7b7a1934c3a20dea28cba89f1d4a03acd892f5f6a81ed3855c38647e285a150e3c9ba062e38943bef57fee6c1554c3a - languageName: node - linkType: hard - "ci-info@npm:^4.0.0, ci-info@npm:^4.1.0": version: 4.4.0 resolution: "ci-info@npm:4.4.0" @@ -5241,6 +5225,15 @@ __metadata: languageName: node linkType: hard +"husky@npm:^9": + version: 9.1.7 + resolution: "husky@npm:9.1.7" + bin: + husky: bin.js + checksum: 10c0/35bb110a71086c48906aa7cd3ed4913fb913823715359d65e32e0b964cb1e255593b0ae8014a5005c66a68e6fa66c38dcfa8056dbbdfb8b0187c0ffe7ee3a58f + languageName: node + linkType: hard + "iconv-lite@npm:^0.7.0, iconv-lite@npm:^0.7.2, iconv-lite@npm:~0.7.0": version: 0.7.2 resolution: "iconv-lite@npm:0.7.2"