Skip to content

Commit

Permalink
Project update. [p][robotic]
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswrks committed Aug 26, 2023
1 parent 7eddd98 commit c8ea403
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 147 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [19.1.0, 20.5.1]
node-version: [20.5.1]

runs-on: ${{matrix.os}}
environment: ci # CI environment.
Expand All @@ -44,6 +44,7 @@ jobs:
USER_NPM_TOKEN: ${{secrets.USER_NPM_TOKEN}}

# Supplied by repo environment secrets.
# Only available for repos using a Dotenv Vault.
USER_DOTENV_KEY_MAIN: ${{secrets.USER_DOTENV_KEY_MAIN || ''}}
USER_DOTENV_KEY_CI: ${{secrets.USER_DOTENV_KEY_CI || ''}}

Expand All @@ -55,14 +56,21 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
cache: npm # Cache NPM dependencies.
cache: npm # Caches NPM dependencies.

- name: Get Package JSON
shell: bash
run: |
echo 'PKG_JSON='"$(jq -c . ./package.json)" >> $GITHUB_ENV;
echo 'PKG_JSON_C10N='"$(jq -c '.config | .c10n | .["&"]' ./package.json)" >> $GITHUB_ENV;
- name: Install Project
shell: bash
run: |
npx @clevercanyon/madrun install project --mode=ci;
- name: Run Project Tests
if: fromJson(env.PKG_JSON_C10N).build.appType
shell: bash
run: |
npx @clevercanyon/madrun tests --mode=ci;
Expand Down
12 changes: 8 additions & 4 deletions dev/.files/vite/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ export default async ({ mode, command, ssrBuild: isSSRBuild }) => {
/**
* Pre-updates `package.json` properties impacting build process.
*/
await u.updatePkg({ $set: { type: updatePkg.type, sideEffects: updatePkg.sideEffects } });
if ('build' === command /* Only when building the app. */) {
await u.updatePkg({ $set: { type: updatePkg.type, sideEffects: updatePkg.sideEffects } });
}

/**
* Configures plugins for Vite.
Expand Down Expand Up @@ -301,12 +303,14 @@ export default async ({ mode, command, ssrBuild: isSSRBuild }) => {
/**
* Updates `package.json`.
*/
await u.updatePkg({ $set: updatePkg });
if ('build' === command) {
await u.updatePkg({ $set: updatePkg });
}

/**
* Copies `./.env.vault` to dist directory.
*/
if (fs.existsSync(path.resolve(projDir, './.env.vault'))) {
if ('build' === command && fs.existsSync(path.resolve(projDir, './.env.vault'))) {
await fsp.copyFile(path.resolve(projDir, './.env.vault'), path.resolve(distDir, './.env.vault'));
}

Expand All @@ -318,7 +322,7 @@ export default async ({ mode, command, ssrBuild: isSSRBuild }) => {
}

/**
* Deletes a few files that interfere with apps running on Cloudflare Pages.
* Deletes a few files that are not needed for apps running on Cloudflare Pages.
*/
if ('build' === command && ['spa', 'mpa'].includes(appType) && ['cfp'].includes(targetEnv)) {
for (const fileOrDir of await $glob.promise(['types', '.env.vault', 'index.*'], { cwd: distDir, onlyFiles: false })) {
Expand Down
Loading

0 comments on commit c8ea403

Please sign in to comment.