diff --git a/.changeset/mean-llamas-cheat.md b/.changeset/mean-llamas-cheat.md new file mode 100644 index 00000000..e6dede65 --- /dev/null +++ b/.changeset/mean-llamas-cheat.md @@ -0,0 +1,7 @@ +--- +"@lookit/templates": patch +"@lookit/record": patch +"@lookit/data": patch +--- + +Generate environment file before production build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6a219a6..30b07edb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [18, 20] + node: ["18.x", "20.x"] steps: - uses: actions/checkout@v4 @@ -25,6 +25,12 @@ jobs: - name: Install NPM dependencies run: npm ci + - name: Create environment file + run: printenv > .env + env: + DEBUG: "false" + LOCAL_DOWNLOAD: "false" + - name: Build packages run: npm run build diff --git a/README.md b/README.md index 4711e2bf..4953a162 100644 --- a/README.md +++ b/README.md @@ -95,15 +95,21 @@ npm i @jspsych/config -w @lookit/ ## Build all packages -We can use npm workspaces to build all packages. +First, create a `.env` file at the root of the monorepo. It can contain the +following for a successful local development build. -First, install dependencies: +``` +DEBUG=true +LOCAL_DOWNLOAD=true +``` + +Next, we can use npm to install dependencies. ``` npm ci ``` -Build all packages: +Then, build all packages. ``` npm run build diff --git a/packages/data/rollup.config.mjs b/packages/data/rollup.config.mjs index 010f204b..43981b10 100644 --- a/packages/data/rollup.config.mjs +++ b/packages/data/rollup.config.mjs @@ -9,7 +9,7 @@ export default makeRollupConfig("chsData").map((config) => { // Resolve node dependencies to be used in a browser. nodeResolve({ browser: true, preferBuiltins: false }), // Add support for .env files - dotenv(), + dotenv({ cwd: "../../" }), ...config.plugins, ], }; diff --git a/packages/record/rollup.config.mjs b/packages/record/rollup.config.mjs index d45968af..9bc94497 100644 --- a/packages/record/rollup.config.mjs +++ b/packages/record/rollup.config.mjs @@ -11,7 +11,7 @@ export default makeRollupConfig("chsRecord").map((config) => { plugins: [ ...config.plugins, // Add support for .env files - dotenv(), + dotenv({ cwd: "../../" }), // Add support to import yaml and handlebars files as strings importAsString({ include: ["**/*.yaml", "**/*.hbs"], diff --git a/packages/templates/rollup.config.mjs b/packages/templates/rollup.config.mjs index 63119b11..a63d624a 100644 --- a/packages/templates/rollup.config.mjs +++ b/packages/templates/rollup.config.mjs @@ -9,7 +9,7 @@ export default makeRollupConfig("chsTemplates").map((config) => { plugins: [ ...config.plugins, // Add support for .env files - dotenv(), + dotenv({ cwd: "../../" }), // Add support to import yaml and handlebars files as strings importAsString({ include: ["**/*.yaml", "**/*.hbs"],