Skip to content

Commit

Permalink
🔨 make copy-env a script
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Nov 4, 2021
1 parent 3192422 commit 8b6bc9d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@casper124578/eslint-config-next": "^0.1.1",
"@casper124578/eslint-config-react": "^0.1.2",
"colorette": "2.0.16",
"copy": "^0.3.2",
"eslint": "^7.32.0",
"husky": "^7.0.4",
"prettier": "^2.4.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"version": "1.0.0-beta.0",
"scripts": {
"dev": "rimraf .env && next dev",
"build": "yarn copy-env && next build",
"build": "yarn copy-env && yarn next-build",
"next-build": "next build",
"start": "next start",
"copy-env": "copy ../../.env ./client/.env",
"copy-env": "node ../../scripts/copy-env.mjs",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,css,json}\" --ignore-path .gitignore",
"lint": "eslint . --ext .ts,.js,.tsx,.jsx,"
},
Expand Down Expand Up @@ -42,7 +43,6 @@
"@types/sortablejs": "^1.10.7",
"@types/uuid": "^8.3.1",
"autoprefixer": "^10.4.0",
"copy": "^0.3.2",
"postcss": "^8.3.11",
"preact": "^10.5.15",
"rimraf": "^3.0.2",
Expand Down
22 changes: 22 additions & 0 deletions scripts/copy-env.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { one } from "copy";
import { join } from "node:path";

const ENV_FILE_PATH = join(process.cwd(), ".env");
const CLIENT_PACKAGE_PATH = join(process.cwd(), "packages", "client");

async function copyEnv() {
try {
one(ENV_FILE_PATH, CLIENT_PACKAGE_PATH, (error) => {
if (error) {
console.log({ error });
return;
}

console.log("✅ copied .env");
});
} catch (e) {
console.log({ e });
}
}

copyEnv();
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,6 @@ __metadata:
"@types/uuid": ^8.3.1
autoprefixer: ^10.4.0
axios: ^0.24.0
copy: ^0.3.2
date-fns: ^2.25.0
formik: ^2.2.9
hex-color-regex: ^1.1.0
Expand Down Expand Up @@ -9463,6 +9462,7 @@ resolve@^2.0.0-next.3:
"@casper124578/eslint-config-next": ^0.1.1
"@casper124578/eslint-config-react": ^0.1.2
colorette: 2.0.16
copy: ^0.3.2
eslint: ^7.32.0
husky: ^7.0.4
prettier: ^2.4.1
Expand Down

0 comments on commit 8b6bc9d

Please sign in to comment.