Skip to content

Commit fd9da86

Browse files
committed
Merge branch 'develop'
2 parents c059b1c + e80381b commit fd9da86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2237
-1768
lines changed

.changeset/serious-paws-train.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.docs/generate.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import jsdoc2md from 'jsdoc-to-markdown';
22
import fs from 'fs-extra';
33
import path from 'path';
44
import chalk from 'chalk';
5-
import { ConfigManager, LogManager } from '@bluecadet/launchpad-utils';
5+
import { loadConfigFromFile, LogManager } from '@bluecadet/launchpad-utils';
6+
import { findConfigFile } from 'typescript';
67

7-
const config = ConfigManager.getInstance().getConfig();
8+
const configFile = findConfigFile();
9+
const config = configFile ? (await loadConfigFromFile(configFile)) : {};
810
const logger = LogManager.getInstance(config).getLogger('docs');
911

1012
/**

.github/workflows/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ jobs:
2323
run: npm install
2424

2525
- name: Run eslint
26-
run: npm run lint
26+
run: npm run lint
27+
28+
- name: Validate types
29+
run: npm run build

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
id: changesets
2828
uses: changesets/action@v1
2929
with:
30-
publish: npx changeset publish
30+
publish: npm run release
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,6 @@ dist
146146

147147
# changesets
148148
!.changeset/config.json
149+
150+
# generated .d.ts files
151+
types

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,5 @@ npm link
4141
4242
cd ../../my-test-project
4343
@REM If needed: npm init
44-
npm link @bluecadet/launchpad
45-
@REM If needed for your project: npm i @bluecadet/launchpad
44+
npm link @bluecadet/launchpad --save
4645
```

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"watch-docs": "nodemon",
1717
"lint": "npx eslint ./packages/**/*.js",
1818
"lint:fix": "npx eslint ./packages/**/*.js --fix",
19-
"lint:fix-dry": "npx eslint ./packages/**/*.js --fix-dry-run"
19+
"lint:fix-dry": "npx eslint ./packages/**/*.js --fix-dry-run",
20+
"build": "npm run build -w @bluecadet/launchpad",
21+
"release": "npm run build && changeset publish"
2022
},
2123
"repository": {
2224
"type": "git",
@@ -34,9 +36,11 @@
3436
"devDependencies": {
3537
"@changesets/changelog-github": "^0.4.6",
3638
"@changesets/cli": "^2.23.0",
39+
"@types/node": "^20.3.1",
3740
"eslint": "^8.32.0",
3841
"eslint-config-standard": "^17.0.0",
3942
"jsdoc-to-markdown": "^7.1.1",
40-
"nodemon": "^2.0.20"
43+
"nodemon": "^2.0.20",
44+
"typescript": "^5.1.3"
4145
}
4246
}

packages/content/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# @bluecadet/launchpad-content
22

3+
## 1.12.0
4+
5+
### Minor Changes
6+
7+
- [#128](https://github.com/bluecadet/launchpad/pull/128) [`e11973d`](https://github.com/bluecadet/launchpad/commit/e11973d902f90ef3b94d7e29af23ea766301fc72) Thanks [@claytercek](https://github.com/claytercek)! - Add intellisense support to configs
8+
9+
- [#124](https://github.com/bluecadet/launchpad/pull/124) [`55a98ba`](https://github.com/bluecadet/launchpad/commit/55a98ba9a2a50451fb733a0122f0054c59dc26dd) Thanks [@claytercek](https://github.com/claytercek)! - support js configs
10+
11+
- [#133](https://github.com/bluecadet/launchpad/pull/133) [`4d537f2`](https://github.com/bluecadet/launchpad/commit/4d537f297d9c85b22a35f406e06e15d429ca7eb1) Thanks [@claytercek](https://github.com/claytercek)! - Load dotenv files when launching from CLI
12+
13+
### Patch Changes
14+
15+
- [#118](https://github.com/bluecadet/launchpad/pull/118) [`0aed873`](https://github.com/bluecadet/launchpad/commit/0aed87333dcc3902adb077365a330a8e9190cefa) Thanks [@claytercek](https://github.com/claytercek)! - Generate d.ts declaration files for intellisense, and fix all type errors.
16+
17+
- Updated dependencies [[`e11973d`](https://github.com/bluecadet/launchpad/commit/e11973d902f90ef3b94d7e29af23ea766301fc72), [`55a98ba`](https://github.com/bluecadet/launchpad/commit/55a98ba9a2a50451fb733a0122f0054c59dc26dd), [`4d537f2`](https://github.com/bluecadet/launchpad/commit/4d537f297d9c85b22a35f406e06e15d429ca7eb1), [`0aed873`](https://github.com/bluecadet/launchpad/commit/0aed87333dcc3902adb077365a330a8e9190cefa)]:
18+
- @bluecadet/launchpad-utils@1.5.0
19+
320
## 1.11.0
421

522
### Minor Changes

packages/content/README.md

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,54 +45,55 @@ Currently supported sources are:
4545

4646
Some content sources require credentials to access their APIs.
4747

48-
These can all be stored in a local `.credentials.json` file which maps content-source IDs to their credentials. For example:
48+
These can all be stored in a `.env` or `.env.local` file which will be automatically loaded by launchpad.
4949

50-
### `.credentials.json`
50+
### `.env.local`
5151

52-
```json
53-
{
54-
"airtable-cms": {
55-
"apiKey": "<YOUR_AIRTABLE_API_KEY>"
56-
},
57-
"contentful-cms": {
58-
"previewToken": "<YOUR_CONTENTFUL_PREVIEW_TOKEN>",
59-
"deliveryToken": "<YOUR_CONTENTFUL_DELIVERY_TOKEN>",
60-
"usePreviewApi": false
61-
},
62-
"sanity-cms": {
63-
"apiToken": "<YOUR_API_TOKEN>"
64-
},
65-
"strapi-cms": {
66-
"identifier": "<YOUR_API_USER>",
67-
"password": "<YOUR_API_PASS>"
68-
}
69-
}
52+
```sh
53+
AIRTABLE_API_KEY=<YOUR_AIRTABLE_API_KEY>
54+
55+
CONTENTFUL_PREVIEW_TOKEN=<YOUR_CONTENTFUL_PREVIEW_TOKEN>
56+
CONTENTFUL_DELIVERY_TOKEN=<YOUR_CONTENTFUL_DELIVERY_TOKEN>
57+
CONTENTFUL_USE_PREVIEW_API=false
58+
59+
SANITY_API_TOKEN=<YOUR_API_TOKEN>
60+
61+
STRAPI_IDENTIFIER=<YOUR_API_USER>
62+
STRAPI_PASSWORD=<YOUR_API_PASS>
7063
```
7164

72-
### `launchpad.json`
65+
### `launchpad.config.js`
7366

7467
```js
75-
{
76-
"content": {
77-
"sources": [{
78-
"id": "airtable-cms",
79-
"type": "airtable",
80-
//...
81-
}, {
82-
"id": "contentful-cms",
83-
"type": "contentful",
84-
//...
85-
}, {
86-
"id": "sanity-cms",
87-
"type": "sanity",
88-
//...
89-
}, {
90-
"id": "strapi-cms",
91-
"type": "strapi",
92-
//...
93-
}]
94-
}
95-
}
68+
export default defineConfig({
69+
content: {
70+
sources: [
71+
{
72+
id: "airtable-cms",
73+
type: "airtable",
74+
apiKey: process.env.AIRTABLE_API_KEY,
75+
},
76+
{
77+
id: "contentful-cms",
78+
type: "contentful",
79+
previewToken: process.env.CONTENTFUL_PREVIEW_TOKEN,
80+
deliveryToken: process.env.CONTENTFUL_DELIVERY_TOKEN,
81+
usePreviewApi: false,
82+
},
83+
{
84+
id: "sanity-cms",
85+
type: "sanity",
86+
apiToken: process.env.SANITY_API_TOKEN,
87+
},
88+
{
89+
id: "strapi-cms",
90+
type: "strapi",
91+
identifier: process.env.STRAPI_IDENTIFIER,
92+
},
93+
],
94+
},
95+
});
96+
9697
```
9798

9899
## Post Processing

packages/content/docs/contentful-source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Also supports all fields of the Contentful SDK's config.
99
See: 'Configuration' under https://contentful.github.io/contentful.js/contentful/9.1.7/
1010
| Property | Type | Default | Description |
1111
| - | - | - | - |
12-
| <a name="module_contentful-source.ContentfulOptions+space">`space`</a> | <code>string</code>| <code>''</code> | Your Contentful space ID. Note that credentials.json will require an accessToken in addition to this |
12+
| <a name="module_contentful-source.ContentfulOptions+space">`space`</a> | <code>string</code>| <code>''</code> | Your Contentful space ID. Note that an accessToken will be required in addition to this |
1313
| <a name="module_contentful-source.ContentfulOptions+locale">`locale`</a> | <code>string</code>| <code>'en-US'</code> | Optional. Used to pull localized images. |
1414
| <a name="module_contentful-source.ContentfulOptions+filename">`filename`</a> | <code>string</code>| <code>'content.json'</code> | Optional. The filename you want to use for where all content (entries and assets metadata) will be stored. |
1515
| <a name="module_contentful-source.ContentfulOptions+contentTypes">`contentTypes`</a> | <code>Array.&lt;string&gt;</code>| | Optionally limit queries to these content types.<br>This will also apply to linked assets.<br>Types that link to other types will include up to 10 levels of child content.<br>E.g. filtering by Story, might also include Chapters and Images.<br>Uses `searchParams['sys.contentType.sys.id[in]']` under the hood. |

packages/content/docs/strapi-source.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ Options for StrapiSource
1313
| <a name="module_strapi-source.StrapiOptions+limit">`limit`</a> | <code>number</code>| <code>100</code> | Max number of entries per page. |
1414
| <a name="module_strapi-source.StrapiOptions+maxNumPages">`maxNumPages`</a> | <code>number</code>| <code>-1</code> | Max number of pages. Use the default of `-1` for all pages |
1515
| <a name="module_strapi-source.StrapiOptions+pageNumZeroPad">`pageNumZeroPad`</a> | <code>number</code>| <code>0</code> | How many zeros to pad each json filename index with. |
16-
| <a name="module_strapi-source.StrapiOptions+identifier">`identifier`</a> | <code>string</code>| | Username or email. Should be configured via `./credentials.json` |
17-
| <a name="module_strapi-source.StrapiOptions+password">`password`</a> | <code>string</code>| | Should be configured via `./credentials.json` |
16+
| <a name="module_strapi-source.StrapiOptions+identifier">`identifier`</a> | <code>string</code>| | Username or email. Should be configured via `./.env.local` |
17+
| <a name="module_strapi-source.StrapiOptions+password">`password`</a> | <code>string</code>| | Should be configured via `./.env.local` |
1818
| <a name="module_strapi-source.StrapiOptions+token">`token`</a> | <code>string</code>| | Can be used instead of identifer/password if you previously generated one. Otherwise this will be automatically generated using the identifier or password. |

packages/content/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ export * from './lib/launchpad-content.js';
88
export * from './lib/utils/file-utils.js';
99
export default LaunchpadContent;
1010

11+
/**
12+
* @param {import('./lib/content-options.js').ContentOptions | {content: import('./lib/content-options.js').ContentOptions}} config
13+
*/
1114
export const launch = async (config) => {
12-
const content = new LaunchpadContent(config.content || config);
15+
const content = new LaunchpadContent('content' in config ? config.content : config);
1316
await content.start();
1417
};
1518

0 commit comments

Comments
 (0)