diff --git a/packages/odyssey-babel-preset/package.json b/packages/odyssey-babel-preset/package.json index 7ab9cc5b12..c7e8e0f271 100644 --- a/packages/odyssey-babel-preset/package.json +++ b/packages/odyssey-babel-preset/package.json @@ -13,7 +13,7 @@ }, "scripts": { "prepare": "tsc", - "prepack": "node ./scripts/prepack.js" + "prepack": "prepack" }, "dependencies": { "@babel/core": "^7.15.0", diff --git a/packages/odyssey-design-tokens/package.json b/packages/odyssey-design-tokens/package.json index 68314ae57d..4c0dc841d9 100644 --- a/packages/odyssey-design-tokens/package.json +++ b/packages/odyssey-design-tokens/package.json @@ -17,6 +17,6 @@ "scripts": { "build": "style-dictionary clean && style-dictionary build", "prepare": "yarn build", - "prepack": "node ./scripts/prepack.js" + "prepack": "prepack" } } diff --git a/packages/odyssey-design-tokens/scripts/prepack.js b/packages/odyssey-design-tokens/scripts/prepack.js deleted file mode 100644 index 056af6017d..0000000000 --- a/packages/odyssey-design-tokens/scripts/prepack.js +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ - -const { writeFileSync } = require("fs"); -const { resolve } = require("path"); - -const pkgPath = resolve(__dirname, "../package.json"); - -// eslint-disable-next-line no-unused-vars -const { scripts, devDependencies, ...pkg } = require(pkgPath); - -writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n"); diff --git a/packages/odyssey-lifecycle/package.json b/packages/odyssey-lifecycle/package.json new file mode 100644 index 0000000000..1ae7dee729 --- /dev/null +++ b/packages/odyssey-lifecycle/package.json @@ -0,0 +1,11 @@ +{ + "name": "@okta/odyssey-lifecycle", + "version": "0.0.0", + "description": "Lifecycle scripts for lerna and npm", + "author": "Okta, Inc.", + "license": "Apache-2.0", + "private": true, + "bin": { + "prepack": "src/prepack.js" + } +} diff --git a/packages/odyssey-babel-preset/scripts/prepack.js b/packages/odyssey-lifecycle/src/prepack.js old mode 100644 new mode 100755 similarity index 91% rename from packages/odyssey-babel-preset/scripts/prepack.js rename to packages/odyssey-lifecycle/src/prepack.js index 056af6017d..fd9bd28b86 --- a/packages/odyssey-babel-preset/scripts/prepack.js +++ b/packages/odyssey-lifecycle/src/prepack.js @@ -1,3 +1,4 @@ +#!/usr/bin/env node /*! * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") @@ -13,7 +14,7 @@ const { writeFileSync } = require("fs"); const { resolve } = require("path"); -const pkgPath = resolve(__dirname, "../package.json"); +const pkgPath = resolve(process.cwd(), "./package.json"); // eslint-disable-next-line no-unused-vars const { scripts, devDependencies, ...pkg } = require(pkgPath); diff --git a/packages/odyssey-react-theme/package.json b/packages/odyssey-react-theme/package.json index c4ac28eb23..9d23828f1a 100644 --- a/packages/odyssey-react-theme/package.json +++ b/packages/odyssey-react-theme/package.json @@ -44,6 +44,6 @@ "build:clean": "rm -rf dist", "build:types": "tsc --project tsconfig.production.json", "build:source": "./scripts/buildSource", - "prepack": "node ./scripts/prepack.js" + "prepack": "prepack" } } diff --git a/packages/odyssey-react-theme/scripts/prepack.js b/packages/odyssey-react-theme/scripts/prepack.js deleted file mode 100644 index 056af6017d..0000000000 --- a/packages/odyssey-react-theme/scripts/prepack.js +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ - -const { writeFileSync } = require("fs"); -const { resolve } = require("path"); - -const pkgPath = resolve(__dirname, "../package.json"); - -// eslint-disable-next-line no-unused-vars -const { scripts, devDependencies, ...pkg } = require(pkgPath); - -writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n"); diff --git a/packages/odyssey-react/package.json b/packages/odyssey-react/package.json index 1abff0f7db..3e25a07c22 100644 --- a/packages/odyssey-react/package.json +++ b/packages/odyssey-react/package.json @@ -55,6 +55,6 @@ "build:types": "tsc --project tsconfig.production.json", "build:source": "./scripts/buildSource", "build-icons": "svgr $(node ./scripts/resolveIconSrcPath.js) --out-dir ./src/components/Icon/", - "prepack": "node ./scripts/prepack.js" + "prepack": "prepack" } } diff --git a/packages/odyssey-react/scripts/prepack.js b/packages/odyssey-react/scripts/prepack.js deleted file mode 100644 index 056af6017d..0000000000 --- a/packages/odyssey-react/scripts/prepack.js +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ - -const { writeFileSync } = require("fs"); -const { resolve } = require("path"); - -const pkgPath = resolve(__dirname, "../package.json"); - -// eslint-disable-next-line no-unused-vars -const { scripts, devDependencies, ...pkg } = require(pkgPath); - -writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n"); diff --git a/packages/odyssey-storybook/package.json b/packages/odyssey-storybook/package.json index 917fb1ea85..1627dfb883 100644 --- a/packages/odyssey-storybook/package.json +++ b/packages/odyssey-storybook/package.json @@ -35,6 +35,6 @@ "build": "build-storybook --quiet --output-dir dist", "typecheck": "tsc", "prepublishOnly": "yarn run build", - "prepack": "node ./scripts/prepack.js" + "prepack": "prepack" } } diff --git a/packages/odyssey-storybook/scripts/prepack.js b/packages/odyssey-storybook/scripts/prepack.js deleted file mode 100644 index 056af6017d..0000000000 --- a/packages/odyssey-storybook/scripts/prepack.js +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ - -const { writeFileSync } = require("fs"); -const { resolve } = require("path"); - -const pkgPath = resolve(__dirname, "../package.json"); - -// eslint-disable-next-line no-unused-vars -const { scripts, devDependencies, ...pkg } = require(pkgPath); - -writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");