@dword-design/base 16.2.0 → 16.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,11 @@
1
1
  export default function (): ({
2
2
  name: string;
3
3
  uses: any;
4
- env?: undefined;
5
- run?: undefined;
6
4
  if?: undefined;
7
5
  with?: undefined;
8
6
  } | {
9
- env: any;
10
7
  run: string;
8
+ env?: any;
11
9
  name?: undefined;
12
10
  uses?: undefined;
13
11
  if?: undefined;
@@ -21,6 +19,4 @@ export default function (): ({
21
19
  path: string;
22
20
  };
23
21
  name?: undefined;
24
- env?: undefined;
25
- run?: undefined;
26
22
  })[];
@@ -15,21 +15,23 @@ export default function () {
15
15
  }, {
16
16
  cwd: this.cwd
17
17
  });
18
- const envVariableNames = Object.keys(envSchemaPath ? fs.readJsonSync(envSchemaPath) : {}).map(name => constantCase(name));
18
+ const localEnvVariableNames = Object.keys(envSchemaPath ? fs.readJsonSync(envSchemaPath) : {}).map(name => constantCase(name));
19
+ const envVariables = {
20
+ ...(this.config.doppler ? {
21
+ DOPPLER_TOKEN: "${{ secrets.DOPPLER_TOKEN }}"
22
+ } : Object.fromEntries(localEnvVariableNames.map(name => [name, `\${{ secrets.${name} }}`]))),
23
+ ...(this.config.githubActionsTypecheckMemoryLimitMb && {
24
+ NODE_OPTIONS: `--max-old-space-size=${this.config.githubActionsTypecheckMemoryLimitMb}`
25
+ })
26
+ };
19
27
  const packageName = parsePackagejsonName(this.packageConfig.name).fullName;
20
28
  return [...(this.config.doppler ? [{
21
29
  name: "Install Doppler CLI",
22
30
  uses: gitHubAction`dword-design/doppler-cli-action-fork@fork`
23
31
  }] : []), {
24
- env: {
25
- ...(this.config.doppler ? {
26
- DOPPLER_TOKEN: "${{ secrets.DOPPLER_TOKEN }}"
27
- } : Object.fromEntries(envVariableNames.map(name => [name, `\${{ secrets.${name} }}`]))),
28
- GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
29
- ...(this.config.githubActionsTypecheckMemoryLimitMb && {
30
- NODE_OPTIONS: `--max-old-space-size=${this.config.githubActionsTypecheckMemoryLimitMb}`
31
- })
32
- },
32
+ ...(Object.keys(envVariables).length > 0 ? {
33
+ env: envVariables
34
+ } : {}),
33
35
  run: `${this.config.doppler ? `doppler run -p ${packageName} -c test -- ` : ""}pnpm verify`
34
36
  }, {
35
37
  if: "always()",
@@ -1,8 +1,30 @@
1
+ import pathLib from "node:path";
2
+ import { constantCase } from "change-case";
3
+ import { findUpStop, findUpSync } from "find-up";
4
+ import fs from "fs-extra";
5
+ import parsePackagejsonName from "parse-packagejson-name";
1
6
  import gitHubAction from "tagged-template-noop";
2
7
  import coverageSteps from "../steps/coverage.js";
3
8
  import getReleaseSteps from "../steps/get-release.js";
4
9
  import getTestSteps from "../steps/get-test.js";
5
10
  export default function () {
11
+ const envSchemaPath = findUpSync(path => {
12
+ if (fs.existsSync(pathLib.join(path, ".env.schema.json"))) {
13
+ return ".env.schema.json";
14
+ }
15
+ if (fs.existsSync(pathLib.join(path, "package.json"))) {
16
+ return findUpStop;
17
+ }
18
+ }, {
19
+ cwd: this.cwd
20
+ });
21
+ const localEnvVariableNames = Object.keys(envSchemaPath ? fs.readJsonSync(envSchemaPath) : {}).map(name => constantCase(name));
22
+ const envVariables = {
23
+ ...(this.config.doppler ? {
24
+ DOPPLER_TOKEN: "${{ secrets.DOPPLER_TOKEN }}"
25
+ } : Object.fromEntries(localEnvVariableNames.map(name => [name, `\${{ secrets.${name} }}`])))
26
+ };
27
+ const packageName = parsePackagejsonName(this.packageConfig.name).fullName;
6
28
  return {
7
29
  release: {
8
30
  needs: "test",
@@ -26,8 +48,14 @@ export default function () {
26
48
  run: 'git config --global user.name "GitHub Actions"'
27
49
  }, {
28
50
  run: "pnpm install --frozen-lockfile"
29
- }, {
30
- run: "pnpm lint"
51
+ }, ...(this.config.doppler ? [{
52
+ name: "Install Doppler CLI",
53
+ uses: gitHubAction`dword-design/doppler-cli-action-fork@fork`
54
+ }] : []), {
55
+ ...(Object.keys(envVariables).length > 0 ? {
56
+ env: envVariables
57
+ } : {}),
58
+ run: `${this.config.doppler ? `doppler run -p ${packageName} -c test -- ` : ""}pnpm lint`
31
59
  }, ...getReleaseSteps.call(this)]
32
60
  },
33
61
  test: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base",
3
- "version": "16.2.0",
3
+ "version": "16.2.1",
4
4
  "description": "Base package for projects.",
5
5
  "repository": "dword-design/base",
6
6
  "funding": "https://github.com/sponsors/dword-design",